This commit is contained in:
hafifierahman
2022-07-18 16:56:14 +08:00
parent ea8aadb0be
commit 061d99c166
5 changed files with 8917 additions and 9610 deletions
+1836 -2225
View File
File diff suppressed because it is too large Load Diff
+18 -5795
View File
File diff suppressed because it is too large Load Diff
+7034 -1573
View File
File diff suppressed because one or more lines are too long
+27 -13
View File
@@ -421,6 +421,13 @@ const formatter = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2 minimumFractionDigits: 2
}); });
const toBase64 = file => new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
export default { export default {
components: { components: {
pagination, pagination,
@@ -613,12 +620,6 @@ export default {
if (response.data === 1) { if (response.data === 1) {
let config = {
header: {
'Content-Type': 'multipart/form-data'
}
}
this.$swal({ this.$swal({
title: 'Muat Naik Fail Permohonan', title: 'Muat Naik Fail Permohonan',
showCancelButton: true, showCancelButton: true,
@@ -631,17 +632,27 @@ export default {
reader.readAsDataURL(this.files[0]); reader.readAsDataURL(this.files[0]);
}); });
} }
}).then((file) => { }).then(async (file) => {
if (file.value) { if (file.value) {
const d = new Date();
let time = d.getTime();
var imagename,data,imagetype;
var formData = new FormData(); var formData = new FormData();
var file = $('.swal2-file')[0].files[0]; var file = $('.swal2-file')[0].files[0];
formData.append("mohonid", mohonid);
formData.append("image", file); data = await toBase64(file);
formData.append("kelulusan", 'Lulus'); imagetype = file.name.split('.').pop();
if (this.userroles === "operasi") { if (this.userroles === "operasi") {
formData.append("namaoperasi", this.username); imagename = 'TagOperasi_' + time + file.name.split('.').pop();
this.axios.put(this.$hostname + '/admin/permohonan/updateoperasi', formData, config).then(response => { this.axios.put(this.$hostname + '/admin/permohonan/updateoperasi', {
kelulusan: 'Lulus',
mohonid: mohonid,
dataimage: data,
imagename: imagename,
imagetype: imagetype,
namaoperasi: this.username
}).then(response => {
if (response.data === 1) { if (response.data === 1) {
this.$swal({ this.$swal({
icon: 'success', icon: 'success',
@@ -665,10 +676,13 @@ export default {
} }
}); });
} else if (this.userroles === 'akaun') { } else if (this.userroles === 'akaun') {
formData.append("namaakaun", this.username); imagename = 'TagAkaun_' + time + file.name.split('.').pop();
this.axios.put(this.$hostname + '/admin/permohonan/updateakaun', { this.axios.put(this.$hostname + '/admin/permohonan/updateakaun', {
kelulusan: 'Lulus', kelulusan: 'Lulus',
mohonid: mohonid, mohonid: mohonid,
dataimage: data,
imagename: imagename,
imagetype: imagetype,
namaakaun: this.username namaakaun: this.username
}).then(response => { }).then(response => {
if (response.data === 1) { if (response.data === 1) {
+2 -4
View File
@@ -214,10 +214,8 @@ export default {
// focusConfirm: false, // focusConfirm: false,
confirmButtonText: 'Ya', confirmButtonText: 'Ya',
cancelButtonText: 'Tidak', cancelButtonText: 'Tidak',
denyButtonText: `Cetak`, confirmButtonColor: '#2ecc71',
confirmButtonColor: '#f39c12', cancelButtonColor: '#e74c3c',
denyButtonColor: '#f39c12',
cancelButtonColor: '#f39c12',
allowOutsideClick: false, allowOutsideClick: false,
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {