From 900aa413a285f81f8f526675c44374e4338188b8 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Fri, 17 Feb 2023 00:05:03 +0100 Subject: [PATCH] Fix on invoices, add delivery reference, wip on dashboard concurrency requests designed on template --- Gruntfile.js | 11 ++- app/Http/Controllers/Admin/HomeController.php | 8 +- .../Admin/Shop/DashboardController.php | 23 +---- .../Admin/Shop/InvoiceController.php | 7 +- app/Models/Shop/Invoice.php | 10 ++ app/Models/Shop/Order.php | 25 +++++ app/Repositories/Core/DateRange.php | 81 +++++++++++++--- app/Repositories/Core/DateStats.php | 51 ++++++++++ app/Repositories/Shop/Customers.php | 5 + app/Repositories/Shop/Dashboards.php | 13 ++- app/Repositories/Shop/Invoices.php | 4 +- app/Repositories/Shop/Offers.php | 5 + app/Repositories/Shop/Orders.php | 48 ++++++--- build/css/main.css | 48 +++++++++ build/js/plugins/daterangepicker/fr.js | 45 +++++++++ composer.json | 2 + resources/lang/fr/Core.php | 1 + .../Dashboard/_partials/counter.blade.php | 97 +++++++++++++++---- .../Dashboard/_partials/evolutions.blade.php | 10 +- .../Shop/Dashboard/_partials/report.blade.php | 16 +-- .../Admin/Shop/Dashboard/index.blade.php | 35 +++++-- .../views/Admin/Shop/Invoices/edit.blade.php | 67 ++++++++++++- .../views/Admin/Shop/Orders/edit.blade.php | 51 ++++++---- .../Shop/Orders/partials/detail.blade.php | 18 +++- resources/views/components/card.blade.php | 2 +- routes/Admin/route.php | 2 +- 26 files changed, 555 insertions(+), 130 deletions(-) create mode 100644 app/Repositories/Core/DateStats.php create mode 100644 build/js/plugins/daterangepicker/fr.js diff --git a/Gruntfile.js b/Gruntfile.js index 0ec74228..587e801c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -347,8 +347,14 @@ module.exports = function(grunt) { }, { expand: true, - cwd: 'build/Suite/js/widgets/daterangepicker/Lang', - src: ['**'], + cwd: 'node_modules/daterangepicker/', + src: ['daterangepicker.css'], + dest: 'public/assets/plugins/daterangepicker', + }, + { + expand: true, + cwd: 'node_modules/daterangepicker/', + src: ['daterangepicker.js'], dest: 'public/assets/plugins/daterangepicker', }, { @@ -568,6 +574,7 @@ module.exports = function(grunt) { dist: { files: ['build/js/*', 'build/css/*'], tasks: ['concat', 'copy'] + // tasks: ['concat'] } }, }); diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.php index 969a57fd..e3cf9cc0 100644 --- a/app/Http/Controllers/Admin/HomeController.php +++ b/app/Http/Controllers/Admin/HomeController.php @@ -13,9 +13,13 @@ class HomeController extends Controller $this->middleware('auth'); } - public function index() + public function index(Request $request, $period = false) { - $data = Dashboards::getStats(); + $data = $request->all(); + $start = $request->input('start'); + $end = $request->input('end'); + $data = Dashboards::getStats($start, $end); + // dump($data); return view('Admin.Shop.Dashboard.index', $data); } } diff --git a/app/Http/Controllers/Admin/Shop/DashboardController.php b/app/Http/Controllers/Admin/Shop/DashboardController.php index dd90a8ff..d8647c22 100644 --- a/app/Http/Controllers/Admin/Shop/DashboardController.php +++ b/app/Http/Controllers/Admin/Shop/DashboardController.php @@ -5,33 +5,20 @@ namespace App\Http\Controllers\Admin\Shop; use Illuminate\Http\Request; use App\Http\Controllers\Controller; -use App\Repositories\Core\Auth\Users; +use App\Repositories\Shop\Dashboards; class DashboardController extends Controller { - /** - * Create a new controller instance. - * - * @return void - */ public function __construct() { $this->middleware('auth'); } - /** - * Show the application dashboard. - * - * @return - */ - public function index() + public function index(Request $request) { - $data = []; - - if (Users::hasRole('admin')) { - $dashboard = 'dashboard'; - $data = []; - } + $data = $request->all(); + $data = Dashboards::getStats($data); + dump($data); return view('Admin.Shop.Dashboard.index', $data); } diff --git a/app/Http/Controllers/Admin/Shop/InvoiceController.php b/app/Http/Controllers/Admin/Shop/InvoiceController.php index de72885b..d53d981a 100644 --- a/app/Http/Controllers/Admin/Shop/InvoiceController.php +++ b/app/Http/Controllers/Admin/Shop/InvoiceController.php @@ -28,18 +28,19 @@ class InvoiceController extends Controller public function show($id) { - $data = Invoices::get($id); + $data['invoice'] = Invoices::get($id)->toArray(); return view('Admin.Shop.Invoices.view', $data); } public function edit($id) { - $data['customer'] = Invoices::get($id)->toArray(); + $data['invoice'] = Invoices::get($id, ['order.customer', 'order.address', 'order.detail'])->toArray(); + $data['statuses'] = Invoices::statuses(); return view('Admin.Shop.Invoices.edit', $data); } public function destroy($id) { - return Invoices::destroy($id); + return Invoices::delete($id); } } diff --git a/app/Models/Shop/Invoice.php b/app/Models/Shop/Invoice.php index 187f131f..99938065 100644 --- a/app/Models/Shop/Invoice.php +++ b/app/Models/Shop/Invoice.php @@ -31,4 +31,14 @@ class Invoice extends Model { return $this->belongsToThrough(Customer::class, Order::class, null, '', [Customer::class => 'customer_id', Order::class => 'order_id']); } + + public function scopeByUUID($query, $uuid) + { + return $query->where('uuid', $uuid); + } + + public function scopeByPeriod($query, $start, $end) + { + return $query->whereBetween('created_at', [$start, $end]); + } } diff --git a/app/Models/Shop/Order.php b/app/Models/Shop/Order.php index 5ee1ab81..417cab73 100644 --- a/app/Models/Shop/Order.php +++ b/app/Models/Shop/Order.php @@ -46,6 +46,11 @@ class Order extends Model return $this->belongsTo(SaleChannel::class); } + public function scopeByUUID($query, $uuid) + { + return $query->where('uuid', $uuid); + } + public function scopeByCustomer($query, $customer_id) { return $query->where('customer_id', $customer_id); @@ -56,6 +61,21 @@ class Order extends Model return $query->where('delivery_id', $delivery_id); } + public function scopePreparation($query) + { + return $query->byStatus(1); + } + + public function scopeSended($query) + { + return $query->byStatus(2); + } + + public function scopeReceived($query) + { + return $query->byStatus(3); + } + public function scopeByStatus($query, $status) { return $query->where('status', $status); @@ -65,4 +85,9 @@ class Order extends Model { return $query->where('payment_type', $payment_type); } + + public function scopeByPeriod($query, $start, $end, $field = 'created_at') + { + return $query->whereBetween($field, [$start, $end]); + } } diff --git a/app/Repositories/Core/DateRange.php b/app/Repositories/Core/DateRange.php index ea48664e..58a3eb1a 100644 --- a/app/Repositories/Core/DateRange.php +++ b/app/Repositories/Core/DateRange.php @@ -12,6 +12,59 @@ use function League\Period\interval_after; class DateRange { + + public static function today() + { + return self::previousDay(0); + } + + public static function currentWeek() + { + return self::previousWeek(0); + } + + public static function currentMonth() + { + return self::previousMonth(0); + } + + public static function currentYear() + { + return self::previousYear(0); + } + + public static function previousDay($nb = 1) + { + return [ + 'start' => Carbon::now()->subDay($nb)->startOfDay(), + 'end' => Carbon::now()->subDay($nb)->endOfDay(), + ]; + } + + public static function previousWeek($nb = 1) + { + return [ + 'start' => Carbon::now()->subWeek($nb)->startOfWeek(), + 'end' => Carbon::now()->subWeek($nb)->endOfWeek(), + ]; + } + + public static function previousMonth($nb = 1) + { + return [ + 'start' => Carbon::now()->subMonth($nb)->startOfMonth(), + 'end' => Carbon::now()->subMonth($nb)->endOfMonth(), + ]; + } + + public static function previousYear($nb = 1) + { + return [ + 'start' => Carbon::now()->subYear($nb)->startOfYear(), + 'end' => Carbon::now()->subYear($nb)->endOfYear(), + ]; + } + public static function getPeriodsLastMonthWithLabels($nb, $with_actual = true) { $periods = DateRange::PeriodsToCarbon(DateRange::getPeriodsLastMonth($nb, $with_actual)); @@ -30,7 +83,7 @@ class DateRange public static function getPeriodsLastMonth($nb = 1, $with_actual = true) { $end = $with_actual ? Carbon::now()->endOfMonth() : self::lastMonth(); - $begin = ($nb == 1) ? $end->copy()->startOfMonth() : $end->copy()->startOfMonth()->subMonth($nb-1); + $begin = ($nb == 1) ? $end->copy()->startOfMonth() : $end->copy()->startOfMonth()->subMonth($nb - 1); $t = self::getPeriodsbyMonth($begin, $end); return self::getPeriodsbyMonth($begin, $end); } @@ -58,14 +111,14 @@ class DateRange { $end = $with_actual ? Carbon::now()->endOfWeek() : self::lastWeek(); $begin = $end->copy()->subWeek($nb); - return static::getPeriodsbyWeek($begin, $end); + return self::getPeriodsbyWeek($begin, $end); } public static function getPeriodsLastDay($nb = 1, $with_actual = true) { $end = $with_actual ? Carbon::now()->endOfDay() : static::lastDay(); $begin = $end->copy()->subDay($nb); - return static::getPeriodsbyDay($begin, $end); + return self::getPeriodsbyDay($begin, $end); } public static function byDay() @@ -92,16 +145,16 @@ class DateRange { $quarter = Carbon::now()->quarter; switch ($quarter) { - case 1: - case 2: - $date = Carbon::now()->startOfYear(); - break; - case 3: - $date = Carbon::now()->startOfQuarter(); - break; - case 4: - $date = Carbon::now()->subMonth(3)->startOfQuarter(); - break; + case 1: + case 2: + $date = Carbon::now()->startOfYear(); + break; + case 3: + $date = Carbon::now()->startOfQuarter(); + break; + case 4: + $date = Carbon::now()->subMonth(3)->startOfQuarter(); + break; } return [$date, $date->addMonth(6)]; } @@ -143,7 +196,7 @@ class DateRange public static function getPeriods($begin, $end, $duration, $interval = 1) { - $period = new Period($begin, $end); + $period = new Period($begin, $end, $interval); foreach ($period->getDatePeriod($duration) as $day) { $daterange[] = interval_after($day, $duration); } diff --git a/app/Repositories/Core/DateStats.php b/app/Repositories/Core/DateStats.php new file mode 100644 index 00000000..9f7f3baf --- /dev/null +++ b/app/Repositories/Core/DateStats.php @@ -0,0 +1,51 @@ +startOfMonth($prev); + $end = Carbon::now()->endOfMonth($prev); + return self::countByPeriod($start, $end); + } + + public static function countByPeriod($start, $end, $field = 'created_at') + { + return self::getModel()->whereBetween($field, [$start, $end])->count(); + } + + public static function avgByMonth($prev = 0, $field = false) + { + $start = Carbon::now()->startOfMonth($prev); + $end = Carbon::now()->endOfMonth($prev); + return self::avgByPeriod($start, $end, $field); + } + + public static function avgByPeriod($start, $end, $field) + { + $c = self::countByPeriod($start, $end); + return $c ? round(self::sumByPeriod($start, $end, $field) / $c, 2) : 0; + } + + public static function sumByMonth($prev = 0, $field = false) + { + $start = Carbon::now()->startOfMonth($prev); + $end = Carbon::now()->endOfMonth($prev); + return self::sumByPeriod($start, $end, $field); + } + + public static function sumByPeriod($start, $end, $field = 'created_at') + { + return self::getModel()->whereBetween($field, [$start, $end])->sum($field); + } + + public static function getModel() + { + return new Model; + } +} diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php index 610012e6..3d132448 100644 --- a/app/Repositories/Shop/Customers.php +++ b/app/Repositories/Shop/Customers.php @@ -12,6 +12,11 @@ use App\Models\Shop\Customer; class Customers { + public static function count() + { + return Customer::count(); + } + public static function editProfile($id = false) { $id = $id ? $id : self::getId(); diff --git a/app/Repositories/Shop/Dashboards.php b/app/Repositories/Shop/Dashboards.php index b087fb40..46d53b25 100644 --- a/app/Repositories/Shop/Dashboards.php +++ b/app/Repositories/Shop/Dashboards.php @@ -7,12 +7,17 @@ use App\Models\Shop\Homepage; class Dashboards { - public static function getStats() + public static function getStats($start, $end) { return [ - 'orders_count' => Orders::countByMonth(), - 'orders_sum' => Orders::sumByMonth(), - 'orders_avg' => Orders::avgByMonth(), + 'orders_count' => Orders::countByPeriod($start, $end), + 'orders_sum' => Orders::sumByPeriod($start, $end, 'total_shipped'), + 'orders_avg' => Orders::avgByPeriod($start, $end, 'total_shipped'), + 'offers_count' => Offers::count(), + 'clients_count' => Customers::count(), + 'preparationLess24H' => Orders::countInPreparationLess24H(), + 'preparationLess48H' => Orders::countInPreparationLess48H(), + 'preparationMore48H' => Orders::countInPreparationMore48H(), ]; } } diff --git a/app/Repositories/Shop/Invoices.php b/app/Repositories/Shop/Invoices.php index 28837bc5..250b72b6 100644 --- a/app/Repositories/Shop/Invoices.php +++ b/app/Repositories/Shop/Invoices.php @@ -61,7 +61,7 @@ class Invoices public static function getNewRef() { $ref = date('ym') . '00000'; - $last_ref = Invoice::orderBy('ref', 'desc')->where('ref', '>', $ref)->first(); + $last_ref = Invoice::orderBy('id', 'desc')->first(); return $last_ref ? $last_ref->ref + 1 : $ref + 1; } @@ -72,6 +72,6 @@ class Invoices public static function statuses() { - return ['En attente', 'Non soldée', 'Soldée']; + return ['En attente', 'Paiement partiel', 'Soldée', 'Paiement rejeté']; } } diff --git a/app/Repositories/Shop/Offers.php b/app/Repositories/Shop/Offers.php index 5010863b..41807b8c 100644 --- a/app/Repositories/Shop/Offers.php +++ b/app/Repositories/Shop/Offers.php @@ -7,6 +7,11 @@ use App\Repositories\Core\User\ShopCart; class Offers { + public static function count() + { + return Offer::count(); + } + public static function getFull($id, $sale_channel_id = false) { $sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID(); diff --git a/app/Repositories/Shop/Orders.php b/app/Repositories/Shop/Orders.php index acbc6739..29e739b5 100644 --- a/app/Repositories/Shop/Orders.php +++ b/app/Repositories/Shop/Orders.php @@ -4,11 +4,15 @@ namespace App\Repositories\Shop; use Carbon\Carbon; use App\Models\Shop\Order; +use App\Repositories\Core\DateStats; +use Illuminate\Support\Arr; use Illuminate\Support\Str; class Orders { + use DateStats; + public static function saveOrder($data) { $data += $data['basket']; @@ -31,21 +35,29 @@ class Orders return Order::count(); } - public static function countByMonth() + public static function countInPreparationLess24H() { - $start = Carbon::now()->startOfMonth(); - return Order::where('created_at', '>', $start)->count(); + $start = Carbon::now()->subHours(24); + $end = Carbon::now(); + return Order::preparation()->byPeriod($start, $end, 'updated_at')->count(); } - public static function sumByMonth() + public static function countInPreparationLess48H() { - $start = Carbon::now()->startOfMonth(); - return Order::where('created_at', '>', $start)->sum('total_shipped'); + $start = Carbon::now()->subHours(48); + $end = Carbon::now(); + return Order::preparation()->byPeriod($start, $end, 'updated_at')->count(); } - public static function avgByMonth() + public static function countInPreparationMore48H() { - return self::countByMonth() ? round(self::sumByMonth() / self::countByMonth(), 2) : 0; + $start = Carbon::now()->subHours(48); + return Order::preparation()->where('updated_at', '>', $start)->count(); + } + + public static function getTotalByPeriod($start, $end) + { + return self::sumByPeriod($start, $end, 'total_shipped'); } public static function edit($id) @@ -53,7 +65,7 @@ class Orders return [ 'order' => self::get($id, ['customer', 'address', 'detail']), 'statuses' => self::statuses(), - 'payment_types' => self::payment_types(), + 'payment_types' => self::paymentTypes(), 'sale_channels' => SaleChannels::getOptions(), ]; } @@ -100,17 +112,23 @@ class Orders return self::statuses()[$id] ?? false; } + public static function getStatusByName($name) + { + $data = array_flip(self::statuses()); + return $data[$name] ?? ''; + } + public static function statuses() { - return ['En attente', 'Expédié', 'Livré']; + return ['En attente', 'Préparation', 'Expédié', 'Livré']; } public static function getPaymentType($id) { - return self::payment_types()[$id] ?? false; + return self::paymentTypes()[$id] ?? false; } - public static function payment_types() + public static function paymentTypes() { return ['', 'CARTE BANCAIRE', 'CHEQUE', 'VIREMENT BANCAIRE']; } @@ -118,8 +136,12 @@ class Orders public static function getNewRef() { $ref = date('ym') . '00000'; - $last_ref = Order::orderBy('ref', 'desc')->where('ref', '>', $ref)->first(); + $last_ref = Order::orderBy('id', 'desc')->first(); return $last_ref ? $last_ref->ref + 1 : $ref + 1; } + public static function getModel() + { + return Order::query(); + } } diff --git a/build/css/main.css b/build/css/main.css index 1245da50..47f4ccae 100644 --- a/build/css/main.css +++ b/build/css/main.css @@ -56,4 +56,52 @@ ul .jqtree_common { body { font-size: 0.8rem; +} + +.dashboard { + color: #527C39!important; +} + +.dashboard .counter .index { + font-size: 1.6em; + font-weight: 600; +} + +.dashboard .counter .value { + font-size: 24px; + font-weight: 600; +} + +.dashboard .counter .table { + font-size: 14px; + font-weight: 600; +} + +.dashtable .card-header { + padding: 4px 0 4px 10px; + background-color: #527C39!important; + color: white; +} + +.dashtable .card-title { + margin: 0; +} + +.dashtable td { + padding: 0px; +} + +.dashtable .text-muted { + font-size: 0.8em; +} + +.dashtable .counter .index { + color: #527C39!important; + font-size: 1.2em; + font-weight: 400; +} + +.dashtable .counter .value { + color: #527C39!important; + font-size: 1.4em; } \ No newline at end of file diff --git a/build/js/plugins/daterangepicker/fr.js b/build/js/plugins/daterangepicker/fr.js new file mode 100644 index 00000000..bd0d4520 --- /dev/null +++ b/build/js/plugins/daterangepicker/fr.js @@ -0,0 +1,45 @@ +/* require moment.js */ +var dateRangePickerLanguage = { + format: "DD/MM/YYYY", + separator: " au ", + locale: { + applyLabel: "Valider", + cancelLabel: "Retour", + fromLabel: "Du", + toLabel: "Au", + customRangeLabel: "Personnalisé", + weekLabel: "S", + daysOfWeek: [ + "Dim", + "Lun", + "Mar", + "Mer", + "Jeu", + "Ven", + "Sam" + ], + monthNames: [ + "Jan", + "Fev", + "Mar", + "Avr", + "Mai", + "Juin", + "Juil", + "Aou", + "Sep", + "Oct", + "Nov", + "Déc" + ], + firstDay: 1 + }, + ranges: { + 'Aujourd\'hui': [moment(), moment()], + 'Hier': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], + 'La semaine dernière': [moment().subtract(6, 'days'), moment()], + '30 derniers jours': [moment().subtract(29, 'days'), moment()], + 'Ce mois-ci': [moment().startOf('month'), moment().endOf('month')], + 'Le mois dernier': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] + } +}; \ No newline at end of file diff --git a/composer.json b/composer.json index 49b2847d..3ba12ad0 100644 --- a/composer.json +++ b/composer.json @@ -39,6 +39,7 @@ "intervention/imagecache": "^2.4", "jasonlewis/expressive-date": "^1.0", "jenssegers/date": "^4.0", + "jeroen-g/blade-macro": "^1.0", "kalnoy/nestedset": "^6.0", "kirschbaum-development/eloquent-power-joins": "^2.3", "kmlaravel/laravel-geographical-calculator": "^2.1", @@ -106,6 +107,7 @@ "barryvdh/laravel-debugbar": "^3.8", "bestmomo/laravel5-artisan-language": "^0.3", "beyondcode/laravel-dump-server": "^1.7", + "enlightn/enlightn": "^2.1", "fakerphp/faker": "^1.13", "fossbarrow/laravel-phpcs": "dev-main", "kevincobain2000/laravel-erd": "^1.3", diff --git a/resources/lang/fr/Core.php b/resources/lang/fr/Core.php index 79132735..7f92a77b 100644 --- a/resources/lang/fr/Core.php +++ b/resources/lang/fr/Core.php @@ -206,6 +206,7 @@ return [ 'successdel' => 'Le module a été correctement effacé', 'confirmdelete' => 'Confirmez-vous la suppression du module ?', ], + 'dashboard' => 'Tableau de bord', 'person' => 'Personne', 'processing' => 'En cours', 'all' => 'Tous', diff --git a/resources/views/Admin/Shop/Dashboard/_partials/counter.blade.php b/resources/views/Admin/Shop/Dashboard/_partials/counter.blade.php index ae354310..a61150a8 100644 --- a/resources/views/Admin/Shop/Dashboard/_partials/counter.blade.php +++ b/resources/views/Admin/Shop/Dashboard/_partials/counter.blade.php @@ -1,27 +1,82 @@ -
-
- - @include('Admin.Shop.Dashboard.components.infobox', ['count' => $orders_count ?? 0, 'class' => 'bg-aqua', 'icon' => 'ion ion-bag', 'text' => 'Commandes']) - + +
+ Visiteurs en ligne +
40
+
+
+ dans les 30 dernières minutes
-
- - @include('Admin.Shop.Dashboard.components.infobox', ['count' => $invoices_count ?? 0, 'class' => 'bg-red', 'icon' => 'fa-clock-o', 'text' => 'Factures']) - +
+ Paniers Actifs +
40
+
+
+ dans les 30 dernières minutes
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Commandes{{ $orders_count }}
En préparation depuis moins de 24h{{ $preparationLess24H ?? 0 }}
En préparation depuis moins de 48h{{ $preparationLess48H ?? 0 }}
En préparation depuis plus de 48h{{ $preparationMore48H ?? 0 }}
Echec de paiement{{ $paymentsFailed ?? 0 }}
+ A rembourser
+ Payés sans stock disponible +
{{ $refunds ?? 0 }}
+ En attente de confirmation
+ Pour les ventes pro +
{{ $ordersNotConfirmed ?? 0 }}
+
- + + + + + + + + + + +
Stock critique{{ $stocksWarning ?? 0 }}
Paramétrage du niveau critique
+
- -
+ + + + + + + + + + +
Nouveaux clients{{ $newClients ?? 0 }}
Exporter le fichier clients
+
+
diff --git a/resources/views/Admin/Shop/Dashboard/_partials/evolutions.blade.php b/resources/views/Admin/Shop/Dashboard/_partials/evolutions.blade.php index dd93af14..6116c3d2 100644 --- a/resources/views/Admin/Shop/Dashboard/_partials/evolutions.blade.php +++ b/resources/views/Admin/Shop/Dashboard/_partials/evolutions.blade.php @@ -2,7 +2,7 @@
17% -
35 210.43 €
+
{{ $orders_sum ?? 0 }} €
TOTAL VENTE
@@ -11,7 +11,7 @@
0% -
10 390.90 €
+
{{ $orders_avg ?? 0 }} €
PANIER MOYEN
@@ -20,7 +20,7 @@
20% -
248
+
{{ $clients_count ?? 0 }}
NB CLIENTS
@@ -29,8 +29,8 @@
18% -
1200
- NB PRODUITS +
{{ $offers_count ?? 0 }}
+ NB OFFRES
diff --git a/resources/views/Admin/Shop/Dashboard/_partials/report.blade.php b/resources/views/Admin/Shop/Dashboard/_partials/report.blade.php index 1fb87a21..4e0b033e 100644 --- a/resources/views/Admin/Shop/Dashboard/_partials/report.blade.php +++ b/resources/views/Admin/Shop/Dashboard/_partials/report.blade.php @@ -1,23 +1,11 @@
- -
+
@include('Admin.Shop.Dashboard._partials.salesByPeriod')
- -
- @include('Admin.Shop.Dashboard._partials.stock') -
-
-
-
+
@include('Admin.Shop.Dashboard._partials.latestOrders')
- -
- @include('Admin.Shop.Dashboard._partials.ordersByTypes') -
-
\ No newline at end of file diff --git a/resources/views/Admin/Shop/Dashboard/index.blade.php b/resources/views/Admin/Shop/Dashboard/index.blade.php index 2d88f3b4..734cd5d9 100644 --- a/resources/views/Admin/Shop/Dashboard/index.blade.php +++ b/resources/views/Admin/Shop/Dashboard/index.blade.php @@ -1,17 +1,38 @@ @extends('layout.index', [ - 'title' => __('dashboard.title'), - 'subtitle' => __('boilerplate::users.list.title'), - 'breadcrumb' => [ - __('boilerplate::dashboard.title') => 'boilerplate.users.index' - ] + 'title' => __('Core.dashboard'), ]) @include('boilerplate::logs.style') @section('content') - @include('Admin.Shop.Dashboard._partials.counter') - @include('Admin.Shop.Dashboard._partials.report') +
+ + + + + + + @include('components.form.daterangepicker', [ + 'name' => 'period', + ]) +
+ +
+
+ @include('Admin.Shop.Dashboard._partials.counter') +
+
+ @include('Admin.Shop.Dashboard._partials.report') +
+
@endsection +@include('load.form.daterangepicker') + +@push('js') + +@endpush \ No newline at end of file diff --git a/resources/views/Admin/Shop/Invoices/edit.blade.php b/resources/views/Admin/Shop/Invoices/edit.blade.php index d9ba74e8..d398c826 100644 --- a/resources/views/Admin/Shop/Invoices/edit.blade.php +++ b/resources/views/Admin/Shop/Invoices/edit.blade.php @@ -10,9 +10,72 @@ {{ Form::open(['route' => 'Admin.Shop.Invoices.update', 'id' => 'invoice-form', 'autocomplete' => 'off']) }} - @include('Admin.Shop.Invoices.form') - @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']['address']) + {{ $invoice['order']['address']['address'] }}
+ @isset ($invoice['order']['address']['address2']) + {{ $invoice['order']['address']['address2'] }}
+ @endisset + {{ $invoice['order']['address']['zipcode'] }} {{ $invoice['order']['address']['city'] }}
+ @endif +
+
+
+
+
+
+
+ Facture
+ 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']]) +
+
+
@endsection diff --git a/resources/views/Admin/Shop/Orders/edit.blade.php b/resources/views/Admin/Shop/Orders/edit.blade.php index c851a0f1..2862baf7 100644 --- a/resources/views/Admin/Shop/Orders/edit.blade.php +++ b/resources/views/Admin/Shop/Orders/edit.blade.php @@ -1,6 +1,6 @@ @extends('layout.index', [ 'title' => __('shop.orders.title'), - 'subtitle' => __('shop.orders.list'), + 'subtitle' => __('shop.orders.edit'), 'breadcrumb' => ['Commandes'] ]) @@ -8,17 +8,27 @@ {{ Form::open(['route' => 'Admin.Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }} +
+
+

{{ $order['delivery']['name'] }}

+
+
+ @include('components.form.buttons.button-save') +
+
+

{{ $order['customer']['last_name'] }} {{ $order['customer']['first_name'] }}

-

{{ $order['delivery']['name'] }}

+
@if ($order['address']) {{ $order['address']['address'] }}
@isset ($order['address']['address2']) {{ $order['address']['address2'] }}
@endisset {{ $order['address']['zipcode'] }} {{ $order['address']['city'] }}
@endif +
@@ -29,28 +39,35 @@ du {{ Carbon\Carbon::parse($order['created_at'])->isoFormat('LLLL') }}
-
- @include('components.form.select', [ - 'name' => 'sale_channel_id', - 'list' => $sale_channels ?? [], - 'value' => $order['sale_channel_id'], - 'class' => 'select2', - ]) -
-
-
-
-
@include('components.form.select', [ + 'label' => 'Statut', 'name' => 'status', 'list' => $statuses ?? [], 'value' => $order['status'], 'class' => 'select2', ])
-
-
+
+
+
@include('components.form.select', [ + 'label' => 'Canal de vente', + 'name' => 'sale_channel_id', + 'list' => $sale_channels ?? [], + 'value' => $order['sale_channel_id'], + 'class' => 'select2', + ]) +
+
+ @include('components.form.input', [ + 'label' => 'Référence colis', + 'name' => 'delivery_ref', + 'value' => $order['deivery_ref'], + ]) +
+
+ @include('components.form.select', [ + 'label' => 'Règlement', 'name' => 'payment_type', 'list' => $payment_types ?? [], 'value' => $order['payment_type'], @@ -62,7 +79,7 @@
- @include('Admin.Shop.Orders.partials.detail') + @include('Admin.Shop.Orders.partials.detail', ['detail_type' => 'commande'])
diff --git a/resources/views/Admin/Shop/Orders/partials/detail.blade.php b/resources/views/Admin/Shop/Orders/partials/detail.blade.php index 01cf21cc..00a9249d 100644 --- a/resources/views/Admin/Shop/Orders/partials/detail.blade.php +++ b/resources/views/Admin/Shop/Orders/partials/detail.blade.php @@ -1,18 +1,22 @@ - +
- +
- - + + + + @foreach ($order['detail'] as $detail) + + @@ -23,6 +27,8 @@ + + @if ($order['shipping'] ?? false) @@ -30,12 +36,16 @@ + + + + @endif diff --git a/resources/views/components/card.blade.php b/resources/views/components/card.blade.php index 5c8f5d1a..3e370576 100644 --- a/resources/views/components/card.blade.php +++ b/resources/views/components/card.blade.php @@ -1,6 +1,6 @@
@if($title ?? $header ?? false) -
+
@isset($header) {{ $header }} @else diff --git a/routes/Admin/route.php b/routes/Admin/route.php index d74da9bc..cfee85dc 100644 --- a/routes/Admin/route.php +++ b/routes/Admin/route.php @@ -1,7 +1,7 @@ prefix('Admin')->namespace('Admin')->name('Admin.')->group(function () { - Route::get('', 'HomeController@index')->name('home'); + Route::get('{period?}', 'HomeController@index')->name('home'); include __DIR__ . '/Botanic/route.php'; include __DIR__ . '/Core/route.php'; include __DIR__ . '/Shop/route.php';
Nom QuantitéPrix unitaireTotalPU HTTVAPU TTCTotal TTC
{{ $detail['name'] }} {{ $detail['quantity'] }}{{ $detail['price'] }}{{ $detail['tax'] }} {{ $detail['price_taxed'] }} {{ $detail['total_taxed'] }}
Total {{ $order['total_taxed'] }}
Livraison {{ $order['shipping'] }}
Total à payer {{ $order['taxes'] }} {{ $order['total_shipped'] }}