Dead mods removed
This commit is contained in:
parent
c6571c810b
commit
f1f0bcac8c
|
|
@ -1,4 +1,4 @@
|
|||
APP_NAME=Razzo
|
||||
APP_NAME=Bagisto
|
||||
APP_ENV=local
|
||||
APP_VERSION=0.1.6
|
||||
APP_KEY=
|
||||
|
|
@ -34,13 +34,6 @@ MAIL_ENCRYPTION=tls
|
|||
SHOP_MAIL_FROM=
|
||||
ADMIN_MAIL_TO=
|
||||
|
||||
STRIPE_ENABLE_TESTING=
|
||||
STRIPE_TEST_PUBLISHABLE_KEY=
|
||||
STRIPE_TEST_SECRET_KEY=
|
||||
STRIPE_LIVE_PUBLISHABLE_KEY=
|
||||
STRIPE_LIVE_SECRET_KEY=
|
||||
STRIPE_STATEMENT_DESCRIPTOR=
|
||||
|
||||
fixer_api_key=
|
||||
|
||||
PUSHER_APP_ID=
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@ class Kernel extends HttpKernel
|
|||
\Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\Webkul\SAASCustomizer\Http\Middleware\ValidatesDomain::class,
|
||||
\Webkul\ShowPriceAfterLogin\Http\Middleware\ShowShopAfterLogin::class
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class
|
||||
],
|
||||
|
||||
'api' => [
|
||||
|
|
|
|||
|
|
@ -90,19 +90,7 @@
|
|||
"Webkul\\Tax\\": "packages/Webkul/Tax/src",
|
||||
"Webkul\\API\\": "packages/Webkul/API",
|
||||
"Webkul\\Discount\\": "packages/Webkul/Discount/src",
|
||||
"Webkul\\CMS\\": "packages/Webkul/CMS/src",
|
||||
"Webkul\\CustomerDocument\\": "packages/Webkul/CustomerDocument",
|
||||
"Webkul\\BulkAddToCart\\": "packages/Webkul/BulkAddToCart",
|
||||
"Webkul\\AdminAuthCheck\\": "packages/Webkul/AdminAuthCheck/src",
|
||||
"Webkul\\StripeConnect\\": "packages/Webkul/StripeConnect/src",
|
||||
"Webkul\\CustomerCreditMax\\": "packages/Webkul/CustomerCreditMax",
|
||||
"Webkul\\CustomerGroupCatalog\\": "packages/Webkul/CustomerGroupCatalog",
|
||||
"Webkul\\ShowPriceAfterLogin\\": "packages/Webkul/ShowPriceAfterLogin/src",
|
||||
"Webkul\\PreOrder\\": "packages/Webkul/PreOrder/src",
|
||||
"Webkul\\Webfont\\": "packages/Webkul/Webfont/src",
|
||||
"Webkul\\GTM\\": "packages/Webkul/GTM/src",
|
||||
"Webkul\\Custom\\": "packages/Webkul/Custom/src",
|
||||
"Webkul\\SAASCustomizer\\": "packages/Webkul/SAASCustomizer/src"
|
||||
"Webkul\\CMS\\": "packages/Webkul/CMS/src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://bagsaas.com'),
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -245,19 +245,7 @@ return [
|
|||
Webkul\Tax\Providers\TaxServiceProvider::class,
|
||||
Webkul\API\Providers\APIServiceProvider::class,
|
||||
Webkul\Discount\Providers\DiscountServiceProvider::class,
|
||||
Webkul\CMS\Providers\CMSServiceProvider::class,
|
||||
Webkul\CustomerDocument\Providers\CustomerDocumentServiceProvider::class,
|
||||
Webkul\BulkAddToCart\Providers\BulkAddToCartServiceProvider::class,
|
||||
Webkul\AdminAuthCheck\Providers\AdminAuthCheckServiceProvider::class,
|
||||
Webkul\Webfont\Providers\WebfontServiceProvider::class,
|
||||
Webkul\GTM\Providers\GTMServiceProvider::class,
|
||||
Webkul\StripeConnect\Providers\StripeConnectServiceProvider::class,
|
||||
Webkul\ShowPriceAfterLogin\Providers\ShowPriceAfterLoginServiceProvider::class,
|
||||
Webkul\CustomerCreditMax\Providers\CustomerCreditMaxServiceProvider::class,
|
||||
Webkul\PreOrder\Providers\PreOrderServiceProvider::class,
|
||||
Webkul\CustomerGroupCatalog\Providers\CustomerGroupCatalogServiceProvider::class,
|
||||
Webkul\SAASCustomizer\Providers\SAASCustomizerServiceProvider::class,
|
||||
Webkul\Custom\Providers\CustomServiceProvider::class
|
||||
Webkul\CMS\Providers\CMSServiceProvider::class
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -315,7 +303,6 @@ return [
|
|||
'PDF' => Barryvdh\DomPDF\Facade::class,
|
||||
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
|
||||
'Concord' => Konekt\Concord\Facades\Concord::class,
|
||||
'Helper' => Konekt\Concord\Facades\Helper::class,
|
||||
'Company' => Webkul\SAASCustomizer\Facades\Company::class
|
||||
'Helper' => Konekt\Concord\Facades\Helper::class
|
||||
],
|
||||
];
|
||||
|
|
@ -27,11 +27,6 @@ return [
|
|||
'provider' => 'admins'
|
||||
],
|
||||
|
||||
'super-admin' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'superadmins'
|
||||
],
|
||||
|
||||
'admin-api' => [
|
||||
'driver' => 'token',
|
||||
'provider' => 'admins',
|
||||
|
|
@ -47,11 +42,6 @@ return [
|
|||
'admins' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => Webkul\User\Models\Admin::class,
|
||||
],
|
||||
|
||||
'superadmins' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => Webkul\SAASCustomizer\Models\SuperAdmin::class
|
||||
]
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@ return [
|
|||
\Webkul\Tax\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\User\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Discount\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\CMS\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\StripeConnect\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\PreOrder\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Webfont\Providers\ModuleServiceProvider::class
|
||||
\Webkul\CMS\Providers\ModuleServiceProvider::class
|
||||
]
|
||||
];
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
];
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
];
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"name": "bagisto/laravel-AdminAuthCheck",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Prashant Singh",
|
||||
"email": "prashant.singh852@webkul.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"konekt/concord": "^1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Webkul\\AdminAuthCheck\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Webkul\\AdminAuthCheck\\Providers\\AdminAuthCheckServiceProvider"
|
||||
],
|
||||
"aliases": {}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerCustomizer\Http\Controllers;
|
||||
|
||||
use Webkul\CustomerCustomizer\Http\Controllers\Controller;
|
||||
|
||||
use Company;
|
||||
|
||||
/**
|
||||
* Customer Approval controller
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CustomerApprovalController extends Controller
|
||||
{
|
||||
protected $_config;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function approve()
|
||||
{
|
||||
dd('approving the newly created customer');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\AdminAuthCheck\Listeners;
|
||||
|
||||
use Company;
|
||||
use Webkul\SAASCustomizer\Repositories\SuperAdminRepository as SuperAdmin;
|
||||
|
||||
/**
|
||||
* Login Authentication Attempt Event handler
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class LoginAuthenticationAttempt
|
||||
{
|
||||
protected $superAdmin;
|
||||
|
||||
public function __construct(SuperAdmin $superAdmin) {
|
||||
$this->superAdmin = $superAdmin;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$company = Company::getCurrent();
|
||||
|
||||
if (! auth()->guard('super-admin')->check()) {
|
||||
$credentials = request()->all();
|
||||
$credentials['company_id'] = $company->id;
|
||||
|
||||
unset($credentials['_token']);
|
||||
|
||||
if (auth()->guard('admin')->check()) {
|
||||
$admin = auth()->guard('admin')->user();
|
||||
|
||||
if (Company::getCurrent()->id != $admin->company_id) {
|
||||
auth()->guard('admin')->logout();
|
||||
|
||||
throw new \Exception('invalid_admin_login', 400);
|
||||
}
|
||||
} else if (auth()->guard('customer')->check()) {
|
||||
$customer = auth()->guard('customer')->user();
|
||||
|
||||
if (Company::getCurrent()->id != $customer->company_id) {
|
||||
auth()->guard('customer')->logout();
|
||||
|
||||
if (! auth()->guard('customer')->attempt($credentials)) {
|
||||
|
||||
throw new \Exception('invalid_customer_login', 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\AdminAuthCheck\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Webkul\AdminAuthCheck\Providers\EventServiceProvider;
|
||||
use Illuminate\Contracts\Debug\ExceptionHandler;
|
||||
use Webkul\SAASCustomizer\Exceptions\Handler;
|
||||
use Illuminate\Routing\Router;
|
||||
|
||||
// use Webkul\Sales\Providers\ModuleServiceProvider;
|
||||
|
||||
|
||||
class AdminAuthCheckServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot(Router $router)
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
|
||||
$this->app->bind(
|
||||
ExceptionHandler::class,
|
||||
Handler::class
|
||||
);
|
||||
|
||||
// $this->app->register(ModuleServiceProvider::class);
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\AdminAuthCheck\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
// 'Illuminate\Auth\Events\Attempting' => [
|
||||
// 'Webkul\AdminAuthCheck\Listeners\LoginAuthenticationAttempt'
|
||||
// ], // make use of this to stop admins logging into other sites
|
||||
|
||||
'Illuminate\Auth\Events\Authenticated' => [
|
||||
'Webkul\AdminAuthCheck\Listeners\LoginAuthenticationAttempt'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\AdminAuthCheck\Providers;
|
||||
|
||||
use Konekt\Concord\AbstractModuleServiceProvider;
|
||||
|
||||
class ModuleServiceProvider extends AbstractModuleServiceProvider
|
||||
{
|
||||
protected $models = [
|
||||
];
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'set-category-visibility' => 'Set Category Visibility',
|
||||
];
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"name": "bagisto/bulk-add-to-cart",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Rahul Shukla",
|
||||
"email": "rahulshukla517@webkul.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Webkul\\BulkAddToCart\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Webkul\\BulkAddToCart\\BulkAddToCartServiceProvider"
|
||||
],
|
||||
"aliases": {}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'key' => 'account.bulk-add-to-cart',
|
||||
'name' => 'bulkaddtocart::app.products.bulk-add-to-cart',
|
||||
'route' =>'cart.bulk-add-to-cart.create',
|
||||
'sort' => 7
|
||||
]
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\BulkAddToCart\Http\Controllers;
|
||||
|
||||
use Webkul\Admin\Imports\DataGridImport;
|
||||
use Webkul\Product\Repositories\ProductRepository as Product;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Maatwebsite\Excel\Validators\Failure;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Excel;
|
||||
use Cart;
|
||||
|
||||
/**
|
||||
* BulkAddToCart controlller
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class BulkAddToCartController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* ProductRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $product;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Product\Repositories\ProductRepository $product
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Product $product)
|
||||
{
|
||||
$this->product = $product;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$valid_extension = ['xlsx', 'csv', 'xls', 'ods'];
|
||||
|
||||
if (! in_array(request()->file('file')->getClientOriginalExtension(), $valid_extension)) {
|
||||
session()->flash('error', trans('bulkaddtocart::app.products.upload-error'));
|
||||
|
||||
return redirect()->back();
|
||||
} else {
|
||||
try {
|
||||
$excelData = (new DataGridImport)->toArray(request()->file('file'));
|
||||
$cart = [];
|
||||
|
||||
foreach ($excelData as $data) {
|
||||
foreach ($data as $column => $uploadData) {
|
||||
$validator = Validator::make($uploadData, [
|
||||
'sku' => 'required',
|
||||
'quantity' => 'required|numeric|min:1',
|
||||
]);
|
||||
|
||||
$product = $this->product->findOneWhere([
|
||||
'sku' => $uploadData['sku'],
|
||||
]);
|
||||
|
||||
if ($product) {
|
||||
$canAdd = $product->haveSufficientQuantity($uploadData['quantity']);
|
||||
|
||||
if (! $canAdd) {
|
||||
$sufficientQuantity[] = $column + 1;
|
||||
} else if ($product->type == 'simple' && $uploadData['quantity'] > 0) {
|
||||
if ($product->parent_id != null) {
|
||||
$parentProduct = $this->product->findOneWhere([
|
||||
'id' => $product->parent_id,
|
||||
]);
|
||||
|
||||
foreach ($parentProduct->super_attributes as $super_attribute) {
|
||||
if ($super_attribute->type == 'select') {
|
||||
foreach ($product->attribute_values as $attribute_value) {
|
||||
if ($super_attribute->id == $attribute_value->attribute_id) {
|
||||
$attributes[$super_attribute->id] = (string) $attribute_value->integer_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cart['product'] = (string) $parentProduct->id;
|
||||
$cart['quantity'] = (string) $uploadData['quantity'];
|
||||
$cart['is_configurable'] = 'true';
|
||||
$cart['selected_configurable_option'] = (string) $product->id;
|
||||
$cart['super_attribute'] = $attributes;
|
||||
} else {
|
||||
$cart['product'] = (string) $product->id;
|
||||
$cart['quantity'] = (string) $uploadData['quantity'];
|
||||
$cart['is_configurable'] = 'false';
|
||||
}
|
||||
|
||||
request()->merge([
|
||||
'quantity' => $cart['quantity']
|
||||
]);
|
||||
|
||||
Event::fire('checkout.cart.add.before', $cart['product']);
|
||||
|
||||
$result = Cart::add($cart['product'], $cart);
|
||||
|
||||
Event::fire('checkout.cart.add.after', $result);
|
||||
|
||||
Cart::collectTotals();
|
||||
}
|
||||
} else {
|
||||
$skuError[] = $column + 1;
|
||||
}
|
||||
|
||||
if ($validator->fails()) {
|
||||
$failedRules[$column+1] = $validator->errors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($failedRules)) {
|
||||
foreach ($failedRules as $coulmn => $fail) {
|
||||
if ($fail->first('sku')) {
|
||||
$errorMsg[$coulmn] = $fail->first('sku');
|
||||
} else if ($fail->first('quantity')) {
|
||||
$errorMsg[$coulmn] = $fail->first('quantity');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($errorMsg as $key => $msg) {
|
||||
$msg = str_replace(".", "", $msg);
|
||||
$message[] = $msg. ' at Row ' .$key . '.';
|
||||
}
|
||||
|
||||
$finalMsg[] = implode(" ", $message);
|
||||
}
|
||||
if (isset($skuError)) {
|
||||
$errorRows = implode(",", $skuError);
|
||||
$finalMsg[] = trans('bulkaddtocart::app.products.sku-error') . ' ' . $errorRows . '.';
|
||||
}
|
||||
if (isset($sufficientQuantity)) {
|
||||
$errorRows = implode(",", $sufficientQuantity);
|
||||
$finalMsg[] = trans('bulkaddtocart::app.products.quantity-error') . ' ' . $errorRows . '.';
|
||||
}
|
||||
if (isset($finalMsg)) {
|
||||
$finalErrorMsg = implode(" ", $finalMsg);
|
||||
|
||||
session()->flash('error', $finalErrorMsg);
|
||||
|
||||
return redirect()->back();
|
||||
} else {
|
||||
session()->flash('success', trans('bulkaddtocart::app.products.upload-sucess'));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
session()->flash('error', $e->getMessage());
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Download Sample
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function downLoadSample()
|
||||
{
|
||||
return Storage::download('sample/sample.xls');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\BulkAddToCart\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;
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function () {
|
||||
|
||||
Route::prefix('customer')->group(function () {
|
||||
|
||||
Route::group(['middleware' => ['customer']], function () {
|
||||
|
||||
Route::get('bulk-add-to-cart', 'Webkul\BulkAddToCart\Http\Controllers\BulkAddToCartController@create')->defaults('_config', [
|
||||
'view' => 'bulkaddtocart::products.bulk-add-to-cart'
|
||||
])->name('cart.bulk-add-to-cart.create');
|
||||
|
||||
Route::post('bulk-add-to-cart', 'Webkul\BulkAddToCart\Http\Controllers\BulkAddToCartController@store')->defaults('_config', [
|
||||
'redirect' => 'shop.checkout.cart.index'
|
||||
])->name('cart.bulk-add-to-cart.store');
|
||||
|
||||
Route::get('download-sample', 'Webkul\BulkAddToCart\Http\Controllers\BulkAddToCartController@downLoadSample')->defaults('_config', [
|
||||
'view' => 'bulkaddtocart::products.bulk-add-to-cart'
|
||||
])->name('cart.bulk-add-to-cart.sample.download');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\BulkAddToCart\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Routing\Router;
|
||||
|
||||
class BulkAddToCartServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
|
||||
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'bulkaddtocart');
|
||||
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'bulkaddtocart');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register package config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->mergeConfigFrom(
|
||||
dirname(__DIR__) . '/Config/menu.php', 'menu.customer'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'products' => [
|
||||
'bulk-add-to-cart' => 'Bulk Add to Cart',
|
||||
'file' => 'File',
|
||||
'submit' => 'Submit',
|
||||
'upload-sucess' => 'Products Sucessfully added to Cart',
|
||||
'quantity-error' => 'Products have not sufficient quantity at row',
|
||||
'upload-error' => 'The file must be a file of type: xls, xlsx, csv, ods.',
|
||||
'enough-row-error' => 'file has not enough rows',
|
||||
'sku-error' => 'Invalid SKU at row',
|
||||
'allowed-type' => 'Allowed Type :',
|
||||
'file-type' => 'csv, xls, xlsx, ods.',
|
||||
'download-sample' => 'Download Sample'
|
||||
],
|
||||
];
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
@extends('shop::layouts.master')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('bulkaddtocart::app.products.bulk-add-to-cart') }}
|
||||
@endsection
|
||||
|
||||
@section('content-wrapper')
|
||||
|
||||
<div class="account-content">
|
||||
@include('shop::customers.account.partials.sidemenu')
|
||||
|
||||
<div class="account-layout">
|
||||
|
||||
<div class="account-head mb-15">
|
||||
<span class="account-heading">{{ __('bulkaddtocart::app.products.bulk-add-to-cart') }}</span>
|
||||
|
||||
<div class="horizontal-rule"></div>
|
||||
</div>
|
||||
|
||||
<div class="account-items-list">
|
||||
<form method="POST" action="{{ route('cart.bulk-add-to-cart.store') }}" enctype="multipart/form-data" @submit.prevent="onSubmit">
|
||||
@csrf()
|
||||
|
||||
<div class="control-group" :class="[errors.has('file') ? 'has-error' : '']">
|
||||
<label for="file" class="required">{{ __('bulkaddtocart::app.products.file') }}</label>
|
||||
<input v-validate="'required'" type="file" class="control" id="file" name="file" data-vv-as=""{{ __('bulkaddtocart::app.products.file') }}"" value="{{ old('file') }}" style="padding-top: 5px"><br>
|
||||
<span>{{ __('bulkaddtocart::app.products.allowed-type') }}</span>
|
||||
<span><b>{{ __('bulkaddtocart::app.products.file-type') }}</b></span>
|
||||
<span class="control-error" v-if="errors.has('file')">@{{ errors.first('file') }}</span>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('bulkaddtocart::app.products.submit') }}
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="download-sample" style="margin-top: 30px;">
|
||||
<span><b>{{ __('bulkaddtocart::app.products.download-sample') }}</b></span>
|
||||
<span>
|
||||
<a href="{{ route('cart.bulk-add-to-cart.sample.download') }}">
|
||||
<i class="icon sort-down-icon" style="position: absolute; margin-left: 30px; cursor: pointer;"></i>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
/node_modules
|
||||
/package-lock.json
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"name": "bagisto/laravel-custom",
|
||||
"description": "Custom package to over ride settings",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Webkul",
|
||||
"email": "support@webkul.com"
|
||||
}
|
||||
],
|
||||
"require": {},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Webkul\\Custom\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Webkul\\Custom\\Providers\\CustomServiceProvider"
|
||||
],
|
||||
"aliases": {}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddUrlKeyColumnInSlidersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('sliders', function (Blueprint $table) {
|
||||
$table->string('url_type')->nullable();
|
||||
$table->string('url_key')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('sliders', function (Blueprint $table) {
|
||||
$this->dropColumn('url_type');
|
||||
$this->dropColumn('url_key');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Custom\Helpers;
|
||||
|
||||
use Webkul\Category\Repositories\CategoryRepository as Category;
|
||||
use Webkul\Product\Repositories\ProductFlatRepository as Product;
|
||||
|
||||
class CollectURLKeys
|
||||
{
|
||||
/**
|
||||
* Will hold CategoryRepository instance
|
||||
*/
|
||||
protected $category;
|
||||
|
||||
/**
|
||||
* Will hold ProductRepository instance
|
||||
*/
|
||||
protected $product;
|
||||
|
||||
public function __construct(
|
||||
Category $category,
|
||||
Product $product
|
||||
)
|
||||
{
|
||||
$this->category = $category;
|
||||
|
||||
$this->product = $product;
|
||||
}
|
||||
|
||||
public function getCategoryKeys()
|
||||
{
|
||||
$categories = $this->category->all();
|
||||
|
||||
$categoryURLKeys = collect();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
if (strtolower($category->slug) != 'root') {
|
||||
$categoryURLKeys->push([
|
||||
'id' => $category->id,
|
||||
'name' => $category->name,
|
||||
'url_key' => $category->slug
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $categoryURLKeys;
|
||||
}
|
||||
|
||||
public function getProductKeys()
|
||||
{
|
||||
$products = $this->product->findWhere(
|
||||
[
|
||||
'status' => 1,
|
||||
'visible_individually' => 1,
|
||||
'channel' => core()->getCurrentChannel()->code,
|
||||
'locale' => core()->getCurrentlocale()->code
|
||||
]
|
||||
);
|
||||
|
||||
$productURLKeys = collect();
|
||||
|
||||
foreach ($products as $product) {
|
||||
$productURLKeys->push([
|
||||
'id' => $product->id,
|
||||
'name' => $product->name,
|
||||
'url_key' => $product->url_key
|
||||
]);
|
||||
}
|
||||
|
||||
return $productURLKeys;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Custom\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;
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Custom\Models;
|
||||
|
||||
use Webkul\Core\Models\Slider as BaseModel;
|
||||
|
||||
use Company;
|
||||
|
||||
class Slider extends BaseModel
|
||||
{
|
||||
protected $fillable = [
|
||||
'title', 'path', 'content', 'channel_id', 'url_type', 'url_key'
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new Eloquent query builder for the model.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $query
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function newEloquentBuilder($query)
|
||||
{
|
||||
$company = Company::getCurrent();
|
||||
|
||||
if (auth()->guard('super-admin')->check() || ! isset($company->id)) {
|
||||
return new \Illuminate\Database\Eloquent\Builder($query);
|
||||
} else {
|
||||
return new \Illuminate\Database\Eloquent\Builder($query->where('sliders' . '.company_id', $company->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Custom\Observers;
|
||||
|
||||
use Webkul\SAASCustomizer\Models\Customer\Customer;
|
||||
|
||||
use Company;
|
||||
|
||||
class CustomerObserver
|
||||
{
|
||||
public function creating(Customer $model)
|
||||
{
|
||||
if (! auth()->guard('super-admin')->check()) {
|
||||
$model->company_id = Company::getCurrent()->id;
|
||||
|
||||
$model->status = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Custom\Observers;
|
||||
|
||||
use Webkul\Custom\Models\Slider;
|
||||
|
||||
use Company;
|
||||
|
||||
class SliderObserver
|
||||
{
|
||||
// public function creating(Slider $model)
|
||||
// {
|
||||
// dd($model->content);
|
||||
|
||||
// if (! auth()->guard('super-admin')->check()) {
|
||||
// $model->company_id = Company::getCurrent()->id;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public function saving(Slider $model)
|
||||
|
||||
// { dd($model->content);
|
||||
|
||||
// if (! auth()->guard('super-admin')->check()) {
|
||||
// $model->company_id = Company::getCurrent()->id;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Custom\Providers;
|
||||
|
||||
use Webkul\Custom\Providers\EventServiceProvider;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Routing\Router;
|
||||
|
||||
class CustomServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot(Router $router)
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'custom');
|
||||
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'custom');
|
||||
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
|
||||
$this->app->concord->registerModel(\Webkul\Core\Contracts\Slider::class, \Webkul\Custom\Models\Slider::class);
|
||||
|
||||
\Webkul\SAASCustomizer\Models\Customer\Customer::observe(\Webkul\Custom\Observers\CustomerObserver::class);
|
||||
|
||||
\Webkul\Custom\Models\Slider::observe(\Webkul\Custom\Observers\SliderObserver::class);
|
||||
|
||||
$this->publishes([
|
||||
__DIR__ . '/../Resources/views/navmenu.blade.php' => resource_path('views/vendor/shop/layouts/header/nav-menu/navmenu.blade.php'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Custom\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Event::listen('bagisto.admin.settings.slider.create.after', function($viewRenderEventManager) {
|
||||
$viewRenderEventManager->addTemplate('custom::customslider');
|
||||
});
|
||||
|
||||
Event::listen('bagisto.admin.settings.slider.edit.after', function($viewRenderEventManager) {
|
||||
$viewRenderEventManager->addTemplate('custom::customslider');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Custom\Providers;
|
||||
|
||||
use Konekt\Concord\BaseModuleServiceProvider;
|
||||
|
||||
class ModuleServiceProvider extends BaseModuleServiceProvider
|
||||
{
|
||||
protected $models = [
|
||||
];
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
@php
|
||||
$link = app('Webkul\Custom\Helpers\CollectURLKeys');
|
||||
|
||||
$categoryKeys = $link->getCategoryKeys();
|
||||
|
||||
$productKeys = $link->getProductKeys();
|
||||
@endphp
|
||||
|
||||
<div class="control-group">
|
||||
<label for="select-link">Select Link</label>
|
||||
|
||||
<select class="control" name="url_key" v-validate="'required'">
|
||||
@if (count($categoryKeys))
|
||||
<optgroup label="categories">
|
||||
@foreach ($categoryKeys as $categoryKey)
|
||||
@php
|
||||
$value = 'categories/'.$categoryKey['url_key'];
|
||||
@endphp
|
||||
|
||||
<option value="{{ $value }}"
|
||||
@if(isset($slider->url_key) && $slider->url_key == $value)
|
||||
selected="selected"
|
||||
@endif>
|
||||
|
||||
{{ $categoryKey['name'] }}
|
||||
|
||||
</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@endif
|
||||
|
||||
@if (count($productKeys))
|
||||
<optgroup label="products">
|
||||
@foreach ($productKeys as $productKey)
|
||||
@php
|
||||
$value = 'products/'.$productKey['url_key'];
|
||||
@endphp
|
||||
|
||||
<option value="{{ $value }}"
|
||||
@if(isset($slider->url_key) && $slider->url_key == $value)
|
||||
selected="selected"
|
||||
@endif>
|
||||
|
||||
{{ $productKey['name'] }}
|
||||
|
||||
</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
{!! view_render_event('bagisto.shop.layout.header.category.before') !!}
|
||||
|
||||
<?php
|
||||
|
||||
$categories = [];
|
||||
|
||||
foreach (app('Webkul\CustomerGroupCatalog\Repositories\CategoryRepository')->getVisibleCategoryTree(core()->getCurrentChannel()->root_category_id) as $category) {
|
||||
if ($category->slug)
|
||||
array_push($categories, $category);
|
||||
}
|
||||
|
||||
$cmsPages = app('Webkul\CMS\Repositories\CMSRepository')->findWhere([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'locale_id' => core()->getCurrentLocale()->id
|
||||
]);
|
||||
|
||||
?>
|
||||
|
||||
<category-nav categories='@json($categories)' url="{{url()->to('/')}}"></category-nav>
|
||||
|
||||
{!! view_render_event('bagisto.shop.layout.header.category.after') !!}
|
||||
|
||||
|
||||
@push('scripts')
|
||||
|
||||
|
||||
<script type="text/x-template" id="category-nav-template">
|
||||
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="{{ route('shop.home.index') }}">Home</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a>Catalog</a>
|
||||
|
||||
<category-item
|
||||
v-for="(item, index) in items"
|
||||
:key="index"
|
||||
:url="url"
|
||||
:item="item"
|
||||
:parent="index">
|
||||
</category-item>
|
||||
</li>
|
||||
|
||||
@foreach($cmsPages as $cmsPage)
|
||||
<li>
|
||||
<a href="{{ route('shop.cms.page', $cmsPage->url_key) }}">{{ $cmsPage->page_title }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Vue.component('category-nav', {
|
||||
|
||||
template: '#category-nav-template',
|
||||
|
||||
props: {
|
||||
categories: {
|
||||
type: [Array, String, Object],
|
||||
required: false,
|
||||
default: (function () {
|
||||
return [];
|
||||
})
|
||||
},
|
||||
|
||||
url: String
|
||||
},
|
||||
|
||||
data: function(){
|
||||
return {
|
||||
items_count:0
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
items: function() {
|
||||
return JSON.parse(this.categories)
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-template" id="category-item-template">
|
||||
<li>
|
||||
<a :href="url+'/categories/'+this.item['translations'][0].slug">
|
||||
@{{ name }} 
|
||||
<i class="icon dropdown-right-icon" v-if="haveChildren && item.parent_id != null"></i>
|
||||
</a>
|
||||
|
||||
<i :class="[show ? 'icon icon-arrow-down mt-15' : 'icon dropdown-right-icon left mt-15']"
|
||||
v-if="haveChildren" @click="showOrHide"></i>
|
||||
|
||||
<ul v-if="haveChildren && show">
|
||||
<category-item
|
||||
v-for="(child, index) in item.children"
|
||||
:key="index"
|
||||
:url="url"
|
||||
:item="child">
|
||||
</category-item>
|
||||
</ul>
|
||||
</li>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Vue.component('category-item', {
|
||||
|
||||
template: '#category-item-template',
|
||||
|
||||
props: {
|
||||
item: Object,
|
||||
url: String,
|
||||
},
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
items_count:0,
|
||||
show: false,
|
||||
};
|
||||
},
|
||||
|
||||
mounted: function() {
|
||||
if(window.innerWidth > 770){
|
||||
this.show = true;
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
haveChildren: function() {
|
||||
return this.item.children.length ? true : false;
|
||||
},
|
||||
|
||||
name: function() {
|
||||
if (this.item.translations && this.item.translations.length) {
|
||||
this.item.translations.forEach(function(translation) {
|
||||
if (translation.locale == document.documentElement.lang)
|
||||
return translation.name;
|
||||
});
|
||||
}
|
||||
|
||||
return this.item.name;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
showOrHide: function() {
|
||||
this.show = !this.show;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.nav > li > li').css('display', 'none');
|
||||
|
||||
$('.nav > li').mouseenter(function () {
|
||||
$('.nav > li > li').css('display', 'block');
|
||||
});
|
||||
|
||||
$('.nav > li').mouseleave(function () {
|
||||
$('.nav > li > li').css('display', 'none');
|
||||
});
|
||||
|
||||
$('ul > li li').css('background', 'white');
|
||||
|
||||
$('ul > li li').css('border', '1px solid #c7c7c7');
|
||||
|
||||
$('ul > li li').css('border-right', '1px solid #c7c7c7');
|
||||
|
||||
$('.header .header-bottom .nav > li').css('z-index', '1');
|
||||
});
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'key' => 'customer.settings.credit_max',
|
||||
'name' => 'customercreditmax::app.admin.system.credit-max',
|
||||
'sort' => 4,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'status',
|
||||
'title' => 'customercreditmax::app.admin.system.use-credit-max',
|
||||
'type' => 'boolean',
|
||||
'channel_based' => true
|
||||
], [
|
||||
'name' => 'amount',
|
||||
'title' => 'customercreditmax::app.admin.system.max-credit-amount',
|
||||
'type' => 'text',
|
||||
'validation' => 'decimal',
|
||||
'channel_based' => true
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerCreditMax\Listeners;
|
||||
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Webkul\Sales\Repositories\OrderRepository;
|
||||
use Cart as CartFacade;
|
||||
|
||||
/**
|
||||
* Cart event handler
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class Cart
|
||||
{
|
||||
/**
|
||||
* OrderRepository object
|
||||
*
|
||||
* @var Product
|
||||
*/
|
||||
protected $orderRepository;
|
||||
|
||||
/**
|
||||
* Create a new cart event listener instance.
|
||||
*
|
||||
* @param Webkul\Sales\Repositories\OrderRepository $orderRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(OrderRepository $orderRepository)
|
||||
{
|
||||
$this->orderRepository = $orderRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current logged in customer
|
||||
*
|
||||
* @return Customer | Boolean
|
||||
*/
|
||||
public function getCurrentCustomerGuard()
|
||||
{
|
||||
$guard = request()->has('token') ? 'api' : 'customer';
|
||||
|
||||
return auth()->guard($guard);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if customer credit amount exceeded or not
|
||||
*
|
||||
* @param mixed $cartItem
|
||||
*/
|
||||
public function cartItemAddBefore($productId)
|
||||
{
|
||||
if (! core()->getConfigData('customer.settings.credit_max.status') || ! $this->getCurrentCustomerGuard()->check())
|
||||
return;
|
||||
|
||||
$baseGrandTotal = $this->orderRepository->scopeQuery(function ($query) {
|
||||
return $query
|
||||
->where('orders.customer_id', $this->getCurrentCustomerGuard()->user()->id)
|
||||
->where('orders.status', '<>', 'canceled');
|
||||
})->sum('base_grand_total');
|
||||
|
||||
$baseGrandTotalInvoiced = $this->orderRepository->scopeQuery(function ($query) {
|
||||
return $query
|
||||
->where('orders.customer_id', $this->getCurrentCustomerGuard()->user()->id)
|
||||
->where('orders.status', '<>', 'canceled');
|
||||
})->sum('base_grand_total_invoiced');
|
||||
|
||||
if ( ($baseGrandTotal - $baseGrandTotalInvoiced) >= core()->getConfigData('customer.settings.credit_max.amount'))
|
||||
throw new \Exception('You available credit limit has been exceeded. Please pay your pending invoice.');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerCreditMax\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Routing\Router;
|
||||
|
||||
class CustomerCreditMaxServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'customercreditmax');
|
||||
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->mergeConfigFrom(
|
||||
dirname(__DIR__) . '/Config/system.php', 'core'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerCreditMax\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Event::listen('checkout.cart.add.before', 'Webkul\CustomerCreditMax\Listeners\Cart@cartItemAddBefore');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'admin' => [
|
||||
'system' => [
|
||||
'credit-max' => 'Credit Max',
|
||||
'use-credit-max' => 'Use Credit Max',
|
||||
'max-credit-amount' => 'Max Credit Amount'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/node_modules
|
||||
/package-lock.json
|
||||
npm-debug.log
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"name": "bagisto/customer-document",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Rahul Shukla",
|
||||
"email": "rahulshukla517@webkul.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Webkul\\CustomerDocument\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Webkul\\CustomerDocument\\CustomerDocumentServiceProvider"
|
||||
],
|
||||
"aliases": {}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"watch-poll": "cross-env npm run watch -- --watch-poll --progress",
|
||||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"prod": "npm run production",
|
||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.18",
|
||||
"cross-env": "^5.1.4",
|
||||
"laravel-mix": "^2.1",
|
||||
"laravel-mix-merge-manifest": "^0.1.1",
|
||||
"jquery": "^3.2",
|
||||
"vue": "^2.1.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"vee-validate": "2.0.0-rc.26",
|
||||
"vue-flatpickr": "^2.3.0",
|
||||
"vue-slider-component": "^2.7.5"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'key' => 'documents',
|
||||
'name' => 'customerdocument::app.admin.customers.documents',
|
||||
'route' => 'admin.documents.index',
|
||||
'sort' => 1
|
||||
], [
|
||||
'key' => 'documents.files',
|
||||
'name' => 'customerdocument::app.admin.documents.b2b-files',
|
||||
'route' => 'admin.documents.index',
|
||||
'sort' => 2
|
||||
]
|
||||
];
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'key' => 'account.documents',
|
||||
'name' => 'customerdocument::app.admin.customers.documents',
|
||||
'route' =>'customer.documents.index',
|
||||
'sort' => 6
|
||||
]
|
||||
];
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'key' => 'documents',
|
||||
'name' => 'customerdocument::app.admin.customers.documents',
|
||||
'route' => 'admin.documents.index',
|
||||
'sort' => 6,
|
||||
'icon-class' => 'document-icon',
|
||||
], [
|
||||
'key' => 'documents.files',
|
||||
'name' => 'customerdocument::app.admin.documents.b2b-files',
|
||||
'route' => 'admin.documents.index',
|
||||
'sort' => 1,
|
||||
'icon-class' => '',
|
||||
],
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'key' => 'customer.settings.documents',
|
||||
'name' => 'customerdocument::app.admin.customers.documents',
|
||||
'sort' => 4,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'size',
|
||||
'title' => 'customerdocument::app.admin.customers.size',
|
||||
'type' => 'text',
|
||||
'validation' => 'decimal:2'
|
||||
], [
|
||||
'name' => 'allowed_extensions',
|
||||
'title' => 'customerdocument::app.admin.customers.allowed-types',
|
||||
'type' => 'text'
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Contracts;
|
||||
|
||||
interface CustomerDocument
|
||||
{
|
||||
}
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\DataGrids;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* CustomerDocumentDataGrid class
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CustomerDocumentDataGrid extends DataGrid
|
||||
{
|
||||
protected $index = 'id'; //the column that needs to be treated as index column
|
||||
|
||||
protected $sortOrder = 'desc'; //asc or desc
|
||||
|
||||
protected $itemsPerPage = 10;
|
||||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('customer_documents')
|
||||
->addSelect('id', 'name', 'status', 'type');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'label' => trans('admin::app.datagrid.id'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'name',
|
||||
'label' => trans('admin::app.datagrid.name'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'status',
|
||||
'label' => trans('admin::app.datagrid.status'),
|
||||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => false,
|
||||
'filterable' => false,
|
||||
'wrapper' => function($value) {
|
||||
if ($value->status == 1)
|
||||
return 'Active';
|
||||
else
|
||||
return 'Inactive';
|
||||
}
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'type',
|
||||
'label' => trans('admin::app.datagrid.type'),
|
||||
'type' => 'string',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'Edit',
|
||||
'method' => 'GET',
|
||||
'route' => 'admin.documents.edit',
|
||||
'icon' => 'icon pencil-lg-icon'
|
||||
]);
|
||||
|
||||
$this->addAction([
|
||||
'type' => 'Delete',
|
||||
'method' => 'POST', // use GET request only for redirect purposes
|
||||
'route' => 'admin.documents.delete',
|
||||
'confirm_text' => trans('ui::app.datagrid.massaction.delete', ['resource' => 'product']),
|
||||
'icon' => 'icon trash-icon'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CustomerDocumentsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customer_documents', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->string('type');
|
||||
$table->string('path');
|
||||
$table->integer('customer_id')->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('customer_documents');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,280 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\CustomerDocument\Repositories\CustomerDocumentRepository;
|
||||
use Webkul\CustomerDocument\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Document controlller
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class DocumentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CustomerDocumentRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customerDocument;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Customer\Repositories\CustomerDocumentRepository $customerDocument
|
||||
*/
|
||||
public function __construct(CustomerDocumentRepository $customerDocument)
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customerDocument = $customerDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$excludedExtensions = core()->getConfigData('customer.settings.documents.allowed_extensions');
|
||||
$maxSize = core()->getConfigData('customer.settings.documents.size');
|
||||
|
||||
if ($excludedExtensions != '') {
|
||||
$valid_extension = explode(',', $excludedExtensions);
|
||||
} else {
|
||||
$valid_extension = [];
|
||||
}
|
||||
|
||||
$originalSize = filesize(request()->file('file')) / 1000;
|
||||
|
||||
if ($maxSize != null) {
|
||||
$maxSize = (float) $maxSize * 1000;
|
||||
} else {
|
||||
$maxSize = 5 * 1024;
|
||||
}
|
||||
|
||||
if (! ($originalSize <= $maxSize) || $originalSize == 0) {
|
||||
session()->flash('error', trans('customerdocument::app.admin.customers.size-error'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
if (! empty($valid_extension) && (! in_array(request()->file('file')->getClientOriginalExtension(), $valid_extension))) {
|
||||
session()->flash('error', trans('customerdocument::app.admin.customers.upload-error'));
|
||||
|
||||
return redirect()->back();
|
||||
} else {
|
||||
try {
|
||||
$data = request()->all();
|
||||
|
||||
if (request()->hasFile('file')) {
|
||||
$dir = 'customer';
|
||||
$document['path'] = request()->file('file')->store($dir);
|
||||
}
|
||||
|
||||
if (isset($data['customer_id'])) {
|
||||
$document['customer_id'] = $data['customer_id'];
|
||||
} else {
|
||||
$document['customer_id'] = 0;
|
||||
}
|
||||
|
||||
if (isset($data['status'])) {
|
||||
$document['status'] = $data['status'];
|
||||
} else {
|
||||
$document['status'] = 1;
|
||||
}
|
||||
|
||||
$document['name'] = $data['name'];
|
||||
$document['description'] = $data['description'];
|
||||
$document['type'] = $data['type'];
|
||||
|
||||
$this->customerDocument->create($document);
|
||||
|
||||
session()->flash('success', trans('customerdocument::app.admin.customers.upload-success'));
|
||||
|
||||
if (isset($data['customer_id'])) {
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
} catch (\Exception $e) {
|
||||
session()->flash('error', $e);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$document = $this->customerDocument->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('document'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$excludedExtensions = core()->getConfigData('customer.settings.documents.allowed_extensions');
|
||||
$maxSize = core()->getConfigData('customer.settings.documents.size');
|
||||
|
||||
if ($excludedExtensions != '') {
|
||||
$valid_extension = explode(',', $excludedExtensions);
|
||||
} else {
|
||||
$valid_extension = [];
|
||||
}
|
||||
|
||||
$originalSize = filesize(request()->file('file')) / 1000;
|
||||
|
||||
if ($maxSize != null) {
|
||||
$maxSize = (float) $maxSize * 1000;
|
||||
} else {
|
||||
$maxSize = 5 * 1024;
|
||||
}
|
||||
|
||||
if (! ($originalSize <= $maxSize)) {
|
||||
session()->flash('error', trans('customerdocument::app.admin.customers.size-error'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
if (! empty($valid_extension) && (! in_array(request()->file('file')->getClientOriginalExtension(), $valid_extension))) {
|
||||
session()->flash('error', trans('customerdocument::app.admin.customers.upload-error'));
|
||||
|
||||
return redirect()->back();
|
||||
} else {
|
||||
try {
|
||||
$data = request()->all();
|
||||
|
||||
$uploaDocument = $this->customerDocument->findOrfail($id);
|
||||
|
||||
if (request()->hasFile('file')) {
|
||||
$dir = 'customer';
|
||||
$document['path'] = request()->file('file')->store($dir);
|
||||
Storage::delete($uploaDocument['path']);
|
||||
}
|
||||
|
||||
$document['name'] = $data['name'];
|
||||
$document['description'] = $data['description'];
|
||||
$document['type'] = $data['type'];
|
||||
$document['status'] = $data['status'];
|
||||
|
||||
$this->customerDocument->update($document, $id);
|
||||
|
||||
session()->flash('success', trans('customerdocument::app.admin.customers.upload-success'));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
} catch (\Exception $e) {
|
||||
session()->flash('error', $e);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage..
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$document = $this->customerDocument->findOrfail($id);
|
||||
|
||||
try {
|
||||
$this->customerDocument->delete($id);
|
||||
|
||||
Storage::delete($document['path']);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Document']));
|
||||
|
||||
return response()->json(['message' => true], 200);
|
||||
} catch (\Exception $e) {
|
||||
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Document']));
|
||||
}
|
||||
|
||||
return response()->json(['message' => false], 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* download the file for the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function download($id)
|
||||
{
|
||||
$document = $this->customerDocument->findOrfail($id);
|
||||
|
||||
$extension = explode('.', $document['path']);
|
||||
|
||||
$name = $document['name'].'.'.end($extension);
|
||||
|
||||
return Storage::download($document['path'], $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage..
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$document = $this->customerDocument->findOrfail($id);
|
||||
|
||||
$this->customerDocument->delete($id);
|
||||
|
||||
Storage::delete($document['path']);
|
||||
|
||||
session()->flash('success', trans('customerdocument::app.admin.customers.delete-success'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\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;
|
||||
}
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\CustomerDocument\Repositories\CustomerDocumentRepository;
|
||||
use Webkul\CustomerDocument\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Document controlller
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class DocumentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CustomerDocumentRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customerDocument;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Customer\Repositories\CustomerDocumentRepository $customerDocument
|
||||
*/
|
||||
public function __construct(CustomerDocumentRepository $customerDocument)
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customerDocument = $customerDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$documents = $this->customerDocument->findWhere(['customer_id' => auth()->guard('customer')->user()->id]);
|
||||
|
||||
return view($this->_config['view'], compact('documents'));
|
||||
}
|
||||
|
||||
/**
|
||||
* upload document
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
$excludedExtensions = core()->getConfigData('customer.settings.documents.allowed_extensions');
|
||||
$maxSize = core()->getConfigData('customer.settings.documents.size');
|
||||
|
||||
$valid_extension = explode(',', $excludedExtensions);
|
||||
|
||||
$originalSize = filesize(request()->file('file')) / 1000;
|
||||
|
||||
if ($maxSize != null) {
|
||||
$maxSize = (float) $maxSize * 1000;
|
||||
} else {
|
||||
$maxSize = 5 * 1024;
|
||||
}
|
||||
|
||||
if (! ($originalSize <= $maxSize) || $originalSize == 0) {
|
||||
session()->flash('error', trans('customerdocument::app.admin.customers.size-error'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
if (! in_array(request()->file('file')->getClientOriginalExtension(), $valid_extension)) {
|
||||
session()->flash('error', trans('customerdocument::app.admin.customers.upload-error'));
|
||||
|
||||
return redirect()->back();
|
||||
} else {
|
||||
try {
|
||||
$data = request()->all();
|
||||
|
||||
if (request()->hasFile('file')) {
|
||||
$dir = 'customer';
|
||||
$document['path'] = request()->file('file')->store($dir);
|
||||
}
|
||||
|
||||
$document['customer_id'] = $data['customer_id'];
|
||||
$document['name'] = $data['name'];
|
||||
$document['description'] = $data['description'];
|
||||
|
||||
$this->customerDocument->create($document);
|
||||
|
||||
session()->flash('success', trans('customerdocument::app.admin.customers.upload-success'));
|
||||
|
||||
return redirect()->back();
|
||||
} catch (\Exception $e) {
|
||||
session()->flash('error', $e);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* download the file for the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function download($id)
|
||||
{
|
||||
$document = $this->customerDocument->findOrfail($id);
|
||||
|
||||
return Storage::download($document['path'], $document['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage..
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$document = $this->customerDocument->findOrfail($id);
|
||||
|
||||
$this->customerDocument->delete($id);
|
||||
|
||||
Storage::delete($document['path']);
|
||||
|
||||
session()->flash('success', trans('customerdocument::app.admin.customers.delete-success'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\CustomerDocument\Repositories\CustomerDocumentRepository;
|
||||
use Webkul\CustomerDocument\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Document controlller
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla.symfony517@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class DocumentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CustomerDocumentRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customerDocument;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Customer\Repositories\CustomerDocumentRepository $customerDocument
|
||||
*/
|
||||
public function __construct(CustomerDocumentRepository $customerDocument)
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customerDocument = $customerDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$documents = $this->customerDocument->getDocuments(auth()->guard('customer')->user()->id);
|
||||
|
||||
$productDocument = $marketingDocument = [];
|
||||
|
||||
foreach($documents as $document) {
|
||||
if ($document->type == 'marketing') {
|
||||
$marketingDocument[] = $document;
|
||||
} else if ($document->type == 'product') {
|
||||
$productDocument[] = $document;
|
||||
}
|
||||
}
|
||||
|
||||
return view($this->_config['view'], compact('productDocument', 'marketingDocument'));
|
||||
}
|
||||
|
||||
/**
|
||||
* download the file for the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function download($id)
|
||||
{
|
||||
$document = $this->customerDocument->findOrfail($id);
|
||||
|
||||
$extension = explode('.', $document['path']);
|
||||
|
||||
$name = $document['name'].'.'.end($extension);
|
||||
|
||||
return Storage::download($document['path'], $name);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
Route::group(['middleware' => ['web']], function () {
|
||||
|
||||
Route::prefix('admin')->group(function () {
|
||||
|
||||
Route::group(['middleware' => ['admin']], function () {
|
||||
|
||||
//document Management Routes
|
||||
Route::get('documents', 'Webkul\CustomerDocument\Http\Controllers\Admin\DocumentController@index')->defaults('_config',[
|
||||
'view' => 'customerdocument::admin.documents.index'
|
||||
])->name('admin.documents.index');
|
||||
|
||||
Route::get('documents/create', 'Webkul\CustomerDocument\Http\Controllers\Admin\DocumentController@create')->defaults('_config',[
|
||||
'view' => 'customerdocument::admin.documents.create'
|
||||
])->name('admin.documents.create');
|
||||
|
||||
Route::post('documents/create', 'Webkul\CustomerDocument\Http\Controllers\Admin\DocumentController@store')->defaults('_config',[
|
||||
'redirect' => 'admin.documents.index'
|
||||
])->name('admin.documents.store');
|
||||
|
||||
Route::get('documents/edit/{id}', 'Webkul\CustomerDocument\Http\Controllers\Admin\DocumentController@edit')->defaults('_config',[
|
||||
'view' => 'customerdocument::admin.documents.edit'
|
||||
])->name('admin.documents.edit');
|
||||
|
||||
Route::put('documents/edit/{id}', 'Webkul\CustomerDocument\Http\Controllers\Admin\DocumentController@update')->defaults('_config',[
|
||||
'redirect' => 'admin.documents.index'
|
||||
])->name('admin.documents.update');
|
||||
|
||||
Route::post('documents/delete/{id}', 'Webkul\CustomerDocument\Http\Controllers\Admin\DocumentController@destroy')->name('admin.documents.delete');
|
||||
|
||||
Route::get('download-document/{id}', 'Webkul\CustomerDocument\Http\Controllers\Admin\DocumentController@download')->defaults('_config', [
|
||||
'view' => 'customerdocument::admin.documents.edit'
|
||||
])->name('admin.documents.download');
|
||||
|
||||
Route::get('customer-documents/delete/{id}', 'Webkul\CustomerDocument\Http\Controllers\Admin\DocumentController@delete')->name('admin.customer.documents.delete');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function () {
|
||||
|
||||
Route::prefix('customer')->group(function () {
|
||||
|
||||
Route::group(['middleware' => ['customer']], function () {
|
||||
|
||||
Route::prefix('account')->group(function () {
|
||||
|
||||
Route::get('documents', 'Webkul\CustomerDocument\Http\Controllers\Shop\DocumentController@index')->defaults('_config', [
|
||||
'view' => 'customerdocument::shop.customers.document'
|
||||
])->name('customer.documents.index');
|
||||
|
||||
Route::get('download-document/{id}', 'Webkul\CustomerDocument\Http\Controllers\Shop\DocumentController@download')->defaults('_config', [
|
||||
'redirect' => 'admin.customer.index'
|
||||
])->name('customer.document.download');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\CustomerDocument\Contracts\CustomerDocument as CustomerDocumentContract;
|
||||
|
||||
class CustomerDocument extends Model implements CustomerDocumentContract
|
||||
{
|
||||
protected $table = 'customer_documents';
|
||||
|
||||
protected $fillable = ['name', 'path', 'customer_id', 'description', 'type', 'status'];
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Models;
|
||||
|
||||
use Konekt\Concord\Proxies\ModelProxy;
|
||||
|
||||
class CustomerDocumentProxy extends ModelProxy
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Observers;
|
||||
|
||||
use Webkul\CustomerDocument\Models\CustomerDocument;
|
||||
|
||||
use Company;
|
||||
|
||||
class CustomerDocumentObserver
|
||||
{
|
||||
public function creating(CustomerDocument $model)
|
||||
{
|
||||
if (! auth()->guard('super-admin')->check()) {
|
||||
$model->company_id = Company::getCurrent()->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Routing\Router;
|
||||
|
||||
class CustomerDocumentServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Http/admin-routes.php');
|
||||
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Http/front-routes.php');
|
||||
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'customerdocument');
|
||||
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'customerdocument');
|
||||
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/migrations');
|
||||
|
||||
$this->publishes([
|
||||
dirname(__DIR__) . '/Resources/assets/sass/customerdocument.scss' => base_path('public/vendor/webkul/customerdocument/assets/css/customerdocument.css')
|
||||
]);
|
||||
|
||||
\Webkul\CustomerDocument\Models\CustomerDocument::observe(\Webkul\CustomerDocument\Observers\CustomerDocumentObserver::class);
|
||||
|
||||
$this->app->register(ModuleServiceProvider::class);
|
||||
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register package config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->mergeConfigFrom(
|
||||
dirname(__DIR__) . '/Config/menu.php', 'menu.admin'
|
||||
);
|
||||
|
||||
$this->mergeConfigFrom(
|
||||
dirname(__DIR__) . '/Config/customer-menu.php', 'menu.customer'
|
||||
);
|
||||
|
||||
$this->mergeConfigFrom(
|
||||
dirname(__DIR__) . '/Config/system.php', 'core'
|
||||
);
|
||||
|
||||
$this->mergeConfigFrom(
|
||||
dirname(__DIR__) . '/Config/acl.php', 'acl'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Event::listen('bagisto.admin.layout.head', function($viewRenderEventManager) {
|
||||
$viewRenderEventManager->addTemplate('customerdocument::style');
|
||||
});
|
||||
|
||||
Event::listen('bagisto.admin.customer.edit.after', function($viewRenderEventManager) {
|
||||
$viewRenderEventManager->addTemplate('customerdocument::admin.customers.upload');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Providers;
|
||||
|
||||
use Konekt\Concord\BaseModuleServiceProvider;
|
||||
|
||||
class ModuleServiceProvider extends BaseModuleServiceProvider
|
||||
{
|
||||
protected $models = [
|
||||
\Webkul\CustomerDocument\Models\CustomerDocument::class,
|
||||
];
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerDocument\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* Customer Reposotory
|
||||
*
|
||||
* @author Rahul Shukla <rahulshukla517@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CustomerDocumentRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\CustomerDocument\Contracts\CustomerDocument';
|
||||
}
|
||||
|
||||
/**
|
||||
* get All Documents
|
||||
*
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
function getDocuments($id)
|
||||
{
|
||||
return $this->model
|
||||
->whereIn('customer_id', [$id, 0])
|
||||
->where('status', '1')
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 51.1 (57501) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Icon-Document-Active</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Icon-Document-Active" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
|
||||
<g id="Group-2" transform="translate(13.000000, 10.000000)" stroke="#0041FF" stroke-width="2">
|
||||
<g id="Group">
|
||||
<polygon id="Rectangle-15" points="0 0.0511538462 22 0 22 27.0677273 0 27.0165734"></polygon>
|
||||
</g>
|
||||
<path d="M4,0.5 L4,26.5" id="Path-27"></path>
|
||||
<polyline id="Path-28" points="11 1 11 10.5 14.25 7.25 17.5 10.5 17.5 1"></polyline>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 947 B |
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 51.1 (57501) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Icon-Document</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Icon-Document" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
|
||||
<g id="Group-2" transform="translate(13.000000, 10.000000)" stroke="#979797" stroke-width="2">
|
||||
<g id="Group">
|
||||
<polygon id="Rectangle-15" points="0 0.0511538462 22 0 22 27.0677273 0 27.0165734"></polygon>
|
||||
</g>
|
||||
<path d="M4,0.5 L4,26.5" id="Path-27"></path>
|
||||
<polyline id="Path-28" points="11 1 11 10.5 14.25 7.25 17.5 10.5 17.5 1"></polyline>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 933 B |
|
|
@ -1,23 +0,0 @@
|
|||
.icon {
|
||||
display: inline-block;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
%menu-properties {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: inline-block;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.document-icon {
|
||||
@extend %menu-properties;
|
||||
background-image: url("../images/Icon-Document.svg");
|
||||
}
|
||||
|
||||
.active {
|
||||
.document-icon {
|
||||
@extend %menu-properties;
|
||||
background-image: url("../images/Icon-Document-Active.svg");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'admin' =>[
|
||||
'customers' => [
|
||||
'documents' => 'Documents',
|
||||
'add-document' => 'Add Document',
|
||||
'submit' => 'Submit',
|
||||
'file' => 'File',
|
||||
'name' => 'Name',
|
||||
'download' => 'Download',
|
||||
'upload-success' => 'Document uploaded successfully.',
|
||||
'delete-success' => 'Document deleted successfully.',
|
||||
'empty' => 'You Do not Have Any Documents.',
|
||||
'allowed-types' => 'Allowed types (ex: csv,xls,doc,docx,etc)',
|
||||
'allowed-types-one' => 'Allowed types: ',
|
||||
'file-type' => 'csv, xls, xlsx, ods, png, jpeg, zip.',
|
||||
'upload-error' => 'Invalid File Format',
|
||||
'size-error' => 'File exceeds allowed size limits',
|
||||
'description' => 'Description',
|
||||
'size' => 'Max Size Allowed (MB)',
|
||||
'any-type' => 'All file types are allowed'
|
||||
],
|
||||
|
||||
'documents' => [
|
||||
'title' => 'Documents',
|
||||
'add-document' => 'Add Document',
|
||||
'b2b-files' => 'B2B Files',
|
||||
'save-document' => 'Save Document',
|
||||
'type' => 'Type',
|
||||
'status' => 'Status',
|
||||
'active' => 'Active',
|
||||
'in-active' => 'Inactive',
|
||||
'product' => 'Product',
|
||||
'marketing' => 'Marketing',
|
||||
'other' => 'Other',
|
||||
'add-document' => 'Add Document',
|
||||
'edit-document' => 'Edit Document'
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
<?php
|
||||
|
||||
$customerDocumentRepository = app('Webkul\CustomerDocument\Repositories\CustomerDocumentRepository');
|
||||
|
||||
$documents = $customerDocumentRepository->findWhere(['customer_id' => $customer->id, 'status' => 1]);
|
||||
|
||||
?>
|
||||
|
||||
@section('css')
|
||||
@parent
|
||||
|
||||
<style>
|
||||
.modal-container {
|
||||
top: 20px !important;
|
||||
}
|
||||
</style>
|
||||
@stop
|
||||
|
||||
<accordian :title="'{{ __('customerdocument::app.admin.customers.documents') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<button type="button" style="margin-bottom : 20px" class="btn btn-md btn-primary" @click="showModal('addDocument')">
|
||||
{{ __('customerdocument::app.admin.customers.add-document') }}
|
||||
</button>
|
||||
|
||||
<div class="table" style="margin-bottom: 20px;">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('customerdocument::app.admin.customers.name') }}</th>
|
||||
<th>{{ __('customerdocument::app.admin.documents.type') }}</th>
|
||||
<th>{{ __('customerdocument::app.admin.customers.description') }}</th>
|
||||
<th>{{ __('customerdocument::app.admin.customers.download') }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($documents as $document)
|
||||
<tr>
|
||||
<td>{{ $document->name }}</td>
|
||||
<td>{{ $document->type }}</td>
|
||||
<td>{{ $document->description }}</td>
|
||||
<td>
|
||||
<a href="{{ route('admin.documents.download', $document->id) }}">
|
||||
<i class="icon sort-down-icon"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="{{ route('admin.customer.documents.delete', $document->id) }}">
|
||||
<i class="icon trash-icon"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<modal id="addDocument" :is-open="modalIds.addDocument">
|
||||
<h3 slot="header">{{ __('customerdocument::app.admin.customers.add-document') }}</h3>
|
||||
|
||||
<div slot="body">
|
||||
<form method="POST" action="{{ route('admin.documents.store') }}" enctype="multipart/form-data" @submit.prevent="onSubmit">
|
||||
@csrf()
|
||||
|
||||
<input type="hidden" name="customer_id" value="{{ $customer->id }}">
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('customerdocument::app.admin.customers.name') }}</label>
|
||||
<input v-validate="'required'" type="text" class="control" id="name" name="name" data-vv-as=""{{ __('customerdocument::app.admin.customers.name') }}"" value="{{ old('name') }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('type') ? 'has-error' : '']">
|
||||
<label for="type" class="required">{{ __('customerdocument::app.admin.documents.type') }}</label>
|
||||
<select name="type" class="control" v-validate="'required'" data-vv-as=""{{ __('customerdocument::app.admin.documents.type') }}"">
|
||||
<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>
|
||||
|
||||
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
|
||||
<label for="description">{{ __('customerdocument::app.admin.customers.description') }}</label>
|
||||
|
||||
<textarea class="control" id="description" name="description" data-vv-as=""{{ __('customerdocument::app.admin.customers.description') }}"" value="{{ old('description') }}"/
|
||||
></textarea>
|
||||
|
||||
<span class="control-error" v-if="errors.has('description')">@{{ errors.first('description') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('file') ? 'has-error' : '']">
|
||||
<label for="file" class="required">{{ __
|
||||
('customerdocument::app.admin.customers.file') }}</label>
|
||||
|
||||
<input v-validate="'required'" type="file" class="control" id="file" name="file" data-vv-as=""{{ __('customerdocument::app.admin.customers.file') }}"" value="{{ old('file') }}" style="padding-top: 5px">
|
||||
|
||||
@php
|
||||
$allowedTypes = core()->getConfigData('customer.settings.documents.allowed_extensions');
|
||||
@endphp
|
||||
|
||||
<span>{{ __('customerdocument::app.admin.customers.allowed-types-one') }}</span>
|
||||
<span>
|
||||
<b>
|
||||
@if ($allowedTypes != null)
|
||||
{{ $allowedTypes }}
|
||||
@else
|
||||
{{ __('customerdocument::app.admin.customers.any-type') }}
|
||||
@endif
|
||||
|
||||
</b>
|
||||
</span>
|
||||
<span class="control-error" v-if="errors.has('file')">@{{ errors.first('file') }}</span>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('customerdocument::app.admin.customers.submit') }}
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</modal>
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('customerdocument::app.admin.documents.add-document') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.documents.store') }}" @submit.prevent="onSubmit" enctype="multipart/form-data">
|
||||
|
||||
<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>
|
||||
|
||||
{{ __('customerdocument::app.admin.documents.add-document') }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('customerdocument::app.admin.documents.save-document') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('customerdocument::app.admin.customers.name') }}</label>
|
||||
<input v-validate="'required'" type="text" class="control" id="name" name="name" data-vv-as=""{{ __('customerdocument::app.admin.customers.name') }}"" value="{{ old('name') }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('type') ? 'has-error' : '']">
|
||||
<label for="type" class="required">{{ __('customerdocument::app.admin.documents.type') }}</label>
|
||||
<select name="type" class="control" v-validate="'required'" data-vv-as=""{{ __('customerdocument::app.admin.documents.type') }}"">
|
||||
<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>
|
||||
|
||||
<div class="control-group" :class="[errors.has('status') ? 'has-error' : '']">
|
||||
<label for="status" class="required">{{ __('customerdocument::app.admin.documents.status') }}</label>
|
||||
<select name="status" class="control" v-validate="'required'" data-vv-as=""{{ __('customerdocument::app.admin.documents.status') }}"">
|
||||
<option value="1">{{ __('customerdocument::app.admin.documents.active') }}</option>
|
||||
<option value="0">{{ __('customerdocument::app.admin.documents.in-active') }}</option>
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('status')">@{{ errors.first('status') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
|
||||
<label for="description">{{ __('customerdocument::app.admin.customers.description') }}</label>
|
||||
|
||||
<textarea class="control" id="description" name="description" data-vv-as=""{{ __('customerdocument::app.admin.customers.description') }}"" value="{{ old('description') }}"
|
||||
></textarea>
|
||||
|
||||
<span class="control-error" v-if="errors.has('description')">@{{ errors.first('description') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('file') ? 'has-error' : '']">
|
||||
<label for="file" class="required">{{ __
|
||||
('customerdocument::app.admin.customers.file') }}</label>
|
||||
|
||||
<input v-validate="'required'" type="file" class="control" id="file" name="file" data-vv-as=""{{ __('customerdocument::app.admin.customers.file') }}"" value="{{ old('file') }}" style="padding-top: 5px">
|
||||
|
||||
@php
|
||||
$allowedTypes = core()->getConfigData('customer.settings.documents.allowed_extensions');
|
||||
@endphp
|
||||
|
||||
<div>
|
||||
<span>{{ __('customerdocument::app.admin.customers.allowed-types-one') }}</span>
|
||||
<span>
|
||||
<b>
|
||||
@if ($allowedTypes != null)
|
||||
{{ $allowedTypes }}
|
||||
@else
|
||||
{{ __('customerdocument::app.admin.customers.any-type') }}
|
||||
@endif
|
||||
|
||||
</b>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span class="control-error" v-if="errors.has('file')">@{{ errors.first('file') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('customerdocument::app.admin.documents.edit-document') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.documents.update', $document->id) }}" @submit.prevent="onSubmit" enctype="multipart/form-data">
|
||||
|
||||
<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>
|
||||
|
||||
{{ __('customerdocument::app.admin.documents.edit-document') }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('customerdocument::app.admin.documents.save-document') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('customerdocument::app.admin.customers.name') }}</label>
|
||||
<input v-validate="'required'" type="text" class="control" id="name" name="name" value="{{ $document->name }}" data-vv-as=""{{ __('customerdocument::app.admin.customers.name') }}""/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('type') ? 'has-error' : '']">
|
||||
<label for="type" class="required">{{ __('customerdocument::app.admin.documents.type') }}</label>
|
||||
<select name="type" class="control" v-validate="'required'" value="{{ $document->type }}" data-vv-as=""{{ __('customerdocument::app.admin.documents.type') }}"">
|
||||
<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>
|
||||
|
||||
<div class="control-group" :class="[errors.has('status') ? 'has-error' : '']">
|
||||
<label for="status" class="required">{{ __('customerdocument::app.admin.documents.status') }}</label>
|
||||
<select name="status" class="control" value="{{ $document->status }}" v-validate="'required'" data-vv-as=""{{ __('customerdocument::app.admin.documents.status') }}"">
|
||||
<option value="1" {{ $document->status == "1" ? 'selected' : '' }}>{{ __('customerdocument::app.admin.documents.active') }}</option>
|
||||
<option value="0" {{ $document->status == "0" ? 'selected' : '' }}>{{ __('customerdocument::app.admin.documents.in-active') }}</option>
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('status')">@{{ errors.first('status') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
|
||||
<label for="description">{{ __('customerdocument::app.admin.customers.description') }}</label>
|
||||
|
||||
<textarea class="control" id="description" name="description" data-vv-as=""{{ __('customerdocument::app.admin.customers.description') }}""
|
||||
>{{ $document->description }}</textarea>
|
||||
|
||||
<span class="control-error" v-if="errors.has('description')">@{{ errors.first('description') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('file') ? 'has-error' : '']">
|
||||
<label for="file" class="required">{{ __
|
||||
('customerdocument::app.admin.customers.file') }}</label>
|
||||
|
||||
<a href="{{ route('admin.documents.download', $document->id) }}">
|
||||
<i class="icon sort-down-icon download"></i>
|
||||
</a>
|
||||
|
||||
<input type="file" class="control" id="file" name="file" data-vv-as=""{{ __('customerdocument::app.admin.customers.file') }}"" value="{{ old('file') }}" style="padding-top: 5px">
|
||||
|
||||
@php
|
||||
$allowedTypes = core()->getConfigData('customer.settings.documents.allowed_extensions');
|
||||
@endphp
|
||||
|
||||
<div>
|
||||
<span>{{ __('customerdocument::app.admin.customers.allowed-types-one') }}</span>
|
||||
<span>
|
||||
<b>
|
||||
@if ($allowedTypes != null)
|
||||
{{ $allowedTypes }}
|
||||
@else
|
||||
{{ __('customerdocument::app.admin.customers.any-type') }}
|
||||
@endif
|
||||
|
||||
</b>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span class="control-error" v-if="errors.has('file')">@{{ errors.first('file') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('customerdocument::app.admin.documents.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('customerdocument::app.admin.documents.title') }}</h1>
|
||||
</div>
|
||||
<div class="page-action">
|
||||
<a href="{{ route('admin.documents.create') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('customerdocument::app.admin.documents.add-document') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
@inject('customerDocumentGrid','Webkul\CustomerDocument\DataGrids\CustomerDocumentDataGrid')
|
||||
|
||||
{!! $customerDocumentGrid->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
@extends('shop::layouts.master')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('customerdocument::app.admin.customers.documents') }}
|
||||
@endsection
|
||||
|
||||
@section('content-wrapper')
|
||||
|
||||
<div class="account-content">
|
||||
|
||||
@include('shop::customers.account.partials.sidemenu')
|
||||
|
||||
<div class="account-layout">
|
||||
|
||||
<div class="account-head mb-15">
|
||||
<span class="account-heading">{{ __('customerdocument::app.admin.customers.documents') }}</span>
|
||||
|
||||
<div class="horizontal-rule"></div>
|
||||
</div>
|
||||
|
||||
<div class="sale-container">
|
||||
|
||||
<tabs>
|
||||
|
||||
<tab name="{{ __('customerdocument::app.admin.documents.product') }}" :selected="true">
|
||||
@if (! empty($productDocument))
|
||||
<div class="account-items-list" style="display: none;">
|
||||
<div class="table" style="margin-bottom: 20px;">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('customerdocument::app.admin.customers.name') }}</th>
|
||||
<th>{{ __('customerdocument::app.admin.customers.description') }}</th>
|
||||
<th>{{ __('customerdocument::app.admin.customers.download') }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($productDocument as $document)
|
||||
<tr>
|
||||
<td>{{ $document->name }}</td>
|
||||
<td>{{ $document->description }}</td>
|
||||
<td>
|
||||
<a href="{{ route('customer.document.download', $document->id) }}">
|
||||
<i class="icon sort-down-icon"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="empty" style="display: none; margin-top: 20px;">
|
||||
{{ __('customerdocument::app.admin.customers.empty') }}
|
||||
</div>
|
||||
@endif
|
||||
</tab>
|
||||
|
||||
<tab name="{{ __('customerdocument::app.admin.documents.marketing') }}">
|
||||
@if (! empty($marketingDocument))
|
||||
<div class="account-items-list" style="display: none;">
|
||||
<div class="table" style="margin-bottom: 20px;">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('customerdocument::app.admin.customers.name') }}</th>
|
||||
<th>{{ __('customerdocument::app.admin.customers.description') }}</th>
|
||||
<th>{{ __('customerdocument::app.admin.customers.download') }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($marketingDocument as $document)
|
||||
<tr>
|
||||
<td>{{ $document->name }}</td>
|
||||
<td>{{ $document->description }}</td>
|
||||
<td>
|
||||
<a href="{{ route('customer.document.download', $document->id) }}">
|
||||
<i class="icon sort-down-icon"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="empty" style="display: none; margin-top: 20px;">
|
||||
{{ __('customerdocument::app.admin.customers.empty') }}
|
||||
</div>
|
||||
@endif
|
||||
</tab>
|
||||
|
||||
</tabs>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.account-items-list').css('display','block');
|
||||
$('.empty').css('display','block');
|
||||
});
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
|
@ -1 +0,0 @@
|
|||
<link href="{{ asset('vendor/webkul/customerdocument/assets/css/customerdocument.css') }}" rel="stylesheet" />
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
const { mix } = require("laravel-mix");
|
||||
require("laravel-mix-merge-manifest");
|
||||
|
||||
// var publicPath = 'publishable/assets';
|
||||
var publicPath = "../../../public/vendor/webkul/customerdocument/assets";
|
||||
|
||||
mix.setPublicPath(publicPath).mergeManifest();
|
||||
mix.disableNotifications();
|
||||
|
||||
mix.copy(__dirname + "/src/Resources/assets/images", publicPath + "/images/")
|
||||
.sass(__dirname + "/src/Resources/assets/sass/customerdocument.scss", "css/customerdocument.css")
|
||||
.options({
|
||||
processCssUrls: false
|
||||
});
|
||||
|
||||
if (mix.inProduction()) {
|
||||
mix.version();
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCustomerGroupProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customer_group_products', function (Blueprint $table) {
|
||||
$table->integer('customer_group_id')->unsigned();
|
||||
$table->integer('product_id')->unsigned();
|
||||
|
||||
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
|
||||
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('customer_group_products');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCustomerGroupCategoriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customer_group_categories', function (Blueprint $table) {
|
||||
$table->integer('customer_group_id')->unsigned();
|
||||
$table->integer('category_id')->unsigned();
|
||||
|
||||
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
|
||||
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('customer_group_categories');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerGroupCatalog\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
use Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\CustomerGroupCatalog\Repositories\CategoryRepository;
|
||||
|
||||
/**
|
||||
* Customer Group controlller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CustomerGroupController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CustomerGroupRepository object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $customerGroupRepository;
|
||||
|
||||
/**
|
||||
* ProductRepository object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $productRepository;
|
||||
|
||||
/**
|
||||
* CategoryRepository object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $categoryRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepositor;
|
||||
* @param \Webkul\Product\Repositories\ProductRepository $productRepository;
|
||||
* @param \Webkul\Category\Repositories\CategoryRepository $categoryRepository;
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
CustomerGroupRepository $customerGroupRepository,
|
||||
ProductRepository $productRepository,
|
||||
CategoryRepository $categoryRepository
|
||||
)
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customerGroupRepository = $customerGroupRepository;
|
||||
|
||||
$this->productRepository = $productRepository;
|
||||
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for catalog
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$results = [];
|
||||
|
||||
if (request()->input('type') == 'products') {
|
||||
foreach ($this->productRepository->searchProductByAttribute(request()->input('query')) as $row) {
|
||||
$results[] = [
|
||||
'id' => $row->product_id,
|
||||
'name' => $row->name,
|
||||
];
|
||||
}
|
||||
} else {
|
||||
foreach ($this->categoryRepository->search(request()->input('query')) as $row) {
|
||||
$results[] = [
|
||||
'id' => $row->id,
|
||||
'name' => $row->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'name' => 'string|required',
|
||||
'code' => 'string|unique:customer_groups,code'
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
|
||||
$data['is_user_defined'] = 1;
|
||||
|
||||
$this->customerGroupRepository->create($data);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer Group']));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->validate(request(), [
|
||||
'name' => 'string|required',
|
||||
]);
|
||||
|
||||
$this->customerGroupRepository->update(request()->all(), $id);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer Group']));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
Route::group(['middleware' => ['web']], function () {
|
||||
|
||||
Route::prefix('admin')->group(function () {
|
||||
|
||||
Route::group(['middleware' => ['admin']], function () {
|
||||
|
||||
//Seller routes
|
||||
Route::get('groups/catalog/search', 'Webkul\CustomerGroupCatalog\Http\Controllers\Admin\CustomerGroupController@search')->name('admin.customer_group_catalog.search.catalog');
|
||||
|
||||
Route::post('groups/create', 'Webkul\CustomerGroupCatalog\Http\Controllers\Admin\CustomerGroupController@store')->defaults('_config',[
|
||||
'redirect' => 'admin.groups.index'
|
||||
])->name('admin.customer_group_catalog.store');
|
||||
|
||||
Route::put('groups/edit/{id}', 'Webkul\CustomerGroupCatalog\Http\Controllers\Admin\CustomerGroupController@update')->defaults('_config',[
|
||||
'redirect' => 'admin.groups.index'
|
||||
])->name('admin.customer_group_catalog.update');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
namespace Webkul\CustomerGroupCatalog\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Customer\Models\CustomerGroup as BaseCustomerGroup;
|
||||
use Webkul\Product\Models\ProductProxy;
|
||||
use Webkul\Category\Models\CategoryProxy;
|
||||
|
||||
class CustomerGroup extends BaseCustomerGroup
|
||||
{
|
||||
/**
|
||||
* The products that belong to the customer group.
|
||||
*/
|
||||
public function products()
|
||||
{
|
||||
return $this->belongsToMany(ProductProxy::modelClass(), 'customer_group_products');
|
||||
}
|
||||
|
||||
/**
|
||||
* The categories that belong to the customer group.
|
||||
*/
|
||||
public function categories()
|
||||
{
|
||||
return $this->belongsToMany(CategoryProxy::modelClass(), 'customer_group_categories');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerGroupCatalog\Observers;
|
||||
|
||||
use Webkul\CustomerGroupCatalog\Models\CustomerGroup;
|
||||
|
||||
use Company;
|
||||
|
||||
class CustomerGroupObserver
|
||||
{
|
||||
public function creating(CustomerGroup $model)
|
||||
{
|
||||
if (! auth()->guard('super-admin')->check()) {
|
||||
$model->company_id = Company::getCurrent()->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerGroupCatalog\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class CustomerGroupCatalogServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Http/admin-routes.php');
|
||||
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'customergroupcatalog');
|
||||
|
||||
\Webkul\CustomerGroupCatalog\Models\CustomerGroup::observe(\Webkul\CustomerGroupCatalog\Observers\CustomerGroupObserver::class);
|
||||
|
||||
$this->publishes([
|
||||
__DIR__ . '/../Resources/views/admin/customers/groups' => resource_path('views/vendor/admin/customers/groups'),
|
||||
__DIR__ . '/../Resources/views/shop/layouts' => resource_path('views/vendor/shop/layouts'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerGroupCatalog\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Webkul\Category\Repositories\CategoryRepository as BaseCategoryRepository;
|
||||
|
||||
/**
|
||||
* Category Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CategoryRepository extends BaseCategoryRepository
|
||||
{
|
||||
/**
|
||||
* Search Category
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function search($term)
|
||||
{
|
||||
return $this->getModel()->join('category_translations', function ($join) {
|
||||
$join->on('categories.id', 'category_translations.category_id')
|
||||
->where('category_translations.locale', app()->getLocale())
|
||||
->where('category_translations.name', 'like', '%' . urldecode(request()->input('query')) . '%');
|
||||
})
|
||||
->select('categories.*')
|
||||
->groupBy('categories.id')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* get visible category tree
|
||||
*
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getVisibleCategoryTree($id = null)
|
||||
{
|
||||
static $categories = [];
|
||||
|
||||
if (array_key_exists($id, $categories))
|
||||
return $categories[$id];
|
||||
|
||||
$customer = auth()->guard(request()->has('token') ? 'api' : 'customer')->user();
|
||||
|
||||
$categoryIds = [];
|
||||
$showCategories = [];
|
||||
$parentCategoryIds = [];
|
||||
|
||||
if (! $customer) {
|
||||
$categories = app('Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository')->findOneByField('code', 'guest')->categories()->get();
|
||||
|
||||
$categoryIds = app('Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository')->findOneByField('code', 'guest')->categories()->pluck('id')->toArray();
|
||||
|
||||
$showCategories = $this->getShowAbleCatyegory($categories, $categoryIds);
|
||||
} else {
|
||||
if ($customer->group) {
|
||||
$categories = app('Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository')->find($customer->group->id)->categories()->get();
|
||||
|
||||
$categoryIds = app('Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository')->find($customer->group->id)->categories()->pluck('id')->toArray();
|
||||
|
||||
$showCategories = $this->getShowAbleCatyegory($categories, $categoryIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($showCategories)) {
|
||||
$categories[$id] = $id
|
||||
? $this->model::orderBy('position', 'ASC')->where('status', 1)->whereIn('id', $categoryIds)->descendantsOf($id)->toTree()
|
||||
: $this->model::orderBy('position', 'ASC')->where('status', 1)->whereIn('id', $categoryIds)->get()->toTree();
|
||||
|
||||
return $categories[$id];
|
||||
} else {
|
||||
// $categories[$id] = $id
|
||||
// ? $this->model::orderBy('position', 'ASC')->where('status', 1)->descendantsOf($id)->toTree()
|
||||
// : $this->model::orderBy('position', 'ASC')->where('status', 1)->get()->toTree();
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get show able category
|
||||
*
|
||||
* @param integer array
|
||||
* @return array
|
||||
*/
|
||||
public function getShowAbleCatyegory($categories, $categoryIds) {
|
||||
$showCategories = [];
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$parentCategoryIds[] = $category->id;
|
||||
$parentCategory = $this->getParentCategory($category->parent_id);
|
||||
|
||||
$result = array_merge($parentCategoryIds, $parentCategory);
|
||||
$count = 0;
|
||||
foreach($result as $cat) {
|
||||
if (in_array($cat, $categoryIds)) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($result) == $count) {
|
||||
$showCategories[] = $category->id;
|
||||
}
|
||||
}
|
||||
|
||||
return $showCategories;
|
||||
}
|
||||
|
||||
/**
|
||||
* get parent category
|
||||
*
|
||||
* @param integer $id
|
||||
* @return array
|
||||
*/
|
||||
public function getParentCategory($parentId) {
|
||||
$parentCategories = [];
|
||||
$parentCategory = $this->getModel()->where('id', $parentId)->first();
|
||||
|
||||
if ($parentCategory->parent_id != null) {
|
||||
$parentCategories[] = array_push($parentCategories, $parentCategory->id);
|
||||
$this->getParentCategory($parentCategory->parent_id);
|
||||
}
|
||||
|
||||
return $parentCategories;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\CustomerGroupCatalog\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* CustomerGroup Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CustomerGroupRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\CustomerGroupCatalog\Models\CustomerGroup';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
$group = parent::create($data);
|
||||
|
||||
if (isset($data['products'])) {
|
||||
$group->products()->sync($data['products']);
|
||||
} else {
|
||||
$group->products()->sync([]);
|
||||
}
|
||||
|
||||
if (isset($data['categories'])) {
|
||||
$group->categories()->sync($data['categories']);
|
||||
} else {
|
||||
$group->categories()->sync([]);
|
||||
}
|
||||
|
||||
return $group;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param $id
|
||||
* @param string $attribute
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(array $data, $id, $attribute = "id")
|
||||
{
|
||||
parent::update($data, $id, $attribute);
|
||||
|
||||
$group = $this->find($id);
|
||||
|
||||
if (isset($data['products'])) {
|
||||
$group->products()->sync($data['products']);
|
||||
} else {
|
||||
$group->products()->sync([]);
|
||||
}
|
||||
|
||||
if (isset($data['categories'])) {
|
||||
$group->categories()->sync($data['categories']);
|
||||
} else {
|
||||
$group->categories()->sync([]);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getProducts($group)
|
||||
{
|
||||
$products = [];
|
||||
|
||||
foreach ($this->find($group->id)->products as $product) {
|
||||
$products[] = ['id' => $product->id, 'name' => $product->name];
|
||||
}
|
||||
|
||||
return $products;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getCategories($group)
|
||||
{
|
||||
$categories = [];
|
||||
|
||||
foreach ($this->find($group->id)->categories as $category) {
|
||||
$categories[] = ['id' => $category->id, 'name' => $category->name];
|
||||
}
|
||||
|
||||
return $categories;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'customers' => [
|
||||
'groups' => [
|
||||
'general' => 'General',
|
||||
'linked-product-categories' => 'Linked Categories',
|
||||
'categories' => 'Categories',
|
||||
'products' => 'Products',
|
||||
'search-hint' => 'Start typing name',
|
||||
'no-result-found' => 'Categories not found with same name.'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.customers.groups.add-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.customer_group_catalog.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>
|
||||
|
||||
{{ __('admin::app.customers.groups.add-title') }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.customers.groups.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<accordian :title="'{{ __('customergroupcatalog::app.customers.groups.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.customers.groups.code') }}</label>
|
||||
<input v-validate="'required'" class="control" id="code" name="code" data-vv-as=""{{ __('admin::app.customers.groups.code') }}"" v-code/>
|
||||
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">
|
||||
{{ __('admin::app.customers.groups.name') }}
|
||||
</label>
|
||||
<input type="text" class="control" name="name" v-validate="'required'" value="{{ old('name') }}" data-vv-as=""{{ __('admin::app.customers.groups.name') }}"">
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('customergroupcatalog::app.customers.groups.linked-product-categories') }}'">
|
||||
<div slot="body">
|
||||
|
||||
<linked-products-categories></linked-products-categories>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@push('scripts')
|
||||
|
||||
<script type="text/x-template" id="linked-products-categories-template">
|
||||
<div>
|
||||
|
||||
<div class="control-group" v-for='key in controls'>
|
||||
<label>@{{ controls_labels[key] }}</label>
|
||||
|
||||
<input type="text" class="control" placeholder="{{ __('customergroupcatalog::app.customers.groups.search-hint') }}" v-model.lazy="search_terms[key]" v-debounce="500" autocomplete="off">
|
||||
|
||||
<div class="linked-product-search-result">
|
||||
<ul>
|
||||
<li v-for='(result, index) in searched_results[key]' v-if='searched_results[key].length' @click="addItem(result, key)">
|
||||
@{{ result.name }}
|
||||
</li>
|
||||
|
||||
<li v-if='! searched_results[key].length && search_terms[key].length && ! is_searching[key]'>
|
||||
{{ __('customergroupcatalog::app.customers.groups.no-result-found') }}
|
||||
</li>
|
||||
|
||||
<li v-if="is_searching[key] && search_terms[key].length">
|
||||
{{ __('admin::app.catalog.products.searching') }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="products[]" v-for='(product, index) in searched_results.products' v-if="(key == 'products') && searched_results.products.length" :value="product.id"/>
|
||||
|
||||
<span class="filter-tag" style="text-transform: capitalize; margin-top: 10px; margin-right: 0px; justify-content: flex-start" v-if="saved_results[key].length">
|
||||
|
||||
<span class="wrapper" style="margin-left: 0px; margin-right: 10px;" v-for='(savedItem, index) in saved_results[key]'>
|
||||
<input type="hidden" :name="key + '[]'" :value="savedItem.id"/>
|
||||
|
||||
@{{ savedItem.name }}
|
||||
<span class="icon cross-icon" @click="removeItem(savedItem, key)"></span>
|
||||
</span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
Vue.component('linked-products-categories', {
|
||||
|
||||
template: '#linked-products-categories-template',
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
searched_results: {
|
||||
products: [],
|
||||
|
||||
categories: [],
|
||||
},
|
||||
|
||||
saved_results: {
|
||||
products: [],
|
||||
|
||||
categories: [],
|
||||
},
|
||||
|
||||
search_terms: {
|
||||
products: '',
|
||||
|
||||
categories: ''
|
||||
},
|
||||
|
||||
is_searching: {
|
||||
products: false,
|
||||
|
||||
categories: false
|
||||
},
|
||||
|
||||
controls: [
|
||||
// 'products',
|
||||
|
||||
'categories'
|
||||
],
|
||||
|
||||
controls_labels: {
|
||||
'products': "{{ __('customergroupcatalog::app.customers.groups.products') }}",
|
||||
|
||||
'categories': "{{ __('customergroupcatalog::app.customers.groups.categories') }}",
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'search_terms.products': function(newVal, oldVal) {
|
||||
this.search('products')
|
||||
},
|
||||
|
||||
'search_terms.categories': function(newVal, oldVal) {
|
||||
this.search('categories')
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
addItem: function (item, key) {
|
||||
this.saved_results[key].push(item);
|
||||
|
||||
this.search_terms[key] = '';
|
||||
|
||||
this.searched_results[key] = [];
|
||||
},
|
||||
|
||||
removeItem: function (item, key) {
|
||||
for (var index in this.saved_results[key]) {
|
||||
if (this.saved_results[key][index].id == item.id) {
|
||||
this.saved_results[key].splice(index, 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
search: function (key) {
|
||||
this_this = this;
|
||||
|
||||
this.is_searching[key] = true;
|
||||
|
||||
if (! this.search_terms[key].length) {
|
||||
this_this.searched_results[key] = [];
|
||||
|
||||
this_this.is_searching[key] = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.$http.get ("{{ route('admin.customer_group_catalog.search.catalog') }}", {params: {query: this.search_terms[key], type: key}})
|
||||
.then (function(response) {
|
||||
for (var key1 in this_this.saved_results[key]) {
|
||||
for (var key2 in response.data) {
|
||||
if (response.data[key2].id == this_this.saved_results[key][key1].id) {
|
||||
response.data.splice(key2, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this_this.searched_results[key] = response.data;
|
||||
|
||||
this_this.is_searching[key] = false;
|
||||
})
|
||||
.catch (function (error) {
|
||||
this_this.is_searching[key] = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
|
|
@ -1,234 +0,0 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.customers.groups.edit-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.customer_group_catalog.update', $group->id) }}">
|
||||
|
||||
<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>
|
||||
|
||||
{{ __('admin::app.customers.groups.edit-title') }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.customers.groups.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
<div class="form-container">
|
||||
@csrf()
|
||||
|
||||
<input name="_method" type="hidden" value="PUT">
|
||||
|
||||
<accordian :title="'{{ __('customergroupcatalog::app.customers.groups.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||
<label for="code" class="required">{{ __('admin::app.customers.groups.code') }}</label>
|
||||
<input type="text" v-validate="'required'" class="control" id="code" name="code" data-vv-as=""{{ __('admin::app.customers.groups.code') }}"" value="{{ $group->code }}" disabled="disabled"/>
|
||||
<input type="hidden" name="code" value="{{ $group->code }}"/>
|
||||
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">
|
||||
{{ __('admin::app.customers.groups.name') }}
|
||||
</label>
|
||||
<input type="text" class="control" name="name" v-validate="'required'" value="{{ $group->name }}" data-vv-as=""{{ __('admin::app.customers.groups.name') }}"">
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</accordian>
|
||||
|
||||
<accordian :title="'{{ __('customergroupcatalog::app.customers.groups.linked-product-categories') }}'">
|
||||
<div slot="body">
|
||||
|
||||
<linked-products-categories></linked-products-categories>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@push('scripts')
|
||||
|
||||
<script type="text/x-template" id="linked-products-categories-template">
|
||||
<div>
|
||||
|
||||
<div class="control-group" v-for='key in controls'>
|
||||
<label>@{{ controls_labels[key] }}</label>
|
||||
|
||||
<input type="text" class="control" placeholder="{{ __('customergroupcatalog::app.customers.groups.search-hint') }}" v-model.lazy="search_terms[key]" v-debounce="500" autocomplete="off">
|
||||
|
||||
<div class="linked-product-search-result">
|
||||
<ul>
|
||||
<li v-for='(result, index) in searched_results[key]' v-if='searched_results[key].length' @click="addItem(result, key)">
|
||||
@{{ result.name }}
|
||||
</li>
|
||||
|
||||
<li v-if='! searched_results[key].length && search_terms[key].length && ! is_searching[key]'>
|
||||
{{ __('customergroupcatalog::app.customers.groups.no-result-found') }}
|
||||
</li>
|
||||
|
||||
<li v-if="is_searching[key] && search_terms[key].length">
|
||||
{{ __('admin::app.catalog.products.searching') }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<span class="filter-tag" style="text-transform: capitalize; margin-top: 10px; margin-right: 0px; justify-content: flex-start" v-if="saved_results[key].length">
|
||||
|
||||
|
||||
<span class="wrapper" style="margin-left: 0px; margin-right: 10px;" v-for='(savedItem, index) in saved_results[key]'>
|
||||
<input type="hidden" :name="key + '[]'" :value="savedItem.id"/>
|
||||
|
||||
@{{ savedItem.name }}
|
||||
<span class="icon cross-icon" @click="removeItem(savedItem, key)"></span>
|
||||
</span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Vue.component('linked-products-categories', {
|
||||
|
||||
template: '#linked-products-categories-template',
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
searched_results: {
|
||||
products: [],
|
||||
|
||||
categories: []
|
||||
},
|
||||
|
||||
saved_results: {
|
||||
products: [],
|
||||
|
||||
categories: []
|
||||
},
|
||||
|
||||
linked_results: {
|
||||
products: @json(app('Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository')->getProducts($group)),
|
||||
|
||||
categories: @json(app('Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository')->getCategories($group))
|
||||
},
|
||||
|
||||
search_terms: {
|
||||
products: '',
|
||||
|
||||
categories: ''
|
||||
},
|
||||
|
||||
is_searching: {
|
||||
products: false,
|
||||
|
||||
categories: false
|
||||
},
|
||||
|
||||
controls: [
|
||||
// 'products',
|
||||
|
||||
'categories'
|
||||
],
|
||||
|
||||
controls_labels: {
|
||||
products: "{{ __('customergroupcatalog::app.customers.groups.products') }}",
|
||||
|
||||
categories: "{{ __('customergroupcatalog::app.customers.groups.categories') }}"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
created: function () {
|
||||
for (var index in this.linked_results.products) {
|
||||
this.saved_results['products'].push(this.linked_results.products[index]);
|
||||
}
|
||||
|
||||
for (var index in this.linked_results.categories) {
|
||||
this.saved_results['categories'].push(this.linked_results.categories[index]);
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'search_terms.products': function(newVal, oldVal) {
|
||||
this.search('products')
|
||||
},
|
||||
|
||||
'search_terms.categories': function(newVal, oldVal) {
|
||||
this.search('categories')
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
addItem: function (item, key) {
|
||||
this.saved_results[key].push(item);
|
||||
|
||||
this.search_terms[key] = '';
|
||||
|
||||
this.searched_results[key] = [];
|
||||
},
|
||||
|
||||
removeItem: function (item, key) {
|
||||
for (var index in this.saved_results[key]) {
|
||||
if (this.saved_results[key][index].id == item.id) {
|
||||
this.saved_results[key].splice(index, 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
search: function (key) {
|
||||
this_this = this;
|
||||
|
||||
this.is_searching[key] = true;
|
||||
|
||||
if (! this.search_terms[key].length) {
|
||||
this_this.searched_results[key] = [];
|
||||
|
||||
this_this.is_searching[key] = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.$http.get ("{{ route('admin.customer_group_catalog.search.catalog') }}", {params: {query: this.search_terms[key], type: key}})
|
||||
.then (function(response) {
|
||||
for (var key1 in this_this.saved_results[key]) {
|
||||
for (var key2 in response.data) {
|
||||
if (response.data[key2].id == this_this.saved_results[key][key1].id) {
|
||||
response.data.splice(key2, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this_this.searched_results[key] = response.data;
|
||||
|
||||
this_this.is_searching[key] = false;
|
||||
})
|
||||
.catch (function (error) {
|
||||
this_this.is_searching[key] = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
<div class="footer">
|
||||
<div class="footer-content">
|
||||
<div class="footer-list-container">
|
||||
|
||||
<?php
|
||||
$categories = [];
|
||||
|
||||
foreach (app('Webkul\CustomerGroupCatalog\Repositories\CategoryRepository')->getVisibleCategoryTree(core()->getCurrentChannel()->root_category_id) as $category){
|
||||
if ($category->slug)
|
||||
array_push($categories, $category);
|
||||
}
|
||||
?>
|
||||
|
||||
@if (count($categories))
|
||||
<div class="list-container">
|
||||
<span class="list-heading">Categories</span>
|
||||
|
||||
<ul class="list-group">
|
||||
@foreach ($categories as $key => $category)
|
||||
<li>
|
||||
<a href="{{ route('shop.categories.index', $category->slug) }}">{{ $category->name }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{!! DbView::make(core()->getCurrentChannel())->field('footer_content')->render() !!}
|
||||
|
||||
<div class="list-container">
|
||||
@if(core()->getConfigData('customer.settings.newsletter.subscription'))
|
||||
<span class="list-heading">{{ __('shop::app.footer.subscribe-newsletter') }}</span>
|
||||
<div class="form-container">
|
||||
<form action="{{ route('shop.subscribe') }}">
|
||||
<div class="control-group" :class="[errors.has('subscriber_email') ? 'has-error' : '']">
|
||||
<input type="email" class="control subscribe-field" name="subscriber_email" placeholder="Email Address" required><br/>
|
||||
|
||||
<button class="btn btn-md btn-primary">{{ __('shop::app.subscription.subscribe') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<?php
|
||||
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
|
||||
$searchTerm = explode("?", $query);
|
||||
|
||||
foreach($searchTerm as $term){
|
||||
if (strpos($term, 'term') !== false) {
|
||||
$serachQuery = $term;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<span class="list-heading">{{ __('shop::app.footer.locale') }}</span>
|
||||
<div class="form-container">
|
||||
<div class="control-group">
|
||||
<select class="control locale-switcher" onchange="window.location.href = this.value" @if (count(core()->getCurrentChannel()->locales) == 1) disabled="disabled" @endif>
|
||||
|
||||
@foreach (core()->getCurrentChannel()->locales as $locale)
|
||||
@if(isset($serachQuery))
|
||||
<option value="?{{ $serachQuery }}?locale={{ $locale->code }}" {{ $locale->code == app()->getLocale() ? 'selected' : '' }}>{{ $locale->name }}</option>
|
||||
@else
|
||||
<option value="?locale={{ $locale->code }}" {{ $locale->code == app()->getLocale() ? 'selected' : '' }}>{{ $locale->name }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="currency">
|
||||
<span class="list-heading">{{ __('shop::app.footer.currency') }}</span>
|
||||
<div class="form-container">
|
||||
<div class="control-group">
|
||||
<select class="control locale-switcher" onchange="window.location.href = this.value">
|
||||
|
||||
@foreach (core()->getCurrentChannel()->currencies as $currency)
|
||||
@if(isset($serachQuery))
|
||||
<option value="?{{ $serachQuery }}?currency={{ $currency->code }}" {{ $currency->code == core()->getCurrentCurrencyCode() ? 'selected' : '' }}>{{ $currency->code }}</option>
|
||||
@else
|
||||
<option value="?currency={{ $currency->code }}" {{ $currency->code == core()->getCurrentCurrencyCode() ? 'selected' : '' }}>{{ $currency->code }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
{!! view_render_event('bagisto.shop.layout.header.category.before') !!}
|
||||
|
||||
<?php
|
||||
|
||||
$categories = [];
|
||||
|
||||
foreach (app('Webkul\CustomerGroupCatalog\Repositories\CategoryRepository')->getVisibleCategoryTree(core()->getCurrentChannel()->root_category_id) as $category) {
|
||||
if ($category->slug)
|
||||
array_push($categories, $category);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<category-nav categories='@json($categories)' url="{{url()->to('/')}}"></category-nav>
|
||||
|
||||
{!! view_render_event('bagisto.shop.layout.header.category.after') !!}
|
||||
|
||||
|
||||
@push('scripts')
|
||||
|
||||
|
||||
<script type="text/x-template" id="category-nav-template">
|
||||
|
||||
<ul class="nav">
|
||||
<category-item
|
||||
v-for="(item, index) in items"
|
||||
:key="index"
|
||||
:url="url"
|
||||
:item="item"
|
||||
:parent="index">
|
||||
</category-item>
|
||||
</ul>
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Vue.component('category-nav', {
|
||||
|
||||
template: '#category-nav-template',
|
||||
|
||||
props: {
|
||||
categories: {
|
||||
type: [Array, String, Object],
|
||||
required: false,
|
||||
default: (function () {
|
||||
return [];
|
||||
})
|
||||
},
|
||||
|
||||
url: String
|
||||
},
|
||||
|
||||
data: function(){
|
||||
return {
|
||||
items_count:0
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
items: function() {
|
||||
return JSON.parse(this.categories)
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-template" id="category-item-template">
|
||||
<li>
|
||||
<a :href="url+'/categories/'+this.item['translations'][0].slug">
|
||||
@{{ name }} 
|
||||
<i class="icon dropdown-right-icon" v-if="haveChildren && item.parent_id != null"></i>
|
||||
</a>
|
||||
|
||||
<i :class="[show ? 'icon icon-arrow-down mt-15' : 'icon dropdown-right-icon left mt-15']"
|
||||
v-if="haveChildren" @click="showOrHide"></i>
|
||||
|
||||
<ul v-if="haveChildren && show">
|
||||
<category-item
|
||||
v-for="(child, index) in item.children"
|
||||
:key="index"
|
||||
:url="url"
|
||||
:item="child">
|
||||
</category-item>
|
||||
</ul>
|
||||
</li>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Vue.component('category-item', {
|
||||
|
||||
template: '#category-item-template',
|
||||
|
||||
props: {
|
||||
item: Object,
|
||||
url: String,
|
||||
},
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
items_count:0,
|
||||
show: false,
|
||||
};
|
||||
},
|
||||
|
||||
mounted: function() {
|
||||
if(window.innerWidth > 770){
|
||||
this.show = true;
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
haveChildren: function() {
|
||||
return this.item.children.length ? true : false;
|
||||
},
|
||||
|
||||
name: function() {
|
||||
if (this.item.translations && this.item.translations.length) {
|
||||
this.item.translations.forEach(function(translation) {
|
||||
if (translation.locale == document.documentElement.lang)
|
||||
return translation.name;
|
||||
});
|
||||
}
|
||||
|
||||
return this.item.name;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
showOrHide: function() {
|
||||
this.show = !this.show;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@endpush
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
@extends('shop::layouts.master')
|
||||
|
||||
@section('page_title')
|
||||
{{ $category->meta_title ?? $category->name }}
|
||||
@stop
|
||||
|
||||
@section('seo')
|
||||
<meta name="description" content="{{ $category->meta_description }}"/>
|
||||
<meta name="keywords" content="{{ $category->meta_keywords }}"/>
|
||||
@stop
|
||||
|
||||
@section('content-wrapper')
|
||||
@inject ('productRepository', 'Webkul\Product\Repositories\ProductRepository')
|
||||
|
||||
<div class="main">
|
||||
{!! view_render_event('bagisto.shop.products.index.before', ['category' => $category]) !!}
|
||||
|
||||
<div class="category-container">
|
||||
|
||||
@if (in_array($category->display_mode, [null, 'products_only', 'products_and_description']))
|
||||
@include ('shop::products.list.layered-navigation')
|
||||
@endif
|
||||
|
||||
<div class="category-block" @if ($category->display_mode == 'description_only') style="width: 100%" @endif>
|
||||
<div class="hero-image mb-35">
|
||||
@if (!is_null($category->image))
|
||||
<img class="logo" src="{{ $category->image_url }}" />
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if (in_array($category->display_mode, [null, 'description_only', 'products_and_description']))
|
||||
@if ($category->description)
|
||||
<div class="category-description">
|
||||
{!! $category->description !!}
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@if (in_array($category->display_mode, [null, 'products_only', 'products_and_description']))
|
||||
<?php $products = $productRepository->getAll($category->id); ?>
|
||||
|
||||
@if ($products->count())
|
||||
|
||||
@include ('shop::products.list.toolbar')
|
||||
|
||||
@inject ('toolbarHelper', 'Webkul\Product\Helpers\Toolbar')
|
||||
|
||||
@if ($toolbarHelper->getCurrentMode() == 'grid')
|
||||
<div class="product-grid-3">
|
||||
@foreach ($products as $productFlat)
|
||||
|
||||
@include ('shop::products.list.card', ['product' => $productFlat])
|
||||
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<div class="product-list">
|
||||
@foreach ($products as $productFlat)
|
||||
|
||||
@include ('shop::products.list.card', ['product' => $productFlat])
|
||||
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.index.pagination.before', ['category' => $category]) !!}
|
||||
|
||||
<div class="bottom-toolbar">
|
||||
{{ $products->appends(request()->input())->links() }}
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.index.pagination.after', ['category' => $category]) !!}
|
||||
|
||||
@else
|
||||
|
||||
<div class="product-list empty">
|
||||
<h2>{{ __('shop::app.products.whoops') }}</h2>
|
||||
|
||||
<p>
|
||||
{{ __('shop::app.products.empty') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.index.after', ['category' => $category]) !!}
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.responsive-layred-filter').css('display','none');
|
||||
$(".sort-icon, .filter-icon").on('click', function(e){
|
||||
var currentElement = $(e.currentTarget);
|
||||
if (currentElement.hasClass('sort-icon')) {
|
||||
currentElement.removeClass('sort-icon');
|
||||
currentElement.addClass('icon-menu-close-adj');
|
||||
currentElement.next().removeClass();
|
||||
currentElement.next().addClass('icon filter-icon');
|
||||
$('.responsive-layred-filter').css('display','none');
|
||||
$('.pager').css('display','flex');
|
||||
$('.pager').css('justify-content','space-between');
|
||||
} else if (currentElement.hasClass('filter-icon')) {
|
||||
currentElement.removeClass('filter-icon');
|
||||
currentElement.addClass('icon-menu-close-adj');
|
||||
currentElement.prev().removeClass();
|
||||
currentElement.prev().addClass('icon sort-icon');
|
||||
$('.pager').css('display','none');
|
||||
$('.responsive-layred-filter').css('display','block');
|
||||
$('.responsive-layred-filter').css('margin-top','10px');
|
||||
} else {
|
||||
currentElement.removeClass('icon-menu-close-adj');
|
||||
$('.responsive-layred-filter').css('display','none');
|
||||
$('.pager').css('display','none');
|
||||
if ($(this).index() == 0) {
|
||||
currentElement.addClass('sort-icon');
|
||||
} else {
|
||||
currentElement.addClass('filter-icon');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"name": "bagisto/laravel-gtm",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Prashant Singh",
|
||||
"email": "prashant.singh852@webkul.com"
|
||||
}
|
||||
],
|
||||
"require": {},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Webkul\\GTM\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Webkul\\GTM\\Providers\\GTMServiceProvider"
|
||||
],
|
||||
|
||||
"aliases": {
|
||||
}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
# 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.
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
[
|
||||
'key' => 'general.gtm',
|
||||
'name' => 'gtm::app.gtm',
|
||||
'sort' => 3,
|
||||
], [
|
||||
'key' => 'general.gtm.values',
|
||||
'name' => 'gtm::app.values',
|
||||
'sort' => 1,
|
||||
'fields' => [
|
||||
[
|
||||
'name' => 'status',
|
||||
'title' => 'gtm::app.gtm-status',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
[
|
||||
'title' => 'Active',
|
||||
'value' => true
|
||||
], [
|
||||
'title' => 'Inactive',
|
||||
'value' => false
|
||||
]
|
||||
],
|
||||
|
||||
'channel_based' => false,
|
||||
'locale_based' => false
|
||||
], [
|
||||
'name' => 'container_id',
|
||||
'title' => 'gtm::app.container-id',
|
||||
'type' => 'text',
|
||||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => false
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\GTM\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use View;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Event::listen('bagisto.shop.layout.head', function($viewRenderEventManager) {
|
||||
$viewRenderEventManager->addTemplate('gtm::head');
|
||||
});
|
||||
|
||||
Event::listen('bagisto.shop.layout.body.before', function($viewRenderEventManager) {
|
||||
$viewRenderEventManager->addTemplate('gtm::body');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\GTM\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Webkul\GTM\Providers\EventServiceProvider;
|
||||
|
||||
class GTMServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'gtm');
|
||||
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'gtm');
|
||||
|
||||
$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'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'gtm' => 'Tag Manager',
|
||||
'container-id' => 'Container ID',
|
||||
'values' => 'Settings',
|
||||
'gtm-status' => 'Status'
|
||||
];
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
@if (core()->getConfigData('general.gtm.values.status'))
|
||||
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ core()->getConfigData('general.gtm.values.container_id') }}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
|
||||
@if (\Route::current()->getName() == 'shop.products.index')
|
||||
@include('gtm::product')
|
||||
@endif
|
||||
|
||||
@if (\Route::current()->getName() == 'shop.categories.index')
|
||||
@include('gtm::category')
|
||||
@endif
|
||||
|
||||
@if (\Route::current()->getName() == 'shop.checkout.cart.index')
|
||||
@include('gtm::cart')
|
||||
@endif
|
||||
|
||||
@if (\Route::current()->getName() == 'shop.checkout.success')
|
||||
@include('gtm::checkout-success')
|
||||
@endif
|
||||
|
||||
@endif
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
@inject ('priceHelper', 'Webkul\Product\Helpers\Price')
|
||||
|
||||
@inject('productFlat', 'Webkul\Product\Repositories\ProductFlatRepository')
|
||||
|
||||
<script>
|
||||
dataLayer.push({
|
||||
'pageCategory': 'shop.checkout.cart.index',
|
||||
|
||||
@php
|
||||
$cart = \Cart::getCart();
|
||||
@endphp
|
||||
|
||||
@if ($cart)
|
||||
@foreach($cart->items as $item)
|
||||
@php
|
||||
$product = $item->product;
|
||||
@endphp
|
||||
|
||||
@if ($product->type == 'configurable')
|
||||
'ecommerce': {
|
||||
'currencyCode': '{{ core()->getCurrentCurrency()->code }}',
|
||||
'impressions': [{
|
||||
'id': '{{ $product->id ?? null }}',
|
||||
'sku': '{{ $product->sku ?? null }}'
|
||||
'category': '{{ $category ?? null }}',
|
||||
'name': '{{ $product->name ?? null }}',
|
||||
'price': '{{ core()->currency($priceHelper->getMinimalPrice($product)) ?? null }}'
|
||||
}]
|
||||
}
|
||||
@else
|
||||
'ecommerce': {
|
||||
'currencyCode': '{{ core()->getCurrentCurrency()->code }}',
|
||||
|
||||
'impressions': [{
|
||||
'id': '{{ $product->id ?? null }}',
|
||||
'name': '{{ $product->name ?? null }}',
|
||||
'category': '{{ $category ?? null }}',
|
||||
|
||||
@if ($priceHelper->haveSpecialPrice($product))
|
||||
'price': '{{ core()->currency($priceHelper->getSpecialPrice($product)) ?? null }}'
|
||||
@else
|
||||
'price': '{{ core()->currency($product->price) ?? null }}'
|
||||
@endif
|
||||
}]
|
||||
}
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
});
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue