fixed #3453
This commit is contained in:
parent
a704d53331
commit
390fcc11bc
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use Webkul\Ui\DataGrid\Traits\ProvideDataGridPlus;
|
||||
|
||||
class InvoicesTransactionsDatagrid extends DataGrid
|
||||
{
|
||||
use ProvideDataGridPlus;
|
||||
|
||||
protected $index = 'id';
|
||||
|
||||
protected $sortOrder = 'desc';
|
||||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('order_transactions')
|
||||
->leftJoin('invoices as inv', 'order_transactions.invoice_id', '=', 'inv.id')
|
||||
->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');
|
||||
$this->addFilter('created_at', 'order_transactions.created_at');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
||||
public function addColumns()
|
||||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'label' => trans('admin::app.datagrid.id'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'transaction_id',
|
||||
'label' => trans('admin::app.datagrid.transaction-id'),
|
||||
'type' => 'string',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'created_at',
|
||||
'label' => trans('admin::app.datagrid.transaction-date'),
|
||||
'type' => 'datetime',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function prepareActions()
|
||||
{
|
||||
$this->addAction([
|
||||
'title' => trans('admin::app.datagrid.view'),
|
||||
'method' => 'GET',
|
||||
'route' => 'admin.sales.transactions.view',
|
||||
'icon' => 'icon eye-icon',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ class OrderInvoicesDataGrid extends DataGrid
|
|||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'label' => trans('admin::app.datagrid.id'),
|
||||
'label' => trans('admin::app.datagrid.invoice-id'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
|
|
@ -45,6 +45,15 @@ class OrderInvoicesDataGrid extends DataGrid
|
|||
'filterable' => true,
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'created_at',
|
||||
'label' => trans('admin::app.datagrid.invoice-date'),
|
||||
'type' => 'datetime',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'base_grand_total',
|
||||
'label' => trans('admin::app.datagrid.grand-total'),
|
||||
|
|
@ -55,13 +64,26 @@ class OrderInvoicesDataGrid extends DataGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'created_at',
|
||||
'label' => trans('admin::app.datagrid.invoice-date'),
|
||||
'type' => 'datetime',
|
||||
'searchable' => true,
|
||||
'index' => 'state',
|
||||
'label' => trans('admin::app.datagrid.status'),
|
||||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'closure' => true,
|
||||
'filterable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if ($value->state == 'paid') {
|
||||
return '<span class="badge badge-md badge-success">' . trans('admin::app.sales.invoices.status-paid') . '</span>';
|
||||
} elseif ($value->state == 'pending' || $value->state == 'pending_payment') {
|
||||
return '<span class="badge badge-md badge-warning">' . trans('admin::app.sales.invoices.status-pending') . '</span>';
|
||||
} elseif ($value->state == 'overdue') {
|
||||
return '<span class="badge badge-md badge-info">' . trans('admin::app.sales.invoices.status-overdue') . '</span>';
|
||||
} else {
|
||||
return $value->state;
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function prepareActions()
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@ class OrderTransactionsDataGrid extends DataGrid
|
|||
{
|
||||
$queryBuilder = DB::table('order_transactions')
|
||||
->leftJoin('orders as ors', 'order_transactions.order_id', '=', 'ors.id')
|
||||
->select('order_transactions.id as id', 'order_transactions.transaction_id as transaction_id', 'ors.increment_id as order_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', 'ors.increment_id as order_id', 'order_transactions.created_at as created_at');
|
||||
|
||||
$this->addFilter('id', 'order_transactions.id');
|
||||
$this->addFilter('transaction_id', 'order_transactions.transaction_id');
|
||||
$this->addFilter('invoice_id', 'order_transactions.invoice_id');
|
||||
$this->addFilter('order_id', 'ors.increment_id');
|
||||
$this->addFilter('created_at', 'order_transactions.created_at');
|
||||
|
||||
|
|
@ -45,6 +46,15 @@ class OrderTransactionsDataGrid extends DataGrid
|
|||
'filterable' => true,
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'invoice_id',
|
||||
'label' => trans('admin::app.datagrid.invoice-id'),
|
||||
'type' => 'number',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true,
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'order_id',
|
||||
'label' => trans('admin::app.datagrid.order-id'),
|
||||
|
|
|
|||
|
|
@ -2,9 +2,15 @@
|
|||
|
||||
namespace Webkul\Admin\Http\Controllers\Sales;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
use Webkul\Admin\Http\Controllers\Controller;
|
||||
use Webkul\Payment\Facades\Payment;
|
||||
|
||||
use Webkul\Sales\Repositories\OrderRepository;
|
||||
use Webkul\Sales\Repositories\OrderTransactionRepository;
|
||||
use Webkul\Sales\Repositories\InvoiceRepository;
|
||||
|
||||
class TransactionController extends Controller
|
||||
{
|
||||
|
|
@ -15,6 +21,13 @@ class TransactionController extends Controller
|
|||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* OrderRepository object
|
||||
*
|
||||
* @var \Webkul\Sales\Repositories\OrderRepository
|
||||
*/
|
||||
protected $orderRepository;
|
||||
|
||||
/**
|
||||
* OrderRepository object
|
||||
*
|
||||
|
|
@ -22,19 +35,35 @@ class TransactionController extends Controller
|
|||
*/
|
||||
protected $orderTransactionRepository;
|
||||
|
||||
/**
|
||||
* InvoiceRepository object
|
||||
*
|
||||
* @var \Webkul\Sales\Repositories\InvoiceRepository
|
||||
*/
|
||||
protected $invoiceRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Sales\Repositories\OrderRepository $orderRepository
|
||||
* @param \Webkul\Sales\Repositories\OrderTransactionRepository $orderTransactionRepository
|
||||
* @param \Webkul\Sales\Repositories\InvoiceRepository $invoiceRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(OrderTransactionRepository $orderTransactionRepository)
|
||||
public function __construct(
|
||||
OrderRepository $orderRepository,
|
||||
OrderTransactionRepository $orderTransactionRepository,
|
||||
InvoiceRepository $invoiceRepository)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->orderRepository = $orderRepository;
|
||||
|
||||
$this->orderTransactionRepository = $orderTransactionRepository;
|
||||
|
||||
$this->invoiceRepository = $invoiceRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -47,6 +76,75 @@ class TransactionController extends Controller
|
|||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a form to save the tranaction.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$payment_methods = Payment::getSupportedPaymentMethods();
|
||||
return view($this->_config['view'], compact('payment_methods'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the tranaction.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validate = $this->validate(request(), [
|
||||
'invoice_id' => 'required',
|
||||
'payment_method' => 'required',
|
||||
'amount' => 'required|numeric'
|
||||
]);
|
||||
|
||||
$invoice = $this->invoiceRepository->find($request->invoice_id);
|
||||
|
||||
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->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'] = $request->invoice_id;
|
||||
$transactionData['order_id'] = $invoice->order_id;
|
||||
$transactionData['status'] = 'paid';
|
||||
$transactionData['data'] = json_encode($data);
|
||||
|
||||
$this->orderTransactionRepository->create($transactionData);
|
||||
|
||||
if ($invoice->base_grand_total == $request->amount) {
|
||||
$this->orderRepository->updateOrderStatus($order, 'processing');
|
||||
$update = $this->invoiceRepository->updateState($invoice, "paid");
|
||||
} else {
|
||||
$this->orderRepository->updateOrderStatus($order, 'pending');
|
||||
$update = $this->invoiceRepository->updateState($invoice, "pending");
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the view for the specified resource.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -264,6 +264,12 @@ Route::group(['middleware' => ['web', 'admin_locale']], function () {
|
|||
'view' => 'admin::sales.transactions.index',
|
||||
])->name('admin.sales.transactions.index');
|
||||
|
||||
Route::get('/transactions/create', 'Webkul\Admin\Http\Controllers\Sales\TransactionController@create')->defaults('_config', [
|
||||
'view' => 'admin::sales.transactions.create',
|
||||
])->name('admin.sales.transactions.create');
|
||||
|
||||
Route::post('/transactions/create', 'Webkul\Admin\Http\Controllers\Sales\TransactionController@store')->name('admin.sales.transactions.store');
|
||||
|
||||
Route::get('/transactions/view/{id}', 'Webkul\Admin\Http\Controllers\Sales\TransactionController@view')->defaults('_config', [
|
||||
'view' => 'admin::sales.transactions.view',
|
||||
])->name('admin.sales.transactions.view');
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ return [
|
|||
'billed-to' => 'فاتورة إلى',
|
||||
'shipped-to' => 'تم شحنها إلي',
|
||||
'order-id' => 'رقم التعريف الخاص بالطلب',
|
||||
'invoice-id' => 'رقم الفاتورة',
|
||||
'invoice-date' => 'تاريخ الفاتورة',
|
||||
'total-qty' => 'إجمالي الكمية',
|
||||
'inventory-source' => 'مصدر الجرد',
|
||||
|
|
@ -479,16 +480,24 @@ return [
|
|||
|
||||
'transactions' => [
|
||||
'title' => 'Transactions',
|
||||
'create-title' => 'Add transaction',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'Transaction Id',
|
||||
'payment-method' => 'Payment method',
|
||||
'transaction-amount' => 'Transaction amount',
|
||||
'action' => 'Action',
|
||||
'view-title' => 'Transaction #:transaction_id',
|
||||
'transaction-data' => 'Transaction Data',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice Id',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Created At',
|
||||
'transaction-details' => 'Transaction Details'
|
||||
'transaction-details' => 'Transaction Details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'This invoice id does not exist',
|
||||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
@ -1495,6 +1504,10 @@ return [
|
|||
'cache-small-image' => 'Small Image',
|
||||
'cache-medium-image' => 'Medium Image',
|
||||
'cache-large-image' => 'Large Image',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ return [
|
|||
'billed-to' => 'Rechnung an',
|
||||
'shipped-to' => 'Versendet an',
|
||||
'order-id' => 'Auftragsnummer',
|
||||
'invoice-id' => 'Rechnungsnummer',
|
||||
'invoice-date' => 'Rechnungsdatum',
|
||||
'total-qty' => 'Gesamtmenge',
|
||||
'inventory-source' => 'Inventar Quelle',
|
||||
|
|
@ -472,16 +473,24 @@ return [
|
|||
|
||||
'transactions' => [
|
||||
'title' => 'Transactions',
|
||||
'create-title' => 'Add transaction',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'Transaction Id',
|
||||
'payment-method' => 'Payment method',
|
||||
'transaction-amount' => 'Transaction amount',
|
||||
'action' => 'Action',
|
||||
'view-title' => 'Transaction #:transaction_id',
|
||||
'transaction-data' => 'Transaction Data',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice Id',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Created At',
|
||||
'transaction-details' => 'Transaction Details'
|
||||
'transaction-details' => 'Transaction Details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'This invoice id does not exist',
|
||||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid'
|
||||
]
|
||||
]
|
||||
],
|
||||
'catalog' =>
|
||||
|
|
@ -1471,6 +1480,10 @@ return [
|
|||
'cache-small-image' => 'Small Image',
|
||||
'cache-medium-image' => 'Medium Image',
|
||||
'cache-large-image' => 'Large Image',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ return [
|
|||
'billed-to' => 'Billed To',
|
||||
'shipped-to' => 'Shipped To',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice number',
|
||||
'invoice-date' => 'Invoice Date',
|
||||
'total-qty' => 'Total Qty',
|
||||
'inventory-source' => 'Inventory Source',
|
||||
|
|
@ -489,16 +490,24 @@ return [
|
|||
|
||||
'transactions' => [
|
||||
'title' => 'Transactions',
|
||||
'create-title' => 'Add transaction',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'Transaction Id',
|
||||
'payment-method' => 'Payment method',
|
||||
'transaction-amount' => 'Transaction amount',
|
||||
'action' => 'Action',
|
||||
'view-title' => 'Transaction #:transaction_id',
|
||||
'transaction-data' => 'Transaction Data',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice Id',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Created At',
|
||||
'transaction-details' => 'Transaction Details'
|
||||
'transaction-details' => 'Transaction Details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'This invoice id does not exist',
|
||||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
@ -1509,6 +1518,10 @@ return [
|
|||
'cache-small-image' => 'Small Image',
|
||||
'cache-medium-image' => 'Medium Image',
|
||||
'cache-large-image' => 'Large Image',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ return [
|
|||
'billed-to' => 'Facturado a',
|
||||
'shipped-to' => 'Enviado a',
|
||||
'order-id' => 'Pedido #',
|
||||
'invoice-id' => 'Número de factura',
|
||||
'invoice-date' => 'Fecha de factura',
|
||||
'total-qty' => 'Cantidad total',
|
||||
'inventory-source' => 'Fuente de inventario',
|
||||
|
|
@ -488,17 +489,25 @@ return [
|
|||
],
|
||||
|
||||
'transactions' => [
|
||||
'title' => 'Transacciones',
|
||||
'id' => 'ID',
|
||||
'transaction-id' => 'Transacción #',
|
||||
'payment-method' => 'Método de Pago',
|
||||
'action' => 'Accción',
|
||||
'view-title' => 'Transacciónn #:transaction_id',
|
||||
'transaction-data' => 'Fecha de Transacción',
|
||||
'order-id' => 'Pedido #',
|
||||
'status' => 'Estado',
|
||||
'created-at' => 'Creado En',
|
||||
'transaction-details' => 'Detalles de la Transacción'
|
||||
'title' => 'Transactions',
|
||||
'create-title' => 'Add transaction',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'Transaction Id',
|
||||
'payment-method' => 'Payment method',
|
||||
'transaction-amount' => 'Transaction amount',
|
||||
'action' => 'Action',
|
||||
'view-title' => 'Transaction #:transaction_id',
|
||||
'transaction-data' => 'Transaction Data',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice Id',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Created At',
|
||||
'transaction-details' => 'Transaction Details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'This invoice id does not exist',
|
||||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
@ -1502,6 +1511,10 @@ return [
|
|||
'cache-small-image' => 'Small Image',
|
||||
'cache-medium-image' => 'Medium Image',
|
||||
'cache-large-image' => 'Large Image',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ return [
|
|||
'billed-to' => 'صورت حساب داده شده برای',
|
||||
'shipped-to' => 'فرستاده شده به',
|
||||
'order-id' => 'شناسه سفارش',
|
||||
'invoice-id' => 'Invoice number',
|
||||
'invoice-date' => 'تاریخ فاکتور',
|
||||
'total-qty' => 'کل مقدار',
|
||||
'inventory-source' => 'منابع موجودی',
|
||||
|
|
@ -481,17 +482,25 @@ return [
|
|||
],
|
||||
|
||||
'transactions' => [
|
||||
'title' => 'پرداختی ها',
|
||||
'title' => 'Transactions',
|
||||
'create-title' => 'Add transaction',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'شناسه پرداخت',
|
||||
'payment-method' => 'پرداخت با',
|
||||
'action' => 'عملیات',
|
||||
'view-title' => 'پرداخت #:transaction_id',
|
||||
'transaction-data' => 'اطلاعات پرداخت',
|
||||
'order-id' => 'شمار سفارش',
|
||||
'status' => 'وضعیت',
|
||||
'created-at' => 'ایجاد شده در',
|
||||
'transaction-details' => 'جزئیات پرداخت'
|
||||
'transaction-id' => 'Transaction Id',
|
||||
'payment-method' => 'Payment method',
|
||||
'transaction-amount' => 'Transaction amount',
|
||||
'action' => 'Action',
|
||||
'view-title' => 'Transaction #:transaction_id',
|
||||
'transaction-data' => 'Transaction Data',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice Id',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Created At',
|
||||
'transaction-details' => 'Transaction Details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'This invoice id does not exist',
|
||||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
@ -1481,7 +1490,11 @@ return [
|
|||
'cache-small-image' => 'Small Image',
|
||||
'cache-medium-image' => 'Medium Image',
|
||||
'cache-large-image' => 'Large Image',
|
||||
'all-customer-groups' => 'همه گروه های مشتری'
|
||||
'all-customer-groups' => 'همه گروه های مشتری',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ return [
|
|||
'billed-to' => 'Fatturato a',
|
||||
'shipped-to' => 'Spedito a',
|
||||
'order-id' => 'Id Ordine',
|
||||
'invoice-id' => 'numero di fattura',
|
||||
'invoice-date' => 'Data Fattura',
|
||||
'total-qty' => 'Qtà Totale',
|
||||
'inventory-source' => 'Magazzino',
|
||||
|
|
@ -479,16 +480,24 @@ return [
|
|||
|
||||
'transactions' => [
|
||||
'title' => 'Transactions',
|
||||
'create-title' => 'Add transaction',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'Transaction Id',
|
||||
'payment-method' => 'Payment method',
|
||||
'transaction-amount' => 'Transaction amount',
|
||||
'action' => 'Action',
|
||||
'view-title' => 'Transaction #:transaction_id',
|
||||
'transaction-data' => 'Transaction Data',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice Id',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Created At',
|
||||
'transaction-details' => 'Transaction Details'
|
||||
'transaction-details' => 'Transaction Details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'This invoice id does not exist',
|
||||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
@ -1492,6 +1501,10 @@ return [
|
|||
'cache-small-image' => 'Small Image',
|
||||
'cache-medium-image' => 'Medium Image',
|
||||
'cache-large-image' => 'Large Image',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ return [
|
|||
'billed-to' => 'Gefactureerd aan',
|
||||
'shipped-to' => 'Verzonden naar',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Factuurnummer',
|
||||
'invoice-date' => 'Factuur datum',
|
||||
'total-qty' => 'Totale hoeveelheid',
|
||||
'inventory-source' => 'Voorraad bron',
|
||||
|
|
@ -476,16 +477,24 @@ return [
|
|||
|
||||
'transactions' => [
|
||||
'title' => 'Transacties',
|
||||
'create-title' => 'Transactie toevoegen',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'Transactie Id',
|
||||
'payment-method' => 'Betalingswijze',
|
||||
'transaction-amount' => 'Transactiebedrag',
|
||||
'action' => 'Actie',
|
||||
'view-title' => 'Transactie #:transaction_id',
|
||||
'transaction-data' => 'Transacatie data',
|
||||
'transaction-data' => 'Transactie Data',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Factuurnummer',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Datum aangemaakt',
|
||||
'transaction-details' => 'Transactie Details'
|
||||
'created-at' => 'Toegevoegd op',
|
||||
'transaction-details' => 'Transactie details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'Dit factuurnummer bestaat niet',
|
||||
'transaction-saved' => 'De transactie is geregistreerd',
|
||||
'already-paid' => 'Dit factuur is al voldaan'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
@ -1485,6 +1494,10 @@ return [
|
|||
'cache-small-image' => 'Small Image',
|
||||
'cache-medium-image' => 'Medium Image',
|
||||
'cache-large-image' => 'Large Image',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ return [
|
|||
'billed-to' => 'Zapłacono za',
|
||||
'shipped-to' => 'Wysłane do',
|
||||
'order-id' => 'Identyfikator zamówienia',
|
||||
'invoice-id' => 'numer faktury',
|
||||
'invoice-date' => 'Data faktury',
|
||||
'total-qty' => 'Ilość Całkowita',
|
||||
'inventory-source' => 'Źródło zapasów',
|
||||
|
|
@ -478,16 +479,24 @@ return [
|
|||
|
||||
'transactions' => [
|
||||
'title' => 'Transactions',
|
||||
'create-title' => 'Add transaction',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'Transaction Id',
|
||||
'payment-method' => 'Payment method',
|
||||
'transaction-amount' => 'Transaction amount',
|
||||
'action' => 'Action',
|
||||
'view-title' => 'Transaction #:transaction_id',
|
||||
'transaction-data' => 'Transaction Data',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice Id',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Created At',
|
||||
'transaction-details' => 'Transaction Details'
|
||||
'transaction-details' => 'Transaction Details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'This invoice id does not exist',
|
||||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
@ -1476,6 +1485,10 @@ return [
|
|||
'cache-small-image' => 'Small Image',
|
||||
'cache-medium-image' => 'Medium Image',
|
||||
'cache-large-image' => 'Large Image',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
@ -195,6 +195,7 @@ return [
|
|||
'billed-to' => 'Cobrado de',
|
||||
'shipped-to' => 'Enviado para',
|
||||
'order-id' => 'Pedido Id',
|
||||
'invoice-id' => 'Número da fatura',
|
||||
'invoice-date' => 'Data da Fatura',
|
||||
'total-qty' => 'Total Qtd',
|
||||
'inventory-source' => 'Fonte do Estoque',
|
||||
|
|
@ -476,17 +477,25 @@ return [
|
|||
],
|
||||
|
||||
'transactions' => [
|
||||
'title' => 'Transações',
|
||||
'id' => 'ID',
|
||||
'transaction-id' => 'ID da Transação',
|
||||
'payment-method' => 'Método de pagamento',
|
||||
'action' => 'Ação',
|
||||
'view-title' => 'Transação #:transaction_id',
|
||||
'title' => 'Transactions',
|
||||
'create-title' => 'Add transaction',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'Transaction Id',
|
||||
'payment-method' => 'Payment method',
|
||||
'transaction-amount' => 'Transaction amount',
|
||||
'action' => 'Action',
|
||||
'view-title' => 'Transaction #:transaction_id',
|
||||
'transaction-data' => 'Transaction Data',
|
||||
'order-id' => 'ID do Pedido',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice Id',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Criado em',
|
||||
'transaction-details' => 'Detalhes da transação'
|
||||
'created-at' => 'Created At',
|
||||
'transaction-details' => 'Transaction Details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'This invoice id does not exist',
|
||||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
@ -1490,6 +1499,10 @@ return [
|
|||
'cache-small-image' => 'Imagem pequena',
|
||||
'cache-medium-image' => 'Imagem média',
|
||||
'cache-large-image' => 'Imagem grande',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ return [
|
|||
'billed-to' => 'Fatura Bilgileri',
|
||||
'shipped-to' => 'Kargo Bilgileri',
|
||||
'order-id' => 'Sipariş ID',
|
||||
'invoice-id' => 'Fatura numarası',
|
||||
'invoice-date' => 'Fatura Tarihi',
|
||||
'total-qty' => 'Toplam Miktar',
|
||||
'inventory-source' => 'Envanter Kaynağı',
|
||||
|
|
@ -476,16 +477,24 @@ return [
|
|||
|
||||
'transactions' => [
|
||||
'title' => 'Transactions',
|
||||
'create-title' => 'Add transaction',
|
||||
'id' => 'Id',
|
||||
'transaction-id' => 'Transaction Id',
|
||||
'payment-method' => 'Payment method',
|
||||
'transaction-amount' => 'Transaction amount',
|
||||
'action' => 'Action',
|
||||
'view-title' => 'Transaction #:transaction_id',
|
||||
'transaction-data' => 'Transaction Data',
|
||||
'order-id' => 'Order Id',
|
||||
'invoice-id' => 'Invoice Id',
|
||||
'status' => 'Status',
|
||||
'created-at' => 'Created At',
|
||||
'transaction-details' => 'Transaction Details'
|
||||
'transaction-details' => 'Transaction Details',
|
||||
'response' => [
|
||||
'invoice-missing' => 'This invoice id does not exist',
|
||||
'transaction-saved' => 'The transaction has been saved',
|
||||
'already-paid' => 'This invoice has already been paid'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
@ -1473,6 +1482,10 @@ return [
|
|||
'cache-small-image' => 'Small Image',
|
||||
'cache-medium-image' => 'Medium Image',
|
||||
'cache-large-image' => 'Large Image',
|
||||
'generate-invoice' => 'Automatically generate the invoice after placing an order',
|
||||
'set-invoice-status' => 'Set the invoice status after creating the invoice to',
|
||||
'set-order-status' => 'Set the order status after creating the invoice to',
|
||||
'generate-invoice-applicable' => 'Applicable if automatic generate invoice is enabled'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -34,8 +34,10 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="sale-container">
|
||||
<tabs>
|
||||
|
||||
<tab name="{{ __('admin::app.sales.orders.info') }}" :selected="true">
|
||||
<div class="sale-container">
|
||||
<accordian :title="'{{ __('admin::app.sales.orders.order-and-account') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
|
|
@ -81,6 +83,16 @@
|
|||
|
||||
{!! view_render_event('sales.invoice.status_label.after', ['order' => $order]) !!}
|
||||
|
||||
<div class="row">
|
||||
<span class="title">
|
||||
{{ __('admin::app.sales.invoices.status') }}
|
||||
</span>
|
||||
|
||||
<span class="value">
|
||||
{{ $invoice->status_label }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<span class="title">
|
||||
{{ __('admin::app.sales.orders.channel') }}
|
||||
|
|
@ -120,6 +132,7 @@
|
|||
</div>
|
||||
</accordian>
|
||||
|
||||
|
||||
@if ($order->billing_address || $order->shipping_address)
|
||||
<accordian :title="'{{ __('admin::app.sales.orders.address') }}'" :active="true">
|
||||
<div slot="body" style="display: flex; overflow:auto;">
|
||||
|
|
@ -251,8 +264,16 @@
|
|||
|
||||
</div>
|
||||
</accordian>
|
||||
|
||||
</div>
|
||||
</tab>
|
||||
|
||||
<tab name="Transactions" :selected="false">
|
||||
<div class="sale-container">
|
||||
@inject('InvoicesTransactionsDatagrid', 'Webkul\Admin\DataGrids\InvoicesTransactionsDatagrid')
|
||||
{!! $InvoicesTransactionsDatagrid->render() !!}
|
||||
</div>
|
||||
</tab>
|
||||
</tabs>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.sales.transactions.create-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sales.transactions.index') }}'"></i>
|
||||
<h1>{{ __('admin::app.sales.transactions.create-title') }}</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
<form method="POST" action="{{ route('admin.sales.transactions.store') }}">
|
||||
<div class="form-container">
|
||||
@csrf
|
||||
|
||||
<div class="control-group" :class="[errors.has('invoice_id') ? 'has-error' : '']">
|
||||
<label for="invoice_id" class="required">
|
||||
{{ __('admin::app.sales.transactions.invoice-id') }}
|
||||
</label>
|
||||
|
||||
<input id="invoice_id" name="invoice_id" class="control" value="{{ old('invoice_id') }}" v-validate="'required'" data-vv-as=""{{ __('admin::app.sales.transactions.invoice-id') }}"" />
|
||||
<span class="control-error" v-if="errors.has('invoice_id')">@{{ errors.first('invoice_id') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group select" :class="[errors.has('payment_method') ? 'has-error' : '']">
|
||||
<label for="payment-method" class="required">{{ __('admin::app.sales.transactions.payment-method') }} </label>
|
||||
<select id="payment-method" name="payment_method" class="control" v-validate="'required'" data-vv-as=""{{ __('admin::app.sales.transactions.payment-method') }}"">
|
||||
<option value=""></option>
|
||||
|
||||
@foreach ($payment_methods["paymentMethods"] as $paymentMethod)
|
||||
@if($paymentMethod["method"] == "cashondelivery" || $paymentMethod["method"] == "moneytransfer")
|
||||
<option value="{{ $paymentMethod["method"] }}">{{ $paymentMethod["method_title"] }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('payment_method')">@{{ errors.first('payment_method') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('amount') ? 'has-error' : '']">
|
||||
<label for="transaction-amount" class="required">{{ __('admin::app.sales.transactions.transaction-amount') }}</label>
|
||||
<input id="transaction-amount" name="amount" class="control" value="{{ old('amount') }}" v-validate="'required'" data-vv-as=""{{ __('admin::app.sales.transactions.transaction-amount') }}"">
|
||||
<span class="control-error" v-if="errors.has('amount')">@{{ errors.first('amount') }}</span>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-lg btn-primary">{{ __('admin::app.save') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -18,6 +18,8 @@
|
|||
{{ __('admin::app.export.export') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<a href="{{ route('admin.sales.transactions.create') }}" class="btn btn-lg btn-primary">{{ __('admin::app.sales.transactions.create-title') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,20 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
@if($transaction->invoice_id)
|
||||
<div class="row">
|
||||
<span class="title">
|
||||
{{ __('admin::app.sales.transactions.invoice-id') }}
|
||||
</span>
|
||||
|
||||
<span class="value">
|
||||
<a href="{{ route('admin.sales.invoices.view', $transaction->order_id)}}">
|
||||
{{ $transaction->invoice_id }}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<span class="title">
|
||||
{{ __('admin::app.sales.transactions.payment-method') }}
|
||||
|
|
@ -63,7 +77,7 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
{{-- <div class="row">
|
||||
<div class="row">
|
||||
<span class="title">
|
||||
{{ __('admin::app.sales.transactions.status') }}
|
||||
</span>
|
||||
|
|
@ -71,7 +85,7 @@
|
|||
<span class="value">
|
||||
{{ $transaction->status }}
|
||||
</span>
|
||||
</div> --}}
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<span class="title">
|
||||
|
|
|
|||
|
|
@ -20,26 +20,69 @@ return [
|
|||
'type' => 'depends',
|
||||
'depend' => 'active:1',
|
||||
'validation' => 'required_if:active,1',
|
||||
'channel_based' => false,
|
||||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
], [
|
||||
'name' => 'description',
|
||||
'title' => 'admin::app.admin.system.description',
|
||||
'type' => 'textarea',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true,
|
||||
], [
|
||||
'name' => 'active',
|
||||
'title' => 'admin::app.admin.system.status',
|
||||
'type' => 'boolean',
|
||||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
], [
|
||||
'name' => 'instructions',
|
||||
'title' => 'admin::app.admin.system.instructions',
|
||||
'type' => 'textarea',
|
||||
'channel_based' => false,
|
||||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
], [
|
||||
'name' => 'generate_invoice',
|
||||
'title' => 'admin::app.admin.system.generate-invoice',
|
||||
'type' => 'boolean',
|
||||
'default_value' => false,
|
||||
'channel_based' => true,
|
||||
'locale_based' => false,
|
||||
], [
|
||||
'name' => 'invoice_status',
|
||||
'title' => 'admin::app.admin.system.set-invoice-status',
|
||||
'validation' => 'required_if:generate_invoice,1',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
[
|
||||
'title' => 'admin::app.sales.invoices.status-pending',
|
||||
'value' => 'pending'
|
||||
], [
|
||||
'title' => 'admin::app.sales.invoices.status-paid',
|
||||
'value' => 'paid'
|
||||
],
|
||||
],
|
||||
'info' => 'admin::app.admin.system.generate-invoice-applicable',
|
||||
'channel_based' => true,
|
||||
'locale_based' => false,
|
||||
], [
|
||||
'name' => 'order_status',
|
||||
'title' => 'admin::app.admin.system.set-order-status',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
[
|
||||
'title' => 'admin::app.sales.orders.order-status-pending',
|
||||
'value' => 'pending'
|
||||
], [
|
||||
'title' => 'admin::app.sales.orders.order-status-pending-payment',
|
||||
'value' => 'pending_payment'
|
||||
], [
|
||||
'title' => 'admin::app.sales.orders.order-status-processing',
|
||||
'value' => 'processing'
|
||||
]
|
||||
],
|
||||
'info' => 'admin::app.admin.system.generate-invoice-applicable',
|
||||
'channel_based' => true,
|
||||
'locale_based' => false,
|
||||
], [
|
||||
'name' => 'active',
|
||||
'title' => 'admin::app.admin.system.status',
|
||||
'type' => 'boolean',
|
||||
'validation' => 'required',
|
||||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
], [
|
||||
'name' => 'sort',
|
||||
|
|
@ -73,26 +116,61 @@ return [
|
|||
'type' => 'depends',
|
||||
'depend' => 'active:1',
|
||||
'validation' => 'required_if:active,1',
|
||||
'channel_based' => false,
|
||||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
], [
|
||||
'name' => 'description',
|
||||
'title' => 'admin::app.admin.system.description',
|
||||
'type' => 'textarea',
|
||||
'channel_based' => false,
|
||||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
], [
|
||||
'name' => 'generate_invoice',
|
||||
'title' => 'Automatically generate the invoice after placing an order',
|
||||
'type' => 'boolean',
|
||||
'default_value' => false,
|
||||
'channel_based' => true,
|
||||
'locale_based' => false,
|
||||
], [
|
||||
'name' => 'invoice_status',
|
||||
'title' => 'Invoice status after creating the invoice',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
[
|
||||
'title' => 'Pending',
|
||||
'value' => 'pending'
|
||||
], [
|
||||
'title' => 'Paid',
|
||||
'value' => 'paid'
|
||||
]
|
||||
],
|
||||
'info' => 'admin::app.admin.system.generate-invoice-applicable',
|
||||
], [
|
||||
'name' => 'order_status',
|
||||
'title' => 'Order status after creating the invoice',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
[
|
||||
'title' => 'Pending',
|
||||
'value' => 'pending'
|
||||
], [
|
||||
'title' => 'Processing',
|
||||
'value' => 'processing'
|
||||
]
|
||||
],
|
||||
'info' => 'admin::app.admin.system.generate-invoice-applicable',
|
||||
], [
|
||||
'name' => 'mailing_address',
|
||||
'title' => 'admin::app.admin.system.mailing-address',
|
||||
'type' => 'textarea',
|
||||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
], [
|
||||
'name' => 'active',
|
||||
'title' => 'admin::app.admin.system.status',
|
||||
'type' => 'boolean',
|
||||
'validation' => 'required',
|
||||
'channel_based' => false,
|
||||
'locale_based' => true,
|
||||
], [
|
||||
'name' => 'mailing_address',
|
||||
'title' => 'admin::app.admin.system.mailing-address',
|
||||
'type' => 'textarea',
|
||||
'channel_based' => false,
|
||||
'channel_based' => true,
|
||||
'locale_based' => true,
|
||||
],[
|
||||
'name' => 'sort',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
namespace Webkul\Payment\Listeners;
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
use Webkul\Sales\Repositories\OrderRepository;
|
||||
use Webkul\Sales\Repositories\InvoiceRepository;
|
||||
|
||||
/**
|
||||
* Generate Invoice Event handler
|
||||
*
|
||||
*/
|
||||
class GenerateInvoice
|
||||
{
|
||||
/**
|
||||
* OrderRepository object
|
||||
*
|
||||
* @var \Webkul\Sales\Repositories\OrderRepository
|
||||
*/
|
||||
protected $orderRepository;
|
||||
|
||||
/**
|
||||
* InvoiceRepository object
|
||||
*
|
||||
* @var \Webkul\Sales\Repositories\InvoiceRepository
|
||||
*/
|
||||
protected $invoiceRepository;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @param Webkul\Sales\Repositories\OrderRepository $orderRepository
|
||||
* @param \Webkul\Sales\Repositories\InvoiceRepository invoiceRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
OrderRepository $orderRepository,
|
||||
InvoiceRepository $invoiceRepository
|
||||
)
|
||||
{
|
||||
$this->orderRepository = $orderRepository;
|
||||
$this->invoiceRepository = $invoiceRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a new invoice.
|
||||
*
|
||||
* @param object $order
|
||||
* @return void
|
||||
*/
|
||||
public function handle($order)
|
||||
{
|
||||
if ($order->payment->method == 'cashondelivery' && core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice')) {
|
||||
$this->invoiceRepository->create($this->prepareInvoiceData($order), core()->getConfigData('sales.paymentmethods.cashondelivery.invoice_status'), core()->getConfigData('sales.paymentmethods.cashondelivery.order_status'));
|
||||
}
|
||||
|
||||
if ($order->payment->method == 'moneytransfer' && core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice')) {
|
||||
$this->invoiceRepository->create($this->prepareInvoiceData($order), core()->getConfigData('sales.paymentmethods.moneytransfer.invoice_status'), core()->getConfigData('sales.paymentmethods.moneytransfer.order_status'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares order's invoice data for creation.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function prepareInvoiceData($order)
|
||||
{
|
||||
$invoiceData = ['order_id' => $order->id];
|
||||
|
||||
foreach ($order->items as $item) {
|
||||
$invoiceData['invoice']['items'][$item->id] = $item->qty_to_invoice;
|
||||
}
|
||||
|
||||
return $invoiceData;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Payment\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Event::listen('checkout.order.save.after', 'Webkul\Payment\Listeners\GenerateInvoice@handle');
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ class PaymentServiceProvider extends ServiceProvider
|
|||
public function boot()
|
||||
{
|
||||
include __DIR__ . '/../Http/helpers.php';
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -268,4 +268,16 @@ class InvoiceRepository extends Repository
|
|||
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Webkul\Sales\Contracts\Invoice $invoice
|
||||
* @return void
|
||||
*/
|
||||
public function updateState($invoice, $status)
|
||||
{
|
||||
$invoice->state = $status;
|
||||
$invoice->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue