108 lines
4.0 KiB
PHP
108 lines
4.0 KiB
PHP
@extends('layouts.master')
|
|
|
|
@section('title')
|
|
Common Reporting Format (CRF)
|
|
@endsection
|
|
|
|
@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">Common Reporting Format (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="crfForm" 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-md-2 pr-1">
|
|
<div class="form-group">
|
|
<label for="category">Sektor:</label>
|
|
<div class="input-group">
|
|
<select name="category" id="category" class="form-control">
|
|
<option value="">Sektor</option>
|
|
@foreach ($categories as $category)
|
|
<option value="{{ $category->code }}"
|
|
{{ $sectorCode == $category->code ? 'selected' : '' }}>
|
|
{{ $category->name }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</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('crf.export', [
|
|
'inventoryYear' => $inventoryYear,
|
|
'activityYear' => $activityYear,
|
|
'sectorCode' => $sectorCode,
|
|
]) }}"
|
|
class="btn btn-info">Ekspor Excel</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<br />
|
|
@if ($crfData->isNotEmpty())
|
|
@include('reports.crf.table')
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('styles')
|
|
@endsection
|
|
|
|
@section('js')
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#inventoryYear').select2({
|
|
placeholder: 'Pilih Tahun'
|
|
});
|
|
$('#activityYear').select2({
|
|
placeholder: 'Pilih Tahun'
|
|
});
|
|
$('#category').select2({
|
|
placeholder: 'Pilih Sektor'
|
|
});
|
|
|
|
$('#crfForm').on('submit', function(event) {
|
|
event.preventDefault();
|
|
const actionUrl = updateFormAction();
|
|
window.location.href = actionUrl;
|
|
});
|
|
});
|
|
|
|
function updateFormAction() {
|
|
const inventoryYear = $('#inventoryYear').val();
|
|
const activityYear = $('#activityYear').val() || '';
|
|
const sectorCode = $('#category').val() || '';
|
|
|
|
let actionUrl = `{{ url('reports/crf') }}/${inventoryYear}`;
|
|
if (activityYear) actionUrl += `/${activityYear}`;
|
|
if (sectorCode) actionUrl += `/${sectorCode}`;
|
|
|
|
return actionUrl;
|
|
}
|
|
</script>
|
|
@endsection
|