tebus dan hargaemas

This commit is contained in:
hafifierahman
2021-01-12 11:44:04 +08:00
parent bdb4844a1d
commit a32deccf82
20 changed files with 1025 additions and 318 deletions
+38 -2
View File
@@ -1,5 +1,7 @@
@extends('layouts.app')
@include('modal.editmarhun')
@section('content')
<div class="container">
<div class="row justify-content-center">
@@ -138,7 +140,7 @@
<input type="text" name="kadarkeuntungan" id="kadarkeuntungan" value="" hidden>
<input type="text" name="kuantiti_marhun" id="kuantiti_marhun" value="" hidden>
<input type="text" name="total_nilai_marhun" id="total_nilai_marhun" value="" hidden>
<a href="{{ route('gadai.batal',['norujukan'=>$norujukan]) }}" class="float-right btn btn-danger mr-2">Batal</a>
<a href="{{ route('customer_info') }}" class="float-right btn btn-danger mr-2">Batal</a>
<input type="submit" name="terima_gadai" id="terima_gadai" class="float-right btn btn-primary mr-2" value="Terima">
</div>
</div>
@@ -228,6 +230,8 @@
<script>
var api_url = "<?php echo $api_url ?>";
$('#pinjaman').val(parseFloat("{{ $gadaiannorujukan['pinjaman'] }}"));
function disableF5(e) { if ((e.which || e.keyCode) == 116) e.preventDefault(); };
$(document).ready( function () {
$(document).on("keydown", disableF5);
@@ -334,13 +338,15 @@
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'],
"<button onclick='deletemarhun(this)' class='btn btn-danger'><i class='fas fa-trash-alt'></i></button>"
"<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>"
]).draw();
counter = counter + 1;
});
});
@@ -405,6 +411,36 @@
});
}
function editmarhun(e)
{
let marhun = $(e).closest('tr').children('td:eq(1)').text();
let norujuk = $('#norujukan').val();
$('#norujukedit').val(norujuk);
$('#valmarhun').val(marhun);
$('#editMarhunModal').modal();
}
$("#sltkarat").change(function(e){
let hargaref = $(this).find(':selected').data('harga');
$('#berat').attr('readonly', false);
$('#harga').val(hargaref);
});
function calculationharga(e)
{
let berat = $(e).val();
let total = 0;
let harga = $('#harga').val();
total = berat * harga;
$('#nilaimarhun').val(total.toFixed(2));
}
$('#pinjaman').on('input',function(){
var pinjaman = Number(this.value);
var nilaimarhun = Number($('#jumlah_nilai_marhun').val());