Skip to content

Commit

Permalink
Merge branch 'master' into aggregations
Browse files Browse the repository at this point in the history
  • Loading branch information
madbob committed Nov 26, 2024
2 parents bcfc9fa + f23e343 commit 9772153
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 15 deletions.
12 changes: 12 additions & 0 deletions code/app/Formatters/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,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;
}

Expand Down
2 changes: 1 addition & 1 deletion code/app/Helpers/Formatters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) [
Expand Down
2 changes: 0 additions & 2 deletions code/app/Modifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,9 @@ public function getCheckTargetLevel()
switch($this->applies_target) {
case 'order':
return 'global_product';
break;

default:
return 'product';
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion code/app/Parameters/Config/OrdersShippingUserColumns.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
4 changes: 1 addition & 3 deletions code/app/Printers/Concerns/Shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@ public function formatShipping($order, $fields, $status, $circles, $extra_modifi
'gas_sorting' => $booking->user->gas_id,
'circles_sorting' => $booking->circles_sorting,

'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) {
Expand Down
7 changes: 6 additions & 1 deletion code/app/Singletons/ModifierEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ public function apply($modifier, $booking, $aggregate_data)
$check_target è l'elemento su cui valutare l'applicabilità del
modificatore
*/
switch($modifier->getCheckTargetLevel()) {
$target_level = $modifier->getCheckTargetLevel();
switch($target_level) {
case 'order':
$check_target = $aggregate_data->orders[$order_id] ?? null;
break;
Expand All @@ -266,6 +267,10 @@ public function apply($modifier, $booking, $aggregate_data)
case 'global_product':
$check_target = $aggregate_data->orders[$order_id]->products[$modifier->target->id] ?? null;
break;

default:
Log::error('Tipo di soggetto non riconosciuto per modificatore: ' . $target_level);
return null;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion code/resources/views/aggregate/exportshipping.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@include('commons.selectshippingexport', ['aggregate' => $aggregate, 'included_metaplace' => ['all_by_name', 'all_by_place']])

<?php list($options, $values) = flaxComplexOptions(App\Formatters\User::formattableColumns()) ?>
<?php list($options, $values) = flaxComplexOptions(App\Formatters\User::formattableColumns('shipping')) ?>
<x-larastrap::checks name="fields" :label="_i('Dati Utenti')" :options="$options" :value="$currentgas->orders_shipping_user_columns" />

<?php list($options, $values) = flaxComplexOptions(App\Formatters\Order::formattableColumns('shipping')) ?>
Expand Down
4 changes: 0 additions & 4 deletions code/resources/views/documents/order_shipping_pdf.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@
?>
</div>

@if($d->others)
<div class="extended">{!! $d->others !!}</div>
@endif

<div class="main-wrapper">
@foreach($d->products as $product)
<div class="row">
Expand Down
2 changes: 1 addition & 1 deletion code/resources/views/gas/orders.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</x-larastrap::field>

<x-larastrap::field :label="_i('Colonne Attive in Dettaglio Consegne')" :pophelp="_i('Attributi selezionati di default durante l\'esportazione del Dettaglio Consegne degli ordini')">
<?php list($options, $values) = flaxComplexOptions(App\Formatters\User::formattableColumns()) ?>
<?php list($options, $values) = flaxComplexOptions(App\Formatters\User::formattableColumns('shipping')) ?>
<x-larastrap::checks name="orders_shipping_user_columns" :options="$options" squeeze />

<?php list($options, $values) = flaxComplexOptions(App\Formatters\Order::formattableColumns('shipping')) ?>
Expand Down
2 changes: 1 addition & 1 deletion code/resources/views/order/exportshipping.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@include('commons.selectshippingexport', ['aggregate' => $order->aggregate, 'included_metaplace' => ['all_by_name', 'all_by_place']])

<?php list($options, $values) = flaxComplexOptions(App\Formatters\User::formattableColumns()) ?>
<?php list($options, $values) = flaxComplexOptions(App\Formatters\User::formattableColumns('shipping')) ?>
<x-larastrap::checks name="fields" :label="_i('Dati Utenti')" :options="$options" :value="$currentgas->orders_shipping_user_columns" />

<?php list($options, $values) = flaxComplexOptions(App\Formatters\Order::formattableColumns('shipping')) ?>
Expand Down

0 comments on commit 9772153

Please sign in to comment.