@extends('layouts.app') @section('content') @php // Clean numeric display: PHP doubles json_encode with full precision on // this server (127.2900000000000006…) — trim to a tidy form. $cleanNum = function ($v) { return rtrim(rtrim(number_format((float) $v, 6, '.', ''), '0'), '.'); }; $minPrices = $current['size_min_prices'] ?? []; $minPricesJson = '{' . collect($minPrices) ->map(fn ($v, $k) => '"' . $k . '":' . $cleanNum($v))->implode(',') . '}'; $bounds = array_values($current['distance_tier_bounds'] ?? []); $descriptions = [ 'markup_base' => "Flat amount added to every size's markup on every quote.", 'min_cost_distance_km' => 'Routes shorter than this (km) get the minimum charge.', 'uk_vat_rate' => 'VAT applied when the place of supply is the UK. Enter a fraction: 0.05 = 5%.', 'size_30_multiplier' => '30 m³ price = the 15 m³ price × this.', 'price_rounding_decimals' => 'Decimal places on the final displayed price.', 'size_min_prices' => 'Minimum charge per size, applied under the min-charge distance.', 'distance_tier_bounds' => 'Distance boundaries (km) that select the rate tier. Must strictly increase.', 'eu_supported_countries' => 'Moves between two ticked countries are priced with the EU rate block.', ]; // The recognised EU-27 codes — the only values the server accepts. $eu27 = [ 'AT' => 'Austria', 'BE' => 'Belgium', 'BG' => 'Bulgaria', 'HR' => 'Croatia', 'CY' => 'Cyprus', 'CZ' => 'Czechia', 'DK' => 'Denmark', 'EE' => 'Estonia', 'FI' => 'Finland', 'FR' => 'France', 'DE' => 'Germany', 'GR' => 'Greece', 'HU' => 'Hungary', 'IE' => 'Ireland', 'IT' => 'Italy', 'LV' => 'Latvia', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MT' => 'Malta', 'NL' => 'Netherlands', 'PL' => 'Poland', 'PT' => 'Portugal', 'RO' => 'Romania', 'SK' => 'Slovakia', 'SI' => 'Slovenia', 'ES' => 'Spain', 'SE' => 'Sweden', ]; $currentEu = $current['eu_supported_countries'] ?? []; $locked = collect($constants ?? [])->reject(fn ($r) => $r['editable_later']); @endphp
Pricing Constants

The fixed values the pricing engine uses. Edit the business knobs below and Review changes to preview the impact before saving.

@if(!$gateOpen)
Editing is disabled right now — you can review and preview impact, but saving is turned off.
@endif
{{-- The server accepts these three as JSON strings; JS keeps them in sync with the friendly fields below so nobody has to hand-type JSON. --}}
Core knobs

Simple numeric values. Out-of-range entries are flagged as you type.

{{ $descriptions['markup_base'] }}
{{ $descriptions['min_cost_distance_km'] }}
{{ $descriptions['uk_vat_rate'] }}
{{ $descriptions['size_30_multiplier'] }}
{{ $descriptions['price_rounding_decimals'] }}
Minimum charge per size

{{ $descriptions['size_min_prices'] }} Each value must be greater than 0.

@foreach([5, 10, 15, 20, 30] as $size)
@endforeach
Distance tiers

{{ $descriptions['distance_tier_bounds'] }}

@foreach([0, 1, 2] as $i)
@endforeach

Supported EU countries

{{ $descriptions['eu_supported_countries'] }} At least one must be ticked.

{{-- Materialize 0.100.x checkbox pattern: input#id + label[for] siblings. --}} @foreach($eu27 as $code => $name)

@endforeach
Revert last Reset to defaults
@if($locked->isNotEmpty())
Locked (structural) — shown for reference, not editable
@foreach($locked as $row) @endforeach
{{ $row['label'] }} {{ $row['value'] }} {{ $row['meaning'] }} @if($row['note'] !== '')
{{ $row['note'] }} @endif
@endif @stop @section('js') @stop