buat history and notifikasi
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@include('modal.historytebus')
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="customer_detail" tabindex="-1" aria-labelledby="customer_detailLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-xl">
|
||||
@@ -203,6 +205,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12 mt-md-3 justify-content-between form-group row">
|
||||
<div class="btn-group btn-group-toggle col-md-6" data-toggle="buttons">
|
||||
<label class="btn btn-primary">
|
||||
@@ -284,6 +288,12 @@
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" onclick="ubahfunc()">Ubah</button>
|
||||
<button class="btn btn-primary" onclick="hapusfunc()">Hapus</button>
|
||||
<button class="btn btn-primary" onclick="histfunc()">History</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -324,8 +334,9 @@
|
||||
var urlroute = '{{ route("penebusan", ":id") }}';
|
||||
urlroute = urlroute.replace(':id', gadai_detail["norujukan"]);
|
||||
|
||||
|
||||
tablegadai.row.add([
|
||||
counter,
|
||||
'<input type="radio" value='+ gadai_detail["norujukan"] +' name="belum"/>',
|
||||
'<a href=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
|
||||
gadai_detail['t_gadai'],
|
||||
'RM '+formatter.format(gadai_detail['pinjaman']),
|
||||
@@ -342,7 +353,7 @@
|
||||
{
|
||||
var keuntungan_semasa = (gadai_detail['kadarupah']/100)*gadai_detail['bakipjm']*gadai_detail['jbg'];
|
||||
tabledahtebus.row.add([
|
||||
counter,
|
||||
'<input type="radio" value='+ gadai_detail["norujukan"] +' name="sudahtebus"/>',
|
||||
gadai_detail['norujukan'],
|
||||
gadai_detail['t_gadai'],
|
||||
'RM '+formatter.format(gadai_detail['pinjaman']),
|
||||
@@ -397,10 +408,209 @@
|
||||
gadaiTable(data,"belum_tebus");
|
||||
}
|
||||
});
|
||||
$("input[name='options']").click(function(){
|
||||
gadaiOptionButton(noic)
|
||||
|
||||
$('#myTable td').click( function () {
|
||||
alert('dasdsa');
|
||||
});
|
||||
} );
|
||||
|
||||
$("input[name='options']").click(function(){
|
||||
gadaiOptionButton(noic);
|
||||
});
|
||||
|
||||
// $("tbody").delegate("input[name='belum']", "click", function(){
|
||||
// alert($('input[name="belum"]:checked').val());
|
||||
// });
|
||||
|
||||
// $("tbody").delegate("input[name='sudahtebus']", "click", function(){
|
||||
// alert($('input[name="sudahtebus"]:checked').val());
|
||||
// });
|
||||
|
||||
});
|
||||
|
||||
function histfunc()
|
||||
{
|
||||
if($("input[name='options']:checked").val() == 'belum_tebus'){
|
||||
let histid = $('input[name="belum"]:checked').val();
|
||||
|
||||
if(histid == null)
|
||||
{
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Oops...',
|
||||
text: 'Something went wrong!',
|
||||
footer: '<a href>Why do I have this issue?</a>'
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url:'{{ route("gadai.history") }}',
|
||||
data:{ "norujukan" : histid},
|
||||
success:function(data)
|
||||
{
|
||||
$('#historytebusModal').modal();
|
||||
historytebustable(data);
|
||||
},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();
|
||||
|
||||
alert(histid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var historytebusbayaran = $('#tablehistorytebus').DataTable({
|
||||
"ordering": false
|
||||
});
|
||||
|
||||
function historytebustable(data){
|
||||
var counter = 1;
|
||||
|
||||
historytebusbayaran.clear().draw();
|
||||
$.each(data,function(index,tebusaz){
|
||||
|
||||
// var urlroute = '{{ route("resit.ansuran", ":id") }}';
|
||||
// urlroute = urlroute.replace(':id', bayaran['id']);
|
||||
|
||||
historytebusbayaran.row.add([
|
||||
counter,
|
||||
tebusaz['norujukan'],
|
||||
tebusaz['jenistebus'],
|
||||
tebusaz['jbg'],
|
||||
tebusaz['t_tebus'],
|
||||
"<a href='#' class='btn btn-info'>Cetak</a>"
|
||||
]).draw();
|
||||
|
||||
counter = counter + 1;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function ubahfunc()
|
||||
{
|
||||
if($("input[name='options']:checked").val() == 'belum_tebus'){
|
||||
let ubahid = $('input[name="belum"]:checked').val();
|
||||
|
||||
if(ubahid == null)
|
||||
{
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Oops...',
|
||||
text: 'Something went wrong!',
|
||||
footer: '<a href>Why do I have this issue?</a>'
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url:'{{ route("gadai.history") }}',
|
||||
data:{ "norujukan" : ubahid},
|
||||
success:function(data)
|
||||
{
|
||||
$('#historytebusModal').modal();
|
||||
historytebustable(data);
|
||||
},error: function(xhr, status, error) {
|
||||
var err = eval("(" + xhr.responseText + ")");
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
else if($("input[name='options']:checked").val() == 'sudah_tebus'){
|
||||
let ubahid = $('input[name="sudahtebus"]:checked').val();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function hapusfunc()
|
||||
{
|
||||
if($("input[name='options']:checked").val() == 'belum_tebus'){
|
||||
let hapusid = $('input[name="belum"]:checked').val();
|
||||
|
||||
const swalWithBootstrapButtons = Swal.mixin({
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-success',
|
||||
cancelButton: 'btn btn-danger'
|
||||
},
|
||||
buttonsStyling: false
|
||||
})
|
||||
|
||||
swalWithBootstrapButtons.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Yes, delete it!',
|
||||
cancelButtonText: 'No, cancel!',
|
||||
reverseButtons: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
swalWithBootstrapButtons.fire(
|
||||
'Deleted!',
|
||||
'Your file has been deleted.',
|
||||
'success'
|
||||
)
|
||||
} else if (
|
||||
/* Read more about handling dismissals below */
|
||||
result.dismiss === Swal.DismissReason.cancel
|
||||
) {
|
||||
swalWithBootstrapButtons.fire(
|
||||
'Cancelled',
|
||||
'Your imaginary file is safe :)',
|
||||
'error'
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else if($("input[name='options']:checked").val() == 'sudah_tebus'){
|
||||
let hapusid = $('input[name="sudahtebus"]:checked').val();
|
||||
|
||||
const swalWithBootstrapButtons = Swal.mixin({
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-success',
|
||||
cancelButton: 'btn btn-danger'
|
||||
},
|
||||
buttonsStyling: false
|
||||
})
|
||||
|
||||
swalWithBootstrapButtons.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Yes, delete it!',
|
||||
cancelButtonText: 'No, cancel!',
|
||||
reverseButtons: true
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
swalWithBootstrapButtons.fire(
|
||||
'Deleted!',
|
||||
'Your file has been deleted.',
|
||||
'success'
|
||||
)
|
||||
} else if (
|
||||
/* Read more about handling dismissals below */
|
||||
result.dismiss === Swal.DismissReason.cancel
|
||||
) {
|
||||
swalWithBootstrapButtons.fire(
|
||||
'Cancelled',
|
||||
'Your imaginary file is safe :)',
|
||||
'error'
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function gadaiOptionButton(noic){
|
||||
tablegadai.clear().draw();
|
||||
|
||||
Reference in New Issue
Block a user