diff --git a/app/Datatables/Shop/InvoicePaymentsDataTable.php b/app/Datatables/Admin/Shop/InvoicePaymentsDataTable.php
similarity index 78%
rename from app/Datatables/Shop/InvoicePaymentsDataTable.php
rename to app/Datatables/Admin/Shop/InvoicePaymentsDataTable.php
index cb4c10b4..b75b8fe7 100644
--- a/app/Datatables/Shop/InvoicePaymentsDataTable.php
+++ b/app/Datatables/Admin/Shop/InvoicePaymentsDataTable.php
@@ -1,15 +1,20 @@
url = route('Admin.Shop.InvoicePayments.index');
+ }
public function query(InvoicePayment $model)
{
@@ -34,7 +39,7 @@ class InvoicesDataTable extends DataTable
{
return [
Column::make('payment_type')->title('Type')->width(80),
- Column::make('status')->width(60),
+ Column::make('date')->width(60),
Column::make('amount')->title('Montant')->width(100),
Column::make('reference')->title('Référence'),
$this->makeColumnButtons(),
diff --git a/app/Http/Controllers/Admin/Shop/InvoiceController.php b/app/Http/Controllers/Admin/Shop/InvoiceController.php
index 2dc395ad..bd007371 100644
--- a/app/Http/Controllers/Admin/Shop/InvoiceController.php
+++ b/app/Http/Controllers/Admin/Shop/InvoiceController.php
@@ -38,12 +38,9 @@ class InvoiceController extends Controller
{
$data = Invoices::init();
$data['invoice'] = Invoices::getFull($id)->toArray();
- $model = new invoicePaymentsDataTable();
+ $model = new InvoicePaymentsDataTable();
$data['invoice_payments'] = $model->html();
- // dump($data);
- // exit;
-
return view('Admin.Shop.Invoices.edit', $data);
}
diff --git a/app/Http/Controllers/Admin/Shop/InvoicePaymentController.php b/app/Http/Controllers/Admin/Shop/InvoicePaymentController.php
index d6620fff..098d6a19 100644
--- a/app/Http/Controllers/Admin/Shop/InvoicePaymentController.php
+++ b/app/Http/Controllers/Admin/Shop/InvoicePaymentController.php
@@ -16,7 +16,9 @@ class InvoicePaymentController extends Controller
public function create()
{
- return view('Admin.Shop.InvoicePayments.create');
+ $data = InvoicePayments::init();
+
+ return view('Admin.Shop.InvoicePayments.create' , $data);
}
public function store(Request $request)
@@ -37,8 +39,6 @@ class InvoicePaymentController extends Controller
{
$data = InvoicePayments::init();
$data['invoice_payment'] = InvoicePayments::getFull($id)->toArray();
- $model = new invoice_paymentPaymentsDataTable();
- $data['invoice_payment_payments'] = $model->html();
return view('Admin.Shop.InvoicePayments.edit', $data);
}
diff --git a/app/Repositories/Shop/InvoicePayments.php b/app/Repositories/Shop/InvoicePayments.php
index de210acd..0acf23df 100644
--- a/app/Repositories/Shop/InvoicePayments.php
+++ b/app/Repositories/Shop/InvoicePayments.php
@@ -6,6 +6,12 @@ use App\Models\Shop\InvoicePayment;
class InvoicePayments
{
+ public static function init()
+ {
+ return [
+ 'payment_types' => self::paymentTypes(),
+ ];
+ }
public static function get($id, $relations = false)
{
return $relations ? InvoicePayment::with($relations)->findOrFail($id) : InvoicePayment::findOrFail($id);
diff --git a/resources/views/Admin/Shop/InvoicePayments/create.blade.php b/resources/views/Admin/Shop/InvoicePayments/create.blade.php
index 816312fc..af874935 100644
--- a/resources/views/Admin/Shop/InvoicePayments/create.blade.php
+++ b/resources/views/Admin/Shop/InvoicePayments/create.blade.php
@@ -1,16 +1 @@
-@extends('layout.index', [
- 'title' => __('invoices.title'),
- 'subtitle' => __('invoices.create.title'),
- 'breadcrumb' => [__('invoices.title'), __('invoices.create.title')]
-])
-
-@include('boilerplate::load.fileinput')
-
-@section('content')
-
- {{ Form::open(['route' => 'Admin.Shop.Invoices.store', 'id' => 'invoice-form', 'autocomplete' => 'off']) }}
- @include('Admin.Shop.Invoices.form')
- @include('components.save')
-
-
-@endsection
+@include('Admin.Shop.InvoicePayments.form')
diff --git a/resources/views/Admin/Shop/InvoicePayments/form.blade.php b/resources/views/Admin/Shop/InvoicePayments/form.blade.php
index 414c2109..2eb09e66 100644
--- a/resources/views/Admin/Shop/InvoicePayments/form.blade.php
+++ b/resources/views/Admin/Shop/InvoicePayments/form.blade.php
@@ -4,7 +4,7 @@
'label' => 'Règlement',
'name' => 'payment_type',
'list' => $payment_types ?? [],
- 'value' => $invoice_payment['payment_type'],
+ 'value' => $invoice_payment['payment_type'] ?? null,
'class' => 'select2',
])
@@ -12,15 +12,7 @@
@include('components.form.input', [
'label' => 'Montant',
'name' => 'amount',
- 'value' => $invoice_payment['amount'],
+ 'value' => $invoice_payment['amount'] ?? null,
])
-
-
-
-
- @include('components.form.buttons.button-save')
-
-
-
diff --git a/resources/views/Admin/Shop/Invoices/edit.blade.php b/resources/views/Admin/Shop/Invoices/edit.blade.php
index 25d55bda..246ed4b9 100644
--- a/resources/views/Admin/Shop/Invoices/edit.blade.php
+++ b/resources/views/Admin/Shop/Invoices/edit.blade.php
@@ -4,95 +4,8 @@
'breadcrumb' => ['Articles'],
])
-@include('boilerplate::load.fileinput')
-
@section('content')
-
-
- {{ Form::open(['route' => 'Admin.Shop.Invoices.update', 'id' => 'invoice-form', 'autocomplete' => 'off']) }}
-
-
-
-
-
-
-
- @include('components.form.buttons.button-save')
-
-
-
-
-
-
- {{ $invoice['order']['customer']['last_name'] }}
- {{ $invoice['order']['customer']['first_name'] }}
-
-
-
-
- @if ($invoice['order']['delivery_address'])
- {{ $invoice['order']['delivery_address']['address'] }}
- @isset($invoice['order']['delivery_address']['address2'])
- {{ $invoice['order']['delivery_address']['address2'] }}
- @endisset
- {{ $invoice['order']['delivery_address']['zipcode'] }}
- {{ $invoice['order']['delivery_address']['city'] }}
- @endif
-
-
-
-
-
-
-
- Facture N° {{ $invoice['ref'] }}
- du {{ Carbon\Carbon::parse($invoice['created_at'])->isoFormat('LLLL') }}
-
-
-
-
-
-
-
- @include('components.form.select', [
- 'label' => 'Statut',
- 'name' => 'status',
- 'list' => $statuses ?? [],
- 'value' => $invoice['status'],
- 'class' => 'select2',
- ])
-
-
- @include('components.form.select', [
- 'label' => 'Règlement',
- 'name' => 'payment_type',
- 'list' => $payment_types ?? [],
- 'value' => $invoice['order']['payment_type'],
- 'class' => 'select2',
- 'disabled' => false,
- ])
-
-
-
-
-
-
- @include('Admin.Shop.Orders.partials.detail', [
- 'detail_type' => 'facture',
- 'order' => $invoice['order'],
- ])
-
-
-
-
-
-
-
- Règlements
- @include('Admin.Shop.InvoicePayments.list', [
- 'dataTable' => $invoice_payments,
- ])
-
-
-
+
+ @include('Admin.Shop.Invoices.form')
+
@endsection
diff --git a/resources/views/Admin/Shop/Invoices/form.blade.php b/resources/views/Admin/Shop/Invoices/form.blade.php
index d19ca720..36bbd483 100644
--- a/resources/views/Admin/Shop/Invoices/form.blade.php
+++ b/resources/views/Admin/Shop/Invoices/form.blade.php
@@ -1,29 +1,71 @@
+{{ Form::open(['route' => 'Admin.Shop.Invoices.update', 'id' => 'invoice-form', 'autocomplete' => 'off']) }}
+
-
- @include('components.form.input', [
- 'name' => 'name',
- 'value' => $family['name'] ?? null,
- 'required' => true,
- 'label' => 'Nom',
- ])
-
- @include('components.form.textarea', [
- 'name' => 'description',
- 'value' => isset($description) ? $description : null,
- 'class' => 'editor',
- 'required' => false,
- 'label' => 'Description',
- ])
-
+
+
+ Facture N° {{ $invoice['ref'] }}
+ du {{ Carbon\Carbon::parse($invoice['created_at'])->isoFormat('LLLL') }}
+
+
+
+ @include('components.form.buttons.button-save')
-
-
-
- @include('components.form.buttons.button-save')
+
+
+
+ {{ $invoice['order']['customer']['last_name'] }}
+ {{ $invoice['order']['customer']['first_name'] }}
+
+
+
+
+ @if ($invoice['order']['delivery_address'])
+ {{ $invoice['order']['delivery_address']['address'] }}
+ @isset($invoice['order']['delivery_address']['address2'])
+ {{ $invoice['order']['delivery_address']['address2'] }}
+ @endisset
+ {{ $invoice['order']['delivery_address']['zipcode'] }}
+ {{ $invoice['order']['delivery_address']['city'] }}
+ @endif
+
+
+
+
+
+ @include('components.form.select', [
+ 'label' => 'Statut',
+ 'name' => 'status',
+ 'list' => $statuses ?? [],
+ 'value' => $invoice['status'],
+ 'class' => 'select2',
+ ])
+
+
+ @include('components.form.select', [
+ 'label' => 'Règlement',
+ 'name' => 'payment_type',
+ 'list' => $payment_types ?? [],
+ 'value' => $invoice['order']['payment_type'],
+ 'class' => 'select2',
+ 'disabled' => false,
+ ])
+
+
+ @include('Admin.Shop.Invoices.partials.payments')
+
+
+
+ @include('Admin.Shop.Orders.partials.detail', [
+ 'detail_type' => 'facture',
+ 'order' => $invoice['order'] ?? null,
+ ])
+
+
+
-@include('boilerplate::load.tinymce')
+@include('load.layout.modal')
diff --git a/resources/views/Admin/Shop/Invoices/partials/payments.blade.php b/resources/views/Admin/Shop/Invoices/partials/payments.blade.php
new file mode 100644
index 00000000..a0dcfc8b
--- /dev/null
+++ b/resources/views/Admin/Shop/Invoices/partials/payments.blade.php
@@ -0,0 +1,38 @@
+
+@if ($payments ?? false)
+ @foreach ($payments as $payment)
+ @endforeach
+@endif
+
+@push('js')
+
+@endpush
diff --git a/routes/Admin/Shop/InvoicePayments.php b/routes/Admin/Shop/InvoicePayments.php
index 972269dd..61b7e818 100644
--- a/routes/Admin/Shop/InvoicePayments.php
+++ b/routes/Admin/Shop/InvoicePayments.php
@@ -6,6 +6,6 @@ Route::prefix('InvoicePayments')->name('InvoicePayments.')->group(function () {
Route::delete('destroy', 'InvoicePaymentController@destroy')->name('destroy');
Route::post('update', 'InvoicePaymentController@update')->name('update');
Route::post('store', 'InvoicePaymentController@store')->name('store');
- Route::get('edit/{id}', 'InvoicePaymentController@edit')->name('edit');
+ Route::get('edit/{id?}', 'InvoicePaymentController@edit')->name('edit');
});