@extends('layouts.app') @php use App\Models\Permission; $editing = $tenancy->exists; $action = $editing ? route('tenancies.update', $tenancy) : route('tenancies.store'); $canSeeMoney = auth()->user()->hasPermission(Permission::TENANCY_VIEW_FINANCIALS); $value = fn (string $field, $fallback = null) => old($field, $tenancy->{$field} ?? $fallback); $dateValue = fn (string $field) => old($field, $tenancy->{$field}?->format('Y-m-d')); /* | Amounts are shown grouped to two decimals — 15,000.00. A number input | will not hold a separator, so these fields are text with a decimal | keypad; the separators come off again in the browser on submit and in | TenancyRequest for anything posted without JavaScript. */ $amount = fn (string $field) => amount_value($value($field)); @endphp @section('title', $editing ? 'Edit tenancy' : 'Add tenancy') @section('heading', $editing ? 'Edit tenancy — '.$tenancy->outlet : 'Add a tenancy record') @section('actions') Cancel @endsection @section('content')
@endsection