Merged in feature/hapus-ansuran-v2 (pull request #308)
Feature/hapus ansuran v2
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
@section('content')
|
||||
@include('modal.historytebus')
|
||||
@include('modal.wakil')
|
||||
@include('errors.alert', ['errorapproval' => $getApprovalError ?? null])
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
@@ -264,7 +265,7 @@
|
||||
<button class="btn btn-primary" onclick="ubahfunc(this)" id="button-edit-gadaian">Ubah</button>
|
||||
<button class="btn btn-primary" onclick="hapusfunc()">Hapus</button>
|
||||
<button class="btn btn-primary" onclick="histfunc()">Rekod Pembiayaan</button>
|
||||
{{-- <button class="btn btn-primary" onclick="removeansuran(this)" id="button-remove-ansuran">Hapus Ansuran</button> --}}
|
||||
<button class="btn btn-primary" onclick="removeansuran(this)" id="button-remove-ansuran">Hapus Ansuran</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -2777,7 +2778,7 @@
|
||||
|
||||
|
||||
try{
|
||||
let response = await getKelulusanKhazanahOperasi('Hapus Ansuran',ansid);
|
||||
let response = await getKelulusanKhazanahOperasi('Hapus Ansuran',ansid,ansuranlatest);
|
||||
let pusherresponse = await PusherResponse(ansid,response,ansuranlatest['created_at'],ansuranlatest['id']);
|
||||
|
||||
}catch(error){
|
||||
@@ -2797,8 +2798,8 @@
|
||||
.then(response => response[0][0]);
|
||||
}
|
||||
|
||||
async function getKelulusanKhazanahOperasi(textstatus = 'none',norujukan){
|
||||
|
||||
async function getKelulusanKhazanahOperasi(textstatus = 'none',norujukan,ansuranlatest = null){
|
||||
|
||||
const swalWithBootstrapButtons = Swal.mixin({
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-success',
|
||||
@@ -2826,8 +2827,31 @@
|
||||
let marg = gadai.percentpinj;
|
||||
let status = textstatus;
|
||||
let jumpinjam = gadai.pinjaman;
|
||||
let ansuran = ansuranlatest ? ansuranlatest['bakihargajualan'] - gadai.bakihargajualan : 0;
|
||||
let teller = "{{ Auth::user()->name }}";
|
||||
|
||||
|
||||
let comment = Swal.fire({
|
||||
title: 'Sila Masukkan Komen',
|
||||
input: 'text',
|
||||
inputPlaceholder: 'Komen',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Hantar',
|
||||
cancelButtonText: 'Batal',
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
inputValidator: (value) => {
|
||||
if (!value) {
|
||||
return 'Sila masukkan komen!';
|
||||
}
|
||||
}
|
||||
});
|
||||
let komen = await comment.then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
return result.value;
|
||||
}
|
||||
});
|
||||
|
||||
Swal.fire({
|
||||
title: 'Tunggu Pengesahan Daripada Khazanah-Operasi.',
|
||||
icon: 'info',
|
||||
@@ -2845,18 +2869,21 @@
|
||||
|
||||
let requestdata = {
|
||||
"_token": "{{ csrf_token() }}",
|
||||
"mohon" : "Hapus Ansuran",
|
||||
"norujukan" : norujukan,
|
||||
"komen" : '',
|
||||
"komen" : komen,
|
||||
"margin" : marg,
|
||||
"berat" : ber,
|
||||
"nilaimarhun" : nm,
|
||||
"status" : status,
|
||||
"jumpinjam" : jumpinjam,
|
||||
"teller" : teller
|
||||
"teller" : teller,
|
||||
"ansuran" : ansuran,
|
||||
"tagoperasi" : 1
|
||||
};
|
||||
|
||||
|
||||
siricreated = await fetch("{{ route('operasi.createkelulusan') }}",{
|
||||
siricreated = await fetch("{{ route('teller.createkelulusan') }}",{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -2865,8 +2892,8 @@
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => {return response});
|
||||
|
||||
return siricreated;
|
||||
|
||||
return siricreated;
|
||||
|
||||
}else if (result.dismiss === Swal.DismissReason.cancel){
|
||||
console.log('gagal');
|
||||
@@ -2891,12 +2918,14 @@
|
||||
encrypted: true
|
||||
});
|
||||
|
||||
|
||||
let recno = (siricreated && typeof siricreated === 'object' && 'id' in siricreated) ? siricreated['id'] : siricreated;
|
||||
let teller = "{{ Auth::user()->name }}";
|
||||
let kodcaw = "{{ Auth::user()->cawangan }}";
|
||||
var channel = pusher.subscribe('notice-kelulusan');
|
||||
channel.bind('my-kelulusan', function(data) {
|
||||
|
||||
if(data.norujukan == norujukan && data.siri == siricreated && data.teller == teller)
|
||||
console.log(data,siricreated,teller,norujukan);
|
||||
if(data.norujukan == norujukan && data.siri == recno && data.teller == teller && data.tagoperasi == null)
|
||||
{
|
||||
if(data.kelulusan == 'lulus')
|
||||
{
|
||||
@@ -2905,6 +2934,7 @@
|
||||
title: 'Telah Disahkan',
|
||||
text: `Komen : ${data.komen}`
|
||||
}).then(function(){
|
||||
console.log("delete ansuran",tarikh,kodcaw,norujukan,tg_id);
|
||||
deleteFuncAnsuran(tarikh,kodcaw,norujukan,tg_id);
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
@if($errorapproval)
|
||||
<script>
|
||||
|
||||
let jenis = "{{ $errorapproval['mohon'] }}";
|
||||
|
||||
if(jenis == 'Hapus Ansuran'){
|
||||
Swal.fire({
|
||||
title: 'Tunggu Pengesahan Daripada Khazanah-Operasi.',
|
||||
icon: 'info',
|
||||
width: 600,
|
||||
padding: '3em',
|
||||
background: '#fffff',
|
||||
showCancelButton: false,
|
||||
showConfirmButton: false,
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
allowEnterKey: false
|
||||
});
|
||||
}else{
|
||||
Swal.fire({
|
||||
title: 'Tunggu Pengesahan Daripada Khazanah.',
|
||||
icon: 'info',
|
||||
width: 600,
|
||||
padding: '3em',
|
||||
background: '#fffff',
|
||||
showCancelButton: false,
|
||||
showConfirmButton: false,
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
allowEnterKey: false
|
||||
})
|
||||
}
|
||||
|
||||
getPusherResponse();
|
||||
|
||||
async function getPusherResponse(){
|
||||
let api_url = "<?php echo $api_url ?>";
|
||||
const jsonData = {
|
||||
norujukan: "{{ $errorapproval['norujukan'] }}",
|
||||
kodcaw: "{{ Auth::user()->cawangan }}",
|
||||
};
|
||||
|
||||
const queryString = new URLSearchParams(jsonData).toString();
|
||||
|
||||
let ansuranlatest = await fetch(api_url + '/admin/ansuran/getLatest?' + queryString)
|
||||
.then(response => response.json())
|
||||
.then(response => {return response});
|
||||
|
||||
try{
|
||||
let pusherresponse = await PusherResponse("{{ $errorapproval['norujukan'] }}","{{ $errorapproval['recno'] }}",ansuranlatest['created_at'],ansuranlatest['id']);
|
||||
|
||||
}catch(error){
|
||||
console.error("Error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@endif
|
||||
@@ -112,11 +112,12 @@
|
||||
<th>No Rujukan</th>
|
||||
<th>Teller</th>
|
||||
<th>Status</th>
|
||||
<th>Nilai Pembiayaan (RM)</th>
|
||||
<th>Nilai Marhun (RM)</th>
|
||||
<th>Berat</th>
|
||||
<th>Margin</th>
|
||||
<th>Tindakan</th>
|
||||
<th width="10%">Nilai Pembiayaan (RM)</th>
|
||||
<th width="10%">Ansuran (RM)</th>
|
||||
<th width="10%">Nilai Marhun (RM)</th>
|
||||
<th width="10%">Berat</th>
|
||||
<th width="10%">Margin</th>
|
||||
<th width="10%">Tindakan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -133,6 +134,7 @@
|
||||
<td>{{ $k['teller'] }}</td>
|
||||
<td>{{ $k['status'] }}</td>
|
||||
<td>{{ Helper::formatNumber($k['jumpinj']) }}</td>
|
||||
<td></td>
|
||||
<td>{{ Helper::formatNumber($k['nilaimarhun']) }}</td>
|
||||
<td>{{ $k['berat'] }}</td>
|
||||
<td>{{ $k['margin'] }}</td>
|
||||
@@ -141,11 +143,12 @@
|
||||
</tr>
|
||||
@endforeach
|
||||
@foreach($kelulusanmohonid as $index=>$km)
|
||||
<tr>
|
||||
<tr data-recno="{{ $km['recno'] }}" data-tagoperasi = "{{ $km['tagoperasi'] }}">
|
||||
<td><a href="#" data-toggle="modal" data-target="#kelulusanmodal" data-norujukan="{{ $km['norujukan'] }}">{{ $km['norujukan'] }} </a></td>
|
||||
<td>{{ $km['teller'] }}</td>
|
||||
<td>{{ $km['mohon'] }}</td>
|
||||
<td>{{ Helper::formatNumber($km['pinjaman']) }}</td>
|
||||
<td>{{ Helper::formatNumber($km['ansuran']) }}</td>
|
||||
<td>{{ Helper::formatNumber($km['nilaimarhun']) }}</td>
|
||||
<td>{{ $km['berat'] }}</td>
|
||||
<td>{{ $km['margin'] }}</td>
|
||||
@@ -514,6 +517,8 @@
|
||||
let norujukan = $(e).data('norujukan');
|
||||
let teller = $(e).closest('tr').children('td:eq(1)').text();
|
||||
let namakhazanah = "{{ $auth_user = Auth::user()->name }}";
|
||||
let recno = $(e).closest('tr').data('recno');
|
||||
let tagoperasi = $(e).closest('tr').data('tagoperasi');
|
||||
|
||||
teller = String(teller);
|
||||
|
||||
@@ -524,7 +529,9 @@
|
||||
"_token": "{{ csrf_token() }}",
|
||||
"norujukan" : norujukan,
|
||||
"khazanah" : namakhazanah,
|
||||
'teller' : teller
|
||||
'teller' : teller,
|
||||
"recno" : recno,
|
||||
"tagoperasi" : tagoperasi,
|
||||
},
|
||||
success:function(data){
|
||||
|
||||
@@ -593,6 +600,8 @@
|
||||
let norujukan = $(e).data('norujukan');
|
||||
let namakhazanah = "{{ $auth_user = Auth::user()->name }}";
|
||||
let teller = $(e).closest('tr').children('td:eq(1)').text();
|
||||
let recno = $(e).closest('tr').data('recno');
|
||||
let tagoperasi = $(e).closest('tr').data('tagoperasi');
|
||||
|
||||
teller = String(teller);
|
||||
|
||||
@@ -605,7 +614,9 @@
|
||||
"khazanah" : namakhazanah,
|
||||
"komenubahhapus" : komenkelulusan,
|
||||
"batal" : 'batal',
|
||||
'teller' : teller
|
||||
'teller' : teller,
|
||||
"recno" : recno,
|
||||
"tagoperasi" : tagoperasi
|
||||
|
||||
},
|
||||
success:function(data){
|
||||
|
||||
@@ -126,37 +126,7 @@
|
||||
var audio = new Audio("{{ asset('sound/3.wav') }}");
|
||||
audio.muted = true;
|
||||
|
||||
// Enable pusher logging - don't include this in production
|
||||
Pusher.logToConsole = false;
|
||||
|
||||
var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", {
|
||||
cluster: 'ap1',
|
||||
encrypted: true
|
||||
});
|
||||
|
||||
var channel = pusher.subscribe('operasi-notify');
|
||||
channel.bind('operasi-event', function(data) {
|
||||
let message = JSON.stringify(data);
|
||||
|
||||
$('#bell').css("color", "red");
|
||||
$('#linkz').text(data.namateller + " Pohon Kelulusan");
|
||||
$("#linkz").attr("href", "{{ url('kelulusan') }}");
|
||||
|
||||
if(window.location.pathname === '/operasi/kelulusan')
|
||||
{
|
||||
location.reload();
|
||||
}else{
|
||||
audio.play();
|
||||
audio.muted = false;
|
||||
var countlagu = 1;
|
||||
audio.onended = function() {
|
||||
if(countlagu <= 3){
|
||||
countlagu++;
|
||||
this.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
const Toast = Swal.mixin({
|
||||
const Toast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
@@ -166,7 +136,67 @@
|
||||
toast.addEventListener('mouseenter', Swal.stopTimer)
|
||||
toast.addEventListener('mouseleave', Swal.resumeTimer)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// Enable pusher logging - don't include this in production
|
||||
Pusher.logToConsole = false;
|
||||
|
||||
var pusher = new Pusher("{{ env('PUSHER_APP_KEY') }}", {
|
||||
cluster: 'ap1',
|
||||
encrypted: true
|
||||
});
|
||||
|
||||
var kelulusanhapus = pusher.subscribe('notice-kelulusan');
|
||||
kelulusanhapus.bind('my-kelulusan', function(data) {
|
||||
if(data.tagoperasi == 1){
|
||||
let message = JSON.stringify(data);
|
||||
|
||||
$('#bell').css("color", "red");
|
||||
$('#linkz').text(data.namateller + " Pohon Kelulusan Dihapuskan");
|
||||
$("#linkz").attr("href", "{{ url('kelulusan') }}");
|
||||
if(window.location.pathname === '/operasi/kelulusan')
|
||||
location.reload();
|
||||
else{
|
||||
audio.play();
|
||||
audio.muted = false;
|
||||
var countlagu = 1;
|
||||
audio.onended = function() {
|
||||
if(countlagu <= 3){
|
||||
countlagu++;
|
||||
this.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
Toast.fire({
|
||||
icon: 'info',
|
||||
title: 'Kelulusan Dipohon Sekarang!'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var channel = pusher.subscribe('operasi-notify');
|
||||
channel.bind('operasi-event', function(data) {
|
||||
let message = JSON.stringify(data);
|
||||
|
||||
$('#bell').css("color", "red");
|
||||
$('#linkz').text(data.namateller + " Pohon Kelulusan");
|
||||
$("#linkz").attr("href", "{{ url('kelulusan') }}");
|
||||
|
||||
if(window.location.pathname === '/operasi/kelulusan')
|
||||
{
|
||||
location.reload();
|
||||
}else{
|
||||
audio.play();
|
||||
audio.muted = false;
|
||||
var countlagu = 1;
|
||||
audio.onended = function() {
|
||||
if(countlagu <= 3){
|
||||
countlagu++;
|
||||
this.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Toast.fire({
|
||||
icon: 'error',
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="container col-12">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
@@ -113,6 +113,7 @@
|
||||
<th>Komen</th>
|
||||
<th>Status</th>
|
||||
<th>Nilai Pembiayaan</th>
|
||||
<th>Ansuran</th>
|
||||
<th>Nilai Marhun</th>
|
||||
<th>Berat</th>
|
||||
<th>Margin</th>
|
||||
@@ -128,11 +129,16 @@
|
||||
<th>{{ $k['komen'] }}</th>
|
||||
<td>{{ $k['status'] }}</td>
|
||||
<td>{{ number_format($k['pinjaman'],2) }}</td>
|
||||
@if(isset($k['ansuran']) && $k['ansuran'] != 0)
|
||||
<td>{{ number_format($k['ansuran'],2) }}</td>
|
||||
@else
|
||||
<td></td>
|
||||
@endif
|
||||
<td>{{ $k['nilaimarhun'] }}</td>
|
||||
<td>{{ $k['berat'] }}</td>
|
||||
<td>{{ $k['margin'] }}</td>
|
||||
<td><button class="btn btn-primary mr-2" onclick="updatelulus(this)" data-kodcaw="{{ $k['cawangankod'] }}" data-pelulus="{{ $k['pelulus'] }}" data-norujukan="{{ $k['norujukan'] }}" data-siri="{{ $k['siri'] }}"><i class="fas fa-thumbs-up"></i></button>
|
||||
<button class="btn btn-danger" onclick="updatebatal(this)" data-kodcaw="{{ $k['cawangankod'] }}" data-norujukan="{{ $k['norujukan'] }}" data-pelulus="{{ $k['pelulus'] }}" data-siri="{{ $k['siri'] }}" ><i class="fas fa-thumbs-down"></i></button></td>
|
||||
<td><button class="btn btn-primary mr-2" onclick="updatelulus(this)" data-taglulus="{{ isset($k['mohonid']) ? true : false }}" data-kodcaw="{{ $k['cawangankod'] }}" data-norujukan="{{ $k['norujukan'] }}" data-siri="{{ isset($k['siri']) ? $k['siri'] : $k['recno'] }}"><i class="fas fa-thumbs-up"></i></button>
|
||||
<button class="btn btn-danger" onclick="updatebatal(this)" data-taglulus="{{ isset($k['mohonid']) ? true : false }}" data-kodcaw="{{ $k['cawangankod'] }}" data-norujukan="{{ $k['norujukan'] }}" data-siri="{{ isset($k['siri']) ? $k['siri'] : $k['recno'] }}" ><i class="fas fa-thumbs-down"></i></button></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
@@ -346,6 +352,7 @@
|
||||
let siri = $(e).data('siri');
|
||||
let namaoperasi = "{{ Auth::user()->name }}";
|
||||
let teller = $(e).closest('tr').children('td:eq(2)').text();
|
||||
let taglulus = $(e).data('taglulus');
|
||||
|
||||
teller = String(teller);
|
||||
|
||||
@@ -354,6 +361,7 @@
|
||||
url: "{{ route('operasi.updatekelulusan') }}",
|
||||
data: {
|
||||
"_token": "{{ csrf_token() }}",
|
||||
"taglulus" : taglulus,
|
||||
"norujukan" : norujukan,
|
||||
"kodcaw" : cawangankod,
|
||||
"komenkelulusan" : komenkelulusan,
|
||||
|
||||
Reference in New Issue
Block a user