sigd/resources/views/modules/form/table.blade.php

65 lines
3.0 KiB
PHP

<form action="{{ route('modules.form.save', ['sector' => $form->sector, 'code' => $form->code]) }}" method="POST">
@csrf
<input type="hidden" name="inventoryYear" value="{{ $inventoryYear }}">
<input type="hidden" name="instansi" value="{{ $instansi }}">
@if (@request()->instansi || @$instansi)
<div class="table-responsive mt-3" style="overflow-x: auto;">
<table class="table table-bordered table-detail">
<thead class="table-info text-white">
<tr>
<th style="width: 50px;">No.</th>
<th style="width: 100px;">Tahun</th>
@foreach ($formDetails as $detail)
@php
$unitCode = $detail->unit_code;
$unitCategory = $unitsMap[$unitCode]->category ?? null;
@endphp
<th style="min-width: 150px; text-decoration:normal">
{{ $detail->activity ? $detail->activity->name : 'N/A' }} - ({{ $detail->unit_code }})
</th>
@endforeach
</tr>
</thead>
<tbody>
@php
$years = activityYearRange($inventoryYear);
@endphp
@foreach ($years as $k => $year)
<tr>
<td>{{ $k+1 }}</td>
<td>{{ $year }}</td>
@foreach ($formDetails as $detail)
@php
$activity_value = '';
if (isset($activityFormDetails[$year])) {
$activityData = $activityFormDetails[$year]
->where('activity_code', $detail->activity_code)
->where('activity_unit_code', $detail->unit_code)
->first();
$activity_value = $activityData->activity_value ?? '';
}
@endphp
<td>
<div class="input-group">
<input type="text"
name="data[{{ $year }}][{{ $detail->activity_code }}-{{ $detail->unit_code }}]"
value=""
class="form-control text-right" oninput="numberFormat(this)"
{{ $isLocked || $instansi === 'all' || $limitInternal ? 'readonly' : '' }}>
</div>
</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</div>
<br />
<button type="submit" class="btn btn-primary" {{ $isLocked || $instansi === 'all' || $limitInternal ? 'disabled' : '' }}>Simpan</button>
@endif
</form>