125 lines
6.9 KiB
PHP
125 lines
6.9 KiB
PHP
@extends('layouts.master')
|
|
|
|
@section('title', $form->name)
|
|
|
|
@section('content')
|
|
|
|
@php
|
|
$user = Auth::user();
|
|
$scope = $user->getScope();
|
|
|
|
$inventoryYear = request('inventoryYear') ?? date('Y');
|
|
$instansi = request('instansi') ?? null;
|
|
|
|
if ($agencies->count() === 1 && $scope === \App\Enums\LingkupAksesData::INTERNAL->value) {
|
|
$instansi = $agencies[0]->name;
|
|
}
|
|
|
|
$param = [
|
|
'sector' => $form->sector,
|
|
'code' => $form->code,
|
|
'inventoryYear' => $inventoryYear,
|
|
'instansi' => $instansi,
|
|
];
|
|
|
|
$routeImport = route('modules.form.import', $param);
|
|
$routeExport = route('modules.form.export', $param);
|
|
$routeExportTemplate = route('modules.form.export', array_merge($param, ['isTemplate' => true]));
|
|
$routeApproval = route('modules.form.approval', $param);
|
|
|
|
$internal = $internal ?? null;
|
|
$limitInternal = ($internal !== null) && !$agencies->isNotEmpty();
|
|
@endphp
|
|
|
|
<div class="card shadow-sm" data-sector="{{ $form->sector }}" data-code="{{ $form->code }}">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="mb-0 font-weight-bold">{{ $form->name }}</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<form action="{{ route('modules.form.editSingle', ['sector' => $form->sector, 'code' => $form->code]) }}" method="POST">
|
|
@csrf
|
|
<div class="modal-header">
|
|
<div class="modal-title" id="formModalLabel">
|
|
<b>Form Tambah Data Baru</b>
|
|
</div>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
|
|
<input type="hidden" name="id" id="metadataId">
|
|
<input type="hidden" name="code_id" value="{{ $activityForm->id ?? 0 }}">
|
|
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<div class="form-group">
|
|
<label for="inventoryYear">Tahun Inventory:</label>
|
|
<div class="input-group">
|
|
<input type="text" name="inventoryYear" value="{{ request()->tahun }}" class="form-control year" readonly>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<div class="">
|
|
<label for="instansi">Instansi:</label>
|
|
</div>
|
|
<div class="input-group">
|
|
<input type="text" name="instansi" value="{{ request()->instansi }}" class="form-control instansi" readonly>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@foreach ($formDetails as $detail)
|
|
@php
|
|
$unitCode = $detail->unit_code;
|
|
$unitCategory = $unitsMap[$unitCode]->category ?? null;
|
|
@endphp
|
|
<div class="col-md-12 mb-3">
|
|
<b>{{ $detail->activity ? $detail->activity->name : 'N/A' }}</b>
|
|
@if ($unitCategory)
|
|
<div class="input-group">
|
|
@php
|
|
$activity_value = isset($activityFormDetails[request()->tahun])
|
|
? $activityFormDetails[request()->tahun]
|
|
->where('activity_code', $detail->activity_code)
|
|
->where('activity_unit_code', $detail->unit_code)
|
|
->first()->activity_value ?? ''
|
|
: ''
|
|
@endphp
|
|
<input type="text" class="form-control w-50 text-right" name="value[{{ $detail->activity_code }}]" value="{{ @$activity_value == "" ? "" : getFormattedValue($activity_value)}}" oninput="numberFormat(this)">
|
|
<div class="input-group-text p-0" style="width: 200px!important;">
|
|
<select name="unit_code[{{ $detail->activity_code }}]" class="form-control unit-code"
|
|
data-activity-code="{{ $detail->activity_code }}"
|
|
data-current-unit="{{ $unitCode }}">
|
|
@if (@$unitsByCategory[$unitCategory])
|
|
@foreach (@$unitsByCategory[$unitCategory] as $unit)
|
|
@if($unit->code == $unitCode)
|
|
<option value="{{ $unit->code }}"
|
|
{{ $unit->code == $unitCode ? 'selected' : '' }}>
|
|
{{ $unit->code }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
@endif
|
|
</select>
|
|
</div>
|
|
</div>
|
|
@else
|
|
{{ $unitCode }}
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<a href="" class="btn btn-info">Kembali</a>
|
|
<button class="btn btn-primary">Simpan Data</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@endsection |