From f23e343403b95eabe44cf4615d9c2905d5a1a380 Mon Sep 17 00:00:00 2001 From: Roberto Guido Date: Tue, 26 Nov 2024 14:50:27 +0100 Subject: [PATCH] parametro per visualizzare elenco delle altre prenotazioni della giornata in dettaglio consegne. ref #289 --- code/app/Formatters/User.php | 12 ++++++++++++ code/app/Helpers/Formatters.php | 2 +- .../Parameters/Config/OrdersShippingUserColumns.php | 2 +- code/app/Printers/Concerns/Shipping.php | 4 +--- .../views/aggregate/exportshipping.blade.php | 2 +- .../views/documents/order_shipping_pdf.blade.php | 4 ---- code/resources/views/gas/orders.blade.php | 2 +- code/resources/views/order/exportshipping.blade.php | 2 +- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/code/app/Formatters/User.php b/code/app/Formatters/User.php index c0d3b1a6..7abe128c 100644 --- a/code/app/Formatters/User.php +++ b/code/app/Formatters/User.php @@ -118,6 +118,18 @@ private static function columnsByType($ret, $type) ]; } + if ($type == 'shipping' || $type == 'all') { + $ret['other_shippings'] = (object) [ + 'name' => _i('Altre Prenotazioni'), + 'format' => function($obj, $context) { + /* + Qui, $context deve essere un Aggregate + */ + return $obj->morePendingBookings($context) ?: ''; + }, + ]; + } + return $ret; } diff --git a/code/app/Helpers/Formatters.php b/code/app/Helpers/Formatters.php index 8641793d..0a5aee4d 100644 --- a/code/app/Helpers/Formatters.php +++ b/code/app/Helpers/Formatters.php @@ -224,7 +224,7 @@ function closestNumber(array $array, $goal) */ function splitFields($fields) { - $formattable_user = App\Formatters\User::formattableColumns(); + $formattable_user = App\Formatters\User::formattableColumns('shipping'); $formattable_product = App\Formatters\Order::formattableColumns('shipping'); $ret = (object) [ diff --git a/code/app/Parameters/Config/OrdersShippingUserColumns.php b/code/app/Parameters/Config/OrdersShippingUserColumns.php index 31361ec4..ae9f4331 100644 --- a/code/app/Parameters/Config/OrdersShippingUserColumns.php +++ b/code/app/Parameters/Config/OrdersShippingUserColumns.php @@ -18,7 +18,7 @@ public function type() public function default() { - list($options, $values) = flaxComplexOptions(User::formattableColumns()); + list($options, $values) = flaxComplexOptions(User::formattableColumns('shipping')); return $values; } } diff --git a/code/app/Printers/Concerns/Shipping.php b/code/app/Printers/Concerns/Shipping.php index 3aab9656..975605fa 100644 --- a/code/app/Printers/Concerns/Shipping.php +++ b/code/app/Printers/Concerns/Shipping.php @@ -90,12 +90,10 @@ public function formatShipping($order, $fields, $status, $shipping_place, $extra 'gas_sorting' => $booking->user->gas_id, 'shipping_sorting' => $booking->user->shippingplace ? $booking->user->shippingplace->name : 'AAAA', - 'user' => UserFormatter::format($booking->user, $fields->user_columns), + 'user' => UserFormatter::format($booking->user, $fields->user_columns, $order->aggregate), 'products' => [], 'totals' => [], 'notes' => !empty($booking->notes) ? [$booking->notes] : [], - - 'others' => $booking->user->morePendingBookings($order->aggregate), ]; foreach($booking->products_with_friends as $booked) { diff --git a/code/resources/views/aggregate/exportshipping.blade.php b/code/resources/views/aggregate/exportshipping.blade.php index 416ab97d..386f28a1 100644 --- a/code/resources/views/aggregate/exportshipping.blade.php +++ b/code/resources/views/aggregate/exportshipping.blade.php @@ -25,7 +25,7 @@ @include('commons.selectshippingexport', ['aggregate' => $aggregate, 'included_metaplace' => ['all_by_name', 'all_by_place']]) - + diff --git a/code/resources/views/documents/order_shipping_pdf.blade.php b/code/resources/views/documents/order_shipping_pdf.blade.php index ea6257c2..da283967 100644 --- a/code/resources/views/documents/order_shipping_pdf.blade.php +++ b/code/resources/views/documents/order_shipping_pdf.blade.php @@ -147,10 +147,6 @@ ?> - @if($d->others) -
{!! $d->others !!}
- @endif -
@foreach($d->products as $product)
diff --git a/code/resources/views/gas/orders.blade.php b/code/resources/views/gas/orders.blade.php index b560b27e..e1c2227a 100644 --- a/code/resources/views/gas/orders.blade.php +++ b/code/resources/views/gas/orders.blade.php @@ -38,7 +38,7 @@ - + diff --git a/code/resources/views/order/exportshipping.blade.php b/code/resources/views/order/exportshipping.blade.php index 387a245d..0b820bde 100644 --- a/code/resources/views/order/exportshipping.blade.php +++ b/code/resources/views/order/exportshipping.blade.php @@ -11,7 +11,7 @@ @include('commons.selectshippingexport', ['aggregate' => $order->aggregate, 'included_metaplace' => ['all_by_name', 'all_by_place']]) - +