Perbaiki rute dan nama variabel pada form dan aksi edit
Mengubah `holidayCalendar` menjadi `holiday` di variable form untuk konsistensi. Juga memperbaiki rute `href` pada view index agar sesuai dengan rute yang benar.
This commit is contained in:
@@ -6,68 +6,71 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
@if(isset($holidayCalendar->id))
|
@if(isset($holiday->id))
|
||||||
<form action="{{ route('basicdata.holidaycalendar.update', $holidayCalendar->id) }}" method="POST">
|
<form action="{{ route('basicdata.holidaycalendar.update', $holiday->id) }}" method="POST">
|
||||||
<input type="hidden" name="id" value="{{ $holidayCalendar->id }}">
|
<input type="hidden" name="id" value="{{ $holiday->id }}">
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
@else
|
@else
|
||||||
<form method="POST" action="{{ route('basicdata.holidaycalendar.store') }}">
|
<form method="POST" action="{{ route('basicdata.holidaycalendar.store') }}">
|
||||||
@endif
|
@endif
|
||||||
@csrf
|
@csrf
|
||||||
<div class="card pb-2.5">
|
<div class="card pb-2.5">
|
||||||
<div class="card-header" id="basic_settings">
|
<div class="card-header" id="basic_settings">
|
||||||
<h3 class="card-title">
|
<h3 class="card-title">
|
||||||
{{ isset($holidayCalendar->id) ? 'Edit' : 'Tambah' }} Hari Libur
|
{{ isset($holiday->id) ? 'Edit' : 'Tambah' }} Hari Libur
|
||||||
</h3>
|
</h3>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<a href="{{ route('basicdata.holidaycalendar.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
<a href="{{ route('basicdata.holidaycalendar.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body grid gap-5">
|
<div class="card-body grid gap-5">
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label class="form-label max-w-56">
|
<label class="form-label max-w-56">
|
||||||
Tanggal
|
Tanggal
|
||||||
</label>
|
</label>
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<input class="input @error('date') border-danger bg-danger-light @enderror" type="date" name="date" value="{{ $holidayCalendar->date ?? '' }}">
|
<input class="input @error('date') border-danger bg-danger-light @enderror" type="date" name="date" value="{{ old('date', isset($holiday) ? $holiday->date->format('Y-m-d') : '') }}">
|
||||||
@error('date')
|
@error('date')
|
||||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
@enderror
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Deskripsi
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input class="input @error('description') border-danger bg-danger-light @enderror"
|
||||||
|
type="text"
|
||||||
|
name="description"
|
||||||
|
value="{{ old('description', $holiday->description ?? '') }}">
|
||||||
|
@error('description')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Tipe
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<select class="select @error('type') border-danger bg-danger-light @enderror" name="type">
|
||||||
|
<option value="">Pilih Tipe</option>
|
||||||
|
<option value="national_holiday" {{ old('type', $holiday->type ?? '') == 'national_holiday' ? 'selected' : '' }}>Nasional</option>
|
||||||
|
<option value="collective_leave" {{ old('type', $holiday->type ?? '') == 'collective_leave' ? 'selected' : '' }}>Cuti Bersama</option>
|
||||||
|
</select>
|
||||||
|
@error('type')
|
||||||
|
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-end">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
</form>
|
||||||
<label class="form-label max-w-56">
|
|
||||||
Deskripsi
|
|
||||||
</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<input class="input @error('description') border-danger bg-danger-light @enderror" type="text" name="description" value="{{ $holidayCalendar->description ?? '' }}">
|
|
||||||
@error('description')
|
|
||||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label class="form-label max-w-56">
|
|
||||||
Tipe
|
|
||||||
</label>
|
|
||||||
<div class="flex flex-wrap items-baseline w-full">
|
|
||||||
<select class="select @error('type') border-danger bg-danger-light @enderror" name="type">
|
|
||||||
<option value="">Pilih Tipe</option>
|
|
||||||
<option value="national_holiday" {{ (isset($holidayCalendar) && $holidayCalendar->type == 'national_holiday') ? 'selected' : '' }}>Nasional</option>
|
|
||||||
<option value="collective_leave" {{ (isset($holidayCalendar) && $holidayCalendar->type == 'collective_leave') ? 'selected' : '' }}>Cuti Bersama</option>
|
|
||||||
</select>
|
|
||||||
@error('type')
|
|
||||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
|
||||||
@enderror
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-end">
|
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
Save
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
title: 'Action',
|
title: 'Action',
|
||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
return `<div class="flex flex-nowrap justify-center">
|
return `<div class="flex flex-nowrap justify-center">
|
||||||
<a class="btn btn-sm btn-icon btn-clear btn-info" href="basic-data/holiday-calendar/${data.id}/edit">
|
<a class="btn btn-sm btn-icon btn-clear btn-info" href="basic-data/holidaycalendar/${data.id}/edit">
|
||||||
<i class="ki-outline ki-notepad-edit"></i>
|
<i class="ki-outline ki-notepad-edit"></i>
|
||||||
</a>
|
</a>
|
||||||
<a onclick="deleteData(${data.id})" class="delete btn btn-sm btn-icon btn-clear btn-danger">
|
<a onclick="deleteData(${data.id})" class="delete btn btn-sm btn-icon btn-clear btn-danger">
|
||||||
|
|||||||
Reference in New Issue
Block a user