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\Repositories\CustomerRepository;
use Webkul\Ui\DataGrid\DataGrid;
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
class AddressDataGrid extends DataGrid
{
use ProvideDataGridPlus;
/**
* Index.
*

View File

@ -7,23 +7,39 @@ use Webkul\Ui\DataGrid\DataGrid;
class CartRuleCouponDataGrid extends DataGrid
{
/**
* Index.
*
* @var string
*/
protected $index = 'id';
/**
* Sort order.
*
* @var string
*/
protected $sortOrder = 'desc';
/**
* Prepare query builder.
*
* @return void
*/
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')
->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);
}
/**
* Add columns.
*
* @return void
*/
public function addColumns()
{
$this->addColumn([
@ -72,6 +88,11 @@ class CartRuleCouponDataGrid extends DataGrid
]);
}
/**
* Prepare mass actions.
*
* @return void
*/
public function prepareMassActions()
{
$this->addMassAction([

View File

@ -5,12 +5,9 @@ namespace Webkul\Admin\DataGrids;
use Illuminate\Support\Facades\DB;
use Webkul\Sales\Models\OrderAddress;
use Webkul\Ui\DataGrid\DataGrid;
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
class CustomerOrderDataGrid extends DataGrid
{
use ProvideDataGridPlus;
/**
* 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>';
} elseif ($value->status == 'completed') {
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>';
} 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>';
} 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>';
} 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>';
} 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>';
}
},

View File

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

View File

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

View File

@ -2,15 +2,12 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Ui\DataGrid\DataGrid;
use Illuminate\Support\Facades\DB;
use Webkul\Sales\Models\OrderAddress;
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
use Webkul\Ui\DataGrid\DataGrid;
class OrderDataGrid extends DataGrid
{
use ProvideDataGridPlus;
/**
* 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>';
} elseif ($value->status == 'completed') {
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>';
} 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>';
} 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>';
} 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>';
} 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>';
}
},

View File

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

View File

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

View File

@ -3,6 +3,8 @@
namespace Webkul\Admin\Http\Controllers\Sales;
use Illuminate\Http\Request;
use Webkul\Admin\DataGrids\InvoicesTransactionsDatagrid;
use Webkul\Admin\DataGrids\OrderInvoicesDataGrid;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Admin\Traits\Mails;
use Webkul\Core\Traits\PDFHandler;
@ -61,9 +63,24 @@ class InvoiceController extends Controller
*/
public function index()
{
if (request()->ajax()) {
return app(OrderInvoicesDataGrid::class)->toJson();
}
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.
*

View File

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

View File

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

View File

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

View File

@ -12,7 +12,10 @@
</div>
<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') }}
</a>
</div>
@ -21,9 +24,7 @@
{!! view_render_event('bagisto.admin.catalog.attributes.list.before') !!}
<div class="page-content">
{!! app('Webkul\Admin\DataGrids\AttributeDataGrid')->render() !!}
<datagrid-plus src="{{ route('admin.catalog.attributes.index') }}"></datagrid-plus>
</div>
{!! 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')
@ -13,15 +15,20 @@
<h1>{{ __('admin::app.catalog.categories.title') }}</h1>
<div class="control-group">
<select class="control" id="locale-switcher" name="locale"
onchange="reloadPage('locale', this.value)">
<select
class="control"
id="locale-switcher"
name="locale"
onchange="reloadPage('locale', this.value)"
>
<option value="all" {{ ! isset($locale) ? 'selected' : '' }}>
{{ __('admin::app.admin.system.all-locales') }}
</option>
@foreach (core()->getAllLocales() as $localeModel)
<option
value="{{ $localeModel->code }}" {{ (isset($locale) && ($localeModel->code) == $locale) ? 'selected' : '' }}>
value="{{ $localeModel->code }}" {{ (isset($locale) && ($localeModel->code) == $locale) ? 'selected' : '' }}
>
{{ $localeModel->name }}
</option>
@endforeach
@ -39,9 +46,7 @@
{!! view_render_event('bagisto.admin.catalog.categories.list.before') !!}
<div class="page-content">
@inject('categories', 'Webkul\Admin\DataGrids\CategoryDataGrid')
{!! $categories->render() !!}
<datagrid-plus src="{{ route('admin.catalog.categories.index') }}"></datagrid-plus>
</div>
{!! view_render_event('bagisto.admin.catalog.categories.list.after') !!}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,24 +5,15 @@
@stop
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.customers.subscribers.title') }}</h1>
</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 class="page-content">
@inject('subscribers','Webkul\Admin\DataGrids\NewsLetterDataGrid')
{!! $subscribers->render() !!}
<datagrid-plus src="{{ route('admin.customers.subscribers.index') }}"></datagrid-plus>
</div>
</div>
@stop

View File

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

View File

@ -39,7 +39,6 @@
<accordian :title="'{{ __('admin::app.promotions.cart-rules.rule-information') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
<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' : '' }}/>
</div>
</div>
</accordian>
<accordian :title="'{{ __('admin::app.promotions.cart-rules.conditions') }}'" :active="false">
<div slot="body">
<div class="control-group">
<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">
{{ __('admin::app.promotions.cart-rules.add-condition') }}
</button>
</div>
</accordian>
<accordian :title="'{{ __('admin::app.promotions.cart-rules.actions') }}'" :active="false">
<div slot="body">
<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>
@ -307,14 +302,10 @@
</option>
</select>
</div>
</div>
</accordian>
{!! 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">
<div slot="body">
@ -322,6 +313,9 @@
</div>
</accordian>
</div>
</div>
</form>
</div>
</script>
<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">
<div class="">
<form method="POST" data-vv-scope="create-coupun-form" @submit.prevent="generateCopuns('create-coupun-form')">
<div class="control-group" :class="[errors.has('create-coupun-form.coupon_qty') ? 'has-error' : '']">
<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' : '']">
<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;"/>
<span class="control-error" v-if="errors.has('create-coupun-form.coupon_qty')">
@{{ errors.first('create-coupun-form.coupon_qty') }}
<span class="control-error" v-if="errors.has('create-coupon-form.coupon_qty')">
@{{ errors.first('create-coupon-form.coupon_qty') }}
</span>
</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>
<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')">
@{{ errors.first('create-coupun-form.code_length') }}
<span class="control-error" v-if="errors.has('create-coupon-form.code_length')">
@{{ errors.first('create-coupon-form.code_length') }}
</span>
</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>
<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>
</select>
<span class="control-error" v-if="errors.has('create-coupun-form.code_format')">
@{{ errors.first('create-coupun-form.code_format') }}
<span class="control-error" v-if="errors.has('create-coupon-form.code_format')">
@{{ errors.first('create-coupon-form.code_format') }}
</span>
</div>
@ -465,7 +458,6 @@
<div class="button-group">
<button class="btn btn-xl btn-primary">{{ __('admin::app.promotions.cart-rules.generate') }}</button>
</div>
</form>
<div class="content">
@ -483,19 +475,18 @@
<modal id="downloadDataGrid" :is-open="this.$root.modalIds.downloadDataGrid">
<h3 slot="header">{{ __('admin::app.export.download') }}</h3>
<div slot="body">
<export-form></export-form>
</div>
</modal>
@inject('cartRuleCouponGrid','Webkul\Admin\DataGrids\CartRuleCouponDataGrid')
{!! $cartRuleCouponGrid->render() !!}
<datagrid-plus src="{{ route('admin.cart-rules-coupons.index', $cartRule->id) }}"></datagrid-plus>
</div>
</script>
@push('scripts')
@include('admin::export.export', ['gridName' => $cartRuleCouponGrid])
@include('admin::export.export', ['gridName' => app('Webkul\Admin\DataGrids\CartRuleCouponDataGrid')])
@endpush
<script>
@ -762,19 +753,19 @@
},
methods: {
generateCopuns: function(formScope) {
generateCoupons: function(formScope) {
let self = this;
this.$validator.validateAll(formScope).then(function (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) {
window.flashMessages = [{
'type': 'alert-success',
'message': response.data.message
}];
self.$root.addFlashMessages()
self.$root.addFlashMessages();
})
.catch(function (error) {
window.flashMessages = [{
@ -782,8 +773,8 @@
'message': error.response.data.message
}];
self.$root.addFlashMessages()
})
self.$root.addFlashMessages();
});
}
});
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,27 +2,28 @@
namespace Webkul\Attribute\Http\Controllers;
use Webkul\Admin\DataGrids\AttributeFamilyDataGrid;
use Webkul\Attribute\Repositories\AttributeFamilyRepository;
use Webkul\Attribute\Repositories\AttributeRepository;
class AttributeFamilyController extends Controller
{
/**
* Contains route related configuration
* Contains route related configuration.
*
* @var array
*/
protected $_config;
/**
* AttributeFamilyRepository object
* Attribute family repository instance.
*
* @var \Webkul\Attribute\Repositories\AttributeFamilyRepository
*/
protected $attributeFamilyRepository;
/**
* AttributeRepository object
* Attribute repository instance.
*
* @var \Webkul\Attribute\Repositories\AttributeRepository
*/
@ -38,8 +39,7 @@ class AttributeFamilyController extends Controller
public function __construct(
AttributeFamilyRepository $attributeFamilyRepository,
AttributeRepository $attributeRepository
)
{
) {
$this->attributeFamilyRepository = $attributeFamilyRepository;
$this->attributeRepository = $attributeRepository;
@ -54,6 +54,10 @@ class AttributeFamilyController extends Controller
*/
public function index()
{
if (request()->ajax()) {
return app(AttributeFamilyDataGrid::class)->toJson();
}
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
*/

View File

@ -2,20 +2,21 @@
namespace Webkul\CMS\Http\Controllers\Admin;
use Webkul\Admin\DataGrids\CMSPageDataGrid;
use Webkul\CMS\Http\Controllers\Controller;
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
*/
protected $_config;
/**
* To hold the CMSRepository instance
* To hold the CMS repository instance.
*
* @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
*/
public function index()
{
if (request()->ajax()) {
return app(CMSPageDataGrid::class)->toJson();
}
return view($this->_config['view']);
}
/**
* To create a new CMS page
* To create a new CMS page.
*
* @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
*/
@ -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
* @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
* @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
* @return \Illuminate\Http\Response
@ -134,15 +139,15 @@ use Webkul\CMS\Repositories\CmsRepository;
session()->flash('success', trans('admin::app.cms.pages.delete-success'));
return response()->json(['message' => true], 200);
} else {
}
session()->flash('success', trans('admin::app.cms.pages.delete-failure'));
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
*/

View File

@ -6,7 +6,7 @@ use Exception;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
use Webkul\CartRule\Repositories\CartRuleCouponRepository;
use Webkul\Admin\DataGrids\CartRuleDataGrid;
use Webkul\CartRule\Repositories\CartRuleRepository;
class CartRuleController extends Controller
@ -25,30 +25,18 @@ class CartRuleController extends Controller
*/
protected $cartRuleRepository;
/**
* To hold cart rule coupon repository repository instance.
*
* @var \Webkul\CartRule\Repositories\CartRuleCouponRepository
*/
protected $cartRuleCouponRepository;
/**
* Create a new controller instance.
*
* @param \Webkul\CartRule\Repositories\CartRuleRepository $cartRuleRepository
* @param \Webkul\CartRule\Repositories\CartRuleCouponRepository $cartRuleCouponRepository
*
* @return void
*/
public function __construct(
CartRuleRepository $cartRuleRepository,
CartRuleCouponRepository $cartRuleCouponRepository
CartRuleRepository $cartRuleRepository
) {
$this->_config = request('_config');
$this->cartRuleRepository = $cartRuleRepository;
$this->cartRuleCouponRepository = $cartRuleCouponRepository;
}
/**
@ -58,6 +46,10 @@ class CartRuleController extends Controller
*/
public function index()
{
if (request()->ajax()) {
return app(CartRuleDataGrid::class)->toJson();
}
return view($this->_config['view']);
}
@ -229,26 +221,4 @@ class CartRuleController extends Controller
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;
use Illuminate\Http\Request;
use Webkul\Admin\DataGrids\CartRuleCouponDataGrid;
use Webkul\CartRule\Repositories\CartRuleCouponRepository;
class CartRuleCouponController extends Controller
{
/**
* To hold CartRuleCouponRepository repository instance
* To hold cart rule coupon repository instance.
*
* @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
* @return \Illuminate\Http\Response

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@
namespace Webkul\Core\Http\Controllers;
use Webkul\Admin\DataGrids\SliderDataGrid;
use Webkul\Core\Repositories\SliderRepository;
class SliderController extends Controller
@ -47,6 +48,10 @@ class SliderController extends Controller
*/
public function index()
{
if (request()->ajax()) {
return app(SliderDataGrid::class)->toJson();
}
return view($this->_config['view']);
}
@ -59,7 +64,7 @@ class SliderController extends Controller
{
$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;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Admin\DataGrids\NewsLetterDataGrid;
use Webkul\Core\Repositories\SubscribersListRepository;
class SubscriptionController extends Controller
{
/**
* Contains route related configuration
* Contains route related configuration.
*
* @var array
*/
protected $_config;
/**
* SubscribersListRepository
* Subscribers list repository.
*
* @var \Webkul\Core\Repositories\SubscribersListRepository
*/
@ -42,11 +41,15 @@ class SubscriptionController extends Controller
*/
public function index()
{
if (request()->ajax()) {
return app(NewsLetterDataGrid::class)->toJson();
}
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
* @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
* @return \Illuminate\Http\Response

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,6 +9,7 @@ use Webkul\User\Models\Admin;
/**
* Inherited methods.
*
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
@ -30,7 +31,7 @@ class FunctionalTester extends Actor
* Set the logged in user to the admin identity.
*
* @param \Webkul\User\Models\Admin|null $admin
* @return Admin
* @return \Webkul\User\Models\Admin
*
* @throws \Exception
*/
@ -59,7 +60,7 @@ class FunctionalTester extends Actor
* Set the logged in user to the customer identity.
*
* @param \Webkul\User\Models\Customer|null $customer
* @return Customer
* @return \Webkul\Customer\Models\Customer
*
* @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.
*
* @param $data array containing 'code => value' pairs
* @param array $data
* @return void
*/
public function setConfigData($data): void

View File

@ -1,36 +1,28 @@
<?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 Webkul\Checkout\Models\Cart;
use Webkul\Product\Models\Product;
use Faker\Factory;
use Illuminate\Support\Facades\DB;
use Webkul\Checkout\Models\CartItem;
use Webkul\Customer\Models\Customer;
use Illuminate\Support\Facades\Event;
use StdClass;
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\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\ProductDownloadableLink;
use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Product\Models\ProductDownloadableLinkTranslation;
use Webkul\Product\Models\ProductInventory;
/**
* Class Laravel5Helper
*
* @package Webkul\Core\Helpers
*/
class Laravel5Helper extends Laravel
class Bagisto extends Laravel
{
public const SIMPLE_PRODUCT = 1;
@ -91,7 +83,7 @@ class Laravel5Helper extends Laravel
$grand_total = '0.0000';
$base_grand_total = '0.0000';
} else {
$grand_total = (string)$faker->numberBetween(1, 666);
$grand_total = (string) $faker->numberBetween(1, 666);
$base_grand_total = $grand_total;
}
@ -165,7 +157,6 @@ class Laravel5Helper extends Laravel
session()->invalidate();
}
/**
* Helper function to generate products for testing.
*
@ -326,7 +317,7 @@ class Laravel5Helper extends Laravel
->where(['code' => 'brand'])
->firstOrFail(); // usually 25
if (!AttributeOption::query()
if (! AttributeOption::query()
->where(['attribute_id' => $brand->id])
->exists()) {
AttributeOption::create([

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,14 +15,13 @@ class AttributeCest
*/
public function testIndex(FunctionalTester $I): void
{
$attribute = $I->have(Attribute::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('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');
$route = route('admin.catalog.attributes.edit', ['id' => $attribute->id]);
$I->seeInSource($route);
$I->amOnPage($route);
$I->seeCurrentRouteIs('admin.catalog.attributes.edit');
@ -98,7 +96,7 @@ class AttributeCest
'price',
'boolean',
'select',
'multiselect'
'multiselect',
]),
'admin_name' => $I->fake()->firstName,
];

View File

@ -9,14 +9,13 @@ class AttributeFamilyCest
{
public function testIndex(FunctionalTester $I): void
{
$attributeFamily = $I->have(AttributeFamily::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('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
@ -46,7 +45,6 @@ class AttributeFamilyCest
$I->amOnAdminRoute('admin.catalog.families.index');
$route = route('admin.catalog.families.edit', ['id' => $attributeFamily->id]);
$I->seeInSource($route);
$I->amOnPage($route);
$I->seeCurrentRouteIs('admin.catalog.families.edit');
@ -63,15 +61,12 @@ class AttributeFamilyCest
$I->seeCurrentRouteIs('admin.catalog.families.index');
}
/**
* @param FunctionalTester $I
*
* @return array with the test-data
*/
private function fillForm(FunctionalTester $I): array
{
$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, ['-' => '_']),
'name' => $I->fake()->sentence,
];

View File

@ -3,19 +3,17 @@
namespace Tests\Functional\Admin\Catalog;
use FunctionalTester;
use Webkul\Category\Models\Category;
class CategoryCest
{
public function testIndex(FunctionalTester $I): void
{
$category = $I->have(Category::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('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 FunctionalTester;
use Webkul\Core\Models\Locale;
use Webkul\Product\Models\Product;
use Webkul\Attribute\Models\Attribute;
use Webkul\Core\Helpers\Laravel5Helper;
use Webkul\Attribute\Models\AttributeFamily;
use Webkul\Attribute\Models\AttributeOption;
use Webkul\Core\Models\Locale;
use Webkul\Product\Models\Product;
use Webkul\Product\Models\ProductAttributeValue;
class ProductCest
@ -73,14 +72,13 @@ class ProductCest
public function testIndex(FunctionalTester $I): void
{
$product = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, [], ['simple']);
$I->loginAsAdmin();
$I->amOnAdminRoute('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
@ -131,13 +129,13 @@ class ProductCest
$productAttribute = $I->grabRecord(ProductAttributeValue::class, [
'product_id' => $product->id,
'attribute_id' => $this->attributeBrand->id,
'integer_value' => $this->attributeBrandDefaultOption->id
'integer_value' => $this->attributeBrandDefaultOption->id,
]);
$I->seeRecord(ProductAttributeValue::class, [
'product_id' => $product->id,
'attribute_id' => $this->attributeBrand->id,
'integer_value' => $this->attributeBrandDefaultOption->id
'integer_value' => $this->attributeBrandDefaultOption->id,
]);
$I->assertNull($productAttribute->text_value);

View File

@ -9,14 +9,13 @@ class CustomerCest
{
public function testIndex(FunctionalTester $I): void
{
$customer = $I->have(Customer::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('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
@ -38,11 +37,6 @@ class CustomerCest
$I->seeRecord(Customer::class, $testData);
}
/**
* @param FunctionalTester $I
*
* @return array with the test-data
*/
private function fillForm(FunctionalTester $I): array
{
$testData = [

View File

@ -3,14 +3,14 @@
namespace Tests\Functional\Admin\Customer;
use FunctionalTester;
use Webkul\Core\Helpers\Laravel5Helper;
use Helper\Bagisto;
use Webkul\Product\Models\ProductReview;
class ReviewCest
{
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]);
$I->loginAsAdmin();

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ namespace Tests\Functional\Product;
use FunctionalTester;
use Webkul\Product\Models\Product;
use Webkul\Product\Models\ProductFlat;
use Webkul\Core\Helpers\Laravel5Helper;
use Helper\Bagisto;
use Webkul\Product\Models\ProductInventory;
use Webkul\Product\Models\ProductAttributeValue;
@ -20,7 +20,7 @@ class ProductCopyCest
{
config(['products.skipAttributesOnCopy' => ['name', 'inventories']]);
$original = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, [
$original = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, [
'productInventory' => [
'qty' => 10,
],
@ -46,7 +46,7 @@ class ProductCopyCest
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);
@ -60,7 +60,7 @@ class ProductCopyCest
$originalName = $I->fake()->name;
$original = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, [
$original = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, [
'productInventory' => [
'qty' => 10,
],

View File

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

View File

@ -5,7 +5,7 @@ namespace Tests\Functional\Shop;
use Faker\Factory;
use FunctionalTester;
use Codeception\Example;
use Webkul\Core\Helpers\Laravel5Helper;
use Helper\Bagisto;
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->productGuestCheckout = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $pConfigGuestCheckout);
$this->productGuestCheckout = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $pConfigGuestCheckout);
$this->productGuestCheckout->refresh();
}

View File

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

View File

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

View File

@ -6,7 +6,7 @@ use Webkul\BookingProduct\Helpers\EventTicket;
use Webkul\BookingProduct\Models\BookingProduct;
use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Checkout\Models\CartItem;
use Webkul\Core\Helpers\Laravel5Helper;
use Helper\Bagisto;
use Webkul\Product\Models\Product;
class BookingProductEventTicketCest
@ -17,7 +17,7 @@ class BookingProductEventTicketCest
{
$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']);
$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 Webkul\CartRule\Models\CartRule;
use Webkul\CartRule\Models\CartRuleCoupon;
use Webkul\Core\Helpers\Laravel5Helper;
use Helper\Bagisto;
use Webkul\Customer\Models\Customer;
use Webkul\Customer\Models\CustomerAddress;
use Illuminate\Contracts\Support\Arrayable;
@ -728,7 +728,7 @@ class CartRuleCest
'tax_category_id' => $taxCategorie->id,
],
];
$product = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, $productConfig);
$product = $I->haveProduct(Bagisto::SIMPLE_PRODUCT, $productConfig);
$ruleConfig = [
'action_type' => self::ACTION_TYPE_PERCENTAGE,
@ -1161,19 +1161,19 @@ class CartRuleCest
return [
[
'productScenario' => self::PRODUCT_FREE,
'productType' => Laravel5Helper::SIMPLE_PRODUCT,
'productType' => Bagisto::SIMPLE_PRODUCT,
'freeOfCharge' => true,
'reducedTax' => false,
],
[
'productScenario' => self::PRODUCT_NOT_FREE,
'productType' => Laravel5Helper::SIMPLE_PRODUCT,
'productType' => Bagisto::SIMPLE_PRODUCT,
'freeOfCharge' => false,
'reducedTax' => false,
],
[
'productScenario' => self::PRODUCT_NOT_FREE_REDUCED_TAX,
'productType' => Laravel5Helper::SIMPLE_PRODUCT,
'productType' => Bagisto::SIMPLE_PRODUCT,
'freeOfCharge' => false,
'reducedTax' => true,
],

View File

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

View File

@ -5,7 +5,7 @@ namespace Tests\Unit\Checkout\Cart\Models;
use Cart;
use UnitTester;
use Faker\Factory;
use Webkul\Core\Helpers\Laravel5Helper;
use Helper\Bagisto;
class CartModelCest
{
@ -31,9 +31,9 @@ class CartModelCest
'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)

View File

@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Log;
use UnitTester;
use Webkul\BookingProduct\Models\BookingProduct;
use Webkul\BookingProduct\Models\BookingProductEventTicket;
use Webkul\Core\Helpers\Laravel5Helper;
use Helper\Bagisto;
use Webkul\Product\Models\Product;
class BookingCronCest
@ -17,7 +17,7 @@ class BookingCronCest
$index = $I->fake()->numberBetween(2, 6);
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']);
if ($I->fake()->randomDigitNotNull <= 5) {

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