469 lines
24 KiB
PHP
469 lines
24 KiB
PHP
<x-default-layout>
|
|
@php
|
|
$route = explode('.', Route::currentRouteName());
|
|
@endphp
|
|
|
|
<!--begin::Card-->
|
|
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
|
<div class="card card-xxl-stretch mb-5 mb-xl-8">
|
|
<!--begin::Card body-->
|
|
<div class="card-body pt-6">
|
|
<div class="d-flex justify-content-end ">
|
|
<button type="button" class="btn btn-primary btn-sm " style="margin-right:35px" id="openModalBtn">
|
|
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span class="path2"></span></i>
|
|
Tambah
|
|
</button>
|
|
</div>
|
|
<div class="card-body pt-6">
|
|
<div class="table-responsive " style="overflow-x:auto;">
|
|
<div id="user_table">
|
|
@include('konfirmasibank::pages.table_fasilitas')
|
|
</div>
|
|
<div class="d-flex justify-content-end ">
|
|
|
|
<a href="{{ route($route[0] . '.index') }}" type="button" class="btn btn-danger btn-sm redirectButton" style="margin-top:10px">
|
|
<i class="ki-duotone ki-exit-left fs-2"><span class="path1"></span><span
|
|
class="path2"></span></i>
|
|
Kembali
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--end::Card body-->
|
|
</div>
|
|
|
|
<!-- Modal -->
|
|
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
|
aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<!-- Modal header -->
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="myModalLabel">Add Fasilitas</h5>
|
|
<button type="button" class="closeButton" data-dismiss="modal" aria-label="Close" style="display:none">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Modal body -->
|
|
<div class="modal-body">
|
|
<form class="form-horizontal" id="inputFasilitas" action="{{ route($route[0] . '.postFasilitas') }}" method="POST">
|
|
@csrf
|
|
<!-- Add your form fields here -->
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Account No</label>
|
|
<div class="col-sm-9">
|
|
<input type="hidden" class="form-control form-control-sm " name="nomor_cif" value="{{$data['queryParam']['cus_no_fasilitas']}}">
|
|
<input type="text" class="form-control form-control-sm " name="nomor_rekening" placeholder="Nomor Rekening">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Company</label>
|
|
<div class="col-sm-9">
|
|
<select class="form-select form-select-sm" aria-label="Small select example" name="cabang">
|
|
<option selected>Select Company</option>
|
|
@foreach ($data['Company'] as $item)
|
|
<option value="{{$item->COMPANY_NAME}}">{{$item->COMPANY_NAME}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Limit Type</label>
|
|
<div class="col-sm-9">
|
|
<select class="form-select form-select-sm" aria-label="Small select example" name="jenis_fasilitas">
|
|
<option selected>Select Limit Type</option>
|
|
@foreach ($data['limitReference'] as $item)
|
|
<option value="{{$item->SHORT_NAME}}">{{$item->SHORT_NAME}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Account Type</label>
|
|
<div class="col-sm-9">
|
|
{{-- <input type="text" class="form-control form-control-sm " id="jnsFasilitas" name="jenis_fasilitas" placeholder="Jenis Fasilitas"> --}}
|
|
<select class="form-select form-select-sm" aria-label="Small select example"
|
|
id="jnsRekening-select" name="jenis_rekening">
|
|
<option selected>Select Account Type</option>
|
|
@foreach ($data['Category'] as $item)
|
|
<option value="{{$item->SHORT_NAME}}">{{$item->SHORT_NAME}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Signer</label>
|
|
<div class="col-sm-9">
|
|
{{-- <input type="text" class="form-control form-control-sm " id="jnsFasilitas" name="jenis_fasilitas" placeholder="Jenis Fasilitas"> --}}
|
|
<select class="form-select form-select-sm" aria-label="Small select example" name="signer_id">
|
|
<option selected>Select Signer</option>
|
|
@foreach ($data['signer'] as $item)
|
|
<option value="{{$item->id}}">{{$item->signer_type}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Currency</label>
|
|
<div class="col-sm-9">
|
|
{{-- <input type="text" class="form-control form-control-sm " id="jnsFasilitas" name="jenis_fasilitas" placeholder="Jenis Fasilitas"> --}}
|
|
<select class="form-select form-select-sm" aria-label="Small select example"
|
|
id="signerTypeEdit-select" name="mata_uang">
|
|
<option selected>Select Currency</option>
|
|
<option value="IDR">IDR</option>
|
|
<option value="USD">USD</option>
|
|
<option value="EUR">EUR</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Balance</label>
|
|
<div class="col-sm-9">
|
|
<input type="text" class="form-control form-control-sm " name="saldo" placeholder="Balance">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Start Date</label>
|
|
<div class="col-sm-9">
|
|
<input type="date" class="form-control form-control-sm " name="start_date"
|
|
placeholder="Start Date">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">End Date</label>
|
|
<div class="col-sm-9">
|
|
<input type="date" class="form-control form-control-sm " name="due_date"
|
|
placeholder="Due Date">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Fixed Rate</label>
|
|
<div class="col-sm-9">
|
|
<input type="text" class="form-control form-control-sm " name="fixed_rate"
|
|
placeholder="Fixed Rate">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Desc</label>
|
|
<div class="col-sm-9">
|
|
<textarea type="text" class="form-control form-control-sm " name="keterangan"
|
|
placeholder="Description"></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add more form fields here -->
|
|
|
|
<!-- Modal footer -->
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary btn-sm closeButton"
|
|
data-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-primary btn-sm" id="submitFasilitas">Submit</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade myModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<!-- Modal header -->
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="myModalLabel">Edit Limit</h5>
|
|
<button type="button" class="closeButton" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Modal body -->
|
|
<div class="modal-body">
|
|
<div id="errors"></div>
|
|
<form class="form-horizontal" id="myFormUpdate" action="{{ route($route[0] . '.updateFasilitas') }}">
|
|
@csrf
|
|
<!-- Add your form fields here -->
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Account No</label>
|
|
<div class="col-sm-9">
|
|
<input type="hidden" class="form-control form-control-sm " id="id" name="id">
|
|
<input type="text" class="form-control form-control-sm " id="norek" name="nomor_rekening_edit"
|
|
placeholder="Nomor Rekening">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Company</label>
|
|
<div class="col-sm-9">
|
|
{{-- <input type="text" class="form-control form-control-sm " id="jnsFasilitas" name="jenis_fasilitas" placeholder="Jenis Fasilitas"> --}}
|
|
<select class="form-select form-select-sm" aria-label="Small select example"
|
|
id="cabangEdit-select" name="cabang_edit">
|
|
<option selected>Select Company</option>
|
|
@foreach ($data['Company'] as $item)
|
|
<option value="{{$item->COMPANY_NAME}}">{{$item->COMPANY_NAME}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Limit Type</label>
|
|
<div class="col-sm-9">
|
|
{{-- <input type="text" class="form-control form-control-sm " id="jnsFasilitas" name="jenis_fasilitas" placeholder="Jenis Fasilitas"> --}}
|
|
<select class="form-select form-select-sm" aria-label="Small select example"
|
|
id="jnsFaasilitasEdit-select" name="jenis_fasilitas_edit">
|
|
<option selected>Select Limit Type</option>
|
|
@foreach ($data['limitReference'] as $item)
|
|
<option value="{{$item->SHORT_NAME}}">{{$item->SHORT_NAME}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Account Type</label>
|
|
<div class="col-sm-9">
|
|
{{-- <input type="text" class="form-control form-control-sm " id="jnsFasilitas" name="jenis_fasilitas" placeholder="Jenis Fasilitas"> --}}
|
|
<select class="form-select form-select-sm" aria-label="Small select example"
|
|
id="jnsRekeningEdit-select" name="jenis_rekening_edit">
|
|
<option selected>Pilih Jenis Rekening</option>
|
|
@foreach ($data['Category'] as $item)
|
|
<option value="{{$item->SHORT_NAME}}">{{$item->SHORT_NAME}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Signer</label>
|
|
<div class="col-sm-9">
|
|
{{-- <input type="text" class="form-control form-control-sm " id="jnsFasilitas" name="jenis_fasilitas" placeholder="Jenis Fasilitas"> --}}
|
|
<select class="form-select form-select-sm" aria-label="Small select example"
|
|
id="signerTypeEdit-select" name="signer_id_edit">
|
|
<option selected>Pilih Penandatangan</option>
|
|
@foreach ($data['signer'] as $item)
|
|
<option value="{{$item->id}}">{{$item->signer_type}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Currency</label>
|
|
<div class="col-sm-9">
|
|
{{-- <input type="text" class="form-control form-control-sm " id="jnsFasilitas" name="jenis_fasilitas" placeholder="Jenis Fasilitas"> --}}
|
|
<select class="form-select form-select-sm" aria-label="Small select example"
|
|
id="mataUangEdit-select" name="mata_uang_edit">
|
|
<option selected>Pilih Mata Uang</option>
|
|
<option value="IDR">IDR</option>
|
|
<option value="USD">USD</option>
|
|
<option value="EUR">EUR</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Saldo</label>
|
|
<div class="col-sm-9">
|
|
<input type="text" class="form-control form-control-sm " id="saldo" name="saldo_edit"
|
|
placeholder="Saldo">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Start Date</label>
|
|
<div class="col-sm-9">
|
|
<input type="date" class="form-control form-control-sm" id="startDate" name="start_date_edit"
|
|
placeholder="Start Date">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">End Date</label>
|
|
<div class="col-sm-9">
|
|
<input type="date" class="form-control form-control-sm " id="dueDatae" name="due_date_edit"
|
|
placeholder="Due Date">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Fixed Rate</label>
|
|
<div class="col-sm-9">
|
|
<input type="text" class="form-control form-control-sm " id="fixedRate" name="fixed_rate_edit"
|
|
placeholder="Fixed Rate">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label for="inputName" class="col-sm-3 col-form-label">Desc</label>
|
|
<div class="col-sm-9">
|
|
<textarea type="text" class="form-control form-control-sm " id="ket" name="keterangan_edit"
|
|
placeholder="Description"></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add more form fields here -->
|
|
|
|
<!-- Modal footer -->
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary btn-sm closeButton2"
|
|
data-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-primary btn-sm" id="submitFormUpdate">Submit</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@push('customscript')
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Open the modal when the "Open Modal" button is clicked
|
|
$("#openModalBtn").click(function() {
|
|
$("#myModal").modal('show');
|
|
});
|
|
$(".closeButton").click(function() {
|
|
$("#myModal").modal('hide');
|
|
});
|
|
$(".closeButton2").click(function() {
|
|
$(".myModalEdit").modal('hide');
|
|
});
|
|
|
|
// Handle form submission when the "Submit" button inside the modal is clicked
|
|
$("#submitFasilitas").click(function(e) {
|
|
// Serialize the form data
|
|
e.preventDefault();
|
|
var formData = $("#inputFasilitas").serialize();
|
|
|
|
// Send an AJAX request to the form submission route
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "{{ route('konfirmasibank.postFasilitas') }}",
|
|
data: formData,
|
|
success: function(data) {
|
|
$("#myModal").modal('hide');
|
|
var _data = JSON.parse(data);
|
|
toastr.success(_data.message);
|
|
location.reload();
|
|
|
|
},
|
|
error: function(xhr, status, error) {
|
|
// Handle error response (if applicable)
|
|
var errors = data.responseJSON.errors;
|
|
$.each(errors, function(key, value) {
|
|
toastr.error(value);
|
|
});
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
$(".btnEdit").click(function(e) {
|
|
// Serialize the form data
|
|
e.preventDefault();
|
|
var id = $(this).data('id');
|
|
var dataToSend = {
|
|
_token: $('meta[name="csrf-token"]').attr('content'),
|
|
id: id
|
|
};
|
|
// Send an AJAX request to the form submission route
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "{{ route('konfirmasibank.editFasilitas') }}",
|
|
data: dataToSend,
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
console.log(response);
|
|
$('#jnsFaasilitasEdit-select option[value="' + response.jenis_fasilitas + '"]').prop(
|
|
'selected', true);
|
|
$('#signerTypeEdit-select option[value="' + response.signer_id + '"]').prop(
|
|
'selected', true);
|
|
$('#jnsRekeningEdit-select option[value="' + response.jenis_rekening + '"]').prop(
|
|
'selected', true);
|
|
$('#mataUangEdit-select option[value="' + response.mata_uang + '"]').prop(
|
|
'selected', true);
|
|
$('#cabangEdit-select option[value="' + response.cabang + '"]').prop(
|
|
'selected', true);
|
|
$('input[name="nomor_rekening_edit"]').val(response.nomor_rekening);
|
|
$('input[name="jenis_fasilitas_edit"]').val(response.jenis_fasilitas);
|
|
$('input[name="saldo_edit"]').val(response.saldo);
|
|
$('input[name="start_date_edit"]').val(response.start_date);
|
|
$('input[name="due_date_edit"]').val(response.due_date);
|
|
$('input[name="jangka_waktu_edit"]').val(response.jangka_waktu);
|
|
$('input[name="fixed_rate_edit"]').val(response.fixed_rate);
|
|
|
|
$('#ket').val(response.keterangan);
|
|
$('#id').val(response.id);
|
|
$(".myModalEdit").modal('show');
|
|
},
|
|
error: function(xhr, status, error) {
|
|
// Handle error response (if applicable)
|
|
var errors = data.responseJSON.errors;
|
|
$.each(errors, function(key, value) {
|
|
toastr.error(value);
|
|
});
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
|
|
$("#submitFormUpdate").click(function(e) {
|
|
// Serialize the form data
|
|
e.preventDefault();
|
|
var formData = $("#myFormUpdate").serialize();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "{{ route('konfirmasibank.updateFasilitas') }}",
|
|
data: formData, // serializes the form's elements.
|
|
success: function(data) {
|
|
$(".myModalEdit").modal('hide');
|
|
var _data = JSON.parse(data);
|
|
toastr.success(_data.message);
|
|
location.reload();
|
|
|
|
},
|
|
error: function(data, textStatus, errorThrown) {
|
|
var errors = data.responseJSON.errors;
|
|
$.each(errors, function(key, value) {
|
|
toastr.error(value);
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
$(".btnDelete").click(function(e) {
|
|
// var form = $(this).closest("form");
|
|
var id = $(this).data('id');
|
|
var dataToSend = {
|
|
_token: $('meta[name="csrf-token"]').attr('content'),
|
|
id: id
|
|
};
|
|
e.preventDefault();
|
|
Swal.fire({
|
|
title: 'Are you sure?',
|
|
text: "You won't be able to revert this!",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: 'Yes, delete it!'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "{{ route('konfirmasibank.destroyFasilitas') }}",
|
|
data: dataToSend, // serializes the form's elements.
|
|
success: function(data) {
|
|
toastr.success('has been deleted.', 'Success!', {
|
|
timeOut: 5000
|
|
});
|
|
location.reload();
|
|
}
|
|
});
|
|
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
});
|
|
</script>
|
|
@endpush
|
|
|
|
|
|
|
|
</x-default-layout>
|