update
parent
bbf00a428b
commit
12b780124b
|
|
@ -137,6 +137,18 @@ class FormController implements HasMiddleware
|
|||
return view($this->template.'.index', $data);
|
||||
}
|
||||
|
||||
public function update($sector, $code)
|
||||
{
|
||||
// Filter by Year
|
||||
$inventoryYear = request('inventoryYear') ?? date('Y');
|
||||
$instansi = request('instansi') ?? @session('agency_id');
|
||||
|
||||
// Retrieve data
|
||||
$data = $this->data($sector, $code, $inventoryYear, $instansi);
|
||||
|
||||
return view($this->template.'.form-edit', $data);
|
||||
}
|
||||
|
||||
public function save(Request $request, $sector, $code)
|
||||
{
|
||||
$request->validate([
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
@endphp
|
||||
@foreach ($years as $k => $year)
|
||||
<tr>
|
||||
<td><a href="#" data-tahun="{{ $year }}" data-instansi="{{ $instansi }}" data-sector="{{ $form->sector }}" data-code="{{ $form->code }}" class="btn btn-info btn-sm edit"><i class="bx bx-pencil"></i></a></td>
|
||||
<td><a href="{{ url($form->sector.'/'.$form->code.'?tahun='.$year.'&&instansi='.$instansi) }}" class="btn btn-info btn-sm edit"><i class="bx bx-pencil"></i></a></td>
|
||||
<td>{{ $k+1 }}</td>
|
||||
<td>{{ $year }}</td>
|
||||
@foreach ($formDetails as $detail)
|
||||
|
|
@ -245,11 +245,11 @@
|
|||
}
|
||||
|
||||
|
||||
$('.edit').on('click',function(){
|
||||
$('#formModalEdit').modal('show');
|
||||
$('.year').val($(this).attr('data-tahun'));
|
||||
$('.instansi').val($(this).attr('data-instansi'));
|
||||
});
|
||||
// $('.edit').on('click',function(){
|
||||
// $('#formModalEdit').modal('show');
|
||||
// $('.year').val($(this).attr('data-tahun'));
|
||||
// $('.instansi').val($(this).attr('data-instansi'));
|
||||
// });
|
||||
|
||||
function showCreateModal() {
|
||||
$('#formModal').modal('show');
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@ Route::name('management.')->prefix('management')->group(function () {
|
|||
Route::get('/', [FormController::class, 'show'])->name('form.show');
|
||||
Route::post('save', [FormController::class, 'save'])->name('form.save');
|
||||
Route::post('saveSingle', [FormController::class, 'saveSingle'])->name('form.saveSingle');
|
||||
Route::get('update', [FormController::class, 'update'])->name('form.update');
|
||||
Route::post('editSingle', [FormController::class, 'editSingle'])->name('form.editSingle');
|
||||
Route::get('conversion', [FormController::class, 'convertUnit'])->name('form.conversion');
|
||||
Route::post('{inventoryYear}/import/{instansi?}', [FormController::class, 'import'])->name('form.import');
|
||||
|
|
|
|||
Loading…
Reference in New Issue