93 lines
3.4 KiB
PHP
93 lines
3.4 KiB
PHP
@extends('layouts.master')
|
|
|
|
@section('title', 'GCOM CRF')
|
|
|
|
@section('content')
|
|
<div class="card shadow-sm">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="mb-0 font-weight-bold">GCOM CRF</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
@if ($errors->has('error'))
|
|
<div class="alert alert-danger">
|
|
{{ $errors->first('error') }}
|
|
</div>
|
|
@endif
|
|
|
|
@if (session('success'))
|
|
<div class="alert alert-success">
|
|
{{ session('success') }}
|
|
</div>
|
|
@endif
|
|
|
|
<form id="gpcForm" method="GET">
|
|
<div class="row">
|
|
<div class="col-md-2 pr-1">
|
|
<x-inventory-year-select :selected-year="$inventoryYear" />
|
|
</div>
|
|
<div class="col-lg-2 pr-1">
|
|
<x-activity-year-select :selected-year="$activityYear" :inventory-year="$inventoryYear" />
|
|
</div>
|
|
<div class="col-lg-4 d-flex align-items-end align-items-center pt-1 pr-1">
|
|
<div class="form-group mt-2 mb-0 mr-2">
|
|
<button type="submit" class="btn btn-info">Tampilkan</button>
|
|
</div>
|
|
<div class="form-group mt-2 mb-0">
|
|
<a href="{{ route('gcomCrf.export', ['inventoryYear' => $inventoryYear, 'activityYear' => $activityYear]) }}"
|
|
class="btn btn-info">Ekspor Excel</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Align the "Catatan" button to the right -->
|
|
<div class="col-lg-4 d-flex justify-content-end align-items-center pt-1">
|
|
<div class="form-group mt-2 mb-0">
|
|
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#catatanModal">
|
|
Catatan
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<br />
|
|
|
|
@if ($gpcData)
|
|
@include('reports.gcom-crf.table')
|
|
@endif
|
|
@include('reports.gcom-crf.note')
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@section('js')
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Initialize select2 for dropdowns
|
|
$('#inventoryYear').select2({
|
|
placeholder: 'Pilih Tahun'
|
|
});
|
|
$('#activityYear').select2({
|
|
placeholder: 'Pilih Tahun'
|
|
});
|
|
|
|
// Handle form submission
|
|
$('#gpcForm').on('submit', function(event) {
|
|
event.preventDefault();
|
|
const actionUrl = updateFormAction();
|
|
window.location.href = actionUrl;
|
|
});
|
|
});
|
|
|
|
// Function to build the action URL for the form based on selected years
|
|
function updateFormAction() {
|
|
const inventoryYear = $('#inventoryYear').val();
|
|
const activityYear = $('#activityYear').val() || '';
|
|
|
|
let actionUrl = `{{ url('reports/gcom_crf') }}/${inventoryYear}`;
|
|
if (activityYear) actionUrl += `/${activityYear}`;
|
|
|
|
return actionUrl;
|
|
}
|
|
</script>
|
|
@endsection
|