update
This commit is contained in:
@@ -38,8 +38,11 @@ class InvoiceController extends Controller
|
|||||||
{
|
{
|
||||||
$data = Invoices::init();
|
$data = Invoices::init();
|
||||||
$data['invoice'] = Invoices::getFull($id)->toArray();
|
$data['invoice'] = Invoices::getFull($id)->toArray();
|
||||||
|
/*
|
||||||
$model = new InvoicePaymentsDataTable();
|
$model = new InvoicePaymentsDataTable();
|
||||||
$data['invoice_payments'] = $model->html();
|
$data['invoice_payments'] = $model->html();
|
||||||
|
*/
|
||||||
|
// dump($data);
|
||||||
|
|
||||||
return view('Admin.Shop.Invoices.edit', $data);
|
return view('Admin.Shop.Invoices.edit', $data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class InvoicePaymentController extends Controller
|
|||||||
|
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
$data['invoice_payment'] = InvoicePayments::getFull($id)->toArray();
|
$data['invoice_payment'] = InvoicePayments::getArray($id);
|
||||||
|
|
||||||
return view('Admin.Shop.InvoicePayments.view', $data);
|
return view('Admin.Shop.InvoicePayments.view', $data);
|
||||||
}
|
}
|
||||||
@@ -38,13 +38,13 @@ class InvoicePaymentController extends Controller
|
|||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$data = InvoicePayments::init();
|
$data = InvoicePayments::init();
|
||||||
$data['invoice_payment'] = InvoicePayments::getFull($id)->toArray();
|
$data['invoice_payment'] = InvoicePayments::getArray($id);
|
||||||
|
|
||||||
return view('Admin.Shop.InvoicePayments.edit', $data);
|
return view('Admin.Shop.InvoicePayments.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
return InvoicePayments::delete($id);
|
return InvoicePayments::destroy($id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,43 +3,18 @@
|
|||||||
namespace App\Repositories\Shop;
|
namespace App\Repositories\Shop;
|
||||||
|
|
||||||
use App\Models\Shop\InvoicePayment;
|
use App\Models\Shop\InvoicePayment;
|
||||||
|
use App\Traits\Model\Basic;
|
||||||
|
|
||||||
class InvoicePayments
|
class InvoicePayments
|
||||||
{
|
{
|
||||||
|
use Basic;
|
||||||
|
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'payment_types' => self::paymentTypes(),
|
'payment_types' => self::paymentTypes(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public static function get($id, $relations = false)
|
|
||||||
{
|
|
||||||
return $relations ? InvoicePayment::with($relations)->findOrFail($id) : InvoicePayment::findOrFail($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function store($data)
|
|
||||||
{
|
|
||||||
return ($data['id'] ?? false) ? self::update($data) : self::create($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function create($data)
|
|
||||||
{
|
|
||||||
return InvoicePayment::create($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function update($data, $id = false)
|
|
||||||
{
|
|
||||||
$id = $id ? $id : $data['id'];
|
|
||||||
$item = self::get($id);
|
|
||||||
$item->update($data);
|
|
||||||
|
|
||||||
return $item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function delete($id)
|
|
||||||
{
|
|
||||||
return InvoicePayment::destroy($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getPaymentType($id)
|
public static function getPaymentType($id)
|
||||||
{
|
{
|
||||||
@@ -55,4 +30,9 @@ class InvoicePayments
|
|||||||
'VIREMENT',
|
'VIREMENT',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getModel()
|
||||||
|
{
|
||||||
|
return InvoicePayment::query();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Invoices
|
|||||||
|
|
||||||
public static function getFull($id)
|
public static function getFull($id)
|
||||||
{
|
{
|
||||||
return self::get($id, ['address', 'order.customer', 'order.delivery_address', 'order.detail']);
|
return self::get($id, ['address', 'payments', 'order.customer', 'order.delivery_address', 'order.detail']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getByUUID($uuid)
|
public static function getByUUID($uuid)
|
||||||
|
|||||||
@@ -105,3 +105,10 @@ body {
|
|||||||
color: #527C39!important;
|
color: #527C39!important;
|
||||||
font-size: 1.4em;
|
font-size: 1.4em;
|
||||||
}
|
}
|
||||||
|
.bg-lighter {
|
||||||
|
background-color: rgba(255,255,255,0.05)!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-darker {
|
||||||
|
background-color: rgba(0,0,0,0.05)!important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -45,17 +45,13 @@
|
|||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@include('components.form.select', [
|
</div>
|
||||||
'label' => 'Règlement',
|
</div>
|
||||||
'name' => 'payment_type',
|
<x-card class="bg-darker">
|
||||||
'list' => $payment_types ?? [],
|
@include('Admin.Shop.Invoices.partials.payments', [
|
||||||
'value' => $invoice['order']['payment_type'],
|
'payments' => $invoice['payments'] ?? false,
|
||||||
'class' => 'select2',
|
|
||||||
'disabled' => false,
|
|
||||||
])
|
])
|
||||||
</div>
|
</x-card>
|
||||||
</div>
|
|
||||||
@include('Admin.Shop.Invoices.partials.payments')
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
|
|||||||
@@ -7,8 +7,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if ($payments ?? false)
|
@if ($payments ?? false)
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th class="text-right">Montant</th>
|
||||||
|
<th>Ref</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
@foreach ($payments as $payment)
|
@foreach ($payments as $payment)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $payment['date'] }}</td>
|
||||||
|
<td>{{ $payment_types[$payment['payment_type']] }}</td>
|
||||||
|
<td class="text-right font-weight-bold">{{ sprintf('%01.2f', $payment['amount']) }} €</td>
|
||||||
|
<td>{{ $payment['reference'] }}</td>
|
||||||
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
|
|||||||
Reference in New Issue
Block a user