Skip to content

Commit

Permalink
Merge branch 'master' into invoice_permission
Browse files Browse the repository at this point in the history
  • Loading branch information
madbob committed Dec 4, 2023
2 parents 524ad62 + 6c29d15 commit 834af27
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 184 deletions.
11 changes: 8 additions & 3 deletions code/app/Helpers/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ function read_instance_config_file($path)

foreach($config as $c) {
$c = trim($c);
if (!empty($c)) {
list($name, $value) = explode('=', $c);
$params[$name] = $value;
if (empty($c) == false) {
if (strpos($c, '=') === false) {
\Log::error('Configurazione ambigua in file ' . $path . ' - ' . $c);
}
else {
list($name, $value) = explode('=', $c);
$params[$name] = $value;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion code/app/Printers/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private function formatTableRows($order, $shipping_place, $status, $fields, &$al
foreach($bookings as $booking) {
$row = UserFormatter::format($booking->user, $fields->user_columns);
$subrow = $this->formatBookingInTable($order, $booking, $status, $all_products);
$row = array_merge($row, $subrow);
$row += $subrow;

$price = $booking->getValue($get_total, true);
$total_price += $price;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,90 +109,5 @@

<p>&nbsp;</p>
@endforeach

@if($valid_bookings > 1)
@foreach($bookings as $super_booking)
@if($super_booking->user->isFriend())
@continue
@endif

<?php $booked_cell_value = $delivered_cell_value = 0 ?>

<table border="1" style="width: 100%" cellpadding="5" nobr="true">
<thead>
<tr>
<th colspan="5">
<strong>{{ _i('Totale') }}</strong>
</th>
</tr>
</thead>

<tbody>
@foreach($super_booking->bookings as $booking)
<?php $products = $booking->products_with_friends_always_aggregated ?>
@if($products->isEmpty() == false)
<?php
$booked_cell_value += $booking->getValue('booked', true);
$delivered_cell_value += $booking->getValue('delivered', true);
?>

<tr>
<td colspan="5"><strong>{{ $booking->order->supplier->printableName() }}</strong></td>
</tr>

<tr>
<td width="40%"><strong>{{ _i('Prodotto') }}</strong></td>
<td width="15%"><strong>{{ _i('Prenotato') }}</strong></td>
<td width="15%">&nbsp;</td>
<td width="15%"><strong>{{ _i('Consegnato') }}</strong></td>
<td width="15%">&nbsp;</td>
</tr>

@foreach($products as $product)
@if($product->variants->isEmpty() == false)
@foreach($product->variants as $variant)
@if(!empty($variant->quantity) || !empty($variant->delivered))
<tr>
<td>{{ $product->product->printableName() }}</td>
<td>{{ printableQuantity($variant->quantity, $product->product->measure->discrete, 2, ',') }} {{ $variant->printableName() }}</td>
<td>{{ printablePriceCurrency($variant->quantityValue(), ',') }}</td>
<td>{{ printableQuantity($variant->delivered, $product->product->measure->discrete, 2, ',') }} {{ $variant->printableName() }}</td>
<td>{{ printablePriceCurrency($variant->deliveredValue(), ',') }}</td>
</tr>
@endif
@endforeach
@else
@if(!empty($product->quantity) || !empty($product->delivered))
<tr>
<td>{{ $product->product->printableName() }}</td>
<td>{{ printableQuantity($product->quantity, $product->product->measure->discrete, 2, ',') }}</td>
<td>{{ printablePriceCurrency($product->getValue('booked'), ',') }}</td>
<td>{{ printableQuantity($product->delivered, $product->product->measure->discrete, 2, ',') }}</td>
<td>{{ printablePriceCurrency($product->getValue('delivered'), ',') }}</td>
</tr>
@endif
@endif
@endforeach
@endif
@endforeach

@foreach($booking->aggregatedModifiers() as $am)
<tr>
<th colspan="5"><strong>{{ $am->name }}: {{ printablePriceCurrency($am->amount, ',') }}</th>
</tr>
@endforeach

<tr>
<th colspan="5"><strong>{{ _i('Totale Prenotato') }}: {{ printablePriceCurrency($booked_cell_value, ',') }}</strong></th>
</tr>
<tr>
<th colspan="5"><strong>{{ _i('Totale Consegnato') }}: {{ printablePriceCurrency($delivered_cell_value, ',') }}</strong></th>
</tr>
</tbody>
</table>
@endforeach
@endif
</body>
</html>
192 changes: 97 additions & 95 deletions code/resources/views/supplier/products_grid.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,103 +46,105 @@

<div class="row">
<div class="col">
<table class="table sortable-table" id="{{ $identifier }}">
<thead>
<tr>
@foreach($display_columns as $identifier => $metadata)
<th width="{{ $metadata->width }}%" class="order-cell-{{ $identifier }} {{ in_array($identifier, $columns) ? '' : 'hidden' }}">
@if($identifier == 'selection')
<x-larastrap::check classes="triggers-all-checkbox skip-on-submit" data-target-class="product-select" squeeze switch="false" />
@else
{{ $metadata->label }}
@endif
<div class="table-responsive">
<table class="table {{ $currentgas->manual_products_sorting ? 'sortable-table' : '' }}" id="{{ $identifier }}">
<thead>
<tr>
@foreach($display_columns as $identifier => $metadata)
<th width="{{ $metadata->width }}%" class="order-cell-{{ $identifier }} {{ in_array($identifier, $columns) ? '' : 'hidden' }}">
@if($identifier == 'selection')
<x-larastrap::check classes="triggers-all-checkbox skip-on-submit" data-target-class="product-select" squeeze switch="false" />
@else
{{ $metadata->label }}
@endif
</th>
@endforeach
</tr>
</thead>
<thead class="massive-actions hidden">
<tr>
<th class="order-cell-sorting {{ in_array('sorting', $columns) ? '' : 'hidden' }}">
&nbsp;
</th>

<th class="order-cell-selection {{ in_array('selection', $columns) ? '' : 'hidden' }}">
&nbsp;
</th>

<th class="order-cell-name {{ in_array('name', $columns) ? '' : 'hidden' }}">
<x-larastrap::button classes="remove_all skip-on-submit" :label="_i('Elimina')" color="danger" />
</th>

<th class="order-cell-category {{ in_array('category', $columns) ? '' : 'hidden' }}">
<x-larastrap::selectobj classes="skip-on-submit" name="category_id_all" :options="$categories" :extraitem="[0 => _i('Non Modificare')]" squeeze />
</th>

<th class="order-cell-measure {{ in_array('measure', $columns) ? '' : 'hidden' }}">
<x-larastrap::selectobj classes="skip-on-submit" name="measure_id_all" :options="$measures" :extraitem="[0 => _i('Non Modificare')]" squeeze />
</th>

<th class="order-cell-price {{ in_array('price', $columns) ? '' : 'hidden' }}">
&nbsp;
</th>

<th class="order-cell-max_available {{ in_array('max_available', $columns) ? '' : 'hidden' }}">
&nbsp;
</th>

<th class="order-cell-active {{ in_array('active', $columns) ? '' : 'hidden' }}">
<x-larastrap::check classes="skip-on-submit" name="active_all" squeeze />
</th>
</tr>
</thead>
<tbody>
@foreach($products as $index => $product)
<x-larastrap::enclose :obj="$product">
<tr data-element-id="{{ $product->id }}">
<td class="order-cell-sorting {{ in_array('sorting', $columns) ? '' : 'hidden' }}">
<span class="btn btn-info sorter"><i class="bi bi-arrow-down-up"></i></span>
</td>

<td class="order-cell-selection {{ in_array('selection', $columns) ? '' : 'hidden' }}">
<x-larastrap::check name="selected[]" classes="product-select skip-on-submit" squeeze :value="$product->id" switch="false" />
</td>

<td class="order-cell-name {{ in_array('name', $columns) ? '' : 'hidden' }}">
<div class="hidden">
<span class="text-filterable-cell">{{ $product->name }}</span>
@foreach($product->icons() as $icon)
<i class="bi-{{ $icon }}"></i>
@endforeach
</div>

<x-larastrap::hidden name="id" npostfix="[]" />
<x-larastrap::text name="name" :label="_i('Nome')" squeeze required :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-category {{ in_array('category', $columns) ? '' : 'hidden' }}">
<x-larastrap::selectobj name="category_id" :label="_i('Categoria')" :options="$categories" squeeze :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-measure {{ in_array('measure', $columns) ? '' : 'hidden' }}">
<x-larastrap::selectobj name="measure_id" :label="_i('Unità di Misura')" :options="$measures" squeeze :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-price {{ in_array('price', $columns) ? '' : 'hidden' }}">
<x-larastrap::price name="price" :label="_i('Prezzo Unitario')" squeeze required :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-max_available {{ in_array('max_available', $columns) ? '' : 'hidden' }}">
<x-larastrap::decimal name="max_available" :label="_i('Disponibile')" squeeze required :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-active {{ in_array('active', $columns) ? '' : 'hidden' }}">
<x-larastrap::check name="active" classes="bookable" :label="_i('Ordinabile')" squeeze :nprefix="$product->id . '-'" />
</td>
</tr>
</x-larastrap::enclose>
@endforeach
</tr>
</thead>
<thead class="massive-actions hidden">
<tr>
<th class="order-cell-sorting {{ in_array('sorting', $columns) ? '' : 'hidden' }}">
&nbsp;
</th>

<th class="order-cell-selection {{ in_array('selection', $columns) ? '' : 'hidden' }}">
&nbsp;
</th>

<th class="order-cell-name {{ in_array('name', $columns) ? '' : 'hidden' }}">
<x-larastrap::button classes="remove_all skip-on-submit" :label="_i('Elimina')" color="danger" />
</th>

<th class="order-cell-category {{ in_array('category', $columns) ? '' : 'hidden' }}">
<x-larastrap::selectobj classes="skip-on-submit" name="category_id_all" :options="$categories" :extraitem="[0 => _i('Non Modificare')]" squeeze />
</th>

<th class="order-cell-measure {{ in_array('measure', $columns) ? '' : 'hidden' }}">
<x-larastrap::selectobj classes="skip-on-submit" name="measure_id_all" :options="$measures" :extraitem="[0 => _i('Non Modificare')]" squeeze />
</th>

<th class="order-cell-price {{ in_array('price', $columns) ? '' : 'hidden' }}">
&nbsp;
</th>

<th class="order-cell-max_available {{ in_array('max_available', $columns) ? '' : 'hidden' }}">
&nbsp;
</th>

<th class="order-cell-active {{ in_array('active', $columns) ? '' : 'hidden' }}">
<x-larastrap::check classes="skip-on-submit" name="active_all" squeeze />
</th>
</tr>
</thead>
<tbody>
@foreach($products as $index => $product)
<x-larastrap::enclose :obj="$product">
<tr data-element-id="{{ $product->id }}">
<td class="order-cell-sorting {{ in_array('sorting', $columns) ? '' : 'hidden' }}">
<span class="btn btn-info sorter"><i class="bi bi-arrow-down-up"></i></span>
</td>

<td class="order-cell-selection {{ in_array('selection', $columns) ? '' : 'hidden' }}">
<x-larastrap::check name="selected[]" classes="product-select skip-on-submit" squeeze :value="$product->id" switch="false" />
</td>

<td class="order-cell-name {{ in_array('name', $columns) ? '' : 'hidden' }}">
<div class="hidden">
<span class="text-filterable-cell">{{ $product->name }}</span>
@foreach($product->icons() as $icon)
<i class="bi-{{ $icon }}"></i>
@endforeach
</div>

<x-larastrap::hidden name="id" npostfix="[]" />
<x-larastrap::text name="name" :label="_i('Nome')" squeeze required :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-category {{ in_array('category', $columns) ? '' : 'hidden' }}">
<x-larastrap::selectobj name="category_id" :label="_i('Categoria')" :options="$categories" squeeze :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-measure {{ in_array('measure', $columns) ? '' : 'hidden' }}">
<x-larastrap::selectobj name="measure_id" :label="_i('Unità di Misura')" :options="$measures" squeeze :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-price {{ in_array('price', $columns) ? '' : 'hidden' }}">
<x-larastrap::price name="price" :label="_i('Prezzo Unitario')" squeeze required :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-max_available {{ in_array('max_available', $columns) ? '' : 'hidden' }}">
<x-larastrap::decimal name="max_available" :label="_i('Disponibile')" squeeze required :nprefix="$product->id . '-'" />
</td>

<td class="order-cell-active {{ in_array('active', $columns) ? '' : 'hidden' }}">
<x-larastrap::check name="active" classes="bookable" :label="_i('Ordinabile')" squeeze :nprefix="$product->id . '-'" />
</td>
</tr>
</x-larastrap::enclose>
@endforeach
</tbody>
</table>
</tbody>
</table>
</div>
</div>
</div>
</x-larastrap::form>
Expand Down

0 comments on commit 834af27

Please sign in to comment.