117 lines
5.1 KiB
PHP
117 lines
5.1 KiB
PHP
@extends('layouts.master')
|
|
|
|
@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">{{ $title }}</h5>
|
|
<button type="button" class="btn btn-sm btn-primary float-right" data-bs-toggle="modal" data-bs-target="#copyModal">
|
|
{{ $title }}
|
|
</button>
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="table-responsive">
|
|
<table class="table w-100"
|
|
data-search="true"
|
|
data-toggle="table"
|
|
data-pagination="true"
|
|
data-toolbar="#toolbar"
|
|
data-show-refresh="false"
|
|
data-url="{{route($route.'.grid')}}"
|
|
data-ajax-options='{"xhrFields": {"withCredentials": true}}'
|
|
data-sort-name="ids"
|
|
data-sort-order="desc"
|
|
data-page-size="10"
|
|
data-id-field="id"
|
|
id="grid-data">
|
|
<thead class="table-primary text-primary">
|
|
<tr>
|
|
<th data-field="created_at">Waktu Input</th>
|
|
<th data-field="to_year">Tahun Tujuan</th>
|
|
<th data-field="from_year">Tahun Sumber</th>
|
|
<th data-field="status">Status</th>
|
|
<th data-field="executed_time">Waktu Eksekusi</th>
|
|
<th data-field="finished_time">Waktu Selesai</th>
|
|
<th data-field="duration">Durasi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Copy Modal -->
|
|
<div class="modal fade" id="copyModal" tabindex="-1" aria-labelledby="copyModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="copyModalLabel">Salin Aktivitas</h5>
|
|
</div>
|
|
<form action="{{ route($route.'.store') }}" method="POST" id="copyForm">
|
|
@csrf
|
|
<div class="modal-body">
|
|
<div class="form-group">
|
|
<label for="to_year">Tahun Tujuan Data Aktivitas <span class="text-danger">*</span></label>
|
|
<select name="to_year" id="to_year" class="form-control w-100" required>
|
|
@for ($year = date('Y'); $year >= 2000; $year--)
|
|
<option value="{{ $year }}">
|
|
{{ $year }}
|
|
</option>
|
|
@endfor
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="from_year">Tahun Sumber Data Aktivitas <span class="text-danger">*</span></label>
|
|
<select name="from_year" id="from_year" class="form-control" required>
|
|
<option value=""></option>
|
|
@if (isset($availableYears) && count($availableYears) > 0)
|
|
@foreach ($availableYears as $year)
|
|
<option value="{{ $year }}">{{ $year }}</option>
|
|
@endforeach
|
|
@else
|
|
<option value="" disabled>Tidak ada tahun inventory yang terdata.</option>
|
|
@endif
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
|
<button type="submit" class="btn btn-primary">Salin</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@section('js')
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
$('#copyForm').on('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
var fromYear = $('#from_year').val();
|
|
var toYear = $('#to_year').val();
|
|
|
|
Swal.fire({
|
|
title: 'Apakah Anda yakin?',
|
|
text: "Anda akan menyalin data dari tahun " + fromYear + " ke tahun " + toYear +
|
|
". Data yang sudah ada akan di-refresh/replace.",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonText: 'Ya, Salin!',
|
|
cancelButtonText: 'Batal'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
this.submit();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
@endsection
|