update daftar senhitam
This commit is contained in:
@@ -115,12 +115,19 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
toggleModal: function(){
|
||||
|
||||
this.showModal = !this.showModal;
|
||||
|
||||
this.arrayCustomer = [];
|
||||
this.specCust = [];
|
||||
this.specCust = {};
|
||||
this.nota = '';
|
||||
|
||||
if(this.$refs.btnDropdownRef){
|
||||
this.$refs.btnDropdownRef.value = '';
|
||||
}
|
||||
},
|
||||
async toggleDropdown() {
|
||||
|
||||
this.specCust = {};
|
||||
await this.getData()
|
||||
|
||||
if(this.arrayCustomer.length > 0)
|
||||
@@ -137,42 +144,52 @@ export default {
|
||||
}
|
||||
|
||||
},
|
||||
getData: function() {
|
||||
async getData() {
|
||||
|
||||
let inputvalue = document.getElementById("frminput").value;
|
||||
|
||||
if(inputvalue)
|
||||
if(!inputvalue)
|
||||
{
|
||||
if(this.hasNumber(inputvalue))
|
||||
this.arrayCustomer = [];
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
let response;
|
||||
|
||||
if (this.hasNumber(inputvalue)) {
|
||||
|
||||
response = await this.axios.get(
|
||||
this.$api1 + '/admin/searchByIC',
|
||||
{
|
||||
this.axios.get(this.$api1 + '/admin/searchByIC', {
|
||||
params: {
|
||||
ic: inputvalue,
|
||||
kodcaw: this.$kodcaw
|
||||
}
|
||||
}).then(response => {
|
||||
this.arrayCustomer = response.data
|
||||
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
} else {
|
||||
this.axios.get(this.$api1 + '/admin/searchByName', {
|
||||
|
||||
response = await this.axios.get(
|
||||
this.$api1 + '/admin/searchByName',
|
||||
{
|
||||
params: {
|
||||
nama: inputvalue,
|
||||
kodcaw: this.$kodcaw
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}).then(response => {
|
||||
this.arrayCustomer = response.data
|
||||
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
this.arrayCustomer = response.data || [];
|
||||
|
||||
} catch (error) {
|
||||
|
||||
console.log(error);
|
||||
this.arrayCustomer = [];
|
||||
}
|
||||
|
||||
},
|
||||
@@ -221,6 +238,13 @@ export default {
|
||||
},
|
||||
kemaskinifunc: function(){
|
||||
|
||||
if (!this.specCust || !this.specCust.id) {
|
||||
this.$toast.error(
|
||||
"Sila pilih pelanggan daripada senarai carian terlebih dahulu."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
axios.post(this.$hostname + '/admin/AddSenaraiHitam',
|
||||
{
|
||||
kodcaw: this.$kodcaw,
|
||||
@@ -229,19 +253,18 @@ export default {
|
||||
|
||||
}).then(response => {
|
||||
|
||||
if(response.data == 'berjaya')
|
||||
if(response.data && response.data.id)
|
||||
{
|
||||
this.showModal = false;
|
||||
this.$toast.success("Kemaskini Sudah Berjaya!")
|
||||
this.$toast.success("Kemaskini Sudah Berjaya!");
|
||||
// vm.$forceUpdate();
|
||||
|
||||
this.$emit('clickEvent_', this.pageNumber)
|
||||
|
||||
this.$emit('clickEvent_', this.pageNumber);
|
||||
// setTimeout("window.location.reload()", 3000);
|
||||
}else{
|
||||
|
||||
this.showModal = false;
|
||||
this.$toast.error("Kemaskini tidak berjaya")
|
||||
this.$toast.error("Kemaskini tidak berjaya");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user