update
parent
cb5e527cd3
commit
502aa4d797
|
|
@ -311,4 +311,13 @@ class FormController implements HasMiddleware
|
|||
return redirect()->back()->withErrors(['error' => 'Persetujuan Data Produsen gagal diproses. Mohon dicoba kembali.' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
public function create($sector, $code) {
|
||||
|
||||
$inventoryYear = date('Y');
|
||||
$instansi = null;
|
||||
|
||||
$data = $this->data($sector, $code, $inventoryYear, $instansi);
|
||||
return view('modules.form.form', $data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
{{-- <link rel="stylesheet" href="{{ asset('assets/plugins/DataTables/datatables.custom.css') }}"> --}}
|
||||
<style>
|
||||
.select2-hidden-accessible{position: relative!important;}
|
||||
.modal{z-index: 1051!important;}
|
||||
</style>
|
||||
@yield('css')
|
||||
</head>
|
||||
|
|
|
|||
|
|
@ -2,15 +2,17 @@
|
|||
<div class="col-md-12">
|
||||
<form method="GET" action="{{ route('modules.form.show', ['sector' => $form->sector, 'code' => $form->code]) }}"
|
||||
id="filterForm">
|
||||
<div class="row">
|
||||
{{-- <div class="row">
|
||||
<div class="col-md-4">
|
||||
<x-inventory-year-select :selected-year="$inventoryYear" />
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="instansi">Instansi:</label>
|
||||
<div class="form-group d-flex justify-content-center align-items-center gap-1">
|
||||
<div class="">
|
||||
<label for="instansi">Instansi:</label>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<select name="instansi" id="instansi" class="form-control">
|
||||
@if ($scope === \App\Enums\LingkupAksesData::ALL->value)
|
||||
|
|
@ -32,11 +34,17 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-md-8 order-md-2 d-flex gap-1 justify-content-end align-items-center flex-wrap">
|
||||
<div class="form-group mb-0 mr-2">
|
||||
<div class="form-group mb-0 mr-2 d-none">
|
||||
@include('modules.form.approve')
|
||||
</div>
|
||||
<div class="form-group mb-0 mr-2">
|
||||
<button type="button" class="btn btn-info mb-2 mb-md-0" onclick="showMetadataModal()"
|
||||
<button type="button" title="Tambah Data" class="btn btn-primary mb-2 mb-md-0" onclick="showCreateModal()"
|
||||
{{ !$activityForm || $instansi === 'all' || $limitInternal ? 'disabled' : '' }}>
|
||||
<i class="bx bx-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="form-group mb-0 mr-2">
|
||||
<button type="button" class="btn btn-secondary mb-2 mb-md-0" onclick="showMetadataModal()"
|
||||
{{ !$activityForm || $instansi === 'all' || $limitInternal ? 'disabled' : '' }}>
|
||||
<i class="bx bx-menu"></i>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,160 @@
|
|||
<!-- Metadata Modal -->
|
||||
<div class="modal fade" id="formModal" tabindex="-1" role="dialog" aria-labelledby="formModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document" style="width:90%; max-width: 90%;">
|
||||
<div class="modal-content">
|
||||
<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">
|
||||
|
||||
<!-- Right Column - Metadata Form -->
|
||||
<div class="col-md-12">
|
||||
<form id="FormSubmit" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<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">
|
||||
<x-inventory-year-select :selected-year="$inventoryYear" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<div class="">
|
||||
<label for="instansi">Instansi:</label>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<select name="instansi" id="instansi" class="form-control">
|
||||
@if ($scope === \App\Enums\LingkupAksesData::ALL->value)
|
||||
<option value="none" @if ($instansi === null || $instansi == 'none') selected @endif>DATA
|
||||
KONSOLIDASI</option>
|
||||
@if ($agencies->isNotEmpty())
|
||||
<option value="all" @if ($instansi === 'all') selected @endif>SELURUH DATA DARI PRODUSEN</option>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@foreach ($agencies as $agency)
|
||||
<option value="{{ $agency->name }}"
|
||||
@if ($instansi == $agency->name) selected @endif>
|
||||
{{ $agency->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</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">
|
||||
<input type="text" class="form-control w-50 text-right" 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 }}">
|
||||
@foreach ($unitsByCategory[$unitCategory] as $unit)
|
||||
<option value="{{ $unit->code }}"
|
||||
{{ $unit->code == $unitCode ? 'selected' : '' }}>
|
||||
{{ $unit->code }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@else
|
||||
{{ $unitCode }}
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Simpan Data</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section('css')
|
||||
<style>
|
||||
/* Global styles */
|
||||
/* #metadataModal .form-group {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#metadataModal label {
|
||||
color: #555;
|
||||
font-size: 12px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
#metadataModal .form-control {
|
||||
font-size: 12px;
|
||||
height: auto;
|
||||
line-height: 16px;
|
||||
padding: 5px 8px 6px;
|
||||
}
|
||||
|
||||
#metadataModal textarea.form-control {
|
||||
height: 89px;
|
||||
} */
|
||||
|
||||
.meta-content {
|
||||
background: #EEF;
|
||||
border-radius: 5px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
line-height: 16px;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
.meta-content h1 {
|
||||
font-size: 13px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.meta-num {
|
||||
color: #666;
|
||||
font-size: 10px;
|
||||
font-weight: 400;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.meta-actions {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* Link colors */
|
||||
a.qa-pending {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
a.qa-revise {
|
||||
color: IndianRed;
|
||||
}
|
||||
|
||||
a.qa-partial {
|
||||
color: GoldenRod;
|
||||
}
|
||||
|
||||
a.qa-done {
|
||||
color: MediumSeaGreen;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
|
@ -42,6 +42,7 @@
|
|||
</div>
|
||||
</div>
|
||||
@include('modules.form.import')
|
||||
@include('modules.form.form')
|
||||
@if ($instansi !== 'all')
|
||||
@include('modules.form.aktivitas-user')
|
||||
@include('modules.form.metadata.index')
|
||||
|
|
|
|||
|
|
@ -117,12 +117,10 @@
|
|||
.catch(error => console.error('Error converting value:', error));
|
||||
}
|
||||
}
|
||||
|
||||
function showMetadataModal() {
|
||||
$('#metadataModal').modal('show');
|
||||
fetchMetadata();
|
||||
}
|
||||
|
||||
function fetchMetadata() {
|
||||
$('#metadataContent').hide();
|
||||
$('#isLoadMetadata').show();
|
||||
|
|
@ -141,6 +139,30 @@
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
function showCreateModal() {
|
||||
$('#formModal').modal('show');
|
||||
fetchFormdata();
|
||||
}
|
||||
|
||||
function fetchFormdata() {
|
||||
$('#formContent').hide();
|
||||
$('#isLoadForm').show();
|
||||
$.ajax({
|
||||
url: '{{ route('modules.form.create', ['sector' => $form->sector, 'code' => $form->code]) }}',
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
$('#formContent').html(data);
|
||||
$('#formContent').show();
|
||||
$('#isLoadForm').hide();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(error);
|
||||
$('#isLoadForm').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showActivityUserModal() {
|
||||
$('#userActivityModal').modal('show');
|
||||
fetchUserActivity();
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@
|
|||
@endphp
|
||||
<th style="min-width: 150px;">
|
||||
{{ $detail->activity ? $detail->activity->name : 'N/A' }}
|
||||
<br /><br />
|
||||
|
||||
@if ($unitCategory)
|
||||
<select name="unit_code[{{ $detail->activity_code }}]" class="form-control unit-code"
|
||||
{{-- <select name="unit_code[{{ $detail->activity_code }}]" class="form-control unit-code"
|
||||
data-activity-code="{{ $detail->activity_code }}"
|
||||
data-current-unit="{{ $unitCode }}">
|
||||
@foreach ($unitsByCategory[$unitCategory] as $unit)
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
{{ $unit->code }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</select> --}}
|
||||
@else
|
||||
{{ $unitCode }}
|
||||
@endif
|
||||
|
|
@ -54,11 +54,16 @@
|
|||
: '';
|
||||
@endphp
|
||||
<td>
|
||||
<input type="text"
|
||||
name="data[{{ $year }}][{{ $detail->activity_code }}-{{ $detail->unit_code }}]"
|
||||
value="{{ getFormattedValue($activity_value) ?? '' }}"
|
||||
class="form-control text-right" oninput="numberFormat(this)"
|
||||
style="min-width: 80px;" {{ $isLocked || $instansi === 'all' || $limitInternal ? 'readonly' : '' }}>
|
||||
<div class="input-group">
|
||||
<input type="text"
|
||||
name="data[{{ $year }}][{{ $detail->activity_code }}-{{ $detail->unit_code }}]"
|
||||
value="{{ getFormattedValue($activity_value) ?? '' }}"
|
||||
class="form-control text-right" oninput="numberFormat(this)"
|
||||
style="min-width: 80px;" {{ $isLocked || $instansi === 'all' || $limitInternal ? 'readonly' : '' }}>
|
||||
<div class="input-group-text">
|
||||
{{ $detail->unit_code }}
|
||||
</div>
|
||||
</div>
|
||||
{{-- <input type="hidden"
|
||||
name="data[{{ $year }}][{{ $detail->activity_code }}-{{ $detail->unit_code }}]"
|
||||
value="{{ $activity_value }}"> --}}
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ Route::name('management.')->prefix('management')->group(function () {
|
|||
Route::post('ef/add_ef_source', [EfController::class, 'storeEfSource'])->name('pengaturan.ef.addEfSource');
|
||||
|
||||
// Additional Function for Dynamic Form Routing
|
||||
Route::get('form/create/{sector}/{code}', [FormController::class, 'create'])->name('form.create');
|
||||
Route::resource('form/metadata', FormMetadataController::class)->only('index', 'store', 'destroy')->names('form.metadata');
|
||||
Route::get('form/aktivitas_user', [FormController::class, 'getUserActivities'])->name('form.aktivitasUser');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue