DONE: confirmation and list online form
This commit is contained in:
@@ -22,6 +22,10 @@
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">{{ session('message') }}</div>
|
||||
@endif
|
||||
|
||||
@if(!empty($customer_info['photo_base64']))
|
||||
<div class="form-group row col-md-12">
|
||||
<div class="col-md-12 d-flex justify-content-center pb-3">
|
||||
@@ -359,7 +363,7 @@
|
||||
</div>
|
||||
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
||||
@php
|
||||
$activate_tab = request()->session()->pull('activate_tab', 'SAG_lama');
|
||||
$activate_tab = request()->session()->pull('activate_tab', 'SAG_baru');
|
||||
|
||||
$activate_tab_SAG_baru = $activate_tab === 'SAG_baru' ? 'active' : '';
|
||||
$aria_selected_SAG_baru = $activate_tab === 'SAG_baru' ? 'true' : 'false';
|
||||
@@ -378,91 +382,41 @@
|
||||
</nav>
|
||||
<div class="tab-content" id="navtawarruqdannottawarruq">
|
||||
<div class="tab-pane fade {{ $activate_pane_SAG_baru }}" id="nav-tawarruq" role="tabpanel" aria-labelledby="nav-tawarruq-tab">
|
||||
<table class="table table-striped table-hover" id="myTable">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Bil</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>Tarikh Pembiayaan</th>
|
||||
<th>Tarikh Matang</th>
|
||||
<th>Baki Harga Jualan</th>
|
||||
<th>Baki Pembiayaan</th>
|
||||
<th>Margin</th>
|
||||
<th>Tempoh</th>
|
||||
<th>Keuntungan</th>
|
||||
<th>Lelong</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<x-datatable
|
||||
id="myTable"
|
||||
filename="SAG_Baru"
|
||||
:columns="['Bil', 'No Rujukan', 'Tarikh Pembiayaan', 'Tarikh Matang', 'Baki Harga Jualan', 'Baki Pembiayaan', 'Margin', 'Tempoh', 'Keuntungan', 'Lelong', 'Borang Online']"
|
||||
/>
|
||||
</div>
|
||||
<div class="tab-pane fade {{ $activate_pane_SAG_lama }}" id="nav-xtawarruq" role="tabpanel" aria-labelledby="nav-xtawarruq-tab">
|
||||
<table id="xtawarruq" class="table table-striped table-hover">
|
||||
<thead class="thead-dark">
|
||||
{{-- <tr>
|
||||
<th>Bil</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>Tarikh Gadai</th>
|
||||
<th>Tarikh Matang</th>
|
||||
<th>Pembiayaan</th>
|
||||
<th>Margin</th>
|
||||
<th>Tempoh</th>
|
||||
<th>Lelong</th>
|
||||
</tr> --}}
|
||||
<tr>
|
||||
<th>Bil</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>Tarikh Pembiayaan</th>
|
||||
<th>Tarikh Matang</th>
|
||||
<th>Baki Harga Jualan</th>
|
||||
<th>Baki Pembiayaan</th>
|
||||
<th>Margin</th>
|
||||
<th>Tempoh</th>
|
||||
<th>Keuntungan</th>
|
||||
<th>Lelong</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<x-datatable
|
||||
id="xtawarruq"
|
||||
filename="SAG_Lama"
|
||||
:columns="['Bil', 'No Rujukan', 'Tarikh Pembiayaan', 'Tarikh Matang', 'Baki Harga Jualan', 'Baki Pembiayaan', 'Margin', 'Tempoh', 'Keuntungan', 'Lelong', 'Borang Online']"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Sudah Tebus --}}
|
||||
|
||||
<table id="dahtebusTable" class="table table-striped table-hover">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Bil</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>Tarikh Penyelesaian Pembiayaan</th>
|
||||
<th>Baki Pembiayaan</th>
|
||||
<th>Margin</th>
|
||||
<th>Tempoh</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<x-datatable
|
||||
id="dahtebusTable"
|
||||
filename="SAG_Sudah_Tebus"
|
||||
:columns="['Bil', 'No Rujukan', 'Tarikh Penyelesaian Pembiayaan', 'Baki Pembiayaan', 'Margin', 'Tempoh']"
|
||||
/>
|
||||
|
||||
<table id="lelongTable" class="table table-striped table-hover">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Bil</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>Tarikh Lelong</th>
|
||||
<th>Tarikh Tuntut</th>
|
||||
<th>Pembiayaan</th>
|
||||
<th>Harga Jual</th>
|
||||
<th>Jum Tuntut/Bayar</th>
|
||||
<th>Keuntungan</th>
|
||||
<th>Caj Lelong</th>
|
||||
<th>Status Tuntutan</th>
|
||||
<th>Cetak</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<x-datatable
|
||||
id="lelongTable"
|
||||
filename="SAG_Lelong"
|
||||
:columns="['Bil', 'No Rujukan', 'Tarikh Lelong', 'Tarikh Tuntut', 'Pembiayaan', 'Harga Jual', 'Jum Tuntut/Bayar', 'Keuntungan', 'Caj Lelong', 'Status Tuntutan', 'Cetak']"
|
||||
/>
|
||||
|
||||
<div class="text-center">
|
||||
<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-info" type="button" onclick="cetakBorangOnlineSelected()">Cetak Borang Online</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -787,27 +741,32 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
|
||||
// here is the new selected tab id
|
||||
var selectedTabId = e.target.id;
|
||||
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function () {
|
||||
if (typeof adjustErahnDatatables === 'function') {
|
||||
adjustErahnDatatables();
|
||||
}
|
||||
});
|
||||
|
||||
var tablegadai = $('#myTable').DataTable({
|
||||
"scrollX": false,
|
||||
order: [
|
||||
[1, 'desc']
|
||||
var tablegadai = initErahnDatatable('#myTable', {
|
||||
order: [[1, 'desc']],
|
||||
columnDefs: [
|
||||
{ targets: 0, orderable: false, width: '40px' },
|
||||
{ targets: -1, orderable: false, searchable: false, width: '70px' }
|
||||
]
|
||||
});
|
||||
|
||||
var xtawarruq = $('#xtawarruq').DataTable({
|
||||
"scrollX": false
|
||||
var xtawarruq = initErahnDatatable('#xtawarruq', {
|
||||
columnDefs: [
|
||||
{ targets: 0, orderable: false, width: '40px' }
|
||||
]
|
||||
});
|
||||
|
||||
var tabledahtebus = $('#dahtebusTable').DataTable({});
|
||||
var tabledahtebus = initErahnDatatable('#dahtebusTable');
|
||||
|
||||
var tablelelong = $('#lelongTable').DataTable({
|
||||
"scrollX": false
|
||||
var tablelelong = initErahnDatatable('#lelongTable', {
|
||||
columnDefs: [
|
||||
{ targets: -1, orderable: false, searchable: false, width: '80px' }
|
||||
]
|
||||
});
|
||||
|
||||
var historybayarandatatable = $('#tablehistorybayaran').DataTable({
|
||||
@@ -822,6 +781,41 @@
|
||||
minimumFractionDigits: 2
|
||||
});
|
||||
|
||||
function urlBorangOnline(norujukan) {
|
||||
return '{{ url("/gadai/borang-pengesahan-online") }}/' + encodeURIComponent(norujukan);
|
||||
}
|
||||
|
||||
function cetakBorangOnlineCell(gadai_detail) {
|
||||
var cara = String(gadai_detail['cara_terima'] || '').toUpperCase();
|
||||
if (cara !== 'ONLINE') {
|
||||
return '';
|
||||
}
|
||||
return '<a class="btn btn-sm btn-info" href="' + urlBorangOnline(gadai_detail['norujukan']) +
|
||||
'" target="_blank" title="Cetak borang pengesahan online"><i class="fas fa-print"></i></a>';
|
||||
}
|
||||
|
||||
function cetakBorangOnlineSelected() {
|
||||
var selected = $('input[name="belum"]:checked');
|
||||
if (!selected.length) {
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: 'Sila pilih SAG',
|
||||
text: 'Pilih pembiayaan untuk cetak borang pengesahan.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
var cara = String(selected.data('cara-terima') || '').toUpperCase();
|
||||
if (cara !== 'ONLINE') {
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
title: 'Bukan pembiayaan online',
|
||||
text: 'Borang ini hanya untuk SAG yang terima pembiayaan secara online.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
window.open(urlBorangOnline(selected.val()), '_blank');
|
||||
}
|
||||
|
||||
function getGadaiByNorujukan(norujukan) {
|
||||
console.log(norujukan);
|
||||
let gadai_tawarruq = fetch(api_url + '/api/gadai/norujukan/' + norujukan);
|
||||
@@ -1223,8 +1217,8 @@
|
||||
|
||||
let table_norujukan = gadai_detail["norujukan"];
|
||||
tablegadai.row.add([
|
||||
'<input type="radio" value=' + gadai_detail["norujukan"] +
|
||||
' name="belum"/>',
|
||||
'<input type="radio" value="' + gadai_detail["norujukan"] +
|
||||
'" name="belum" data-cara-terima="' + (gadai_detail['cara_terima'] || '') + '"/>',
|
||||
'<a href="#" onclick="checkserah(this)" data-pinjaman=' +
|
||||
gadai_detail['pinjaman'] + ' data-hargajualan=' +
|
||||
gadai_detail['hargajualan'] + ' data-norujukan=' +
|
||||
@@ -1241,6 +1235,7 @@
|
||||
'RM ' + formatter.format(upahsemasa['pendapatan']),
|
||||
'<div style="white-space: nowrap; color:red; font-weight: bolder">' +
|
||||
taglel + '</div>',
|
||||
cetakBorangOnlineCell(gadai_detail),
|
||||
]).draw();
|
||||
}
|
||||
} else if (jenistebus == "sudah_tebus") {
|
||||
@@ -1560,6 +1555,9 @@
|
||||
success: function(data) {
|
||||
$('#myTable').parents('div.dataTables_wrapper').first().show();
|
||||
gadaiTable(data, "belum_tebus");
|
||||
if (typeof adjustErahnDatatables === 'function') {
|
||||
adjustErahnDatatables();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2816,6 +2814,9 @@
|
||||
url: api_url + "/api/customers/" + noic + "/gadai/belum_tebus/" + kodcaw,
|
||||
success: function(data) {
|
||||
gadaiTable(data, "belum_tebus");
|
||||
if (typeof adjustErahnDatatables === 'function') {
|
||||
adjustErahnDatatables();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user