branch aku jah deh
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@include('modal.wakil')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
@@ -69,17 +71,20 @@
|
||||
NO SIRI TEBUS
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<input type="text">
|
||||
<input type="text" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group row" style="visibility: hidden;">
|
||||
<div class="col-4">
|
||||
<div class="form-group row">
|
||||
<div class="col-2">
|
||||
WAKIL
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<input type="text">
|
||||
<input type="text" class="form-control" name="wakil" id="wakiltxt" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-primary" id="caribtn" onclick="wakilfunction(this)">Cari</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -741,7 +746,7 @@ function bayaransemua()
|
||||
{
|
||||
Swal.fire(
|
||||
'Amaran!',
|
||||
'Masukkan jumlah melebihi jumlah perlu dibayar!',
|
||||
'Jumlah bayaran kurang daripada jumlah yang perlu dibayar!',
|
||||
'error'
|
||||
)
|
||||
return false;
|
||||
@@ -972,6 +977,169 @@ function bayaransemua()
|
||||
|
||||
}
|
||||
|
||||
|
||||
function wakilfunction(e)
|
||||
{
|
||||
let wakil = $('#wakiltxt').val();
|
||||
|
||||
if(wakil.length == 12)
|
||||
{
|
||||
$.ajax({
|
||||
method:'GET',
|
||||
url: "{{ route('wakil.search') }}",
|
||||
data:{
|
||||
'wakil' : wakil
|
||||
},
|
||||
success:function(data){
|
||||
|
||||
if(data == 'no-data')
|
||||
{
|
||||
Swal.fire({
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
allowEnterKey: false,
|
||||
confirmButtonText: '<i class="fa fa-thumbs-up"></i> Daftar Dulu Boss!',
|
||||
icon: 'info',
|
||||
title: 'Maklumat anda tiada dalam senarai wakil! Tekan button okay untuk mendaftar!'
|
||||
}).then(function(){
|
||||
daftarfunction(wakil);
|
||||
});
|
||||
}else{
|
||||
Swal.fire({
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
allowEnterKey: false,
|
||||
confirmButtonText: '<i class="fa fa-thumbs-up"></i> Baik Boss!',
|
||||
icon: 'success',
|
||||
title: 'Maklumat anda Berjaya Direkodkan!'
|
||||
});
|
||||
|
||||
$('#wakiltxt').prop( "disabled", true );
|
||||
$(e).html("Ubah");
|
||||
$(e).attr("onclick","ubahwakil(this)");
|
||||
}
|
||||
|
||||
},error: function (request, status, error) {
|
||||
console.log(request.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
titleText: 'Kad Pengenalan',
|
||||
text: 'mestilah tidak melebihi dan kurang daripada 12 patah perkataan'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function daftarwakil()
|
||||
{
|
||||
let nopelanggan = $('#nopelanggan').val();
|
||||
let nowakil = $('#nowakil').val();
|
||||
let nama = $('#nama').val();
|
||||
let hubungan = $('#slthubungan').val();
|
||||
let alamat = $('#alamat').val();
|
||||
let telefon = $('#notel').val();
|
||||
let nota = $('#nota').val();
|
||||
let nokp = $('#nokp').val();
|
||||
|
||||
|
||||
$.ajax({
|
||||
method:'POST',
|
||||
url: "{{ route('wakil.create') }}",
|
||||
data:{
|
||||
"_token": "{{ csrf_token() }}",
|
||||
"nopelanggan" : nopelanggan,
|
||||
"nowakil" : nowakil,
|
||||
"nama" : nama,
|
||||
"hubungan" : hubungan,
|
||||
"alamat" : alamat,
|
||||
"telefon" : telefon,
|
||||
"nota" : nota,
|
||||
"icno" : nokp
|
||||
},
|
||||
success:function(data){
|
||||
|
||||
if(data == 1)
|
||||
{
|
||||
$('#WakilModal').hide();
|
||||
$('#WakilModal').modal('hide');
|
||||
|
||||
Swal.fire({
|
||||
allowOutsideClick: false,
|
||||
allowEscapeKey: false,
|
||||
allowEnterKey: false,
|
||||
confirmButtonText: '<i class="fa fa-thumbs-up"></i> Baik Boss!',
|
||||
icon: 'success',
|
||||
title: 'Berjaya Mendaftar Wakil Pelanggan!'
|
||||
}).then(function(){
|
||||
$('#wakiltxt').prop( "disabled", true );
|
||||
$('#caribtn').html("Ubah");
|
||||
$('#caribtn').attr("onclick","ubahwakil(this)");
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
},error: function (request, status, error) {
|
||||
console.log(request.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function daftarfunction(id)
|
||||
{
|
||||
$('#nokp').val(id);
|
||||
|
||||
$.ajax({
|
||||
method:'GET',
|
||||
url: "{{ route('wakil.caricustomer') }}",
|
||||
data:{ "icno" : id },
|
||||
success:function(data){
|
||||
|
||||
$('#WakilModal').modal();
|
||||
$('#nama').val('');
|
||||
$('#alamat').val(data['']);
|
||||
$('#notel').val(data['']);
|
||||
|
||||
//get first wakil
|
||||
$.ajax({
|
||||
method:'GET',
|
||||
url: "{{ route('wakil.first') }}",
|
||||
success:function(getfirstwakil)
|
||||
{
|
||||
let firstwakil = parseInt(getfirstwakil);
|
||||
|
||||
$('#nowakil').val(firstwakil+1);
|
||||
}
|
||||
});
|
||||
|
||||
if(data != 'no-data')
|
||||
{
|
||||
$('#nama').val(data['nama']);
|
||||
$('#alamat').val(data['alamat1']);
|
||||
$('#notel').val(data['telefon']);
|
||||
$('#nopelanggan').val(data['nopelanggan']);
|
||||
}
|
||||
|
||||
|
||||
},error: function (request, status, error) {
|
||||
console.log(request.responseText);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function ubahwakil(e)
|
||||
{
|
||||
$('#wakiltxt').prop( "disabled", false);
|
||||
$(e).html("Cari");
|
||||
$(e).attr( "onclick", "wakilfunction(this)");
|
||||
}
|
||||
|
||||
// Restricts input for the set of matched elements to the given inputFilter function.
|
||||
(function($) {
|
||||
$.fn.inputFilter = function(inputFilter) {
|
||||
@@ -990,8 +1158,5 @@ function bayaransemua()
|
||||
};
|
||||
}(jQuery));
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user