Files
kaunter/resources/views/khazanah/permohonanwang.blade.php
T
hafifierahman 28b985f72b cit skit
2022-04-05 06:01:17 +08:00

267 lines
9.9 KiB
PHP

@extends('layouts.app')
@section('content')
@include('modal.permohonanwang')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<nav aria-label="breadcrumb">
<ol class="breadcrumb pb-3">
<li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Permohonan</li>
</ol>
</nav>
<div class="card-body mx-auto col-12">
@if(session()->has('message'))
<div class="alert alert-success">
{{ session()->get('message') }}
</div>
@endif
@if(session()->has('error'))
<div class="alert alert-danger">
{{ session()->get('error') }}
</div>
@endif
<div class="mx-auto d-flex justify-content-center col-12">
<div class="col-4">
<div class="small-box bg-warning text-center"><div class="inner"><b>Peti Besi: <span>RM {{ number_format($getVault,2) }}</span></b></div></div>
</div>
</div>
<div class="d-flex justify-content-between mb-2">
<h5 class="mt-2">Senarai Permohonan Masih Aktif</h5>
<div>
<button class="btn btn-info" data-toggle="modal" data-target="#PermohonanWang">Mohon</button>
<a class="btn btn-info" href="{{ route('permohonan.rekod') }}">Rekod Permohonan</a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-striped table-hover" id="permohonantable">
<thead class="thead-dark text-center">
<tr>
<th>Bil</th>
<th>No Permohonan</th>
<th>Tarikh Mohon</th>
<th>Jumlah Mohon (RM)</th>
<th>Semak</th>
<th>Jenis Permohonan</th>
<th>Tindakan</th>
</tr>
</thead>
<tbody>
@foreach($permohonan as $mohon)
<tr class="text-center">
<td>{{ $loop->iteration }}</td>
<td>{{ $mohon['nopermohonan'] }}</td>
<td>{{ $mohon['tarikh_permohonan'] }}</td>
<td>{{ number_format($mohon['amaun_mohon'],2) }}</td>
<td>
<a href="{{ route('permohonan.status', ['mohonid' => $mohon['mohonid']]) }}" class="btn btn-info"><i class="fas fa-eye"></i></a>
</td>
<td>{{ $mohon['jenismohon'] }}</td>
<td>
@php
if($mohon['tagdeposit'] === 1)
{
echo '<button data-mohonid="' . $mohon["mohonid"] . '" id="btnterima" class="btn btn-success"><i class="fas fa-check"></i></button>';
}else if(($mohon['tagcit'] === 0 && $mohon['jenismohon'] === 'bayaranbalik'))
{
echo '<button data-mohonid="' . $mohon["mohonid"] . '" id="btncit" class="btn btn-secondary">CIT</button>';
}
else{
echo '<span class="p-2 badge badge-info">DALAM PROSES</span>';
}
@endphp
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var tablemohon = $('#permohonantable').DataTable({
"ordering": false
});
var api_url = '{{ $api_url }}';
$('#PermohonanWang').on('hidden.bs.modal', function (e) {
$(this)
.find("input[name='jumlahmohon']")
.val('')
.end()
.find("input[type=checkbox], input[type=radio]")
.prop("checked", "")
.end();
})
function funcpermohonan(){
let amaun = $('#jumlahmohon').val();
// let tarikh = $('#tarikhmohon').val();
let jenis = $('#radwang:checked').val();
let petibesi = $('#bakipetibesi').val();
let outstanding = $('#outstanding').val();
let boolamaun = false;let booljenis = false;
if(amaun === ''){
$("#erroramaun").show();
// $("[name='erroramaun']").text("*Isikan amaun dalam input!");
$("[name='jumlahmohon']").addClass('is-invalid');
}
if(!jenis)
{
$("#pilihper").show();
booljenis = true;
}else{
$("pilihper").hide();
booljenis = false;
}
if(boolamaun === false && booljenis === false)
{
$("#terima_permohonan").prop('disabled', true);
$('#permohonanform').submit();
return true;
}else{
$("#terima_permohonan").prop('disabled', false);
event.preventDefault();
return false;
}
}
$(document).on('click', '#btnterima', function(e) {
let nama = "{{ Auth::user()->name }}";
let mid = $(this).data("mohonid");
Swal.fire({
title: 'Adakah Wang sudah diterima?',
showDenyButton: true,
showCancelButton: false,
confirmButtonText: 'Terima',
denyButtonText: `Belum`,
allowOutsideClick: false
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$.ajax({
method:"put",
url: api_url + '/admin/permohonan/tagterima',
data: {
"mohonid" : mid,
"namapenerima" : nama
},
success:function(data)
{
if(data === 1)
Swal.fire('Diterima!', '', 'success')
}
});
} else if (result.isDenied) {
// Swal.fire('Belum Diterima!', '', 'info')
}
});
});
$(document).on('click', '#btncit', function(e) {
let mid = $(this).data("mohonid");
var bank = @php echo json_encode($bank) @endphp;
var options = {};
$.map(bank,
function(o) {
options[o.abbreviation] = o.name;
});
Swal.fire({
title: 'BANK CIT',
text: 'Sila Pilih Bank',
input: 'select',
inputOptions: options,
showCancelButton: true,
animation: 'slide-from-top',
inputPlaceholder: 'Sila Pilih Bank',
allowOutsideClick: false,
preConfirm: (value) => {
if(!value){
Swal.showValidationMessage(
`Pilih Bank yang dinyatakan`
);
}
}
}).then(function (result) {
if (result) {
if (result.isConfirmed) {
let cit = result.value;
Swal.fire({
title: 'Masukkan No Resit',
input: 'text',
animation: 'slide-from-top',
inputPlaceholder: 'No Resit',
allowOutsideClick: false,
preConfirm: (value) => {
if(!value){
Swal.showValidationMessage(
`Masukkan No Resit Di dalam kotak disediakan`
);
}
}
}).then(function (response) {
if(response){
$.ajax({
method:"put",
url: api_url + '/admin/permohonan/tagcit',
data: {
"mohonid" : mid,
"bank" : cit,
"resitcit" : response.value
},
success:function(data)
{
if(data === 1)
Swal.fire('Diterima!', '', 'success')
}
});
}
});
}else{
}
}
});
});
</script>
@endsection