@extends('layouts.app') @section('title', ($isNew ? 'New ' : 'Edit ').$cfg['singular']) @section('crumbs', ''.$cfg['title'].' ยท '.($isNew ? 'New' : 'Edit').'') @section('content')

{{ $isNew ? 'New' : 'Edit' }} {{ $cfg['singular'] }}

@csrf @if(!$isNew)@method('PUT')@endif
@foreach($cfg['fields'] as $name => $f) @php $type = $f['type'] ?? 'text'; $w = $f['width'] ?? 6; $val = old($name, $record->$name ?? null); if($name==='allowances' && is_array($val)){ $tmp=[]; foreach($val as $ak=>$av) $tmp[]="$ak=$av"; $val=implode("\n",$tmp); } elseif(is_array($val)) $val = json_encode($val); if($val instanceof \Carbon\Carbon) $val = $type==='datetime' ? $val->format('Y-m-d\TH:i') : $val->format('Y-m-d'); $ro = !$isNew && !empty($f['readonly_on_edit']); @endphp @if($type==='hidden') @elseif($type==='checkbox')
@elseif($type==='display')
@else
@if($type==='textarea') @elseif($type==='select') @elseif($type==='file') @if($val)
Current: {{ $val }}
@endif @else @endif @if(!empty($f['help']))
{{ $f['help'] }}
@endif @error($name)
{{ $message }}
@enderror
@endif @endforeach
Cancel
@endsection