fix skit2

This commit is contained in:
hafifierahman
2022-07-17 09:10:26 +08:00
parent ee282b65ea
commit ea8aadb0be
9 changed files with 523 additions and 92 deletions
+83 -58
View File
@@ -613,66 +613,91 @@ export default {
if (response.data === 1) {
if (this.userroles === "operasi") {
this.axios.put(this.$hostname + '/admin/permohonan/updateoperasi', {
kelulusan: 'Lulus',
mohonid: mohonid,
namaoperasi: this.username
}).then(response => {
if (response.data === 1) {
this.$swal({
icon: 'success',
title: 'Berjaya',
text: 'Berjaya mengemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
} else {
this.$swal({
icon: 'warning',
title: 'Tidak Berjaya',
text: 'tidak berjaya dikemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
}
});
} else if (this.userroles === 'akaun') {
this.axios.put(this.$hostname + '/admin/permohonan/updateakaun', {
kelulusan: 'Lulus',
mohonid: mohonid,
namaakaun: this.username
}).then(response => {
if (response.data === 1) {
this.$swal({
icon: 'success',
title: 'Berjaya',
text: 'Berjaya mengemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
} else {
this.$swal({
icon: 'warning',
title: 'Tidak Berjaya',
text: 'tidak berjaya dikemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
}
});
} else {
let config = {
header: {
'Content-Type': 'multipart/form-data'
}
}
this.$swal({
title: 'Muat Naik Fail Permohonan',
showCancelButton: true,
confirmButtonText: 'Muat Naik',
input: 'file',
allowOutsideClick: false,
willOpen: () => {
$(".swal2-file").change(function () {
var reader = new FileReader();
reader.readAsDataURL(this.files[0]);
});
}
}).then((file) => {
if (file.value) {
var formData = new FormData();
var file = $('.swal2-file')[0].files[0];
formData.append("mohonid", mohonid);
formData.append("image", file);
formData.append("kelulusan", 'Lulus');
if (this.userroles === "operasi") {
formData.append("namaoperasi", this.username);
this.axios.put(this.$hostname + '/admin/permohonan/updateoperasi', formData, config).then(response => {
if (response.data === 1) {
this.$swal({
icon: 'success',
title: 'Berjaya',
text: 'Berjaya mengemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
} else {
this.$swal({
icon: 'warning',
title: 'Tidak Berjaya',
text: 'tidak berjaya dikemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
}
});
} else if (this.userroles === 'akaun') {
formData.append("namaakaun", this.username);
this.axios.put(this.$hostname + '/admin/permohonan/updateakaun', {
kelulusan: 'Lulus',
mohonid: mohonid,
namaakaun: this.username
}).then(response => {
if (response.data === 1) {
this.$swal({
icon: 'success',
title: 'Berjaya',
text: 'Berjaya mengemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
} else {
this.$swal({
icon: 'warning',
title: 'Tidak Berjaya',
text: 'tidak berjaya dikemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
}
});
}
}
});
} else {
this.$swal({
icon: 'warning',
+137 -16
View File
@@ -16,6 +16,20 @@
</div>
</div>
<div class="flex justify-between">
<div class="pr-4">
<button @click.prevent="cetakpdf" class="border border-yellow-600 text-white bg-yellow-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300">PDF</button>
<button @click.prevent="cetaksenarai" class="border border-yellow-600 text-white bg-yellow-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300">Excel</button>
<!-- <vue-excel-xlsx :disabled="this.selectedNorujukan.length == 0" :data="arraybakilelong" :columns="columns" :file-name="'exceltest'" :file-type="'xlsx'" :sheet-name="'exceltestsheet'" class="border border-yellow-600 text-white bg-yellow-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300">
Excel
</vue-excel-xlsx> -->
</div>
<div class="p-4">
{{ extensionbulan(this.$props.bulanmula) }} Hingga {{ extensionbulan(this.$props.bulanhingga) }}
</div>
</div>
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 rounded-lg border w-full sm:h-96 p-6 overflow-x-auto overflow-y-scroll scrollbar">
<thead class="text-xs text-gray-700 uppercase bg-yellow-200 dark:bg-gray-700 dark:text-gray-400">
<tr>
@@ -82,10 +96,27 @@ export default {
boolblocksag: false,
cawangan: 'KB2',
batchno: 0,
blockseterusnya:false,
blockseterusnya: false,
columns: [{
label: "Norujukan",
field: "norujukan",
},
{
label: "Tarikh",
field: "t_lelong",
},
{
label: "Pembiayaan",
field: "pinjaman",
},
{
label: "Baki",
field: "baki",
},
],
}
},
props: ['bakilelong'],
props: ['bakilelong', 'bulanmula', 'bulanhingga'],
methods: {
async associate() {
this.arraybakilelong = this.$props.bakilelong;
@@ -176,6 +207,7 @@ export default {
icon: 'info',
title: '<strong>Cetak WTD</strong>',
html: "Sila tekan <b>Cetak</b> untuk mencetak senarai SAG yang ingin dituntut,Sila tekan <b>Ya</b> untuk block SAG!",
// html:"<button onclick='console.log(`haha`);cetaksenarai();' class='px-4 py-2 bg-yellow-500 text-white rounded-xl'>PDF</button><button class='ml-2 px-4 py-2 bg-yellow-500 text-white rounded-xl'>Excel</button>",
showCloseButton: true,
showCancelButton: true,
showDenyButton: true,
@@ -183,28 +215,51 @@ export default {
confirmButtonText: 'Ya',
cancelButtonText: 'Tidak',
denyButtonText: `Cetak`,
confirmButtonColor: '#2ecc71',
confirmButtonColor: '#f39c12',
denyButtonColor: '#f39c12',
cancelButtonColor: '#e74c3c',
cancelButtonColor: '#f39c12',
allowOutsideClick: false,
}).then((result) => {
if (result.isConfirmed) {
this.blockwtd();
} else if (result.isDenied) {
// Swal.fire('Changes are not saved', '', 'info')
this.cetaksenarai();
this.$swal({
icon: 'info',
title: '<strong>Pilihan Cetakan</strong>',
html: "Sila tekan <b>PDF</b> untuk pilihan dalam bentuk PDF,Sila tekan <b>Excel</b> untuk pilihan dalam bentuk Excel!",
showCloseButton: true,
showCancelButton: false,
showDenyButton: true,
confirmButtonText: 'Excel',
denyButtonText: 'PDF',
confirmButtonColor: '#f39c12',
denyButtonColor: '#f39c12',
allowOutsideClick: false,
}).then((result) => {
if (result.isConfirmed) {
this.cetaksenarai();
event.preventDefault();
return false;
} else if (result.isDenied) {
this.cetakpdf();
event.preventDefault();
return false;
}
});
}
})
}else{
this.$swal(
'Amaran!',
'Sila pilih norujukan terlebih dahulu!',
'warning'
)
} else {
this.$swal(
'Amaran!',
'Sila pilih norujukan terlebih dahulu!',
'warning'
)
}
},
@@ -227,9 +282,75 @@ export default {
});
},
cetaksenarai: function () {
let urldirect = window.route('wtd.cetak');
let noruj = JSON.stringify(this.selectedNorujukan);
window.open(urldirect + '?cawangan=' + this.cawangan + '&&norujukan=' + noruj, '_blank');
if (this.selectedNorujukan.length > 0) {
let urldirect = window.route('wtd.cetak');
let noruj = JSON.stringify(this.selectedNorujukan);
window.open(urldirect + '?cawangan=' + this.cawangan + '&&norujukan=' + noruj + '&&jenis=excel' + '&&mula=' + this.extensionbulan(this.$props.bulanmula) + '&&hingga=' + this.extensionbulan(this.$props.bulanhingga), '_blank');
} else {
this.$swal(
'Amaran!',
'Sila pilih norujukan terlebih dahulu!',
'warning'
)
}
},
cetakpdf: function () {
if (this.selectedNorujukan.length > 0) {
let urldirect = window.route('wtd.cetak');
let noruj = JSON.stringify(this.selectedNorujukan);
window.open(urldirect + '?cawangan=' + this.cawangan + '&&norujukan=' + noruj + '&&jenis=pdf' + '&&mula=' + this.extensionbulan(this.$props.bulanmula) + '&&hingga=' + this.extensionbulan(this.$props.bulanhingga), '_blank');
} else {
this.$swal(
'Amaran!',
'Sila pilih norujukan terlebih dahulu!',
'warning'
)
}
},
extensionbulan: function (bulan) {
var stringexplode = bulan.split("-");
switch (stringexplode[0]) {
case '01':
bulan = "Januari";
break;
case '02':
bulan = "Februari";
break;
case '03':
bulan = "Mac";
break;
case '04':
bulan = "April";
break;
case '05':
bulan = "Mei";
break;
case '06':
bulan = "Jun";
break;
case '07':
bulan = "Julai";
break;
case '08':
bulan = "Ogos";
break;
case '09':
bulan = "September";
break;
case '10':
bulan = "Oktober";
break;
case '11':
bulan = "November";
break;
case '12':
bulan = "Disember";
break;
}
return bulan + '-' + stringexplode[1];
}
}
}
+2 -2
View File
@@ -29,7 +29,7 @@
<senarai-baki :bakilelong="bakilelong" ref="senaraibaki" @updateLoad="updateLoad"></senarai-baki>
<senarai-baki :bakilelong="bakilelong" :bulanmula="mula" :bulanhingga="hingga" ref="senaraibaki" @updateLoad="updateLoad"></senarai-baki>
</div>
</template>
@@ -86,7 +86,7 @@ export default {
)
}
});
await this.$refs.senaraibaki.associate();
}
+3
View File
@@ -29,6 +29,8 @@ import VueHtml5Editor from 'vue-html5-editor'
import VueFlatPickr from 'vue-flatpickr-component';
import 'flatpickr/dist/flatpickr.css';
import VueExcelXlsx from "vue-excel-xlsx";
let ops = {
// global component name
name: "vue-html5-editor",
@@ -110,6 +112,7 @@ Vue.use(VueContentPlaceholders)
Vue.use(VueSweetalert2);
Vue.use(VueFriendlyIframe)
Vue.use(VueFlatPickr)
Vue.use(VueExcelXlsx)
Vue.use(require('vue-moment'));