fix skit2

This commit is contained in:
MUHD HAFIFIE
2021-05-20 16:54:16 +08:00
parent 3adc94849b
commit dd0ca831da
19 changed files with 1340 additions and 28 deletions
+132
View File
@@ -4,6 +4,27 @@
@section('content')
@include('modal.historytebus')
@include('modal.wakil')
@include('modal.agh')
@if(Session::has('aghinformation'))
@php list($message, $type) = explode('|', Session::get('aghinformation')); @endphp
<script> Swal.fire({
icon: '{{ $type }}',
title: 'Status!',
text: '{{ $message }}'
}).then(function(){
var type = '{{ $type }}';
urlroute = var urlroute = '{{ route("resit.ansurans", ":id") }}';
if(type === 'success')
window.open(urlroute, '_blank');
});
</script>
@endif
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12 col-lg-12">
@@ -206,6 +227,7 @@
<div class="text-center">
<button class="btn btn-primary" onclick="histfunc()">Rekod Gadaian</button>
<button class="btn btn-primary" onclick="saghilangfunc()">Surat Akuan Hilang</button>
</div>
</div>
@@ -649,6 +671,116 @@
}
}
function saghilangfunc()
{
if($("input[name='options']:checked").val() == 'belum_tebus'){
let histid = $('input[name="belum"]:checked').val();
if(histid == null){
Swal.fire({
icon: 'error',
title: 'Amaran',
text: 'Sila pilih salah satu SAG'
});
}else{
$.ajax({
method:'get',
url: api_url + '/api/polis/get/',
data:{ "norujukan" : histid,"kodcaw" : kodcaw},
success:function(data)
{
var count = Object.keys(data).length;
if(count > 0)
{
Swal.fire({
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: '<i class="fa fa-check-circle"></i> Baiklah',
icon: 'error',
title: 'Surat Akuan Gadaian Hilang telah dikeluarkan!'
});
}else{
$('#AGHModal').modal('show');
$('#norujukanhidden').val(histid);
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}
}else if($("input[name='options']:checked").val() == 'sudah_tebus'){
let histid = $('input[name="sudahtebus"]:checked').val();
if(histid == null){
Swal.fire({
icon: 'error',
title: 'Amaran',
text: 'Sila pilih salah satu SAG'
});
}else{
$.ajax({
method:'get',
url: api_url + '/api/polis/get/',
data:{ "norujukan" : histid,"kodcaw" : kodcaw},
success:function(data){
var count = Object.keys(data).length;
if(count > 0)
{
Swal.fire({
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
confirmButtonText: '<i class="fa fa-check-circle"></i> Baik Boss!',
icon: 'success',
title: 'Surat Akuan Gadaian Hilang telah dijana sebelum ini!'
});
}else{
$('#AGHModal').modal('show');
$('#norujukanhidden').val(histid);
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}
}
}
$('#negeriagh').change(function(){
var daerahselect = document.getElementById("daerahagh");
$('#daerahagh').attr('disabled', false);
$(daerahagh).empty();
$.ajax({
method:'get',
url: api_url + '/api/daerahkodnegeri/' + this.value,
success:function(data){
$.each(data, function( index, daerah ){
addOption(daerah.koddaerah,daerah.namadaerah);
});
}
});
});
function addOption(textopt,valueopt) {
optionText = textopt;
optionValue = valueopt;
$('#daerahagh').append(`<option value='${optionText}'>${optionValue}</option>`);
}
function rekodasal(gadaian){
$('#hargajualanmodal').text('RM ' + formatter.format(gadaian[0][0]['hargajualan']));
$('#pembiayaanmodal').text('RM ' + formatter.format(gadaian[0][0]['pinjaman']));