Webfont added

This commit is contained in:
Prashant Singh 2019-08-19 23:36:52 +05:30
parent 313c9b78ff
commit 9767e479f2
40 changed files with 917 additions and 11 deletions

View File

@ -6,7 +6,7 @@ return [
'name' => 'customerdocument::app.admin.customers.documents',
'route' => 'admin.documents.index',
'sort' => 6,
'icon-class' => 'sales-icon',
'icon-class' => 'document-icon',
], [
'key' => 'documents.files',
'name' => 'customerdocument::app.admin.documents.b2b-files',

View File

@ -33,6 +33,7 @@ return [
'in-active' => 'Inactive',
'product' => 'Product',
'marketing' => 'Marketing',
'other' => 'Other',
'add-document' => 'Add Document',
'edit-document' => 'Edit Document'
],

View File

@ -80,6 +80,7 @@ $documents = $customerDocumentRepository->findWhere(['customer_id' => $customer-
<select name="type" class="control" v-validate="'required'" data-vv-as="&quot;{{ __('customerdocument::app.admin.documents.type') }}&quot;">
<option value="product">{{ __('customerdocument::app.admin.documents.product') }}</option>
<option value="marketing">{{ __('customerdocument::app.admin.documents.marketing') }}</option>
<option value="other">{{ __('customerdocument::app.admin.documents.other') }}</option>
</select>
<span class="control-error" v-if="errors.has('type')">@{{ errors.first('type') }}</span>
</div>

View File

@ -40,6 +40,7 @@
<select name="type" class="control" v-validate="'required'" data-vv-as="&quot;{{ __('customerdocument::app.admin.documents.type') }}&quot;">
<option value="product">{{ __('customerdocument::app.admin.documents.product') }}</option>
<option value="marketing">{{ __('customerdocument::app.admin.documents.marketing') }}</option>
<option value="other">{{ __('customerdocument::app.admin.documents.other') }}</option>
</select>
<span class="control-error" v-if="errors.has('type')">@{{ errors.first('type') }}</span>
</div>

View File

@ -42,6 +42,7 @@
<select name="type" class="control" v-validate="'required'" value="{{ $document->type }}" data-vv-as="&quot;{{ __('customerdocument::app.admin.documents.type') }}&quot;">
<option value="product" {{ $document->type == "product" ? 'selected' : '' }}>{{ __('customerdocument::app.admin.documents.product') }}</option>
<option value="marketing" {{ $document->type == "marketing" ? 'selected' : '' }}>{{ __('customerdocument::app.admin.documents.marketing') }}</option>
<option value="other">{{ __('customerdocument::app.admin.documents.other') }}</option>
</select>
<span class="control-error" v-if="errors.has('type')">@{{ errors.first('type') }}</span>
</div>

View File

@ -22,7 +22,7 @@
<input type="hidden" name="quantity" value="1">
<input type="hidden" value="false" name="is_configurable">
@if ($product->totalQuantity() < 1 && $product->allow_preorder)
@if ($product->totalQuantity() < 1 && $product->product->allow_preorder)
<button class="btn btn-lg btn-primary addtocart">{{ __('preorder::app.shop.products.preorder') }}</button>
@else
<button class="btn btn-lg btn-primary addtocart" {{ $product->haveSufficientQuantity(1) ? '' : 'disabled' }}>{{ __('shop::app.products.add-to-cart') }}</button>

View File

@ -2,7 +2,7 @@
<div class="add-to-buttons">
@if ($product->type != 'configurable')
@if ($product->totalQuantity() < 1 && $product->allow_preorder)
@if ($product->totalQuantity() < 1 && $product->product->allow_preorder)
<button type="submit" class="btn btn-lg btn-primary addtocart" style="width: 100%">
{{ __('preorder::app.shop.products.preorder') }}
</button>

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterCustomerGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('customer_groups', function (Blueprint $table) {
$table->dropUnique('customer_groups_code_unique');
$table->unique(['code', 'company_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('customer_groups', function (Blueprint $table) {
$table->dropUnique('customer_groups_code_company_id_unique');
$table->unique('code');
});
}
}

View File

@ -43,6 +43,7 @@ class PurgeController extends Controller
Event::fire('new.company.registered');
$this->dataSeed->setInstallationCompleteParam();
session()->flash('success', trans('saas::app.status.store-created'));
return redirect()->route('shop.home.index');

View File

@ -3,6 +3,8 @@
namespace Webkul\SAASCustomizer\Listeners;
use Company;
use Illuminate\Support\Facades\Mail;
use Webkul\SAASCustomizer\Mail\NewCompanyNotification;
/**
* New company registered events handler
@ -21,5 +23,7 @@ class CompanyRegistered
$poolInstance->createPreOrderData($company->id);
}
Mail::queue(new NewCompanyNotification($company));
}
}

View File

@ -3,7 +3,6 @@
namespace Webkul\SAASCustomizer\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
class SuperAdmin extends Authenticatable

View File

@ -0,0 +1,50 @@
<?php
namespace Webkul\SAASCustomizer\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Webkul\SAASCustomizer\Models\SuperAdmin;
use Illuminate\Contracts\Queue\ShouldQueue;
/**
* New Company Notification Mail class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2019 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class NewCompanyNotification extends Mailable
{
use Queueable, SerializesModels;
/**
* @var Company
*/
public $company;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($company)
{
$this->company = $company;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$superAdmin = new SuperAdmin;
$superAdmin = $superAdmin->all()->first();
return $this->to($superAdmin->email)
->subject('New Company Registered')
->view('saas::emails.new-company')->with('company', $this->company);
}
}

View File

@ -11,7 +11,15 @@ class AttributeObserver
public function creating(Attribute $model)
{
if (! auth()->guard('super-admin')->check()) {
$model->use_in_flat = 0;
$model->company_id = Company::getCurrent()->id;
}
}
public function updating(Attribute $model)
{
if (! auth()->guard('super-admin')->check()) {
$model->use_in_flat = 0;
}
}
}

View File

@ -0,0 +1 @@
New company is registered.

View File

@ -0,0 +1,26 @@
{
"name": "bagisto/laravel-webfont",
"license": "MIT",
"authors": [
{
"name": "Prashant Singh",
"email": "prashant.singh852@webkul.com"
}
],
"require": {},
"autoload": {
"psr-4": {
"Webkul\\Webfont\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Webkul\\User\\Providers\\WebfontServiceProvider"
],
"aliases": {
}
}
},
"minimum-stability": "dev"
}

View File

@ -0,0 +1,54 @@
# Laravel Webfont v0.1
# Introduction:
Bagisto webfont is dynamic implementation of google web fonts. It allows you to choose fonts from google fonts directly from your own Bagisto instance. Choose as many google fonts at once and customize your font for storefront or backend or both within few steps.
# Feature of Bagisto webfont module
* Allows you to activate and deactivate module.
* Allow a default font in case you have chosen none.
* Separate control for using font in admin panel or storefront.
# Requirements
* Bagisto v0.1.7 or higher.
# Note:
Before proceeding you need google fonts API key. You can get your own key by following instructions after opening the link below:
> https://developers.google.com/fonts/docs/developer_api
# Installation
* Extract contents of the zip file in the root of your Bagisto instance.
* Do entry in composer.json in psr-4 object:
```
"Webkul\\Webfont\\": "packages/Webkul/Webfont/src"
```
* Do entry in config/app.php, inside providers array preferably at the end of it:
```
Webkul\Webfont\Providers\WebfontServiceProvider::class
```
* Do entry in config\concord.php file:
```
\Webkul\Webfont\Providers\ModuleServiceProvider::class
```
* Run command below:
1. composer dump-autoload
> Proceed if there are no errors encountered
2. php artisan migrate
3. php artisan route:cache
* You can now find the module configuration in admin panel under Configuration > General > Design.
* In the configuration page, there is a field for API key which will require to enter your own Google Fonts Developer API key.
* Find the module under CMS > Webfont.
> Congrats, you are all set to use Google fonts from your Bagisto instance.

View File

@ -0,0 +1,11 @@
<?php
return [
[
'key' => 'cms.webfont',
'name' => 'webfont::app.webfont',
'route' => 'admin.cms.webfont',
'sort' => 2,
'icon-class' => '',
]
];

View File

@ -0,0 +1,65 @@
<?php
return [
[
'key' => 'general.design.webfont',
'name' => 'webfont::app.webfont',
'sort' => 1,
'fields' => [
[
'name' => 'status',
'title' => 'webfont::app.webfont-status',
'type' => 'select',
'options' => [
[
'title' => 'Active',
'value' => true
], [
'title' => 'Inactive',
'value' => false
]
],
'channel_based' => false,
'locale_based' => false
], [
'name' => 'webfont',
'title' => 'webfont::app.webfont-api',
'type' => 'text',
'validation' => 'required',
'channel_based' => false,
'locale_based' => false
], [
'name' => 'enable_backend',
'title' => 'webfont::app.webfont-backend',
'type' => 'select',
'channel_based' => false,
'locale_based' => false,
'options' => [
[
'title' => 'Active',
'value' => true
], [
'title' => 'Inactive',
'value' => false
]
]
], [
'name' => 'enable_frontend',
'title' => 'webfont::app.webfont-frontend',
'type' => 'select',
'channel_based' => false,
'locale_based' => false,
'options' => [
[
'title' => 'Active',
'value' => true
], [
'title' => 'Inactive',
'value' => false
]
]
]
]
]
];

View File

@ -0,0 +1,7 @@
<?php
namespace Webkul\Webfont\Contracts;
interface Webfont
{
}

View File

@ -0,0 +1,81 @@
<?php
namespace Webkul\Webfont\DataGrids;
use Webkul\Ui\DataGrid\DataGrid;
use DB;
/**
* WebfontDataGrid class
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class WebfontDataGrid extends DataGrid
{
protected $index = 'id'; //the column that needs to be treated as index column
protected $sortOrder = 'desc'; //asc or desc
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('google_web_fonts')
->select('id', 'font', 'activated');
$this->setQueryBuilder($queryBuilder);
}
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'label' => trans('webfont::app.id'),
'type' => 'number',
'searchable' => false,
'sortable' => true,
'filterable' => true
]);
$this->addColumn([
'index' => 'font',
'label' => trans('webfont::app.font'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => true
]);
$this->addColumn([
'index' => 'activated',
'label' => trans('webfont::app.activated'),
'type' => 'boolean',
'searchable' => true,
'sortable' => true,
'filterable' => true,
'wrapper' => function($row) {
if ($row->activated) {
return trans('webfont::app.activated');
} else {
return trans('webfont::app.de-activated');
}
}
]);
}
public function prepareActions()
{
$this->addAction([
'type' => 'Edit',
'method' => 'GET', //use post only for redirects only
'route' => 'admin.cms.webfont.activate',
'icon' => 'icon pencil-lg-icon'
]);
$this->addAction([
'type' => 'Delete',
'method' => 'POST', //use post only for requests other than redirects
'route' => 'admin.cms.webfont.remove',
'icon' => 'icon trash-icon'
]);
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateGoogleWebFontsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('google_web_fonts', function (Blueprint $table) {
$table->increments('id');
$table->text('font');
$table->boolean('activated')->default(0);
$table->integer('company_id')->unsigned();
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('google_web_fonts');
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace Webkul\Webfont\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View File

@ -0,0 +1,122 @@
<?php
namespace Webkul\Webfont\Http\Controllers;
use Illuminate\Support\Facades\Storage;
use Webkul\Webfont\Repositories\WebfontRepository as Webfont;
use GuzzleHttp;
/**
* Webfont Controller
*
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2019 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class WebfontController extends Controller
{
/**
* Hold webfont repository instance
*/
protected $webfont;
public function __construct(Webfont $webfont)
{
$this->middleware('auth:admin');
$this->webfont = $webfont;
}
public function index()
{
return view('webfont::admin-index');
}
public function add()
{
$client = new GuzzleHttp\Client();
if (core()->getConfigData('general.design.webfont.webfont')) {
$res = $client->request('GET', 'https://www.googleapis.com/webfonts/v1/webfonts?key='.core()->getConfigData('general.design.webfont.webfont'));
if ($res->getStatusCode() == 200) {
$result = (string) $res->getBody()->getContents();
return view('webfont::add-font')->with('fonts', json_decode($result)->items);
} else {
session()->flash('error', trans('webfont::app.cannot-fetch'));
return redirect()->route('admin.cms.webfont');
}
} else {
session()->flash('error', trans('webfont::app.set-api-key'));
return redirect()->route('admin.cms.webfont');
}
}
public function store()
{
$fonts = request()->input('fonts');
$fonts = json_decode($fonts);
foreach($fonts as $font) {
$this->webfont->create(['font' => $font]);
}
session()->flash('success', trans('webfont::app.create-success'));
return redirect()->route('admin.cms.webfont');
}
public function activate($id)
{
$font = $this->webfont->findWhere([
'activated' => 1
]);
if (count($font)) {
$font = $font->first();
$font->update([
'activated' => 0
]);
$font = $this->webfont->findOrFail($id);
$font->update([
'activated' => 1
]);
} else {
$font = $this->webfont->findOrFail($id);
$font->update([
'activated' => 1
]);
}
session()->flash('success', trans('webfont::app.active-success'));
return redirect()->route('admin.cms.webfont');
}
public function remove($id)
{
$font = $this->webfont->findOrFail($id);
if($font->delete()) {
session()->flash('success', trans('webfont::app.delete-success'));
return response()->json(['message' => true], 200);
} else {
session()->flash('error', trans('webfont::app.delete-fail'));
}
}
public function fetchAndSync()
{
$client = new GuzzleHttp\Client();
return view('webfont::add-font');
}
}

View File

@ -0,0 +1,13 @@
<?php
Route::group(['middleware' => ['admin']], function () {
Route::get('admin/webfont', 'Webkul\Webfont\Http\Controllers\WebfontController@index')->name('admin.cms.webfont');
Route::get('admin/webfont/add', 'Webkul\Webfont\Http\Controllers\WebfontController@add')->name('admin.cms.webfont.add');
Route::post('admin/webfont/add', 'Webkul\Webfont\Http\Controllers\WebfontController@store')->name('admin.cms.webfont.store');
Route::get('admin/webfont/activate/{id}', 'Webkul\Webfont\Http\Controllers\WebfontController@activate')->name('admin.cms.webfont.activate');
Route::post('admin/webfont/remove/{id}', 'Webkul\Webfont\Http\Controllers\WebfontController@remove')->name('admin.cms.webfont.remove');
});

View File

@ -0,0 +1,9 @@
<?php
namespace Webkul\Webfont\Listeners;
class Webfont {
public function load() {
return view('webfont::webfont');
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace Webkul\Webfont\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Webfont\Contracts\Webfont as WebfontContract;
class Webfont extends Model implements WebfontContract
{
protected $table = 'google_web_fonts';
protected $fillable = ['font', 'activated'];
}

View File

@ -0,0 +1,10 @@
<?php
namespace Webkul\Webfont\Models;
use Konekt\Concord\Proxies\ModelProxy;
class WebfontProxy extends ModelProxy
{
}

View File

@ -0,0 +1,17 @@
<?php
namespace Webkul\Webfont\Observers;
use Webkul\Webfont\Models\Webfont;
use Company;
class WebfontObserver
{
public function creating(Webfont $model)
{
if (! auth()->guard('super-admin')->check()) {
$model->company_id = Company::getCurrent()->id;
}
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Webkul\Webfont\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Event;
use View;
class EventServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
if (core()->getConfigData('general.design.webfont.status') && core()->getConfigData('general.design.webfont.enable_backend')) {
Event::listen('bagisto.admin.layout.head', function($viewRenderEventManager) {
$viewRenderEventManager->addTemplate('webfont::webfont');
});
}
if (core()->getConfigData('general.design.webfont.status') && core()->getConfigData('general.design.webfont.enable_frontend')) {
Event::listen('bagisto.shop.layout.head', function($viewRenderEventManager) {
$viewRenderEventManager->addTemplate('webfont::webfont');
});
}
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Webkul\Webfont\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
class ModuleServiceProvider extends BaseModuleServiceProvider
{
protected $models = [
\Webkul\Webfont\Models\Webfont::class,
];
}

View File

@ -0,0 +1,53 @@
<?php
namespace Webkul\Webfont\Providers;
use Illuminate\Support\ServiceProvider;
use Webkul\Webfont\Providers\EventServiceProvider;
class WebfontServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'webfont');
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'webfont');
$this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
$this->app->concord->registerModel(\Webkul\Webfont\Contracts\Webfont::class, \Webkul\Webfont\Models\Webfont::class);
$this->app->register(EventServiceProvider::class);
}
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->registerConfig();
}
/**
* Registers config
*/
protected function registerConfig()
{
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/system.php', 'core'
);
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/menu.php', 'menu.admin'
);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Webkul\Webfont\Repositories;
use Webkul\Core\Eloquent\Repository;
/**
* Webfont Repository
*
* @author Prashant Singh<prashant.singh852@webkul.com> @prashant-webkul
* @copyright 2019 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class WebfontRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
return 'Webkul\Webfont\Contracts\Webfont';
}
}

View File

@ -0,0 +1,27 @@
<?php
return [
'id' => 'ID',
'font' => 'Font',
'title' => 'Webfonts',
'save-btn-title' => 'Save Web Font',
'cannot-fetch' => 'Cannot fetch the list of fonts, make sure that you are connected to internet',
'set-api-key' => 'Set API key first',
'select-fonts' => 'Select Fonts',
'select-font-label' => 'Multiple selection and search are possible',
'select-values' => 'Please select values',
'create-success' => 'Fonts added to storage successfully',
'activated' => 'Activated',
'de-activated' => 'Deactived',
'active-success' => 'Font activated successfully',
'delete-success' => 'Font deleted successfully',
'delete-fail' => 'Cannot delete font',
'add' => 'Add Web Font',
'remove' => 'Remove',
'webfont' => 'Webfont',
'webfont-api' => 'API Key',
'webfont-default' => 'Default Font',
'webfont-status' => 'Status',
'webfont-frontend' => 'Enable for storefront',
'webfont-backend' => 'Enable for backend'
];

View File

@ -0,0 +1,104 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('webfont::app.title') }}
@stop
@section('content')
<div class="content">
<web-font-form></web-font-form>
</div>
@stop
@push('scripts')
<script type="text/x-template" id="add-font-form">
<div>
<form method="POST" action="{{ route('admin.cms.webfont.store') }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
{{ __('webfont::app.title') }}
</h1>
</div>
<div class="page-action fixed-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('webfont::app.save-btn-title') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
<input type="hidden" name="fonts" v-model="fonts">
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="selected_fonts" class="required">{{ __('webfont::app.select-font-label') }}</label>
<br/>
<multiselect v-model="selected_fonts" :close-on-select="false" :options="font_list" :searchable="true" :show-labels="true" :custom-label="customLabel" placeholder="{{ __('webfont::app.select-fonts') }}" track-by="family" :multiple="true"></multiselect>
<span class="control-error" v-if="errors.has('selected_fonts')">@{{ errors.first('selected_fonts') }}</span>
</div>
</div>
</div>
</form>
</div>
</script>
<script>
Vue.component('web-font-form', {
template: '#add-font-form',
data() {
return {
font_list: @json($fonts),
fonts: '',
selected_fonts: []
}
},
mounted() {
},
methods: {
customLabel(option) {
return option.family + ' (' + option.category + ')';
},
onSubmit(e) {
temp_fonts = [];
for (i in this.selected_fonts) {
temp_fonts.push(this.selected_fonts[i].family + ', ' + this.selected_fonts[i].category);
}
if (this.selected_fonts.length == 0) {
alert('{{ __('webfont::app.select-values') }}');
} else {
this.fonts = JSON.stringify(temp_fonts);
this.$validator.validateAll().then(result => {
if (result) {
e.target.submit();
}
});
}
},
addFlashMessages() {
const flashes = this.$refs.flashes;
flashMessages.forEach(function(flash) {
flashes.addFlash(flash);
}, this);
}
}
});
</script>
@endpush

View File

@ -0,0 +1,27 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('webfont::app.title') }}
@stop
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
<h1>{{ __('webfont::app.title') }}</h1>
</div>
<div class="page-action">
<a href="{{ route('admin.cms.webfont.add') }}" class="btn btn-lg btn-primary">
{{ __('webfont::app.add') }}
</a>
</div>
</div>
<div class="page-content">
@inject('webfontGrid', 'Webkul\Webfont\DataGrids\WebfontDataGrid')
{!! $webfontGrid->render() !!}
</div>
</div>
@stop

View File

@ -0,0 +1,51 @@
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js"></script>
@php
$activatedFont = app('Webkul\Webfont\Repositories\WebfontRepository');
$font = $activatedFont->findOneWhere([
'activated' => 1
]);
if (isset($font)) {
$activeFont = $font->font;
$font = explode(',', $activeFont)[0];
$family = explode(',', $activeFont)[1];
} else {
$font = 'Montserrat';
$family = 'sans-serif';
}
@endphp
<script>
WebFont.load({
google: {
families: ['{{ $font }}']
}
});
</script>
<style>
* {
font-family: "{{ $font }}", {{ $family }};
}
*::-webkit-input-placeholder {
font-family: $font-montserrat;
}
*::-webkit-input-placeholder {
font-family: $font-montserrat;
}
input {
font-family: $font-montserrat;
}
body {
font-family: "{{ $font }}", {{ $family }};
}
</style>

View File

@ -23,7 +23,7 @@
<div class="page-content">
@inject('orderGrid', 'Webkul\PreOrder\DataGrids\Admin\Order')
{!! $orderGrid->render() !!}
</div>
</div>

View File

@ -31,7 +31,7 @@
</a>
@endif
@if ($order->canShip() && ! app('Webkul\PreOrder\Repositories\PreOrderItemRepository')->isPreOrderPaymentOrder($order->id))
@if ($order->canShip() && ! app('Webkul\PreOrder\Repositories\PreOrderItemRepository')->resetScope()->isPreOrderPaymentOrder($order->id))
<a href="{{ route('admin.sales.shipments.create', $order->id) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.orders.shipment-btn-title') }}
</a>

View File

@ -3,8 +3,6 @@
@if (core()->getConfigData('preorder.settings.general.preorder_type') == 'partial')
<p>{{ __('preorder::app.shop.products.percent-to-pay', ['percent' => core()->getConfigData('preorder.settings.general.percent')]) }}</p>
@endif
@else
<p>{{ __('preorder::app.shop.products.nothing-to-pay') }}</p>
@endif
@endif
@ -24,7 +22,7 @@
<input type="hidden" name="quantity" value="1">
<input type="hidden" value="false" name="is_configurable">
@if ($product->totalQuantity() < 1 && $product->allow_preorder)
@if ($product->totalQuantity() < 1 && $product->product->allow_preorder)
<button class="btn btn-lg btn-primary addtocart">{{ __('preorder::app.shop.products.preorder') }}</button>
@else
<button class="btn btn-lg btn-primary addtocart" {{ $product->haveSufficientQuantity(1) ? '' : 'disabled' }}>{{ __('shop::app.products.add-to-cart') }}</button>

View File

@ -2,7 +2,7 @@
<div class="add-to-buttons">
@if ($product->type != 'configurable')
@if ($product->totalQuantity() < 1 && $product->allow_preorder)
@if ($product->totalQuantity() < 1 && $product->product->allow_preorder)
<button type="submit" class="btn btn-lg btn-primary addtocart" style="width: 100%">
{{ __('preorder::app.shop.products.preorder') }}
</button>
@ -16,7 +16,7 @@
@include ('shop::products.buy-now')
<button type="submit" class="btn btn-lg btn-black pre-order-btn" style="width: 100%; display: none;">
<button type="submit" class="btn btn-lg btn-primary pre-order-btn" style="width: 100%; display: none;">
{{ __('preorder::app.shop.products.preorder') }}
</button>
@endif