@extends('layouts.app') @section('title', __('billing::messages.catalogue.title')) @php use App\Modules\Billing\Models\BillableService; $canManage = auth()->user()?->can('create', BillableService::class) ?? false; $hasFilters = collect([$search, request('category'), $status])->filter(fn ($v): bool => (string) $v !== '')->isNotEmpty(); @endphp @section('content')

{{ __('billing::messages.catalogue.title') }}

{{ __('billing::messages.catalogue.subtitle') }}

{{-- Outside the swapped region: that region is replaced wholesale on every filter change, which would destroy the field being typed into. --}}
{{-- Withdrawn entries are kept for the invoices that point at them, so the list needs a way back to them. --}}
{{-- Kept even though the list filters live: without a script this button is the only way to search. --}} @if ($hasFilters) {{ __('common.clear') }} @endif
@error('catalogue') @enderror
@if ($canManage) @endif @forelse ($services as $service) ! $service->is_active])> @if ($canManage) @endif @if ($canManage) {{-- The editor opens under the row it belongs to, so the price being changed stays in sight while it is typed. --}} @endif @empty @endforelse
{{ __('billing::messages.catalogue.code') }} {{ __('billing::messages.catalogue.name') }} {{ __('billing::messages.catalogue.category') }} {{ __('billing::messages.catalogue.tax_rate') }} {{ __('billing::messages.catalogue.unit_price') }}{{ __('common.actions') }}
{{ $service->code }} {{ $service->name }} @if (! $service->is_active) {{ __('billing::messages.catalogue.withdrawn') }} @endif @if (! $service->is_discountable) {{ __('billing::messages.items.not_discountable') }} @endif {{ $service->category->label() }} {{ $service->taxRate?->label() ?? __('billing::messages.catalogue.no_tax') }} {{ $service->unit_price->toMajor() }}
{{-- Withdraw, not delete: the entry is also the record of what was offered and at what price. --}}
@csrf @method('PATCH')
{{-- The question is asked where the button is: one dialog naming a price could be any of thirty rows. --}}
@csrf @method('DELETE')
@csrf @method('PUT')

{{ __('billing::messages.catalogue.edit_title', ['name' => $service->name]) }}

is_discountable)>
{{ __('billing::messages.catalogue.price_note') }}

{{ __('billing::messages.catalogue.empty') }}

{{ __('billing::messages.catalogue.empty_text') }}

@if ($services->hasPages())
{{ $services->links() }}
@endif
@if ($status === 'withdrawn' || $status === 'all')

{{ __('billing::messages.catalogue.withdrawn_hint') }}

@endif
@can('create', \App\Modules\Billing\Models\BillableService::class)
@csrf
@csrf {{-- The one checkbox on this page that is expensive to get wrong: it decides whether tax is added to the listed price or extracted from within it. --}}
{{ __('billing::messages.catalogue.inclusive_hint') }}
@endcan
@endsection