fix all the bug

This commit is contained in:
hafifierahman
2021-01-31 08:39:15 +08:00
parent c58c0dbc39
commit 86758cfbe1
18 changed files with 1209 additions and 151 deletions
+101 -4
View File
@@ -1,5 +1,7 @@
@extends('layouts.app')
@include('modal.editmarhun')
@section('content')
@php
$gadai_session = Http::get($api_url . '/api/check/sag',['kodcaw'=>$cawangan_info['kodcaw'],'norujukan'=>$norujukan,'nokp'=>$customer_info['kpbaru']])->json();
@@ -38,11 +40,14 @@
<thead>
<tr>
<th>Bil</th>
<th>Recno</th>
<th>Marhun</th>
<th>Nilai Marhun</th>
<th>Karat</th>
<th>Berat</th>
<th>Nota</th>
<th>Harga</th>
<th>Tindakan</th>
</tr>
</thead>
</table>
@@ -300,7 +305,19 @@
}
var tablemarhun = $('#myTable').DataTable({
"ordering": false
"ordering": false,
"columnDefs": [
{
"targets": [ 1 ],
"visible": false,
"searchable": false
},
{
"targets": [ 7 ],
"visible": false,
"searchable": false
}
]
});
$(".select2").select2({
@@ -329,11 +346,14 @@
marhun_details = marhun_details + marhun_detail['bil'] + " " + marhun_detail['marhun'] +",";
tablemarhun.row.add([
counter,
marhun_detail['recno'],
marhun_detail['marhun'],
'RM ' + formatter.format(marhun_detail['n_marhun']),
marhun_detail['karat'],
formatter.format(marhun_detail['berat']),
marhun_detail['nota']
marhun_detail['nota'],
marhun_detail['harga'],
"<div class='buttonpunya text-center'><button onclick='editmarhun(this)' class='btn btn-primary'><i class='fas fa-edit'></i></button> <button onclick='deletemarhun(this)' class='btn btn-danger'><i class='fas fa-trash-alt'></i></button></div>"
]).draw();
counter = counter + 1;
});
@@ -666,6 +686,10 @@
if (result.isConfirmed) {
let norujukan = $('#norujukan').val();
let nm = $('#total_nilai_marhun').val();let ber = $('#total_berat').val();let marg = $('.span-pinjaman').text();
let komen = "Pembiayaan Melebihi Margin 75%|" + nm + "|" + ber + "|" + marg + "|";
let jumpinjam = $('#pinjaman').val();
let teller = "{{ Auth::user()->name }}";
Swal.fire({
title: 'Tunggu Pengesahan Daripada Operasi.',
@@ -685,7 +709,10 @@
url: "{{ route('operasi.createkelulusan') }}",
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan
"norujukan" : norujukan,
"komen" : komen,
"jumpinjam" : jumpinjam,
"teller" : teller
},
success:function(data){
console.log(data);
@@ -705,6 +732,7 @@
url: "{{ route('operasi.getkelulusan') }}",
data: {
"norujukan" : norujukan
},
success:function(data){
if(data != ''){
@@ -756,6 +784,10 @@
if (result.isConfirmed) {
let norujukan = $('#norujukan').val();
let nm = $('#total_nilai_marhun').val();let ber = $('#total_berat').val();let marg = $('.span-pinjaman').text();
let komen = "Pembiayaan Melebihi Margin 70%|" + nm + "|" + ber + "|" + marg + "|";
let jumpinjam = $('#pinjaman').val();
let teller = "{{ Auth::user()->name }}";
Swal.fire({
title: 'Tunggu Pengesahan Daripada Khazanah.',
@@ -775,7 +807,10 @@
url: "{{ route('khazanah.createkelulusan') }}",
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan
"norujukan" : norujukan,
"komen" : komen,
"jumpinjam" : jumpinjam,
"teller" : teller
},
success:function(data){
console.log(data);
@@ -844,5 +879,67 @@
});
}
}
function deletemarhun(e)
{
let marhun = $(e).closest('tr').children('td:eq(1)').text();let selectedrow = $(e).closest('tr');let recnozz = tablemarhun.row(selectedrow).data();
let norujuk = $('#norujukan').val();
$.ajax({
method: 'put',
url: '{{ route("gadai.editmarhun") }}',
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujuk,
"recno" : recnozz[1]
},
success:function(data)
{
console.log(data);
location.reload();
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}
function editmarhun(e)
{
let norujuk = $('#norujukan').val();let selectedrow = $(e).closest('tr');let recno = tablemarhun.row(selectedrow).data();
let nm = recno[3];let karat = recno[4];let berat = recno[5];
let harga = recno[7];
$('#sltkarat').val(karat);
$('#berat').val(berat);
$('#nilaimarhun').val(nm.substring(2));
$('#harga1').val(harga);
$('#norujukedit').val(norujuk);
$('#recno').val(recno[1]);
$('#editMarhunModal').modal();
}
$("#sltkarat").change(function(e){
let hargaref = $(this).find(':selected').data('harga');
let ber = parseFloat($('#berat').val());
let total = ber * hargaref;
$('#nilaimarhun').val(total.toFixed(2));
$('#harga1').val(hargaref);
});
function calculationharga(e)
{
let berat = $(e).val();
let total = 0;
let harga = $('#harga1').val();
total = berat * harga;
$('#nilaimarhun').val(total.toFixed(2));
}
</script>
@endsection