new: make the eye icon work to see an invoice in admin customer view
This commit is contained in:
@@ -11,7 +11,7 @@ use Yajra\DataTables\Html\Column;
|
|||||||
|
|
||||||
class CustomerInvoicesDataTable extends DataTable
|
class CustomerInvoicesDataTable extends DataTable
|
||||||
{
|
{
|
||||||
public $model_name = 'invoices';
|
public $model_name = 'customer_invoices';
|
||||||
|
|
||||||
public $sortedColumn = 1;
|
public $sortedColumn = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -12,15 +12,6 @@ class CustomerInvoiceController extends Controller
|
|||||||
return $dataTable->render('Admin.Shop.CustomerInvoices.list');
|
return $dataTable->render('Admin.Shop.CustomerInvoices.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id)
|
|
||||||
{
|
|
||||||
$data = [
|
|
||||||
'invoice' => Invoices::get($id),
|
|
||||||
];
|
|
||||||
|
|
||||||
return view('Admin.Shop.CustomerInvoices.view', $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
return Invoices::destroy($id);
|
return Invoices::destroy($id);
|
||||||
|
|||||||
@@ -15,8 +15,14 @@ class InvoiceController extends Controller
|
|||||||
|
|
||||||
public function view($uuid)
|
public function view($uuid)
|
||||||
{
|
{
|
||||||
|
$invoice = Invoices::view($uuid);
|
||||||
|
|
||||||
|
if (! $invoice) {
|
||||||
|
abort(404);
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'invoice' => Invoices::view($uuid),
|
'invoice' => $invoice,
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('Shop.Invoices.view', $data);
|
return view('Shop.Invoices.view', $data);
|
||||||
|
|||||||
@@ -36,7 +36,13 @@ class Invoices
|
|||||||
|
|
||||||
public static function view($uuid)
|
public static function view($uuid)
|
||||||
{
|
{
|
||||||
$data = self::getFullByUUID($uuid)->toArray();
|
$invoice = self::getFullByUUID($uuid);
|
||||||
|
|
||||||
|
if (! $invoice) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $invoice->toArray();
|
||||||
$data['payment_type'] = InvoicePayments::getPaymentType($data['payment_type']);
|
$data['payment_type'] = InvoicePayments::getPaymentType($data['payment_type']);
|
||||||
$data['status'] = self::getStatus($data['status']);
|
$data['status'] = self::getStatus($data['status']);
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,28 @@
|
|||||||
'model' => 'customer_invoices',
|
'model' => 'customer_invoices',
|
||||||
'with_print' => false,
|
'with_print' => false,
|
||||||
'with_filters' => false,
|
'with_filters' => false,
|
||||||
|
'show_callback' => 'AdminCustomerInvoiceView(id);',
|
||||||
])
|
])
|
||||||
<x-layout.modal title="Filtres" id="modal-customer_invoices-filters">
|
<x-layout.modal title="Filtres" id="modal-customer_invoices-filters">
|
||||||
@include('Admin.Shop.CustomerInvoices.partials.filters', ['model' => 'customer_invoices'])
|
@include('Admin.Shop.CustomerInvoices.partials.filters', ['model' => 'customer_invoices'])
|
||||||
</x-layout.modal>
|
</x-layout.modal>
|
||||||
</x-card>
|
</x-card>
|
||||||
|
|
||||||
|
@include('load.layout.modal')
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
const customerInvoiceShowTemplate = "{{ route('Shop.Invoices.view', ['uuid' => '__UUID__']) }}";
|
||||||
|
|
||||||
|
window.AdminCustomerInvoiceView = function(id) {
|
||||||
|
if (!id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = customerInvoiceShowTemplate.replace('__UUID__', id);
|
||||||
|
openModal('Voir une facture', '#invoice-form', url, false, false, 'xl', true);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|||||||
@@ -3,5 +3,4 @@
|
|||||||
Route::prefix('CustomerInvoices')->name('CustomerInvoices.')->group(function () {
|
Route::prefix('CustomerInvoices')->name('CustomerInvoices.')->group(function () {
|
||||||
Route::get('', 'CustomerInvoiceController@index')->name('index');
|
Route::get('', 'CustomerInvoiceController@index')->name('index');
|
||||||
Route::delete('destroy/{id?}', 'CustomerInvoiceController@destroy')->name('destroy');
|
Route::delete('destroy/{id?}', 'CustomerInvoiceController@destroy')->name('destroy');
|
||||||
Route::get('view/{id?}', 'CustomerInvoiceController@view')->name('view');
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user