Datagrid Trait Plus Added And Test Case Improved

This commit is contained in:
Devansh 2022-02-07 16:06:38 +05:30
parent c1dceb0a01
commit 5bb56f708c
104 changed files with 689 additions and 666 deletions

View File

@ -6,12 +6,9 @@ use Illuminate\Support\Facades\DB;
use Webkul\Customer\Models\CustomerAddress; use Webkul\Customer\Models\CustomerAddress;
use Webkul\Customer\Repositories\CustomerRepository; use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Ui\DataGrid\DataGrid; use Webkul\Ui\DataGrid\DataGrid;
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
class AddressDataGrid extends DataGrid class AddressDataGrid extends DataGrid
{ {
use ProvideDataGridPlus;
/** /**
* Index. * Index.
* *

View File

@ -7,23 +7,39 @@ use Webkul\Ui\DataGrid\DataGrid;
class CartRuleCouponDataGrid extends DataGrid class CartRuleCouponDataGrid extends DataGrid
{ {
/**
* Index.
*
* @var string
*/
protected $index = 'id'; protected $index = 'id';
/**
* Sort order.
*
* @var string
*/
protected $sortOrder = 'desc'; protected $sortOrder = 'desc';
/**
* Prepare query builder.
*
* @return void
*/
public function prepareQueryBuilder() public function prepareQueryBuilder()
{ {
$route = request()->route() ? request()->route()->getName() : "" ;
$cartRuleId = $route == 'admin.cart-rules.edit' ? collect(request()->segments())->last() : last(explode("/", url()->previous()));
$queryBuilder = DB::table('cart_rule_coupons') $queryBuilder = DB::table('cart_rule_coupons')
->addSelect('id', 'code', 'created_at', 'expired_at', 'times_used') ->addSelect('id', 'code', 'created_at', 'expired_at', 'times_used')
->where('cart_rule_coupons.cart_rule_id', $cartRuleId); ->where('cart_rule_coupons.cart_rule_id', request('id'));
$this->setQueryBuilder($queryBuilder); $this->setQueryBuilder($queryBuilder);
} }
/**
* Add columns.
*
* @return void
*/
public function addColumns() public function addColumns()
{ {
$this->addColumn([ $this->addColumn([
@ -72,6 +88,11 @@ class CartRuleCouponDataGrid extends DataGrid
]); ]);
} }
/**
* Prepare mass actions.
*
* @return void
*/
public function prepareMassActions() public function prepareMassActions()
{ {
$this->addMassAction([ $this->addMassAction([

View File

@ -5,12 +5,9 @@ namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Webkul\Sales\Models\OrderAddress; use Webkul\Sales\Models\OrderAddress;
use Webkul\Ui\DataGrid\DataGrid; use Webkul\Ui\DataGrid\DataGrid;
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
class CustomerOrderDataGrid extends DataGrid class CustomerOrderDataGrid extends DataGrid
{ {
use ProvideDataGridPlus;
/** /**
* Index. * Index.
* *
@ -118,15 +115,15 @@ class CustomerOrderDataGrid extends DataGrid
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-processing') . '</span>'; return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-processing') . '</span>';
} elseif ($value->status == 'completed') { } elseif ($value->status == 'completed') {
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-success') . '</span>'; return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-success') . '</span>';
} elseif ($value->status == "canceled") { } elseif ($value->status == 'canceled') {
return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-canceled') . '</span>'; return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-canceled') . '</span>';
} elseif ($value->status == "closed") { } elseif ($value->status == 'closed') {
return '<span class="badge badge-md badge-info">' . trans('admin::app.sales.orders.order-status-closed') . '</span>'; return '<span class="badge badge-md badge-info">' . trans('admin::app.sales.orders.order-status-closed') . '</span>';
} elseif ($value->status == "pending") { } elseif ($value->status == 'pending') {
return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending') . '</span>'; return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending') . '</span>';
} elseif ($value->status == "pending_payment") { } elseif ($value->status == 'pending_payment') {
return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending-payment') . '</span>'; return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending-payment') . '</span>';
} elseif ($value->status == "fraud") { } elseif ($value->status == 'fraud') {
return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-fraud') . '</span>'; return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-fraud') . '</span>';
} }
}, },

View File

@ -4,12 +4,9 @@ namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Webkul\Ui\DataGrid\DataGrid; use Webkul\Ui\DataGrid\DataGrid;
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
class CustomersInvoicesDataGrid extends DataGrid class CustomersInvoicesDataGrid extends DataGrid
{ {
use ProvideDataGridPlus;
/** /**
* Index column. * Index column.
* *
@ -57,7 +54,7 @@ class CustomersInvoicesDataGrid extends DataGrid
'type' => 'number', 'type' => 'number',
'searchable' => false, 'searchable' => false,
'sortable' => true, 'sortable' => true,
'filterable' => true 'filterable' => true,
]); ]);
$this->addColumn([ $this->addColumn([
@ -87,7 +84,7 @@ class CustomersInvoicesDataGrid extends DataGrid
'filterable' => true, 'filterable' => true,
'closure' => function ($value) { 'closure' => function ($value) {
return '<a href="' . route('admin.sales.orders.view', $value->order_id) . '">' . $value->order_id . '</a>'; return '<a href="' . route('admin.sales.orders.view', $value->order_id) . '">' . $value->order_id . '</a>';
} },
]); ]);
$this->addColumn([ $this->addColumn([

View File

@ -7,11 +7,25 @@ use Webkul\Ui\DataGrid\DataGrid;
class InvoicesTransactionsDatagrid extends DataGrid class InvoicesTransactionsDatagrid extends DataGrid
{ {
/**
* Index.
*
* @var string
*/
protected $index = 'id'; protected $index = 'id';
/**
* Sort order.
*
* @var string
*/
protected $sortOrder = 'desc'; protected $sortOrder = 'desc';
/**
* Prepare query builder.
*
* @return void
*/
public function prepareQueryBuilder() public function prepareQueryBuilder()
{ {
$queryBuilder = DB::table('order_transactions') $queryBuilder = DB::table('order_transactions')
@ -19,7 +33,6 @@ class InvoicesTransactionsDatagrid extends DataGrid
->select('order_transactions.id as id', 'order_transactions.transaction_id as transaction_id', 'order_transactions.invoice_id as invoice_id', 'order_transactions.created_at as created_at') ->select('order_transactions.id as id', 'order_transactions.transaction_id as transaction_id', 'order_transactions.invoice_id as invoice_id', 'order_transactions.created_at as created_at')
->where('order_transactions.invoice_id', request('id')); ->where('order_transactions.invoice_id', request('id'));
$this->addFilter('id', 'order_transactions.id'); $this->addFilter('id', 'order_transactions.id');
$this->addFilter('transaction_id', 'order_transactions.transaction_id'); $this->addFilter('transaction_id', 'order_transactions.transaction_id');
$this->addFilter('order_id', 'ors.increment_id'); $this->addFilter('order_id', 'ors.increment_id');
@ -28,6 +41,11 @@ class InvoicesTransactionsDatagrid extends DataGrid
$this->setQueryBuilder($queryBuilder); $this->setQueryBuilder($queryBuilder);
} }
/**
* Add columns.
*
* @return void
*/
public function addColumns() public function addColumns()
{ {
$this->addColumn([ $this->addColumn([
@ -58,6 +76,11 @@ class InvoicesTransactionsDatagrid extends DataGrid
]); ]);
} }
/**
* Prepare actions.
*
* @return void
*/
public function prepareActions() public function prepareActions()
{ {
$this->addAction([ $this->addAction([

View File

@ -2,15 +2,12 @@
namespace Webkul\Admin\DataGrids; namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\DataGrid;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Webkul\Sales\Models\OrderAddress; use Webkul\Sales\Models\OrderAddress;
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus; use Webkul\Ui\DataGrid\DataGrid;
class OrderDataGrid extends DataGrid class OrderDataGrid extends DataGrid
{ {
use ProvideDataGridPlus;
/** /**
* Index. * Index.
* *
@ -117,15 +114,15 @@ class OrderDataGrid extends DataGrid
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-processing') . '</span>'; return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-processing') . '</span>';
} elseif ($value->status == 'completed') { } elseif ($value->status == 'completed') {
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-success') . '</span>'; return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.orders.order-status-success') . '</span>';
} elseif ($value->status == "canceled") { } elseif ($value->status == 'canceled') {
return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-canceled') . '</span>'; return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-canceled') . '</span>';
} elseif ($value->status == "closed") { } elseif ($value->status == 'closed') {
return '<span class="badge badge-md badge-info">' . trans('admin::app.sales.orders.order-status-closed') . '</span>'; return '<span class="badge badge-md badge-info">' . trans('admin::app.sales.orders.order-status-closed') . '</span>';
} elseif ($value->status == "pending") { } elseif ($value->status == 'pending') {
return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending') . '</span>'; return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending') . '</span>';
} elseif ($value->status == "pending_payment") { } elseif ($value->status == 'pending_payment') {
return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending-payment') . '</span>'; return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.orders.order-status-pending-payment') . '</span>';
} elseif ($value->status == "fraud") { } elseif ($value->status == 'fraud') {
return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-fraud') . '</span>'; return '<span class="badge badge-md badge-danger">' . trans('admin::app.sales.orders.order-status-fraud') . '</span>';
} }
}, },

View File

@ -3,6 +3,7 @@
namespace Webkul\Admin\Http\Controllers\Customer; namespace Webkul\Admin\Http\Controllers\Customer;
use Mail; use Mail;
use Webkul\Admin\DataGrids\CustomerDataGrid;
use Webkul\Admin\DataGrids\CustomerOrderDataGrid; use Webkul\Admin\DataGrids\CustomerOrderDataGrid;
use Webkul\Admin\DataGrids\CustomersInvoicesDataGrid; use Webkul\Admin\DataGrids\CustomersInvoicesDataGrid;
use Webkul\Admin\Http\Controllers\Controller; use Webkul\Admin\Http\Controllers\Controller;
@ -83,6 +84,10 @@ class CustomerController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(CustomerDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Admin\Http\Controllers\Customer; namespace Webkul\Admin\Http\Controllers\Customer;
use Webkul\Admin\DataGrids\CustomerGroupDataGrid;
use Webkul\Admin\Http\Controllers\Controller; use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Customer\Repositories\CustomerGroupRepository; use Webkul\Customer\Repositories\CustomerGroupRepository;
@ -43,6 +44,10 @@ class CustomerGroupController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(CustomerGroupDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -3,6 +3,8 @@
namespace Webkul\Admin\Http\Controllers\Sales; namespace Webkul\Admin\Http\Controllers\Sales;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Webkul\Admin\DataGrids\InvoicesTransactionsDatagrid;
use Webkul\Admin\DataGrids\OrderInvoicesDataGrid;
use Webkul\Admin\Http\Controllers\Controller; use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Admin\Traits\Mails; use Webkul\Admin\Traits\Mails;
use Webkul\Core\Traits\PDFHandler; use Webkul\Core\Traits\PDFHandler;
@ -61,9 +63,24 @@ class InvoiceController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(OrderInvoicesDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }
/**
* Show the form for creating a new resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function invoiceTransactions($id)
{
return app(InvoicesTransactionsDatagrid::class)->toJson();
}
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
* *

View File

@ -2,6 +2,7 @@
namespace Webkul\Admin\Http\Controllers\Sales; namespace Webkul\Admin\Http\Controllers\Sales;
use Webkul\Admin\DataGrids\OrderRefundDataGrid;
use Webkul\Admin\Http\Controllers\Controller; use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Sales\Repositories\OrderItemRepository; use Webkul\Sales\Repositories\OrderItemRepository;
use Webkul\Sales\Repositories\OrderRepository; use Webkul\Sales\Repositories\OrderRepository;
@ -68,6 +69,10 @@ class RefundController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(OrderRefundDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Admin\Http\Controllers\Sales; namespace Webkul\Admin\Http\Controllers\Sales;
use Webkul\Admin\DataGrids\OrderShipmentsDataGrid;
use Webkul\Admin\Http\Controllers\Controller; use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Sales\Repositories\OrderItemRepository; use Webkul\Sales\Repositories\OrderItemRepository;
use Webkul\Sales\Repositories\OrderRepository; use Webkul\Sales\Repositories\OrderRepository;
@ -68,6 +69,10 @@ class ShipmentController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(OrderShipmentsDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -3,14 +3,12 @@
namespace Webkul\Admin\Http\Controllers\Sales; namespace Webkul\Admin\Http\Controllers\Sales;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Event; use Webkul\Admin\DataGrids\OrderTransactionsDataGrid;
use Webkul\Admin\Http\Controllers\Controller; use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Payment\Facades\Payment; use Webkul\Payment\Facades\Payment;
use Webkul\Sales\Repositories\InvoiceRepository;
use Webkul\Sales\Repositories\OrderRepository; use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Sales\Repositories\OrderTransactionRepository; use Webkul\Sales\Repositories\OrderTransactionRepository;
use Webkul\Sales\Repositories\InvoiceRepository;
class TransactionController extends Controller class TransactionController extends Controller
{ {
@ -22,21 +20,21 @@ class TransactionController extends Controller
protected $_config; protected $_config;
/** /**
* OrderRepository object * Order repository instance.
* *
* @var \Webkul\Sales\Repositories\OrderRepository * @var \Webkul\Sales\Repositories\OrderRepository
*/ */
protected $orderRepository; protected $orderRepository;
/** /**
* OrderRepository object * Order transaction repository instance.
* *
* @var \Webkul\Sales\Repositories\OrderTransactionRepository * @var \Webkul\Sales\Repositories\OrderTransactionRepository
*/ */
protected $orderTransactionRepository; protected $orderTransactionRepository;
/** /**
* InvoiceRepository object * Invoice repository instance.
* *
* @var \Webkul\Sales\Repositories\InvoiceRepository * @var \Webkul\Sales\Repositories\InvoiceRepository
*/ */
@ -53,8 +51,7 @@ class TransactionController extends Controller
public function __construct( public function __construct(
OrderRepository $orderRepository, OrderRepository $orderRepository,
OrderTransactionRepository $orderTransactionRepository, OrderTransactionRepository $orderTransactionRepository,
InvoiceRepository $invoiceRepository) InvoiceRepository $invoiceRepository) {
{
$this->middleware('admin'); $this->middleware('admin');
$this->_config = request('_config'); $this->_config = request('_config');
@ -73,6 +70,10 @@ class TransactionController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(OrderTransactionsDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }
@ -84,6 +85,7 @@ class TransactionController extends Controller
public function create() public function create()
{ {
$payment_methods = Payment::getSupportedPaymentMethods(); $payment_methods = Payment::getSupportedPaymentMethods();
return view($this->_config['view'], compact('payment_methods')); return view($this->_config['view'], compact('payment_methods'));
} }
@ -94,40 +96,37 @@ class TransactionController extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
$validate = $this->validate(request(), [ $this->validate(request(), [
'invoice_id' => 'required', 'invoice_id' => 'required',
'payment_method' => 'required', 'payment_method' => 'required',
'amount' => 'required|numeric' 'amount' => 'required|numeric',
]); ]);
$invoice = $this->invoiceRepository->where('increment_id', $request->invoice_id)->first(); $invoice = $this->invoiceRepository->where('increment_id', $request->invoice_id)->first();
if ($invoice) { if ($invoice) {
if ($invoice->state == 'paid') { if ($invoice->state == 'paid') {
session()->flash('info', trans('admin::app.sales.transactions.response.already-paid')); session()->flash('info', trans('admin::app.sales.transactions.response.already-paid'));
return redirect(route('admin.sales.transactions.index')); return redirect(route('admin.sales.transactions.index'));
} }
$order = $this->orderRepository->find($invoice->order_id); $order = $this->orderRepository->find($invoice->order_id);
$data = [
"paidAmount" => $request->amount
];
$randomId = random_bytes(20); $randomId = random_bytes(20);
$transactionId = bin2hex($randomId);
$transactionData['transaction_id'] = $transactionId; $this->orderTransactionRepository->create([
$transactionData['type'] = $request->payment_method; 'transaction_id' => bin2hex($randomId),
$transactionData['payment_method'] = $request->payment_method; 'type' => $request->payment_method,
$transactionData['invoice_id'] = $invoice->id; 'payment_method' => $request->payment_method,
$transactionData['order_id'] = $invoice->order_id; 'invoice_id' => $invoice->id,
$transactionData['amount'] = $request->amount; 'order_id' => $invoice->order_id,
$transactionData['status'] = 'paid'; 'amount' => $request->amount,
$transactionData['data'] = json_encode($data); 'status' => 'paid',
'data' => json_encode([
$this->orderTransactionRepository->create($transactionData); 'paidAmount' => $request->amount,
]),
]);
$transactionTotal = $this->orderTransactionRepository->where('invoice_id', $invoice->id)->sum('amount'); $transactionTotal = $this->orderTransactionRepository->where('invoice_id', $invoice->id)->sum('amount');
@ -140,16 +139,17 @@ class TransactionController extends Controller
$this->orderRepository->updateOrderStatus($order, 'processing'); $this->orderRepository->updateOrderStatus($order, 'processing');
} }
$this->invoiceRepository->updateState($invoice, "paid"); $this->invoiceRepository->updateState($invoice, 'paid');
} }
session()->flash('success', trans('admin::app.sales.transactions.response.transaction-saved')); session()->flash('success', trans('admin::app.sales.transactions.response.transaction-saved'));
return redirect(route('admin.sales.transactions.index'));
} else { return redirect(route('admin.sales.transactions.index'));
session()->flash('error', trans('admin::app.sales.transactions.response.invoice-missing'));
return redirect()->back();
} }
session()->flash('error', trans('admin::app.sales.transactions.response.invoice-missing'));
return redirect()->back();
} }
/** /**
@ -170,12 +170,13 @@ class TransactionController extends Controller
} }
/** /**
* Convert Transaction Details Data into single Dim Array. * Convert transaction details data into single dim array.
* *
* @param array $data * @param array $data
* @return array * @return array
*/ */
public function convertIntoSingleDimArray($transData) { public function convertIntoSingleDimArray($transData)
{
static $detailsData = []; static $detailsData = [];
foreach ($transData as $key => $data) { foreach ($transData as $key => $data) {

View File

@ -12,7 +12,10 @@
</div> </div>
<div class="page-action"> <div class="page-action">
<a href="{{ route('admin.catalog.attributes.create') }}" class="btn btn-lg btn-primary"> <a
href="{{ route('admin.catalog.attributes.create') }}"
class="btn btn-lg btn-primary"
>
{{ __('admin::app.catalog.attributes.add-title') }} {{ __('admin::app.catalog.attributes.add-title') }}
</a> </a>
</div> </div>
@ -21,9 +24,7 @@
{!! view_render_event('bagisto.admin.catalog.attributes.list.before') !!} {!! view_render_event('bagisto.admin.catalog.attributes.list.before') !!}
<div class="page-content"> <div class="page-content">
<datagrid-plus src="{{ route('admin.catalog.attributes.index') }}"></datagrid-plus>
{!! app('Webkul\Admin\DataGrids\AttributeDataGrid')->render() !!}
</div> </div>
{!! view_render_event('bagisto.admin.catalog.attributes.list.after') !!} {!! view_render_event('bagisto.admin.catalog.attributes.list.after') !!}

View File

@ -1,4 +1,6 @@
@php($locale = core()->getRequestedLocaleCode()) @php
$locale = core()->getRequestedLocaleCode();
@endphp
@extends('admin::layouts.content') @extends('admin::layouts.content')
@ -13,15 +15,20 @@
<h1>{{ __('admin::app.catalog.categories.title') }}</h1> <h1>{{ __('admin::app.catalog.categories.title') }}</h1>
<div class="control-group"> <div class="control-group">
<select
<select class="control" id="locale-switcher" name="locale" class="control"
onchange="reloadPage('locale', this.value)"> id="locale-switcher"
name="locale"
onchange="reloadPage('locale', this.value)"
>
<option value="all" {{ ! isset($locale) ? 'selected' : '' }}> <option value="all" {{ ! isset($locale) ? 'selected' : '' }}>
{{ __('admin::app.admin.system.all-locales') }} {{ __('admin::app.admin.system.all-locales') }}
</option> </option>
@foreach (core()->getAllLocales() as $localeModel) @foreach (core()->getAllLocales() as $localeModel)
<option <option
value="{{ $localeModel->code }}" {{ (isset($locale) && ($localeModel->code) == $locale) ? 'selected' : '' }}> value="{{ $localeModel->code }}" {{ (isset($locale) && ($localeModel->code) == $locale) ? 'selected' : '' }}
>
{{ $localeModel->name }} {{ $localeModel->name }}
</option> </option>
@endforeach @endforeach
@ -39,9 +46,7 @@
{!! view_render_event('bagisto.admin.catalog.categories.list.before') !!} {!! view_render_event('bagisto.admin.catalog.categories.list.before') !!}
<div class="page-content"> <div class="page-content">
@inject('categories', 'Webkul\Admin\DataGrids\CategoryDataGrid') <datagrid-plus src="{{ route('admin.catalog.categories.index') }}"></datagrid-plus>
{!! $categories->render() !!}
</div> </div>
{!! view_render_event('bagisto.admin.catalog.categories.list.after') !!} {!! view_render_event('bagisto.admin.catalog.categories.list.after') !!}

View File

@ -21,9 +21,7 @@
{!! view_render_event('bagisto.admin.catalog.families.list.before') !!} {!! view_render_event('bagisto.admin.catalog.families.list.before') !!}
<div class="page-content"> <div class="page-content">
<datagrid-plus src="{{ route('admin.catalog.families.index') }}"></datagrid-plus>
{!! app('Webkul\Admin\DataGrids\AttributeFamilyDataGrid')->render() !!}
</div> </div>
{!! view_render_event('bagisto.admin.catalog.families.list.after') !!} {!! view_render_event('bagisto.admin.catalog.families.list.after') !!}

View File

@ -14,7 +14,8 @@
<div class="page-action"> <div class="page-action">
<div class="export-import" @click="showModal('downloadDataGrid')"> <div class="export-import" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i> <i class="export-icon"></i>
<span >
<span>
{{ __('admin::app.export.export') }} {{ __('admin::app.export.export') }}
</span> </span>
</div> </div>
@ -28,9 +29,7 @@
{!! view_render_event('bagisto.admin.catalog.products.list.before') !!} {!! view_render_event('bagisto.admin.catalog.products.list.before') !!}
<div class="page-content"> <div class="page-content">
@inject('products', 'Webkul\Admin\DataGrids\ProductDataGrid') <datagrid-plus src="{{ route('admin.catalog.products.index') }}"></datagrid-plus>
{!! $products->render() !!}
</div> </div>
{!! view_render_event('bagisto.admin.catalog.products.list.after') !!} {!! view_render_event('bagisto.admin.catalog.products.list.after') !!}
@ -38,6 +37,7 @@
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid"> <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3> <h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body"> <div slot="body">
<export-form></export-form> <export-form></export-form>
</div> </div>
@ -45,7 +45,7 @@
@stop @stop
@push('scripts') @push('scripts')
@include('admin::export.export', ['gridName' => $products]) @include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\ProductDataGrid')])
<script> <script>
function reloadPage(getVar, getVal) { function reloadPage(getVar, getVal) {

View File

@ -5,16 +5,17 @@
@stop @stop
@section('content') @section('content')
<div class="content"> <div class="content">
<div class="page-header"> <div class="page-header">
<div class="page-title"> <div class="page-title">
<h1>{{ __('admin::app.cms.pages.pages') }}</h1> <h1>{{ __('admin::app.cms.pages.pages') }}</h1>
</div> </div>
<div class="page-action"> <div class="page-action">
<div class="export-import" @click="showModal('downloadDataGrid')"> <div class="export-import" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i> <i class="export-icon"></i>
<span >
<span>
{{ __('admin::app.export.export') }} {{ __('admin::app.export.export') }}
</span> </span>
</div> </div>
@ -26,14 +27,13 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('cmsGrid', 'Webkul\Admin\DataGrids\CMSPageDataGrid') <datagrid-plus src="{{ route('admin.cms.index') }}"></datagrid-plus>
{!! $cmsGrid->render() !!}
</div> </div>
</div> </div>
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid"> <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3> <h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body"> <div slot="body">
<export-form></export-form> <export-form></export-form>
</div> </div>
@ -41,6 +41,5 @@
@stop @stop
@push('scripts') @push('scripts')
@include('admin::export.export', ['gridName' => $cmsGrid]) @include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\CMSPageDataGrid')])
@endpush @endpush

View File

@ -1,35 +0,0 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.customers.addresses.title', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}
@stop
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.edit', ['id' => $customer->id]) }}'"></i>
{{ __('admin::app.customers.addresses.title', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}
</h1>
</div>
<div class="page-action">
<a href="{{ route('admin.customer.addresses.create', ['id' => $customer->id]) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.customers.addresses.create-btn-title') }}
</a>
</div>
</div>
{!! view_render_event('bagisto.admin.customer.addresses.list.before') !!}
<div class="page-content">
{!! app('Webkul\Admin\DataGrids\AddressDataGrid')->render() !!}
</div>
{!! view_render_event('bagisto.admin.customer.addresses.list.after') !!}
</div>
@stop

View File

@ -1,35 +0,0 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('address::app.admin.addresses.title-orders', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}
@stop
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.customer.index') }}'"></i>
{{ __('address::app.admin.addresses.title-orders', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}
</h1>
</div>
</div>
<div class="page-content">
<div class="tabs">
<ul>
<li><a href="{{ route('admin.address.addresses.index', ['id' => $customer->id]) }}">{{ __('address::app.admin.addresses.address-list') }}</a></li>
<li class="active"><a href="{{ route('admin.address.orders.index', ['id' => $customer->id]) }}">{{ __('address::app.admin.addresses.order-list') }}</a></li>
</ul>
</div>
{!! app('Webkul\Address\DataGrids\Admin\OrderDataGrid')->render() !!}
</div>
</div>
@stop

View File

@ -5,12 +5,12 @@
@stop @stop
@section('content') @section('content')
<div class="content"> <div class="content">
<div class="page-header"> <div class="page-header">
<div class="page-title"> <div class="page-title">
<h1>{{ __('admin::app.customers.groups.title') }}</h1> <h1>{{ __('admin::app.customers.groups.title') }}</h1>
</div> </div>
<div class="page-action"> <div class="page-action">
<a href="{{ route('admin.groups.create') }}" class="btn btn-lg btn-primary"> <a href="{{ route('admin.groups.create') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.customers.groups.add-title') }} {{ __('admin::app.customers.groups.add-title') }}
@ -19,9 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('customerGroup','Webkul\Admin\DataGrids\CustomerGroupDataGrid') <datagrid-plus src="{{ route('admin.groups.index') }}"></datagrid-plus>
{!! $customerGroup->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -5,16 +5,17 @@
@stop @stop
@section('content') @section('content')
<div class="content"> <div class="content">
<div class="page-header"> <div class="page-header">
<div class="page-title"> <div class="page-title">
<h1>{{ __('admin::app.customers.customers.title') }}</h1> <h1>{{ __('admin::app.customers.customers.title') }}</h1>
</div> </div>
<div class="page-action"> <div class="page-action">
<div class="export-import" @click="showModal('downloadDataGrid')"> <div class="export-import" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i> <i class="export-icon"></i>
<span >
<span>
{{ __('admin::app.export.export') }} {{ __('admin::app.export.export') }}
</span> </span>
</div> </div>
@ -26,22 +27,19 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('customerGrid','Webkul\Admin\DataGrids\CustomerDataGrid') <datagrid-plus src="{{ route('admin.customer.index') }}"></datagrid-plus>
{!! $customerGrid->render() !!}
</div> </div>
</div> </div>
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid"> <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3> <h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body"> <div slot="body">
<export-form></export-form> <export-form></export-form>
</div> </div>
</modal> </modal>
@stop @stop
@push('scripts') @push('scripts')
@include('admin::export.export', ['gridName' => $customerGrid]) @include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\CustomerDataGrid')])
@endpush @endpush

View File

@ -1,27 +0,0 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.customers.orders.list', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}
@stop
@section('content')
<div class="content">
<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.orders.list', ['customer_name' => $customer->first_name . ' ' . $customer->last_name]) }}
</h1>
</div>
</div>
<div class="page-content">
@inject('customerOrderGrid','Webkul\Admin\DataGrids\CustomerOrderDataGrid')
{!! $customerOrderGrid->render() !!}
</div>
</div>
@stop

View File

@ -5,23 +5,17 @@
@stop @stop
@section('content') @section('content')
<div class="content"> <div class="content">
<div class="page-header"> <div class="page-header">
<div class="page-title"> <div class="page-title">
<h1>{{ __('admin::app.customers.reviews.title') }}</h1> <h1>{{ __('admin::app.customers.reviews.title') }}</h1>
</div> </div>
<div class="page-action">
{{-- <a href="{{ route('admin.users.create') }}" class="btn btn-lg btn-primary"> <div class="page-action"></div>
{{ __('Add Customer') }}
</a> --}}
</div>
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('review','Webkul\Admin\DataGrids\CustomerReviewDataGrid') <datagrid-plus src="{{ route('admin.customer.review.index') }}"></datagrid-plus>
{!! $review->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -1,6 +1,5 @@
<script type="text/x-template" id="export-form-template"> <script type="text/x-template" id="export-form-template">
<form method="POST" action="{{ route('admin.datagrid.export', ['locale' => core()->getRequestedLocaleCode()]) }}" @submit.prevent="onSubmit"> <form method="POST" action="{{ route('admin.datagrid.export', ['locale' => core()->getRequestedLocaleCode()]) }}" @submit.prevent="onSubmit">
<div class="page-content"> <div class="page-content">
<div class="form-container"> <div class="form-container">
@csrf() @csrf()
@ -23,7 +22,6 @@
<button type="submit" class="btn btn-lg btn-primary"> <button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.export.export') }} {{ __('admin::app.export.export') }}
</button> </button>
</form> </form>
</script> </script>
@ -33,11 +31,12 @@
methods: { methods: {
onSubmit: function(e) { onSubmit: function(e) {
var this_this = this; var self = this;
e.target.submit(); e.target.submit();
setTimeout(function() { setTimeout(function() {
this_this.$root.$set(this_this.$root.modalIds, 'downloadDataGrid', false); self.$root.$set(self.$root.modalIds, 'downloadDataGrid', false);
}, 0); }, 0);
} }
} }

View File

@ -19,9 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
<datagrid-plus src="{{ route('admin.campaigns.index') }}"></datagrid-plus>
{!! app('Webkul\Admin\DataGrids\CampaignDataGrid')->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -19,9 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
<datagrid-plus src="{{ route('admin.events.index') }}"></datagrid-plus>
{!! app('Webkul\Admin\DataGrids\EventDataGrid')->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -5,24 +5,15 @@
@stop @stop
@section('content') @section('content')
<div class="content"> <div class="content">
<div class="page-header"> <div class="page-header">
<div class="page-title"> <div class="page-title">
<h1>{{ __('admin::app.customers.subscribers.title') }}</h1> <h1>{{ __('admin::app.customers.subscribers.title') }}</h1>
</div> </div>
{{-- <div class="page-action">
<a href="{{ route('admin.subscribers.store') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.customers.subscribers.add-title') }}
</a>
</div> --}}
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('subscribers','Webkul\Admin\DataGrids\NewsLetterDataGrid') <datagrid-plus src="{{ route('admin.customers.subscribers.index') }}"></datagrid-plus>
{!! $subscribers->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -19,9 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
<datagrid-plus src="{{ route('admin.email-templates.index') }}"></datagrid-plus>
{!! app('Webkul\Admin\DataGrids\EmailTemplateDataGrid')->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -39,7 +39,6 @@
<accordian :title="'{{ __('admin::app.promotions.cart-rules.rule-information') }}'" :active="true"> <accordian :title="'{{ __('admin::app.promotions.cart-rules.rule-information') }}'" :active="true">
<div slot="body"> <div slot="body">
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
<label for="name" class="required">{{ __('admin::app.promotions.cart-rules.name') }}</label> <label for="name" class="required">{{ __('admin::app.promotions.cart-rules.name') }}</label>
@ -172,13 +171,11 @@
<input type="text" class="control" id="sort_order" name="sort_order" value="{{ $cartRule->sort_order }}" {{ $cartRule->sort_order ? 'checked' : '' }}/> <input type="text" class="control" id="sort_order" name="sort_order" value="{{ $cartRule->sort_order }}" {{ $cartRule->sort_order ? 'checked' : '' }}/>
</div> </div>
</div> </div>
</accordian> </accordian>
<accordian :title="'{{ __('admin::app.promotions.cart-rules.conditions') }}'" :active="false"> <accordian :title="'{{ __('admin::app.promotions.cart-rules.conditions') }}'" :active="false">
<div slot="body"> <div slot="body">
<div class="control-group"> <div class="control-group">
<label for="condition_type">{{ __('admin::app.promotions.cart-rules.condition-type') }}</label> <label for="condition_type">{{ __('admin::app.promotions.cart-rules.condition-type') }}</label>
@ -199,13 +196,11 @@
<button type="button" class="btn btn-lg btn-primary" style="margin-top: 20px;" @click="addCondition"> <button type="button" class="btn btn-lg btn-primary" style="margin-top: 20px;" @click="addCondition">
{{ __('admin::app.promotions.cart-rules.add-condition') }} {{ __('admin::app.promotions.cart-rules.add-condition') }}
</button> </button>
</div> </div>
</accordian> </accordian>
<accordian :title="'{{ __('admin::app.promotions.cart-rules.actions') }}'" :active="false"> <accordian :title="'{{ __('admin::app.promotions.cart-rules.actions') }}'" :active="false">
<div slot="body"> <div slot="body">
<div class="control-group" :class="[errors.has('action_type') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('action_type') ? 'has-error' : '']">
<label for="action_type" class="required">{{ __('admin::app.promotions.cart-rules.action-type') }}</label> <label for="action_type" class="required">{{ __('admin::app.promotions.cart-rules.action-type') }}</label>
@ -307,14 +302,10 @@
</option> </option>
</select> </select>
</div> </div>
</div> </div>
</accordian> </accordian>
{!! view_render_event('bagisto.admin.promotions.cart-rules.create.after') !!} {!! view_render_event('bagisto.admin.promotions.cart-rules.create.after') !!}
</div>
</div>
</form>
<accordian :title="'{{ __('admin::app.promotions.cart-rules.coupon-codes') }}'" :active="false" v-if="coupon_type && use_auto_generation"> <accordian :title="'{{ __('admin::app.promotions.cart-rules.coupon-codes') }}'" :active="false" v-if="coupon_type && use_auto_generation">
<div slot="body"> <div slot="body">
@ -322,6 +313,9 @@
</div> </div>
</accordian> </accordian>
</div> </div>
</div>
</form>
</div>
</script> </script>
<script type="text/x-template" id="cart-rule-condition-item-template"> <script type="text/x-template" id="cart-rule-condition-item-template">
@ -416,29 +410,28 @@
<script type="text/x-template" id="create-coupon-form-template"> <script type="text/x-template" id="create-coupon-form-template">
<div class=""> <div class="">
<form method="POST" data-vv-scope="create-coupun-form" @submit.prevent="generateCopuns('create-coupun-form')"> <form method="POST" data-vv-scope="create-coupon-form" @submit.prevent="generateCoupons('create-coupon-form')">
<div class="control-group" :class="[errors.has('create-coupon-form.coupon_qty') ? 'has-error' : '']">
<div class="control-group" :class="[errors.has('create-coupun-form.coupon_qty') ? 'has-error' : '']">
<label for="coupon_qty" class="required">{{ __('admin::app.promotions.cart-rules.coupon-qty') }}</label> <label for="coupon_qty" class="required">{{ __('admin::app.promotions.cart-rules.coupon-qty') }}</label>
<input v-validate="'required|min_value:1'" class="control" id="coupon_qty" name="coupon_qty" v-model="coupon_format.coupon_qty" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.coupon-qty') }}&quot;"/> <input v-validate="'required|min_value:1'" class="control" id="coupon_qty" name="coupon_qty" v-model="coupon_format.coupon_qty" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.coupon-qty') }}&quot;"/>
<span class="control-error" v-if="errors.has('create-coupun-form.coupon_qty')"> <span class="control-error" v-if="errors.has('create-coupon-form.coupon_qty')">
@{{ errors.first('create-coupun-form.coupon_qty') }} @{{ errors.first('create-coupon-form.coupon_qty') }}
</span> </span>
</div> </div>
<div class="control-group" :class="[errors.has('create-coupun-form.code_length') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('create-coupon-form.code_length') ? 'has-error' : '']">
<label for="code_length" class="required">{{ __('admin::app.promotions.cart-rules.code-length') }}</label> <label for="code_length" class="required">{{ __('admin::app.promotions.cart-rules.code-length') }}</label>
<input v-validate="'required|min_value:10'" class="control" id="code_length" name="code_length" v-model="coupon_format.code_length" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.code-length') }}&quot;"/> <input v-validate="'required|min_value:10'" class="control" id="code_length" name="code_length" v-model="coupon_format.code_length" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.code-length') }}&quot;"/>
<span class="control-error" v-if="errors.has('create-coupun-form.code_length')"> <span class="control-error" v-if="errors.has('create-coupon-form.code_length')">
@{{ errors.first('create-coupun-form.code_length') }} @{{ errors.first('create-coupon-form.code_length') }}
</span> </span>
</div> </div>
<div class="control-group" :class="[errors.has('create-coupun-form.code_format') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('create-coupon-form.code_format') ? 'has-error' : '']">
<label for="code_format" class="required">{{ __('admin::app.promotions.cart-rules.code-format') }}</label> <label for="code_format" class="required">{{ __('admin::app.promotions.cart-rules.code-format') }}</label>
<select class="control" id="code_format" name="code_format" v-model="coupon_format.code_format" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.code-format') }}&quot;"> <select class="control" id="code_format" name="code_format" v-model="coupon_format.code_format" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.promotions.cart-rules.code-format') }}&quot;">
@ -447,8 +440,8 @@
<option value="numeric">{{ __('admin::app.promotions.cart-rules.numeric') }}</option> <option value="numeric">{{ __('admin::app.promotions.cart-rules.numeric') }}</option>
</select> </select>
<span class="control-error" v-if="errors.has('create-coupun-form.code_format')"> <span class="control-error" v-if="errors.has('create-coupon-form.code_format')">
@{{ errors.first('create-coupun-form.code_format') }} @{{ errors.first('create-coupon-form.code_format') }}
</span> </span>
</div> </div>
@ -465,7 +458,6 @@
<div class="button-group"> <div class="button-group">
<button class="btn btn-xl btn-primary">{{ __('admin::app.promotions.cart-rules.generate') }}</button> <button class="btn btn-xl btn-primary">{{ __('admin::app.promotions.cart-rules.generate') }}</button>
</div> </div>
</form> </form>
<div class="content"> <div class="content">
@ -483,19 +475,18 @@
<modal id="downloadDataGrid" :is-open="this.$root.modalIds.downloadDataGrid"> <modal id="downloadDataGrid" :is-open="this.$root.modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3> <h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body"> <div slot="body">
<export-form></export-form> <export-form></export-form>
</div> </div>
</modal> </modal>
@inject('cartRuleCouponGrid','Webkul\Admin\DataGrids\CartRuleCouponDataGrid') <datagrid-plus src="{{ route('admin.cart-rules-coupons.index', $cartRule->id) }}"></datagrid-plus>
{!! $cartRuleCouponGrid->render() !!}
</div> </div>
</script> </script>
@push('scripts') @push('scripts')
@include('admin::export.export', ['gridName' => $cartRuleCouponGrid]) @include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\CartRuleCouponDataGrid')])
@endpush @endpush
<script> <script>
@ -762,19 +753,19 @@
}, },
methods: { methods: {
generateCopuns: function(formScope) { generateCoupons: function(formScope) {
let self = this; let self = this;
this.$validator.validateAll(formScope).then(function (result) { this.$validator.validateAll(formScope).then(function (result) {
if (result) { if (result) {
self.$http.post("{{ route('admin.cart-rules.generate-coupons', $cartRule->id) }}", self.coupon_format) self.$http.post("{{ route('admin.cart-rules-coupons.store', $cartRule->id) }}", self.coupon_format)
.then(function(response) { .then(function(response) {
window.flashMessages = [{ window.flashMessages = [{
'type': 'alert-success', 'type': 'alert-success',
'message': response.data.message 'message': response.data.message
}]; }];
self.$root.addFlashMessages() self.$root.addFlashMessages();
}) })
.catch(function (error) { .catch(function (error) {
window.flashMessages = [{ window.flashMessages = [{
@ -782,8 +773,8 @@
'message': error.response.data.message 'message': error.response.data.message
}]; }];
self.$root.addFlashMessages() self.$root.addFlashMessages();
}) });
} }
}); });
}, },

View File

@ -8,6 +8,7 @@
<div class="content"> <div class="content">
@php @php
$customer_group = core()->getRequestedCustomerGroupCode(); $customer_group = core()->getRequestedCustomerGroupCode();
$channel = core()->getRequestedChannelCode(false); $channel = core()->getRequestedChannelCode(false);
@endphp @endphp
@ -24,8 +25,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('cartRuleGrid','Webkul\Admin\DataGrids\CartRuleDataGrid') <datagrid-plus src="{{ route('admin.cart-rules.index') }}"></datagrid-plus>
{!! $cartRuleGrid->render() !!}
</div> </div>
</div> </div>
@endsection @endsection
@ -34,6 +34,7 @@
<script> <script>
function reloadPage(getVar, getVal) { function reloadPage(getVar, getVal) {
let url = new URL(window.location.href); let url = new URL(window.location.href);
url.searchParams.set(getVar, getVal); url.searchParams.set(getVar, getVal);
window.location.href = url.href; window.location.href = url.href;

View File

@ -5,7 +5,6 @@
@stop @stop
@section('content') @section('content')
<div class="content"> <div class="content">
<div class="page-header"> <div class="page-header">
<div class="page-title"> <div class="page-title">
@ -20,8 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('catalogRuleGrid','Webkul\Admin\DataGrids\CatalogRuleDataGrid') <datagrid-plus src="{{ route('admin.catalog-rules.index') }}"></datagrid-plus>
{!! $catalogRuleGrid->render() !!}
</div> </div>
</div> </div>
@endsection @endsection

View File

@ -14,6 +14,7 @@
<div class="page-action"> <div class="page-action">
<div class="export-import" @click="showModal('downloadDataGrid')"> <div class="export-import" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i> <i class="export-icon"></i>
<span> <span>
{{ __('admin::app.export.export') }} {{ __('admin::app.export.export') }}
</span> </span>
@ -22,20 +23,19 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('orderInvoicesGrid', 'Webkul\Admin\DataGrids\OrderInvoicesDataGrid') <datagrid-plus src="{{ route('admin.sales.invoices.index') }}"></datagrid-plus>
{!! $orderInvoicesGrid->render() !!}
</div> </div>
</div> </div>
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid"> <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3> <h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body"> <div slot="body">
<export-form></export-form> <export-form></export-form>
</div> </div>
</modal> </modal>
@stop @stop
@push('scripts') @push('scripts')
@include('admin::export.export', ['gridName' => $orderInvoicesGrid]) @include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\OrderInvoicesDataGrid')])
@endpush @endpush

View File

@ -274,8 +274,7 @@
<tab name="{{ __('admin::app.sales.transactions.title') }}" :selected="false"> <tab name="{{ __('admin::app.sales.transactions.title') }}" :selected="false">
<div class="sale-container"> <div class="sale-container">
@inject('InvoicesTransactionsDatagrid', 'Webkul\Admin\DataGrids\InvoicesTransactionsDatagrid') <datagrid-plus src="{{ route('admin.sales.invoices.transactions', $invoice->id) }}"></datagrid-plus>
{!! $InvoicesTransactionsDatagrid->render() !!}
</div> </div>
</tab> </tab>
</tabs> </tabs>

View File

@ -14,6 +14,7 @@
<div class="page-action"> <div class="page-action">
<div class="export-import" @click="showModal('downloadDataGrid')"> <div class="export-import" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i> <i class="export-icon"></i>
<span> <span>
{{ __('admin::app.export.export') }} {{ __('admin::app.export.export') }}
</span> </span>
@ -22,21 +23,19 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('refundGrid', 'Webkul\Admin\DataGrids\OrderRefundDataGrid') <datagrid-plus src="{{ route('admin.sales.refunds.index') }}"></datagrid-plus>
{!! $refundGrid->render() !!}
</div> </div>
</div> </div>
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid"> <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3> <h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body"> <div slot="body">
<export-form></export-form> <export-form></export-form>
</div> </div>
</modal> </modal>
@stop @stop
@push('scripts') @push('scripts')
@include('admin::export.export', ['gridName' => $refundGrid]) @include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\OrderRefundDataGrid')])
@endpush @endpush

View File

@ -14,6 +14,7 @@
<div class="page-action"> <div class="page-action">
<div class="export-import" @click="showModal('downloadDataGrid')"> <div class="export-import" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i> <i class="export-icon"></i>
<span> <span>
{{ __('admin::app.export.export') }} {{ __('admin::app.export.export') }}
</span> </span>
@ -22,20 +23,19 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('orderShipmentsGrid', 'Webkul\Admin\DataGrids\OrderShipmentsDataGrid') <datagrid-plus src="{{ route('admin.sales.shipments.index') }}"></datagrid-plus>
{!! $orderShipmentsGrid->render() !!}
</div> </div>
</div> </div>
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid"> <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3> <h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body"> <div slot="body">
<export-form></export-form> <export-form></export-form>
</div> </div>
</modal> </modal>
@stop @stop
@push('scripts') @push('scripts')
@include('admin::export.export', ['gridName' => $orderShipmentsGrid]) @include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\OrderShipmentsDataGrid')])
@endpush @endpush

View File

@ -14,6 +14,7 @@
<div class="page-action"> <div class="page-action">
<div class="export-import" @click="showModal('downloadDataGrid')"> <div class="export-import" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i> <i class="export-icon"></i>
<span> <span>
{{ __('admin::app.export.export') }} {{ __('admin::app.export.export') }}
</span> </span>
@ -24,13 +25,13 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('orderTransactionsDataGrid', 'Webkul\Admin\DataGrids\OrderTransactionsDataGrid') <datagrid-plus src="{{ route('admin.sales.transactions.index') }}"></datagrid-plus>
{!! $orderTransactionsDataGrid->render() !!}
</div> </div>
</div> </div>
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid"> <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3> <h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body"> <div slot="body">
<export-form></export-form> <export-form></export-form>
</div> </div>
@ -38,5 +39,5 @@
@stop @stop
@push('scripts') @push('scripts')
@include('admin::export.export', ['gridName' => $orderTransactionsDataGrid]) @include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\OrderTransactionsDataGrid')])
@endpush @endpush

View File

@ -19,8 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('channels','Webkul\Admin\DataGrids\ChannelDataGrid') <datagrid-plus src="{{ route('admin.channels.index') }}"></datagrid-plus>
{!! $channels->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -19,8 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('currencies','Webkul\Admin\DataGrids\CurrencyDataGrid') <datagrid-plus src="{{ route('admin.currencies.index') }}"></datagrid-plus>
{!! $currencies->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -23,9 +23,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
<datagrid-plus src="{{ route('admin.exchange_rates.index') }}"></datagrid-plus>
{!! app('Webkul\Admin\DataGrids\ExchangeRatesDataGrid')->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -19,8 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('inventory_sources','Webkul\Admin\DataGrids\InventorySourcesDataGrid') <datagrid-plus src="{{ route('admin.inventory_sources.index') }}"></datagrid-plus>
{!! $inventory_sources->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -19,9 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
<datagrid-plus src="{{ route('admin.locales.index') }}"></datagrid-plus>
@inject('locales','Webkul\Admin\DataGrids\LocalesDataGrid')
{!! $locales->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -5,11 +5,10 @@
@stop @stop
@section('content') @section('content')
<div class="content"> <div class="content">
@php @php
$locale = core()->getRequestedLocaleCode('locale', false); $locale = core()->getRequestedLocaleCode('locale', false);
$channel = core()->getRequestedChannelCode(false); $channel = core()->getRequestedChannelCode(false);
@endphp @endphp
@ -26,22 +25,19 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('sliders','Webkul\Admin\DataGrids\SliderDataGrid') <datagrid-plus src="{{ route('admin.sliders.index') }}"></datagrid-plus>
{!! $sliders->render() !!}
</div> </div>
</div> </div>
@stop @stop
@push('scripts') @push('scripts')
<script> <script>
function reloadPage(getVar, getVal) { function reloadPage(getVar, getVal) {
let url = new URL(window.location.href); let url = new URL(window.location.href);
url.searchParams.set(getVar, getVal); url.searchParams.set(getVar, getVal);
window.location.href = url.href; window.location.href = url.href;
} }
</script> </script>
@endpush @endpush

View File

@ -19,8 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('taxCategories','Webkul\Admin\DataGrids\TaxCategoryDataGrid') <datagrid-plus src="{{ route('admin.tax-categories.index') }}"></datagrid-plus>
{!! $taxCategories->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -5,7 +5,7 @@
@stop @stop
@push('css') @push('css')
<style> <style>
@media only screen and (max-width: 450px){ @media only screen and (max-width: 450px){
.content-container .content .page-header .page-title{ .content-container .content .page-header .page-title{
width: 100% !important; width: 100% !important;
@ -20,8 +20,7 @@
margin-top: 0px !important; margin-top: 0px !important;
} }
} }
</style> </style>
@endpush @endpush
@section('content') @section('content')
@ -34,12 +33,15 @@
<div class="page-action"> <div class="page-action">
<div class="export-import" @click="showModal('uploadDataGrid')" style="margin-right: 20px;"> <div class="export-import" @click="showModal('uploadDataGrid')" style="margin-right: 20px;">
<i class="import-icon"></i> <i class="import-icon"></i>
<span> <span>
{{ __('admin::app.export.import') }} {{ __('admin::app.export.import') }}
</span> </span>
</div> </div>
<div class="export-import" @click="showModal('downloadDataGrid')"> <div class="export-import" @click="showModal('downloadDataGrid')">
<i class="export-icon"></i> <i class="export-icon"></i>
<span> <span>
{{ __('admin::app.export.export') }} {{ __('admin::app.export.export') }}
</span> </span>
@ -52,13 +54,13 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('taxRateGrid', 'Webkul\Admin\DataGrids\TaxRateDataGrid') <datagrid-plus src="{{ route('admin.tax-rates.index') }}"></datagrid-plus>
{!! $taxRateGrid->render() !!}
</div> </div>
</div> </div>
<modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid"> <modal id="downloadDataGrid" :is-open="modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3> <h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body"> <div slot="body">
<export-form></export-form> <export-form></export-form>
</div> </div>
@ -66,15 +68,20 @@
<modal id="uploadDataGrid" :is-open="modalIds.uploadDataGrid"> <modal id="uploadDataGrid" :is-open="modalIds.uploadDataGrid">
<h3 slot="header">{{ __('admin::app.export.upload') }}</h3> <h3 slot="header">{{ __('admin::app.export.upload') }}</h3>
<div slot="body">
<div slot="body">
<form method="POST" action="{{ route('admin.tax-rates.import') }}" enctype="multipart/form-data" @submit.prevent="onSubmit"> <form method="POST" action="{{ route('admin.tax-rates.import') }}" enctype="multipart/form-data" @submit.prevent="onSubmit">
@csrf() @csrf()
<div class="control-group" :class="[errors.has('file') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('file') ? 'has-error' : '']">
<label for="file" class="required">{{ __('admin::app.export.file') }}</label> <label for="file" class="required">{{ __('admin::app.export.file') }}</label>
<input v-validate="'required'" type="file" class="control" id="file" name="file" data-vv-as="&quot;{{ __('admin::app.export.file') }}&quot;" value="{{ old('file') }}"/ style="padding-top: 5px"> <input v-validate="'required'" type="file" class="control" id="file" name="file" data-vv-as="&quot;{{ __('admin::app.export.file') }}&quot;" value="{{ old('file') }}"/ style="padding-top: 5px">
<span>{{ __('admin::app.export.allowed-type') }}</span> <span>{{ __('admin::app.export.allowed-type') }}</span>
<span><b>{{ __('admin::app.export.file-type') }}</b></span> <span><b>{{ __('admin::app.export.file-type') }}</b></span>
<span class="control-error" v-if="errors.has('file')">@{{ errors.first('file') }}</span> <span class="control-error" v-if="errors.has('file')">@{{ errors.first('file') }}</span>
</div> </div>
@ -82,12 +89,10 @@
{{ __('admin::app.export.import') }} {{ __('admin::app.export.import') }}
</button> </button>
</form> </form>
</div> </div>
</modal> </modal>
@endsection @endsection
@push('scripts') @push('scripts')
@include('admin::export.export', ['gridName' => $taxRateGrid]) @include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\TaxRateDataGrid')])
@endpush @endpush

View File

@ -19,8 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
@inject('roles','Webkul\Admin\DataGrids\RolesDataGrid') <datagrid-plus src="{{ route('admin.roles.index') }}"></datagrid-plus>
{!! $roles->render() !!}
</div> </div>
</div> </div>
@stop @stop

View File

@ -5,12 +5,12 @@
@stop @stop
@section('content') @section('content')
<div class="content"> <div class="content">
<div class="page-header"> <div class="page-header">
<div class="page-title"> <div class="page-title">
<h1>{{ __('admin::app.users.users.title') }}</h1> <h1>{{ __('admin::app.users.users.title') }}</h1>
</div> </div>
<div class="page-action"> <div class="page-action">
<a href="{{ route('admin.users.create') }}" class="btn btn-lg btn-primary"> <a href="{{ route('admin.users.create') }}" class="btn btn-lg btn-primary">
{{ __('admin::app.users.users.add-user-title') }} {{ __('admin::app.users.users.add-user-title') }}
@ -19,11 +19,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
<datagrid-plus src="{{ route('admin.users.index') }}"></datagrid-plus>
@inject('datagrid','Webkul\Admin\DataGrids\UserDataGrid')
{!! $datagrid->render() !!}
{{-- <datetime></datetime> --}}
</div> </div>
</div> </div>
@stop @stop

View File

@ -43,9 +43,14 @@ Route::group(['middleware' => ['web', 'admin', 'admin_locale'], 'prefix' => conf
Route::post('cart-rules/delete/{id}', [CartRuleController::class, 'destroy'])->name('admin.cart-rules.delete'); Route::post('cart-rules/delete/{id}', [CartRuleController::class, 'destroy'])->name('admin.cart-rules.delete');
Route::post('cart-rules/generate-coupons/{id?}', [CartRuleController::class, 'generateCoupons'])->name('admin.cart-rules.generate-coupons'); /**
* Cart rule coupons routes.
*/
Route::get('cart-rule-coupons/{id}', [CartRuleCouponController::class, 'index'])->name('admin.cart-rules-coupons.index');
Route::post('/massdelete', [CartRuleCouponController::class, 'massDelete'])->name('admin.cart-rule-coupons.mass-delete'); Route::post('cart-rule-coupons/{id}', [CartRuleController::class, 'store'])->name('admin.cart-rules-coupons.store');
Route::post('cart-rule-coupons/mass-delete', [CartRuleCouponController::class, 'massDelete'])->name('admin.cart-rule-coupons.mass-delete');
/** /**
* Catalog rules routes. * Catalog rules routes.

View File

@ -55,6 +55,9 @@ Route::group(['middleware' => ['web', 'admin', 'admin_locale'], 'prefix' => conf
'view' => 'admin::sales.invoices.print', 'view' => 'admin::sales.invoices.print',
])->name('admin.sales.invoices.print'); ])->name('admin.sales.invoices.print');
Route::get('/invoices/{id}/transactions', [InvoiceController::class, 'invoiceTransactions'])
->name('admin.sales.invoices.transactions');
/** /**
* Shipments routes. * Shipments routes.
*/ */

View File

@ -2,6 +2,7 @@
namespace Webkul\Attribute\Http\Controllers; namespace Webkul\Attribute\Http\Controllers;
use Webkul\Admin\DataGrids\AttributeDataGrid;
use Webkul\Attribute\Repositories\AttributeRepository; use Webkul\Attribute\Repositories\AttributeRepository;
class AttributeController extends Controller class AttributeController extends Controller
@ -40,6 +41,10 @@ class AttributeController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(AttributeDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,27 +2,28 @@
namespace Webkul\Attribute\Http\Controllers; namespace Webkul\Attribute\Http\Controllers;
use Webkul\Admin\DataGrids\AttributeFamilyDataGrid;
use Webkul\Attribute\Repositories\AttributeFamilyRepository; use Webkul\Attribute\Repositories\AttributeFamilyRepository;
use Webkul\Attribute\Repositories\AttributeRepository; use Webkul\Attribute\Repositories\AttributeRepository;
class AttributeFamilyController extends Controller class AttributeFamilyController extends Controller
{ {
/** /**
* Contains route related configuration * Contains route related configuration.
* *
* @var array * @var array
*/ */
protected $_config; protected $_config;
/** /**
* AttributeFamilyRepository object * Attribute family repository instance.
* *
* @var \Webkul\Attribute\Repositories\AttributeFamilyRepository * @var \Webkul\Attribute\Repositories\AttributeFamilyRepository
*/ */
protected $attributeFamilyRepository; protected $attributeFamilyRepository;
/** /**
* AttributeRepository object * Attribute repository instance.
* *
* @var \Webkul\Attribute\Repositories\AttributeRepository * @var \Webkul\Attribute\Repositories\AttributeRepository
*/ */
@ -38,8 +39,7 @@ class AttributeFamilyController extends Controller
public function __construct( public function __construct(
AttributeFamilyRepository $attributeFamilyRepository, AttributeFamilyRepository $attributeFamilyRepository,
AttributeRepository $attributeRepository AttributeRepository $attributeRepository
) ) {
{
$this->attributeFamilyRepository = $attributeFamilyRepository; $this->attributeFamilyRepository = $attributeFamilyRepository;
$this->attributeRepository = $attributeRepository; $this->attributeRepository = $attributeRepository;
@ -54,6 +54,10 @@ class AttributeFamilyController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(AttributeFamilyDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }
@ -157,7 +161,7 @@ class AttributeFamilyController extends Controller
} }
/** /**
* Remove the specified resources from database * Remove the specified resources from database.
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */

View File

@ -2,20 +2,21 @@
namespace Webkul\CMS\Http\Controllers\Admin; namespace Webkul\CMS\Http\Controllers\Admin;
use Webkul\Admin\DataGrids\CMSPageDataGrid;
use Webkul\CMS\Http\Controllers\Controller; use Webkul\CMS\Http\Controllers\Controller;
use Webkul\CMS\Repositories\CmsRepository; use Webkul\CMS\Repositories\CmsRepository;
class PageController extends Controller class PageController extends Controller
{ {
/** /**
* To hold the request variables from route file * To hold the request variables from route file.
* *
* @var array * @var array
*/ */
protected $_config; protected $_config;
/** /**
* To hold the CMSRepository instance * To hold the CMS repository instance.
* *
* @var \Webkul\CMS\Repositories\CmsRepository * @var \Webkul\CMS\Repositories\CmsRepository
*/ */
@ -37,17 +38,21 @@ use Webkul\CMS\Repositories\CmsRepository;
} }
/** /**
* Loads the index page showing the static pages resources * Loads the index page showing the static pages resources.
* *
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(CMSPageDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }
/** /**
* To create a new CMS page * To create a new CMS page.
* *
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
@ -57,7 +62,7 @@ use Webkul\CMS\Repositories\CmsRepository;
} }
/** /**
* To store a new CMS page in storage * To store a new CMS page in storage.
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
@ -80,7 +85,7 @@ use Webkul\CMS\Repositories\CmsRepository;
} }
/** /**
* To edit a previously created CMS page * To edit a previously created CMS page.
* *
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
@ -93,7 +98,7 @@ use Webkul\CMS\Repositories\CmsRepository;
} }
/** /**
* To update the previously created CMS page in storage * To update the previously created CMS page in storage.
* *
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
@ -121,7 +126,7 @@ use Webkul\CMS\Repositories\CmsRepository;
} }
/** /**
* To delete the previously create CMS page * To delete the previously create CMS page.
* *
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
@ -134,15 +139,15 @@ use Webkul\CMS\Repositories\CmsRepository;
session()->flash('success', trans('admin::app.cms.pages.delete-success')); session()->flash('success', trans('admin::app.cms.pages.delete-success'));
return response()->json(['message' => true], 200); return response()->json(['message' => true], 200);
} else { }
session()->flash('success', trans('admin::app.cms.pages.delete-failure')); session()->flash('success', trans('admin::app.cms.pages.delete-failure'));
return response()->json(['message' => false], 200); return response()->json(['message' => false], 200);
} }
}
/** /**
* To mass delete the CMS resource from storage * To mass delete the CMS resource from storage.
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */

View File

@ -6,7 +6,7 @@ use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException; use Illuminate\Validation\ValidationException;
use Illuminate\View\View; use Illuminate\View\View;
use Webkul\CartRule\Repositories\CartRuleCouponRepository; use Webkul\Admin\DataGrids\CartRuleDataGrid;
use Webkul\CartRule\Repositories\CartRuleRepository; use Webkul\CartRule\Repositories\CartRuleRepository;
class CartRuleController extends Controller class CartRuleController extends Controller
@ -25,30 +25,18 @@ class CartRuleController extends Controller
*/ */
protected $cartRuleRepository; protected $cartRuleRepository;
/**
* To hold cart rule coupon repository repository instance.
*
* @var \Webkul\CartRule\Repositories\CartRuleCouponRepository
*/
protected $cartRuleCouponRepository;
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param \Webkul\CartRule\Repositories\CartRuleRepository $cartRuleRepository * @param \Webkul\CartRule\Repositories\CartRuleRepository $cartRuleRepository
* @param \Webkul\CartRule\Repositories\CartRuleCouponRepository $cartRuleCouponRepository
*
* @return void * @return void
*/ */
public function __construct( public function __construct(
CartRuleRepository $cartRuleRepository, CartRuleRepository $cartRuleRepository
CartRuleCouponRepository $cartRuleCouponRepository
) { ) {
$this->_config = request('_config'); $this->_config = request('_config');
$this->cartRuleRepository = $cartRuleRepository; $this->cartRuleRepository = $cartRuleRepository;
$this->cartRuleCouponRepository = $cartRuleCouponRepository;
} }
/** /**
@ -58,6 +46,10 @@ class CartRuleController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(CartRuleDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }
@ -229,26 +221,4 @@ class CartRuleController extends Controller
return response()->json(['message' => false], 400); return response()->json(['message' => false], 400);
} }
/**
* Generate coupon code for cart rule.
*
* @return \Illuminate\Http\JsonResponse
*/
public function generateCoupons()
{
$this->validate(request(), [
'coupon_qty' => 'required|integer|min:1',
'code_length' => 'required|integer|min:10',
'code_format' => 'required',
]);
if (! request('id')) {
return response()->json(['message' => trans('admin::app.promotions.cart-rules.cart-rule-not-defind-error')], 400);
}
$this->cartRuleCouponRepository->generateCoupons(request()->all(), request('id'));
return response()->json(['message' => trans('admin::app.response.create-success', ['name' => 'Cart rule coupons'])]);
}
} }

View File

@ -2,13 +2,13 @@
namespace Webkul\CartRule\Http\Controllers; namespace Webkul\CartRule\Http\Controllers;
use Illuminate\Http\Request; use Webkul\Admin\DataGrids\CartRuleCouponDataGrid;
use Webkul\CartRule\Repositories\CartRuleCouponRepository; use Webkul\CartRule\Repositories\CartRuleCouponRepository;
class CartRuleCouponController extends Controller class CartRuleCouponController extends Controller
{ {
/** /**
* To hold CartRuleCouponRepository repository instance * To hold cart rule coupon repository instance.
* *
* @var \Webkul\CartRule\Repositories\CartRuleCouponRepository * @var \Webkul\CartRule\Repositories\CartRuleCouponRepository
*/ */
@ -26,7 +26,41 @@ class CartRuleCouponController extends Controller
} }
/** /**
* Mass Delete the coupons * Index.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function index($id)
{
return app(CartRuleCouponDataGrid::class)->toJson();
}
/**
* Generate coupon code for cart rule.
*
* @return \Illuminate\Http\JsonResponse
*/
public function store($id)
{
dd('here');
$this->validate(request(), [
'coupon_qty' => 'required|integer|min:1',
'code_length' => 'required|integer|min:10',
'code_format' => 'required',
]);
if (! request('id')) {
return response()->json(['message' => trans('admin::app.promotions.cart-rules.cart-rule-not-defind-error')], 400);
}
$this->cartRuleCouponRepository->generateCoupons(request()->all(), request('id'));
return response()->json(['message' => trans('admin::app.response.create-success', ['name' => 'Cart rule coupons'])]);
}
/**
* Mass delete the coupons.
* *
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response

View File

@ -3,6 +3,7 @@
namespace Webkul\CatalogRule\Http\Controllers; namespace Webkul\CatalogRule\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Webkul\Admin\DataGrids\CatalogRuleDataGrid;
use Webkul\CatalogRule\Helpers\CatalogRuleIndex; use Webkul\CatalogRule\Helpers\CatalogRuleIndex;
use Webkul\CatalogRule\Repositories\CatalogRuleRepository; use Webkul\CatalogRule\Repositories\CatalogRuleRepository;
@ -54,6 +55,10 @@ class CatalogRuleController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(CatalogRuleDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Category\Http\Controllers; namespace Webkul\Category\Http\Controllers;
use Webkul\Admin\DataGrids\CategoryDataGrid;
use Webkul\Attribute\Repositories\AttributeRepository; use Webkul\Attribute\Repositories\AttributeRepository;
use Webkul\Category\Http\Requests\CategoryRequest; use Webkul\Category\Http\Requests\CategoryRequest;
use Webkul\Category\Repositories\CategoryRepository; use Webkul\Category\Repositories\CategoryRepository;
@ -55,6 +56,10 @@ class CategoryController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(CategoryDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Core\Http\Controllers; namespace Webkul\Core\Http\Controllers;
use Webkul\Admin\DataGrids\ChannelDataGrid;
use Webkul\Core\Repositories\ChannelRepository; use Webkul\Core\Repositories\ChannelRepository;
class ChannelController extends Controller class ChannelController extends Controller
@ -40,6 +41,10 @@ class ChannelController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(ChannelDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Core\Http\Controllers; namespace Webkul\Core\Http\Controllers;
use Webkul\Admin\DataGrids\CurrencyDataGrid;
use Webkul\Core\Repositories\CurrencyRepository; use Webkul\Core\Repositories\CurrencyRepository;
class CurrencyController extends Controller class CurrencyController extends Controller
@ -40,6 +41,10 @@ class CurrencyController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(CurrencyDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Core\Http\Controllers; namespace Webkul\Core\Http\Controllers;
use Webkul\Admin\DataGrids\ExchangeRatesDataGrid;
use Webkul\Core\Repositories\CurrencyRepository; use Webkul\Core\Repositories\CurrencyRepository;
use Webkul\Core\Repositories\ExchangeRateRepository; use Webkul\Core\Repositories\ExchangeRateRepository;
@ -53,6 +54,10 @@ class ExchangeRateController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(ExchangeRatesDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Core\Http\Controllers; namespace Webkul\Core\Http\Controllers;
use Webkul\Admin\DataGrids\LocalesDataGrid;
use Webkul\Core\Repositories\LocaleRepository; use Webkul\Core\Repositories\LocaleRepository;
class LocaleController extends Controller class LocaleController extends Controller
@ -40,6 +41,10 @@ class LocaleController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(LocalesDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Core\Http\Controllers; namespace Webkul\Core\Http\Controllers;
use Webkul\Admin\DataGrids\SliderDataGrid;
use Webkul\Core\Repositories\SliderRepository; use Webkul\Core\Repositories\SliderRepository;
class SliderController extends Controller class SliderController extends Controller
@ -47,6 +48,10 @@ class SliderController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(SliderDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }
@ -59,7 +64,7 @@ class SliderController extends Controller
{ {
$locale = core()->getRequestedLocaleCode(); $locale = core()->getRequestedLocaleCode();
return view($this->_config['view'])->with("locale", $locale); return view($this->_config['view'])->with('locale', $locale);
} }
/** /**

View File

@ -2,21 +2,20 @@
namespace Webkul\Core\Http\Controllers; namespace Webkul\Core\Http\Controllers;
use Illuminate\Http\Request; use Webkul\Admin\DataGrids\NewsLetterDataGrid;
use Illuminate\Http\Response;
use Webkul\Core\Repositories\SubscribersListRepository; use Webkul\Core\Repositories\SubscribersListRepository;
class SubscriptionController extends Controller class SubscriptionController extends Controller
{ {
/** /**
* Contains route related configuration * Contains route related configuration.
* *
* @var array * @var array
*/ */
protected $_config; protected $_config;
/** /**
* SubscribersListRepository * Subscribers list repository.
* *
* @var \Webkul\Core\Repositories\SubscribersListRepository * @var \Webkul\Core\Repositories\SubscribersListRepository
*/ */
@ -42,11 +41,15 @@ class SubscriptionController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(NewsLetterDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }
/** /**
* To unsubscribe the user without deleting the resource of the subscribed user * To unsubscribe the user without deleting the resource of the subscribed user.
* *
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
@ -59,7 +62,7 @@ class SubscriptionController extends Controller
} }
/** /**
* To unsubscribe the user without deleting the resource of the subscribed user * To unsubscribe the user without deleting the resource of the subscribed user.
* *
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response

View File

@ -2,6 +2,7 @@
namespace Webkul\Inventory\Http\Controllers; namespace Webkul\Inventory\Http\Controllers;
use Webkul\Admin\DataGrids\InventorySourcesDataGrid;
use Webkul\Inventory\Http\Requests\InventorySourceRequest; use Webkul\Inventory\Http\Requests\InventorySourceRequest;
use Webkul\Inventory\Repositories\InventorySourceRepository; use Webkul\Inventory\Repositories\InventorySourceRepository;
@ -41,6 +42,10 @@ class InventorySourceController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(InventorySourcesDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Marketing\Http\Controllers; namespace Webkul\Marketing\Http\Controllers;
use Webkul\Admin\DataGrids\CampaignDataGrid;
use Webkul\Marketing\Repositories\CampaignRepository; use Webkul\Marketing\Repositories\CampaignRepository;
class CampaignController extends Controller class CampaignController extends Controller
@ -40,6 +41,10 @@ class CampaignController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(CampaignDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Marketing\Http\Controllers; namespace Webkul\Marketing\Http\Controllers;
use Webkul\Admin\DataGrids\EventDataGrid;
use Webkul\Marketing\Repositories\EventRepository; use Webkul\Marketing\Repositories\EventRepository;
class EventController extends Controller class EventController extends Controller
@ -40,6 +41,10 @@ class EventController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(EventDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,6 +2,7 @@
namespace Webkul\Marketing\Http\Controllers; namespace Webkul\Marketing\Http\Controllers;
use Webkul\Admin\DataGrids\EmailTemplateDataGrid;
use Webkul\Marketing\Repositories\TemplateRepository; use Webkul\Marketing\Repositories\TemplateRepository;
class TemplateController extends Controller class TemplateController extends Controller
@ -40,6 +41,10 @@ class TemplateController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(EmailTemplateDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -5,6 +5,7 @@ namespace Webkul\Product\Http\Controllers;
use Exception; use Exception;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Webkul\Admin\DataGrids\ProductDataGrid;
use Webkul\Attribute\Repositories\AttributeFamilyRepository; use Webkul\Attribute\Repositories\AttributeFamilyRepository;
use Webkul\Category\Repositories\CategoryRepository; use Webkul\Category\Repositories\CategoryRepository;
use Webkul\Core\Contracts\Validations\Slug; use Webkul\Core\Contracts\Validations\Slug;
@ -131,6 +132,10 @@ class ProductController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(ProductDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -3,6 +3,7 @@
namespace Webkul\Product\Http\Controllers; namespace Webkul\Product\Http\Controllers;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Webkul\Admin\DataGrids\CustomerReviewDataGrid;
use Webkul\Product\Repositories\ProductReviewRepository; use Webkul\Product\Repositories\ProductReviewRepository;
class ReviewController extends Controller class ReviewController extends Controller
@ -41,6 +42,10 @@ class ReviewController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(CustomerReviewDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,10 +2,12 @@
namespace Webkul\Tax\Http\Controllers; namespace Webkul\Tax\Http\Controllers;
use Webkul\Admin\DataGrids\TaxCategoryDataGrid;
class TaxController extends Controller class TaxController extends Controller
{ {
/** /**
* Contains route related configuration * Contains route related configuration.
* *
* @var array * @var array
*/ */
@ -30,6 +32,10 @@ class TaxController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(TaxCategoryDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }
} }

View File

@ -4,6 +4,7 @@ namespace Webkul\Tax\Http\Controllers;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Maatwebsite\Excel\Validators\Failure; use Maatwebsite\Excel\Validators\Failure;
use Webkul\Admin\DataGrids\TaxRateDataGrid;
use Webkul\Admin\Imports\DataGridImport; use Webkul\Admin\Imports\DataGridImport;
use Webkul\Tax\Repositories\TaxRateRepository; use Webkul\Tax\Repositories\TaxRateRepository;
@ -53,6 +54,10 @@ class TaxRateController extends Controller
*/ */
public function show() public function show()
{ {
if (request()->ajax()) {
return app(TaxRateDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,15 +2,16 @@
namespace Webkul\Ui\DataGrid; namespace Webkul\Ui\DataGrid;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Illuminate\Support\Str;
use Webkul\Ui\DataGrid\Traits\ProvideBouncer; use Webkul\Ui\DataGrid\Traits\ProvideBouncer;
use Webkul\Ui\DataGrid\Traits\ProvideCollection; use Webkul\Ui\DataGrid\Traits\ProvideCollection;
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
use Webkul\Ui\DataGrid\Traits\ProvideExceptionHandler; use Webkul\Ui\DataGrid\Traits\ProvideExceptionHandler;
abstract class DataGrid abstract class DataGrid
{ {
use ProvideBouncer, ProvideCollection, ProvideExceptionHandler; use ProvideBouncer, ProvideCollection, ProvideDataGridPlus, ProvideExceptionHandler;
/** /**
* Set index columns, ex: id. * Set index columns, ex: id.
@ -48,7 +49,6 @@ abstract class DataGrid
*/ */
protected $columns = []; protected $columns = [];
/** /**
* Complete column details. * Complete column details.
* *
@ -392,7 +392,7 @@ abstract class DataGrid
'paginated' => $this->paginate, 'paginated' => $this->paginate,
'itemsPerPage' => $this->itemsPerPage, 'itemsPerPage' => $this->itemsPerPage,
'norecords' => __('ui::app.datagrid.no-records'), 'norecords' => __('ui::app.datagrid.no-records'),
'extraFilters' => $this->getNecessaryExtraFilters() 'extraFilters' => $this->getNecessaryExtraFilters(),
]; ];
} }
@ -429,7 +429,7 @@ abstract class DataGrid
$checks = [ $checks = [
'channels' => core()->getAllChannels(), 'channels' => core()->getAllChannels(),
'locales' => core()->getAllLocales(), 'locales' => core()->getAllLocales(),
'customer_groups' => core()->getAllCustomerGroups() 'customer_groups' => core()->getAllCustomerGroups(),
]; ];
foreach ($checks as $key => $val) { foreach ($checks as $key => $val) {

View File

@ -2,6 +2,7 @@
namespace Webkul\User\Http\Controllers; namespace Webkul\User\Http\Controllers;
use Webkul\Admin\DataGrids\RolesDataGrid;
use Webkul\User\Repositories\AdminRepository; use Webkul\User\Repositories\AdminRepository;
use Webkul\User\Repositories\RoleRepository; use Webkul\User\Repositories\RoleRepository;
@ -55,6 +56,10 @@ class RoleController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(RolesDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -5,6 +5,7 @@ namespace Webkul\User\Http\Controllers;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Webkul\Admin\DataGrids\UserDataGrid;
use Webkul\User\Http\Requests\UserForm; use Webkul\User\Http\Requests\UserForm;
use Webkul\User\Repositories\AdminRepository; use Webkul\User\Repositories\AdminRepository;
use Webkul\User\Repositories\RoleRepository; use Webkul\User\Repositories\RoleRepository;
@ -59,6 +60,10 @@ class UserController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(UserDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }

View File

@ -2,21 +2,21 @@
namespace Webkul\Velocity\Http\Controllers\Admin; namespace Webkul\Velocity\Http\Controllers\Admin;
use Illuminate\Http\Response;
use Webkul\Product\Repositories\ProductRepository; use Webkul\Product\Repositories\ProductRepository;
use Webkul\Velocity\DataGrids\ContentDataGrid;
use Webkul\Velocity\Repositories\ContentRepository; use Webkul\Velocity\Repositories\ContentRepository;
class ContentController extends Controller class ContentController extends Controller
{ {
/** /**
* ProductRepository object * Product repository instance.
* *
* @var \Webkul\Product\Repositories\ProductRepository * @var \Webkul\Product\Repositories\ProductRepository
*/ */
protected $productRepository; protected $productRepository;
/** /**
* ContentRepository object * Content repository instance.
* *
* @var \Webkul\Velocity\Repositories\ContentRepository * @var \Webkul\Velocity\Repositories\ContentRepository
*/ */
@ -39,6 +39,7 @@ class ContentController extends Controller
$this->_config = request('_config'); $this->_config = request('_config');
} }
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* *
@ -46,11 +47,15 @@ class ContentController extends Controller
*/ */
public function index() public function index()
{ {
if (request()->ajax()) {
return app(ContentDataGrid::class)->toJson();
}
return view($this->_config['view']); return view($this->_config['view']);
} }
/** /**
* Search for catalog * Search for catalog.
* *
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
@ -160,7 +165,7 @@ class ContentController extends Controller
} }
/** /**
* Mass Delete the products * Mass delete the products.
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
@ -183,7 +188,7 @@ class ContentController extends Controller
} }
/** /**
* To mass update the content * To mass update the content.
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */

View File

@ -13,6 +13,7 @@ use Webkul\Product\Models\ProductInventory;
/** /**
* Inherited methods. * Inherited methods.
*
* @method void wantToTest($text) * @method void wantToTest($text)
* @method void wantTo($text) * @method void wantTo($text)
* @method void execute($callable) * @method void execute($callable)

View File

@ -9,6 +9,7 @@ use Webkul\User\Models\Admin;
/** /**
* Inherited methods. * Inherited methods.
*
* @method void wantToTest($text) * @method void wantToTest($text)
* @method void wantTo($text) * @method void wantTo($text)
* @method void execute($callable) * @method void execute($callable)
@ -30,7 +31,7 @@ class FunctionalTester extends Actor
* Set the logged in user to the admin identity. * Set the logged in user to the admin identity.
* *
* @param \Webkul\User\Models\Admin|null $admin * @param \Webkul\User\Models\Admin|null $admin
* @return Admin * @return \Webkul\User\Models\Admin
* *
* @throws \Exception * @throws \Exception
*/ */
@ -59,7 +60,7 @@ class FunctionalTester extends Actor
* Set the logged in user to the customer identity. * Set the logged in user to the customer identity.
* *
* @param \Webkul\User\Models\Customer|null $customer * @param \Webkul\User\Models\Customer|null $customer
* @return Customer * @return \Webkul\Customer\Models\Customer
* *
* @throws \Exception * @throws \Exception
*/ */
@ -101,11 +102,11 @@ class FunctionalTester extends Actor
} }
/** /**
* Set specific Webkul/Core configuration keys to a given value. * Set specific `Webkul/Core` configuration keys to a given value.
* *
* TODO: Change method as soon as there is a method to set core config data. * TODO: Change method as soon as there is a method to set core config data.
* *
* @param $data array containing 'code => value' pairs * @param array $data
* @return void * @return void
*/ */
public function setConfigData($data): void public function setConfigData($data): void

View File

@ -1,36 +1,28 @@
<?php <?php
namespace Webkul\Core\Helpers; namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
use StdClass;
use Faker\Factory;
use Codeception\Module\Laravel; use Codeception\Module\Laravel;
use Webkul\Checkout\Models\Cart; use Faker\Factory;
use Webkul\Product\Models\Product;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Webkul\Checkout\Models\CartItem;
use Webkul\Customer\Models\Customer;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use StdClass;
use Webkul\Attribute\Models\Attribute; use Webkul\Attribute\Models\Attribute;
use Webkul\Checkout\Models\CartAddress;
use Webkul\Customer\Models\CustomerAddress;
use Webkul\Product\Models\ProductInventory;
use Webkul\Attribute\Models\AttributeOption; use Webkul\Attribute\Models\AttributeOption;
use Webkul\BookingProduct\Models\BookingProduct; use Webkul\BookingProduct\Models\BookingProduct;
use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Checkout\Models\Cart;
use Webkul\Checkout\Models\CartAddress;
use Webkul\Checkout\Models\CartItem;
use Webkul\Customer\Models\Customer;
use Webkul\Customer\Models\CustomerAddress;
use Webkul\Product\Models\Product;
use Webkul\Product\Models\ProductAttributeValue; use Webkul\Product\Models\ProductAttributeValue;
use Webkul\Product\Models\ProductDownloadableLink; use Webkul\Product\Models\ProductDownloadableLink;
use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Product\Models\ProductDownloadableLinkTranslation; use Webkul\Product\Models\ProductDownloadableLinkTranslation;
use Webkul\Product\Models\ProductInventory;
/** class Bagisto extends Laravel
* Class Laravel5Helper
*
* @package Webkul\Core\Helpers
*/
class Laravel5Helper extends Laravel
{ {
public const SIMPLE_PRODUCT = 1; public const SIMPLE_PRODUCT = 1;
@ -91,7 +83,7 @@ class Laravel5Helper extends Laravel
$grand_total = '0.0000'; $grand_total = '0.0000';
$base_grand_total = '0.0000'; $base_grand_total = '0.0000';
} else { } else {
$grand_total = (string)$faker->numberBetween(1, 666); $grand_total = (string) $faker->numberBetween(1, 666);
$base_grand_total = $grand_total; $base_grand_total = $grand_total;
} }
@ -165,7 +157,6 @@ class Laravel5Helper extends Laravel
session()->invalidate(); session()->invalidate();
} }
/** /**
* Helper function to generate products for testing. * Helper function to generate products for testing.
* *
@ -326,7 +317,7 @@ class Laravel5Helper extends Laravel
->where(['code' => 'brand']) ->where(['code' => 'brand'])
->firstOrFail(); // usually 25 ->firstOrFail(); // usually 25
if (!AttributeOption::query() if (! AttributeOption::query()
->where(['attribute_id' => $brand->id]) ->where(['attribute_id' => $brand->id])
->exists()) { ->exists()) {
AttributeOption::create([ AttributeOption::create([

View File

@ -2,11 +2,10 @@
namespace Helper; namespace Helper;
use Codeception\Module;
use Faker\Factory; use Faker\Factory;
use Faker\Generator; use Faker\Generator;
class DataMocker extends Module class DataMocker extends \Codeception\Module
{ {
/** /**
* Faker instance. * Faker instance.

View File

@ -2,6 +2,7 @@
/** /**
* Inherited methods. * Inherited methods.
*
* @method void wantToTest($text) * @method void wantToTest($text)
* @method void wantTo($text) * @method void wantTo($text)
* @method void execute($callable) * @method void execute($callable)

View File

@ -4,6 +4,7 @@ use Codeception\Stub;
/** /**
* Inherited methods. * Inherited methods.
*
* @method void wantToTest($text) * @method void wantToTest($text)
* @method void wantTo($text) * @method void wantTo($text)
* @method void execute($callable) * @method void execute($callable)

View File

@ -6,9 +6,9 @@ modules:
- \Helper\DataMocker - \Helper\DataMocker
- Laravel: - Laravel:
cleanup: true cleanup: true
database_seeder_class: DatabaseSeeder
environment_file: .env.testing environment_file: .env.testing
parts: ORM database_seeder_class: DatabaseSeeder
packages: packages
run_database_migrations: false run_database_migrations: false
run_database_seeder: false run_database_seeder: false
- REST: - REST:

View File

@ -1,15 +1,15 @@
actor: FunctionalTester actor: FunctionalTester
modules: modules:
enabled: enabled:
- \Helper\Functional
- \Helper\DataMocker
- Asserts - Asserts
- Webkul\Core\Helpers\Laravel5Helper: - \Helper\DataMocker
environment_file: .env.testing - \Helper\Functional
packages: packages - \Helper\Bagisto:
cleanup: false cleanup: false
environment_file: .env.testing
database_seeder_class: DatabaseSeeder
packages: packages
run_database_migrations: true run_database_migrations: true
run_database_seeder: true run_database_seeder: true
database_seeder_class: DatabaseSeeder
step_decorators: ~ step_decorators: ~

View File

@ -15,14 +15,13 @@ class AttributeCest
*/ */
public function testIndex(FunctionalTester $I): void public function testIndex(FunctionalTester $I): void
{ {
$attribute = $I->have(Attribute::class);
$I->loginAsAdmin(); $I->loginAsAdmin();
$I->amOnAdminRoute('admin.catalog.attributes.index'); $I->amOnAdminRoute('admin.catalog.attributes.index');
$I->seeCurrentRouteIs('admin.catalog.attributes.index'); $I->seeCurrentRouteIs('admin.catalog.attributes.index');
$I->see("{$attribute->id}", '//script[@type="text/x-template"]'); $I->sendAjaxGetRequest(route('admin.catalog.attributes.index'));
$I->seeResponseCodeIsSuccessful();
} }
/** /**
@ -64,7 +63,6 @@ class AttributeCest
$I->amOnAdminRoute('admin.catalog.attributes.index'); $I->amOnAdminRoute('admin.catalog.attributes.index');
$route = route('admin.catalog.attributes.edit', ['id' => $attribute->id]); $route = route('admin.catalog.attributes.edit', ['id' => $attribute->id]);
$I->seeInSource($route);
$I->amOnPage($route); $I->amOnPage($route);
$I->seeCurrentRouteIs('admin.catalog.attributes.edit'); $I->seeCurrentRouteIs('admin.catalog.attributes.edit');
@ -98,7 +96,7 @@ class AttributeCest
'price', 'price',
'boolean', 'boolean',
'select', 'select',
'multiselect' 'multiselect',
]), ]),
'admin_name' => $I->fake()->firstName, 'admin_name' => $I->fake()->firstName,
]; ];

View File

@ -9,14 +9,13 @@ class AttributeFamilyCest
{ {
public function testIndex(FunctionalTester $I): void public function testIndex(FunctionalTester $I): void
{ {
$attributeFamily = $I->have(AttributeFamily::class);
$I->loginAsAdmin(); $I->loginAsAdmin();
$I->amOnAdminRoute('admin.catalog.families.index'); $I->amOnAdminRoute('admin.catalog.families.index');
$I->seeCurrentRouteIs('admin.catalog.families.index'); $I->seeCurrentRouteIs('admin.catalog.families.index');
$I->see("{$attributeFamily->id}", '//script[@type="text/x-template"]'); $I->sendAjaxGetRequest(route('admin.catalog.families.index'));
$I->seeResponseCodeIsSuccessful();
} }
public function testCreate(FunctionalTester $I): void public function testCreate(FunctionalTester $I): void
@ -46,7 +45,6 @@ class AttributeFamilyCest
$I->amOnAdminRoute('admin.catalog.families.index'); $I->amOnAdminRoute('admin.catalog.families.index');
$route = route('admin.catalog.families.edit', ['id' => $attributeFamily->id]); $route = route('admin.catalog.families.edit', ['id' => $attributeFamily->id]);
$I->seeInSource($route);
$I->amOnPage($route); $I->amOnPage($route);
$I->seeCurrentRouteIs('admin.catalog.families.edit'); $I->seeCurrentRouteIs('admin.catalog.families.edit');
@ -63,15 +61,12 @@ class AttributeFamilyCest
$I->seeCurrentRouteIs('admin.catalog.families.index'); $I->seeCurrentRouteIs('admin.catalog.families.index');
} }
/**
* @param FunctionalTester $I
*
* @return array with the test-data
*/
private function fillForm(FunctionalTester $I): array private function fillForm(FunctionalTester $I): array
{ {
$testData = [ $testData = [
// code needs to match to: '/^[a-zA-Z]+[a-zA-Z0-9_]+$/' /**
* Code needs to match: '/^[a-zA-Z]+[a-zA-Z0-9_]+$/'
*/
'code' => $I->fake()->word . strtr($I->fake()->uuid, ['-' => '_']), 'code' => $I->fake()->word . strtr($I->fake()->uuid, ['-' => '_']),
'name' => $I->fake()->sentence, 'name' => $I->fake()->sentence,
]; ];

View File

@ -3,19 +3,17 @@
namespace Tests\Functional\Admin\Catalog; namespace Tests\Functional\Admin\Catalog;
use FunctionalTester; use FunctionalTester;
use Webkul\Category\Models\Category;
class CategoryCest class CategoryCest
{ {
public function testIndex(FunctionalTester $I): void public function testIndex(FunctionalTester $I): void
{ {
$category = $I->have(Category::class);
$I->loginAsAdmin(); $I->loginAsAdmin();
$I->amOnAdminRoute('admin.catalog.categories.index'); $I->amOnAdminRoute('admin.catalog.categories.index');
$I->seeCurrentRouteIs('admin.catalog.categories.index'); $I->seeCurrentRouteIs('admin.catalog.categories.index');
$I->see("{$category->id}", '//script[@type="text/x-template"]'); $I->sendAjaxGetRequest(route('admin.catalog.categories.index'));
$I->seeResponseCodeIsSuccessful();
} }
} }

View File

@ -4,12 +4,11 @@ namespace Tests\Functional\Admin\Catalog;
use Faker\Factory; use Faker\Factory;
use FunctionalTester; use FunctionalTester;
use Webkul\Core\Models\Locale;
use Webkul\Product\Models\Product;
use Webkul\Attribute\Models\Attribute; use Webkul\Attribute\Models\Attribute;
use Webkul\Core\Helpers\Laravel5Helper;
use Webkul\Attribute\Models\AttributeFamily; use Webkul\Attribute\Models\AttributeFamily;
use Webkul\Attribute\Models\AttributeOption; use Webkul\Attribute\Models\AttributeOption;
use Webkul\Core\Models\Locale;
use Webkul\Product\Models\Product;
use Webkul\Product\Models\ProductAttributeValue; use Webkul\Product\Models\ProductAttributeValue;
class ProductCest class ProductCest
@ -73,14 +72,13 @@ class ProductCest
public function testIndex(FunctionalTester $I): void public function testIndex(FunctionalTester $I): void
{ {
$product = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, [], ['simple']);
$I->loginAsAdmin(); $I->loginAsAdmin();
$I->amOnAdminRoute('admin.catalog.products.index'); $I->amOnAdminRoute('admin.catalog.products.index');
$I->seeCurrentRouteIs('admin.catalog.products.index'); $I->seeCurrentRouteIs('admin.catalog.products.index');
$I->see("{$product->id}", '//script[@type="text/x-template"]'); $I->sendAjaxGetRequest(route('admin.catalog.products.index'));
$I->seeResponseCodeIsSuccessful();
} }
public function selectEmptyAttributeOptionOnProductCreation(FunctionalTester $I): void public function selectEmptyAttributeOptionOnProductCreation(FunctionalTester $I): void
@ -131,13 +129,13 @@ class ProductCest
$productAttribute = $I->grabRecord(ProductAttributeValue::class, [ $productAttribute = $I->grabRecord(ProductAttributeValue::class, [
'product_id' => $product->id, 'product_id' => $product->id,
'attribute_id' => $this->attributeBrand->id, 'attribute_id' => $this->attributeBrand->id,
'integer_value' => $this->attributeBrandDefaultOption->id 'integer_value' => $this->attributeBrandDefaultOption->id,
]); ]);
$I->seeRecord(ProductAttributeValue::class, [ $I->seeRecord(ProductAttributeValue::class, [
'product_id' => $product->id, 'product_id' => $product->id,
'attribute_id' => $this->attributeBrand->id, 'attribute_id' => $this->attributeBrand->id,
'integer_value' => $this->attributeBrandDefaultOption->id 'integer_value' => $this->attributeBrandDefaultOption->id,
]); ]);
$I->assertNull($productAttribute->text_value); $I->assertNull($productAttribute->text_value);

View File

@ -9,14 +9,13 @@ class CustomerCest
{ {
public function testIndex(FunctionalTester $I): void public function testIndex(FunctionalTester $I): void
{ {
$customer = $I->have(Customer::class);
$I->loginAsAdmin(); $I->loginAsAdmin();
$I->amOnAdminRoute('admin.customer.index'); $I->amOnAdminRoute('admin.customer.index');
$I->seeCurrentRouteIs('admin.customer.index'); $I->seeCurrentRouteIs('admin.customer.index');
$I->see("{$customer->id}", '//script[@type="text/x-template"]'); $I->sendAjaxGetRequest(route('admin.customer.index'));
$I->seeResponseCodeIsSuccessful();
} }
public function testCreate(FunctionalTester $I): void public function testCreate(FunctionalTester $I): void
@ -38,11 +37,6 @@ class CustomerCest
$I->seeRecord(Customer::class, $testData); $I->seeRecord(Customer::class, $testData);
} }
/**
* @param FunctionalTester $I
*
* @return array with the test-data
*/
private function fillForm(FunctionalTester $I): array private function fillForm(FunctionalTester $I): array
{ {
$testData = [ $testData = [

View File

@ -3,14 +3,14 @@
namespace Tests\Functional\Admin\Customer; namespace Tests\Functional\Admin\Customer;
use FunctionalTester; use FunctionalTester;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
use Webkul\Product\Models\ProductReview; use Webkul\Product\Models\ProductReview;
class ReviewCest class ReviewCest
{ {
public function testIndex(FunctionalTester $I): void public function testIndex(FunctionalTester $I): void
{ {
$product = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, [], ['simple']); $product = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, [], ['simple']);
$review = $I->have(ProductReview::class, ['product_id' => $product->id]); $review = $I->have(ProductReview::class, ['product_id' => $product->id]);
$I->loginAsAdmin(); $I->loginAsAdmin();

View File

@ -9,7 +9,7 @@ use Webkul\Sales\Models\Order;
use Webkul\Sales\Models\OrderItem; use Webkul\Sales\Models\OrderItem;
use Webkul\Sales\Models\OrderAddress; use Webkul\Sales\Models\OrderAddress;
use Webkul\Sales\Models\OrderPayment; use Webkul\Sales\Models\OrderPayment;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
class OrderCest class OrderCest
{ {
@ -47,7 +47,7 @@ class OrderCest
private function generateCashOnDeliveryOrder(FunctionalTester $I) private function generateCashOnDeliveryOrder(FunctionalTester $I)
{ {
$product = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, [ $product = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, [
'productAttributes' => [], 'productAttributes' => [],
'productInventory' => [ 'productInventory' => [
'qty' => 5, 'qty' => 5,

View File

@ -3,20 +3,17 @@
namespace Tests\Functional\Admin\Sales; namespace Tests\Functional\Admin\Sales;
use FunctionalTester; use FunctionalTester;
use Webkul\Sales\Models\Shipment;
class ShipmentsCest class ShipmentsCest
{ {
public function testIndex(FunctionalTester $I): void public function testIndex(FunctionalTester $I): void
{ {
$shipment = $I->have(Shipment::class);
$I->loginAsAdmin(); $I->loginAsAdmin();
$I->amOnAdminRoute('admin.sales.shipments.index'); $I->amOnAdminRoute('admin.sales.shipments.index');
$I->seeCurrentRouteIs('admin.sales.shipments.index'); $I->seeCurrentRouteIs('admin.sales.shipments.index');
$I->see("{$shipment->id}", '//script[@type="text/x-template"]'); $I->sendAjaxGetRequest(route('admin.sales.shipments.index'));
$I->see("{$shipment->total_qty}", '//script[@type="text/x-template"]'); $I->seeResponseCodeIsSuccessful();
} }
} }

View File

@ -3,7 +3,7 @@
namespace Tests\Functional\Checkout\Cart; namespace Tests\Functional\Checkout\Cart;
use FunctionalTester; use FunctionalTester;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
class CartCest class CartCest
{ {
@ -22,8 +22,8 @@ class CartCest
'status' => 1, 'status' => 1,
], ],
]; ];
$this->productWithQuantityBox = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $productConfig); $this->productWithQuantityBox = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $productConfig);
$this->productWithoutQuantityBox = $I->haveProduct(Laravel5Helper::DOWNLOADABLE_PRODUCT, $productConfig); $this->productWithoutQuantityBox = $I->haveProduct(Bagisto::DOWNLOADABLE_PRODUCT, $productConfig);
} }
public function checkCartWithQuantityBox(FunctionalTester $I): void public function checkCartWithQuantityBox(FunctionalTester $I): void

View File

@ -5,7 +5,7 @@ namespace Tests\Functional\Product;
use FunctionalTester; use FunctionalTester;
use Webkul\Product\Models\Product; use Webkul\Product\Models\Product;
use Webkul\Product\Models\ProductFlat; use Webkul\Product\Models\ProductFlat;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
use Webkul\Product\Models\ProductInventory; use Webkul\Product\Models\ProductInventory;
use Webkul\Product\Models\ProductAttributeValue; use Webkul\Product\Models\ProductAttributeValue;
@ -20,7 +20,7 @@ class ProductCopyCest
{ {
config(['products.skipAttributesOnCopy' => ['name', 'inventories']]); config(['products.skipAttributesOnCopy' => ['name', 'inventories']]);
$original = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, [ $original = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, [
'productInventory' => [ 'productInventory' => [
'qty' => 10, 'qty' => 10,
], ],
@ -46,7 +46,7 @@ class ProductCopyCest
public function testBlockProductCopy(FunctionalTester $I) public function testBlockProductCopy(FunctionalTester $I)
{ {
$original = $I->haveProduct(Laravel5Helper::BOOKING_EVENT_PRODUCT, []); $original = $I->haveProduct(Bagisto::BOOKING_EVENT_PRODUCT, []);
$I->amOnAdminRoute('admin.catalog.products.copy', ['id' => $original->id], false); $I->amOnAdminRoute('admin.catalog.products.copy', ['id' => $original->id], false);
@ -60,7 +60,7 @@ class ProductCopyCest
$originalName = $I->fake()->name; $originalName = $I->fake()->name;
$original = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, [ $original = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, [
'productInventory' => [ 'productInventory' => [
'qty' => 10, 'qty' => 10,
], ],

View File

@ -9,7 +9,7 @@ use Webkul\Tax\Models\TaxRate;
use Webkul\Tax\Models\TaxCategory; use Webkul\Tax\Models\TaxCategory;
use Webkul\Customer\Models\Customer; use Webkul\Customer\Models\Customer;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
use Webkul\Customer\Models\CustomerAddress; use Webkul\Customer\Models\CustomerAddress;
class CartTaxesCest class CartTaxesCest
@ -52,7 +52,7 @@ class CartTaxesCest
'tax_category_id' => $taxCategory1->id, 'tax_category_id' => $taxCategory1->id,
], ],
]; ];
$product1 = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $config1); $product1 = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $config1);
$config2 = [ $config2 = [
'productInventory' => ['qty' => 100], 'productInventory' => ['qty' => 100],
@ -62,7 +62,7 @@ class CartTaxesCest
'tax_category_id' => $taxCategory2->id, 'tax_category_id' => $taxCategory2->id,
], ],
]; ];
$product2 = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $config2); $product2 = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $config2);
$prod1Quantity = $I->fake()->numberBetween(9, 30); $prod1Quantity = $I->fake()->numberBetween(9, 30);
// quantity of product1 should be odd // quantity of product1 should be odd
@ -215,7 +215,7 @@ class CartTaxesCest
'tax_category_id' => $taxCategory1->id, 'tax_category_id' => $taxCategory1->id,
], ],
]; ];
$product1 = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $config1); $product1 = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $config1);
$config2 = [ $config2 = [
'productInventory' => ['qty' => 100], 'productInventory' => ['qty' => 100],
@ -225,7 +225,7 @@ class CartTaxesCest
'tax_category_id' => $taxCategory2->id, 'tax_category_id' => $taxCategory2->id,
], ],
]; ];
$product2 = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $config2); $product2 = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $config2);
$customer = $I->have(Customer::class); $customer = $I->have(Customer::class);

View File

@ -5,7 +5,7 @@ namespace Tests\Functional\Shop;
use Faker\Factory; use Faker\Factory;
use FunctionalTester; use FunctionalTester;
use Codeception\Example; use Codeception\Example;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
class GuestCheckoutCest class GuestCheckoutCest
{ {
@ -34,10 +34,10 @@ class GuestCheckoutCest
], ],
]; ];
$this->productNoGuestCheckout = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $pConfigDefault); $this->productNoGuestCheckout = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $pConfigDefault);
$this->productNoGuestCheckout->refresh(); $this->productNoGuestCheckout->refresh();
$this->productGuestCheckout = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $pConfigGuestCheckout); $this->productGuestCheckout = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $pConfigGuestCheckout);
$this->productGuestCheckout->refresh(); $this->productGuestCheckout->refresh();
} }

View File

@ -4,11 +4,11 @@ modules:
- Asserts - Asserts
- Filesystem - Filesystem
- \Helper\Unit - \Helper\Unit
- Laravel: - \Helper\Bagisto:
environment_file: .env.testing environment_file: .env.testing
run_database_migrations: true
run_database_seeder: true
database_seeder_class: DatabaseSeeder database_seeder_class: DatabaseSeeder
packages: packages packages: packages
run_database_migrations: true
run_database_seeder: true
step_decorators: ~ step_decorators: ~

View File

@ -3,13 +3,13 @@ modules:
enabled: enabled:
- Asserts - Asserts
- Filesystem - Filesystem
- \Helper\Unit
- \Helper\DataMocker - \Helper\DataMocker
- Webkul\Core\Helpers\Laravel5Helper: - \Helper\Unit
- \Helper\Bagisto:
environment_file: .env.testing environment_file: .env.testing
run_database_migrations: true
run_database_seeder: true
database_seeder_class: DatabaseSeeder database_seeder_class: DatabaseSeeder
packages: packages packages: packages
run_database_migrations: true
run_database_seeder: true
step_decorators: ~ step_decorators: ~

View File

@ -6,7 +6,7 @@ use Webkul\BookingProduct\Helpers\EventTicket;
use Webkul\BookingProduct\Models\BookingProduct; use Webkul\BookingProduct\Models\BookingProduct;
use Webkul\BookingProduct\Models\BookingProductEventTicket; use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Checkout\Models\CartItem; use Webkul\Checkout\Models\CartItem;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
use Webkul\Product\Models\Product; use Webkul\Product\Models\Product;
class BookingProductEventTicketCest class BookingProductEventTicketCest
@ -17,7 +17,7 @@ class BookingProductEventTicketCest
{ {
$this->typeHelper = app(EventTicket::class); $this->typeHelper = app(EventTicket::class);
$product = $I->haveProduct(Laravel5Helper::VIRTUAL_PRODUCT); $product = $I->haveProduct(Bagisto::VIRTUAL_PRODUCT);
Product::query()->where('id', $product->id)->update(['type' => 'booking']); Product::query()->where('id', $product->id)->update(['type' => 'booking']);
$availableTo = Carbon::now()->addMinutes($I->fake()->numberBetween(2, 59)); $availableTo = Carbon::now()->addMinutes($I->fake()->numberBetween(2, 59));

View File

@ -10,7 +10,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Webkul\CartRule\Models\CartRule; use Webkul\CartRule\Models\CartRule;
use Webkul\CartRule\Models\CartRuleCoupon; use Webkul\CartRule\Models\CartRuleCoupon;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
use Webkul\Customer\Models\Customer; use Webkul\Customer\Models\Customer;
use Webkul\Customer\Models\CustomerAddress; use Webkul\Customer\Models\CustomerAddress;
use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Arrayable;
@ -728,7 +728,7 @@ class CartRuleCest
'tax_category_id' => $taxCategorie->id, 'tax_category_id' => $taxCategorie->id,
], ],
]; ];
$product = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $productConfig); $product = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $productConfig);
$ruleConfig = [ $ruleConfig = [
'action_type' => self::ACTION_TYPE_PERCENTAGE, 'action_type' => self::ACTION_TYPE_PERCENTAGE,
@ -1161,19 +1161,19 @@ class CartRuleCest
return [ return [
[ [
'productScenario' => self::PRODUCT_FREE, 'productScenario' => self::PRODUCT_FREE,
'productType' => Laravel5Helper::SIMPLE_PRODUCT, 'productType' => Bagisto::SIMPLE_PRODUCT,
'freeOfCharge' => true, 'freeOfCharge' => true,
'reducedTax' => false, 'reducedTax' => false,
], ],
[ [
'productScenario' => self::PRODUCT_NOT_FREE, 'productScenario' => self::PRODUCT_NOT_FREE,
'productType' => Laravel5Helper::SIMPLE_PRODUCT, 'productType' => Bagisto::SIMPLE_PRODUCT,
'freeOfCharge' => false, 'freeOfCharge' => false,
'reducedTax' => false, 'reducedTax' => false,
], ],
[ [
'productScenario' => self::PRODUCT_NOT_FREE_REDUCED_TAX, 'productScenario' => self::PRODUCT_NOT_FREE_REDUCED_TAX,
'productType' => Laravel5Helper::SIMPLE_PRODUCT, 'productType' => Bagisto::SIMPLE_PRODUCT,
'freeOfCharge' => false, 'freeOfCharge' => false,
'reducedTax' => true, 'reducedTax' => true,
], ],

View File

@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Event;
use UnitTester; use UnitTester;
use Webkul\BookingProduct\Models\BookingProduct; use Webkul\BookingProduct\Models\BookingProduct;
use Webkul\BookingProduct\Models\BookingProductEventTicket; use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
use Webkul\Customer\Models\Customer; use Webkul\Customer\Models\Customer;
use Webkul\Product\Models\ProductDownloadableLink; use Webkul\Product\Models\ProductDownloadableLink;
@ -32,37 +32,37 @@ class CartCest
$this->sessionToken = $this->faker->uuid; $this->sessionToken = $this->faker->uuid;
session(['_token' => $this->sessionToken]); session(['_token' => $this->sessionToken]);
$this->simpleProduct1 = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT); $this->simpleProduct1 = $I->haveProduct(Bagisto::SIMPLE_PRODUCT);
cart()->addProduct($this->simpleProduct1->id, [ cart()->addProduct($this->simpleProduct1->id, [
'_token' => session('_token'), '_token' => session('_token'),
'product_id' => $this->simpleProduct1->id, 'product_id' => $this->simpleProduct1->id,
'quantity' => 1, 'quantity' => 1,
]); ]);
$this->simpleProduct2 = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT); $this->simpleProduct2 = $I->haveProduct(Bagisto::SIMPLE_PRODUCT);
cart()->addProduct($this->simpleProduct2->id, [ cart()->addProduct($this->simpleProduct2->id, [
'_token' => session('_token'), '_token' => session('_token'),
'product_id' => $this->simpleProduct2->id, 'product_id' => $this->simpleProduct2->id,
'quantity' => 1, 'quantity' => 1,
]); ]);
$this->virtualProduct1 = $I->haveProduct(Laravel5Helper::VIRTUAL_PRODUCT); $this->virtualProduct1 = $I->haveProduct(Bagisto::VIRTUAL_PRODUCT);
cart()->addProduct($this->virtualProduct1->id, [ cart()->addProduct($this->virtualProduct1->id, [
'_token' => session('_token'), '_token' => session('_token'),
'product_id' => $this->virtualProduct1->id, 'product_id' => $this->virtualProduct1->id,
'quantity' => 1, 'quantity' => 1,
]); ]);
$this->virtualProduct2 = $I->haveProduct(Laravel5Helper::VIRTUAL_PRODUCT); $this->virtualProduct2 = $I->haveProduct(Bagisto::VIRTUAL_PRODUCT);
cart()->addProduct($this->virtualProduct2->id, [ cart()->addProduct($this->virtualProduct2->id, [
'_token' => session('_token'), '_token' => session('_token'),
'product_id' => $this->virtualProduct2->id, 'product_id' => $this->virtualProduct2->id,
'quantity' => 1, 'quantity' => 1,
]); ]);
$this->downloadableProduct1 = $I->haveProduct(Laravel5Helper::DOWNLOADABLE_PRODUCT); $this->downloadableProduct1 = $I->haveProduct(Bagisto::DOWNLOADABLE_PRODUCT);
$this->downloadableProduct2 = $I->haveProduct(Laravel5Helper::DOWNLOADABLE_PRODUCT); $this->downloadableProduct2 = $I->haveProduct(Bagisto::DOWNLOADABLE_PRODUCT);
$this->customer = $I->have(Customer::class); $this->customer = $I->have(Customer::class);
} }
@ -163,11 +163,11 @@ class CartCest
$product1 = $I->haveProduct($scenario['product_type1']); $product1 = $I->haveProduct($scenario['product_type1']);
$product2 = $I->haveProduct($scenario['product_type2']); $product2 = $I->haveProduct($scenario['product_type2']);
if ($scenario['product_type1'] === Laravel5Helper::DOWNLOADABLE_PRODUCT) { if ($scenario['product_type1'] === Bagisto::DOWNLOADABLE_PRODUCT) {
$downloadableLink1 = ProductDownloadableLink::query()->where('product_id', $product1->id)->firstOrFail(); $downloadableLink1 = ProductDownloadableLink::query()->where('product_id', $product1->id)->firstOrFail();
$I->assertNotNull($downloadableLink1); $I->assertNotNull($downloadableLink1);
} }
if ($scenario['product_type1'] === Laravel5Helper::BOOKING_EVENT_PRODUCT) { if ($scenario['product_type1'] === Bagisto::BOOKING_EVENT_PRODUCT) {
$bookingProduct = BookingProduct::query()->where('product_id', $product1->id)->firstOrFail(); $bookingProduct = BookingProduct::query()->where('product_id', $product1->id)->firstOrFail();
$I->assertNotNull($bookingProduct); $I->assertNotNull($bookingProduct);
$bookingTicket1 = BookingProductEventTicket::query()->where('booking_product_id', $bookingTicket1 = BookingProductEventTicket::query()->where('booking_product_id',
@ -175,11 +175,11 @@ class CartCest
$I->assertNotNull($bookingTicket1); $I->assertNotNull($bookingTicket1);
} }
if ($scenario['product_type2'] === Laravel5Helper::DOWNLOADABLE_PRODUCT) { if ($scenario['product_type2'] === Bagisto::DOWNLOADABLE_PRODUCT) {
$downloadableLink2 = ProductDownloadableLink::query()->where('product_id', $product2->id)->firstOrFail(); $downloadableLink2 = ProductDownloadableLink::query()->where('product_id', $product2->id)->firstOrFail();
$I->assertNotNull($downloadableLink2); $I->assertNotNull($downloadableLink2);
} }
if ($scenario['product_type2'] === Laravel5Helper::BOOKING_EVENT_PRODUCT) { if ($scenario['product_type2'] === Bagisto::BOOKING_EVENT_PRODUCT) {
$bookingProduct = BookingProduct::query()->where('product_id', $product2->id)->firstOrFail(); $bookingProduct = BookingProduct::query()->where('product_id', $product2->id)->firstOrFail();
$I->assertNotNull($bookingProduct); $I->assertNotNull($bookingProduct);
$bookingTicket2 = BookingProductEventTicket::query()->where('booking_product_id', $bookingTicket2 = BookingProductEventTicket::query()->where('booking_product_id',
@ -197,10 +197,10 @@ class CartCest
'quantity' => 1, 'quantity' => 1,
'product_id' => $product1->id, 'product_id' => $product1->id,
]; ];
if ($scenario['product_type1'] === Laravel5Helper::DOWNLOADABLE_PRODUCT) { if ($scenario['product_type1'] === Bagisto::DOWNLOADABLE_PRODUCT) {
$data['links'] = [$downloadableLink1->id]; $data['links'] = [$downloadableLink1->id];
} }
if ($scenario['product_type1'] === Laravel5Helper::BOOKING_EVENT_PRODUCT) { if ($scenario['product_type1'] === Bagisto::BOOKING_EVENT_PRODUCT) {
$data['booking'] = ['qty' => [$bookingTicket1->id => 1]]; $data['booking'] = ['qty' => [$bookingTicket1->id => 1]];
} }
@ -220,10 +220,10 @@ class CartCest
'quantity' => 1, 'quantity' => 1,
'product_id' => $product2->id, 'product_id' => $product2->id,
]; ];
if ($scenario['product_type2'] === Laravel5Helper::DOWNLOADABLE_PRODUCT) { if ($scenario['product_type2'] === Bagisto::DOWNLOADABLE_PRODUCT) {
$data['links'] = [$downloadableLink2->id]; $data['links'] = [$downloadableLink2->id];
} }
if ($scenario['product_type2'] === Laravel5Helper::BOOKING_EVENT_PRODUCT) { if ($scenario['product_type2'] === Bagisto::BOOKING_EVENT_PRODUCT) {
$data['booking'] = ['qty' => [$bookingTicket2->id => 1]]; $data['booking'] = ['qty' => [$bookingTicket2->id => 1]];
} }
@ -243,10 +243,10 @@ class CartCest
'quantity' => 2, 'quantity' => 2,
'product_id' => $product1->id, 'product_id' => $product1->id,
]; ];
if ($scenario['product_type1'] === Laravel5Helper::DOWNLOADABLE_PRODUCT) { if ($scenario['product_type1'] === Bagisto::DOWNLOADABLE_PRODUCT) {
$data['links'] = [$downloadableLink1->id]; $data['links'] = [$downloadableLink1->id];
} }
if ($scenario['product_type1'] === Laravel5Helper::BOOKING_EVENT_PRODUCT) { if ($scenario['product_type1'] === Bagisto::BOOKING_EVENT_PRODUCT) {
$data['booking'] = ['qty' => [$bookingTicket1->id => 2]]; $data['booking'] = ['qty' => [$bookingTicket1->id => 2]];
} }
@ -271,68 +271,68 @@ class CartCest
{ {
return [ return [
[ [
'product_type1' => Laravel5Helper::SIMPLE_PRODUCT, 'product_type1' => Bagisto::SIMPLE_PRODUCT,
'product_type2' => Laravel5Helper::SIMPLE_PRODUCT, 'product_type2' => Bagisto::SIMPLE_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::VIRTUAL_PRODUCT, 'product_type1' => Bagisto::VIRTUAL_PRODUCT,
'product_type2' => Laravel5Helper::VIRTUAL_PRODUCT, 'product_type2' => Bagisto::VIRTUAL_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::SIMPLE_PRODUCT, 'product_type1' => Bagisto::SIMPLE_PRODUCT,
'product_type2' => Laravel5Helper::VIRTUAL_PRODUCT, 'product_type2' => Bagisto::VIRTUAL_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::VIRTUAL_PRODUCT, 'product_type1' => Bagisto::VIRTUAL_PRODUCT,
'product_type2' => Laravel5Helper::SIMPLE_PRODUCT, 'product_type2' => Bagisto::SIMPLE_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::DOWNLOADABLE_PRODUCT, 'product_type1' => Bagisto::DOWNLOADABLE_PRODUCT,
'product_type2' => Laravel5Helper::DOWNLOADABLE_PRODUCT, 'product_type2' => Bagisto::DOWNLOADABLE_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::DOWNLOADABLE_PRODUCT, 'product_type1' => Bagisto::DOWNLOADABLE_PRODUCT,
'product_type2' => Laravel5Helper::SIMPLE_PRODUCT, 'product_type2' => Bagisto::SIMPLE_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::SIMPLE_PRODUCT, 'product_type1' => Bagisto::SIMPLE_PRODUCT,
'product_type2' => Laravel5Helper::DOWNLOADABLE_PRODUCT, 'product_type2' => Bagisto::DOWNLOADABLE_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::DOWNLOADABLE_PRODUCT, 'product_type1' => Bagisto::DOWNLOADABLE_PRODUCT,
'product_type2' => Laravel5Helper::VIRTUAL_PRODUCT, 'product_type2' => Bagisto::VIRTUAL_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::VIRTUAL_PRODUCT, 'product_type1' => Bagisto::VIRTUAL_PRODUCT,
'product_type2' => Laravel5Helper::DOWNLOADABLE_PRODUCT, 'product_type2' => Bagisto::DOWNLOADABLE_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::BOOKING_EVENT_PRODUCT, 'product_type1' => Bagisto::BOOKING_EVENT_PRODUCT,
'product_type2' => Laravel5Helper::BOOKING_EVENT_PRODUCT, 'product_type2' => Bagisto::BOOKING_EVENT_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::BOOKING_EVENT_PRODUCT, 'product_type1' => Bagisto::BOOKING_EVENT_PRODUCT,
'product_type2' => Laravel5Helper::SIMPLE_PRODUCT, 'product_type2' => Bagisto::SIMPLE_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::SIMPLE_PRODUCT, 'product_type1' => Bagisto::SIMPLE_PRODUCT,
'product_type2' => Laravel5Helper::BOOKING_EVENT_PRODUCT, 'product_type2' => Bagisto::BOOKING_EVENT_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::BOOKING_EVENT_PRODUCT, 'product_type1' => Bagisto::BOOKING_EVENT_PRODUCT,
'product_type2' => Laravel5Helper::VIRTUAL_PRODUCT, 'product_type2' => Bagisto::VIRTUAL_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::VIRTUAL_PRODUCT, 'product_type1' => Bagisto::VIRTUAL_PRODUCT,
'product_type2' => Laravel5Helper::BOOKING_EVENT_PRODUCT, 'product_type2' => Bagisto::BOOKING_EVENT_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::BOOKING_EVENT_PRODUCT, 'product_type1' => Bagisto::BOOKING_EVENT_PRODUCT,
'product_type2' => Laravel5Helper::DOWNLOADABLE_PRODUCT, 'product_type2' => Bagisto::DOWNLOADABLE_PRODUCT,
], ],
[ [
'product_type1' => Laravel5Helper::DOWNLOADABLE_PRODUCT, 'product_type1' => Bagisto::DOWNLOADABLE_PRODUCT,
'product_type2' => Laravel5Helper::BOOKING_EVENT_PRODUCT, 'product_type2' => Bagisto::BOOKING_EVENT_PRODUCT,
], ],
]; ];
} }

View File

@ -5,7 +5,7 @@ namespace Tests\Unit\Checkout\Cart\Models;
use Cart; use Cart;
use UnitTester; use UnitTester;
use Faker\Factory; use Faker\Factory;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
class CartModelCest class CartModelCest
{ {
@ -31,9 +31,9 @@ class CartModelCest
'status' => 1, 'status' => 1,
], ],
]; ];
$this->productWithQuantityBox = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $productConfig); $this->productWithQuantityBox = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $productConfig);
$this->productWithoutQuantityBox = $I->haveProduct(Laravel5Helper::DOWNLOADABLE_PRODUCT, $productConfig); $this->productWithoutQuantityBox = $I->haveProduct(Bagisto::DOWNLOADABLE_PRODUCT, $productConfig);
} }
public function testHasProductsWithQuantityBox(UnitTester $I) public function testHasProductsWithQuantityBox(UnitTester $I)

View File

@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Log;
use UnitTester; use UnitTester;
use Webkul\BookingProduct\Models\BookingProduct; use Webkul\BookingProduct\Models\BookingProduct;
use Webkul\BookingProduct\Models\BookingProductEventTicket; use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Core\Helpers\Laravel5Helper; use Helper\Bagisto;
use Webkul\Product\Models\Product; use Webkul\Product\Models\Product;
class BookingCronCest class BookingCronCest
@ -17,7 +17,7 @@ class BookingCronCest
$index = $I->fake()->numberBetween(2, 6); $index = $I->fake()->numberBetween(2, 6);
for ($i=0; $i<$index; $i++) { for ($i=0; $i<$index; $i++) {
$products[$i] = $I->haveProduct(Laravel5Helper::VIRTUAL_PRODUCT); $products[$i] = $I->haveProduct(Bagisto::VIRTUAL_PRODUCT);
Product::query()->where('id', $products[$i]->id)->update(['type' => 'booking']); Product::query()->where('id', $products[$i]->id)->update(['type' => 'booking']);
if ($I->fake()->randomDigitNotNull <= 5) { if ($I->fake()->randomDigitNotNull <= 5) {

Some files were not shown because too many files have changed in this diff Show More