fix editing orders

This commit is contained in:
Ludovic CANDELLIER
2022-11-19 23:43:12 +01:00
parent caee665758
commit 73763bb146
19 changed files with 314 additions and 174 deletions

View File

@@ -1,30 +1,27 @@
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-12">
<a href="{!! route('Admin.Shop.Orders.index') !!}">
@include('Admin.Shop.Dashboard.components.infobox', ['count' => (isset($nb_orders)) ? $nb_orders : 0, 'class' => 'bg-aqua', 'icon' => 'ion ion-bag', 'text' => 'Commandes'])
@include('Admin.Shop.Dashboard.components.infobox', ['count' => $orders_count ?? 0, 'class' => 'bg-aqua', 'icon' => 'ion ion-bag', 'text' => 'Commandes'])
</a>
</div>
<!-- /.col -->
<div class="col-md-3 col-sm-6 col-xs-12">
<a href="{!! route('Admin.Shop.Invoices.index') !!}">
@include('Admin.Shop.Dashboard.components.infobox', ['count' => (isset($nb_invoices)) ? $nb_invoices : 0, 'class' => 'bg-red', 'icon' => 'fa-clock-o', 'text' => 'Factures'])
@include('Admin.Shop.Dashboard.components.infobox', ['count' => $invoices_count ?? 0, 'class' => 'bg-red', 'icon' => 'fa-clock-o', 'text' => 'Factures'])
</a>
</div>
<!-- /.col -->
<!-- fix for small devices only -->
<div class="clearfix visible-sm-block"></div>
<div class="col-md-3 col-sm-6 col-xs-12">
<a href="{!!route('Admin.Shop.Orders.index') !!}">
@include('Admin.Shop.Dashboard.components.infobox', ['count' => (isset($total_invoices)) ? $total_invoices : 0, 'class' => 'bg-yellow', 'icon' => 'ion ion-stats-bars', 'text' => 'CA du mois'])
@include('Admin.Shop.Dashboard.components.infobox', ['count' => $orders_sum ?? 0, 'class' => 'bg-yellow', 'icon' => 'ion ion-stats-bars', 'text' => 'CA du mois'])
</a>
</div>
<!-- /.col -->
<div class="col-md-3 col-sm-6 col-xs-12">
<a href="{!! route('Admin.Shop.Orders.index') !!}">
@include('Admin.Shop.Dashboard.components.infobox', ['count' => (isset($nb_ventes)) ? $nb_ventes : 0, 'class' => 'bg-green', 'icon' => 'fa-check-square-o', 'text' => 'Panier moyen'])
@include('Admin.Shop.Dashboard.components.infobox', ['count' => $orders_avg ?? 0, 'class' => 'bg-green', 'icon' => 'fa-check-square-o', 'text' => 'Panier moyen'])
</a>
</div>
<!-- /.col -->
</div>

View File

@@ -1,54 +1,70 @@
@extends('layout.index', [
'title' => 'Commandes',
'subtitle' => 'Edition d\'une commandes',
'title' => __('shop.orders.title'),
'subtitle' => __('shop.orders.list'),
'breadcrumb' => ['Commandes']
])
@section('content')
{{ Form::open(['route' => 'Admin.Shop.Orders.update', 'id' => 'order-form', 'autocomplete' => 'off']) }}
{{ Form::open(['route' => 'Admin.Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $order['id'] ?? null }}">
<x-card>
<h3>{{ $order['customer']['last_name'] }} {{ $order['customer']['first_name'] }}</h3>
<h4>{{ $order['delivery']['name'] }} </h4>
<div class="row">
<div class="col-12">
@if ($order['address'])
{{ $order['address']['address'] }}<br/>
@isset ($order['address']['address2']) {{ $order['address']['address2'] }}<br/> @endisset
{{ $order['address']['zipcode'] }} {{ $order['address']['city'] }}<br/>
@endif
</div>
</div>
<x-card title="Détail de la commande">
<div class="row">
<div class="col-12">
<table class="datatable w-100 table-bordered">
<thead>
<th>Quantité</th>
<th>Nom</th>
<th>Prix</th>
<th>Total</th>
</thead>
<tbody>
@foreach ($order['detail'] as $detail)
<tr>
<td>{{ $detail['quantity'] }}</td>
<td>{{ $detail['name'] }}</td>
<td>{{ $detail['price'] }}</td>
<td>{{ $detail['total'] }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="row mb-3">
<div class="col-6">
<h3>{{ $order['customer']['last_name'] }} {{ $order['customer']['first_name'] }}</h3>
<h4>{{ $order['delivery']['name'] }} </h4>
<div class="row">
<div class="col-12">
@if ($order['address'])
{{ $order['address']['address'] }}<br/>
@isset ($order['address']['address2']) {{ $order['address']['address2'] }}<br/> @endisset
{{ $order['address']['zipcode'] }} {{ $order['address']['city'] }}<br/>
@endif
</div>
</div>
</div>
</x-card>
<div class="col-6">
<div class="row mb-3">
<div class="col-6" style="font-size: 1.2em; font-weight: 500;">
Commande <br/>
du {{ Carbon\Carbon::parse($order['created_at'])->isoFormat('LLLL') }}
</div>
<div class="col-6">
<label>Canal de vente</label><br/>
@include('components.form.select', [
'name' => 'sale_channel_id',
'list' => $sale_channels ?? [],
'value' => $order['sale_channel_id'],
'class' => 'select2',
])
</div>
</div>
<div class="row mb-3">
<div class="col-6">
<label>Statut</label><br/>
@include('components.form.select', [
'name' => 'status',
'list' => $statuses ?? [],
'value' => $order['status'],
'class' => 'select2',
])
</div>
<div class="col-6">
<label>Règlement</label><br/>
@include('components.form.select', [
'name' => 'payment_type',
'list' => $payment_types ?? [],
'value' => $order['payment_type'],
'class' => 'select2',
])
</div>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('Admin.Shop.Orders.partials.detail')
</div>
</div>
</x-card>
</form>
{{ Form::close() }}
@endsection

View File

@@ -0,0 +1,46 @@
<x-card title="Détail de la commande">
<div class="row">
<div class="col-12">
<table class="table table-bordered table-hover w-100 ">
<thead class="thead-light">
<th>Nom</th>
<th>Quantité</th>
<th>Prix unitaire</th>
<th>Total</th>
</thead>
<tbody>
@foreach ($order['detail'] as $detail)
<tr>
<td>{{ $detail['name'] }}</td>
<td align="right">{{ $detail['quantity'] }}</td>
<td align="right">{{ $detail['price_taxed'] }}</td>
<td align="right">{{ $detail['total_taxed'] }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td style="font-size: 1.2em; font-weight: bold;">Total</td>
<td></td>
<td></td>
<td align="right" style="font-size: 1.2em; font-weight: bold;">{{ $order['total_taxed'] }}</td>
</tr>
@if ($order['shipping'] ?? false)
<tr>
<td style="font-size: 1.1em; font-weight: 500;">Livraison</td>
<td align="right"></td>
<td align="right"></td>
<td align="right" style="font-size: 1.1em; font-weight: bold;">{{ $order['shipping'] }}</td>
</tr>
<tr>
<td style="font-size: 1.4em; font-weight: bold;">Total à payer</td>
<td align="right"></td>
<td align="right"></td>
<td align="right" style="font-size: 1.4em; font-weight: bold;">{{ $order['total_shipped'] }}</td>
</tr>
@endif
</tfoot>
</table>
</div>
</div>
</x-card>

View File

@@ -1,10 +1,10 @@
<hr>
<strong>Mes coordonnées</strong><br>
<i class="fa fa-home pr-2"></i> {{ $customer['first_name'] }} {{ $customer['first_name'] }} {{ $customer['company'] }}
<i class="fa fa-home pr-2"></i> {{ $customer['address'] }}<br>
<i class="pr-5"></i> {{ $customer['address2'] }}<br>
<i class="fa fa-phone pr-2"></i> {{ $customer['phone'] }}<br>
<i class="fa fa-envelope pr-2"></i> {{ $customer['email'] }}<br>
<hr>
<strong>Compte créé le {{ $customer['created_at'] }}</strong>
<strong>Compte créé le {{ Carbon\Carbon::parse($customer['created_at'])->format('d-m-Y') }}</strong>