DONE: error on banner where it is not updated, use uploaded file for etika.pdf
This commit is contained in:
@@ -19,6 +19,22 @@
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Etika Mesyuarat Agung (Muat Turun)</label>
|
||||
<div v-if="form.attendance_etika_url" class="help-block">
|
||||
Semasa:
|
||||
<a :href="form.attendance_etika_url" target="_blank" rel="noopener noreferrer">
|
||||
{{ form.attendance_etika_url }}
|
||||
</a>
|
||||
</div>
|
||||
<input type="file" class="form-control" @change="onEtikaChange" accept="application/pdf,image/*">
|
||||
<small class="help-block">
|
||||
Format: PDF/JPG/PNG/WEBP. Fail akan disimpan ke <code>storage/app/public/portal/</code>.
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Label KoPKB (Zoom) – contoh: KoPKB KALI KE-29/2025</label>
|
||||
<input v-model="form.zoom_meeting_label" type="text" class="form-control" placeholder="KoPKB KALI KE-29/2025">
|
||||
@@ -61,13 +77,15 @@ export default {
|
||||
loading: false,
|
||||
saving: false,
|
||||
bannerFile: null,
|
||||
etikaFile: null,
|
||||
form: {
|
||||
home_mat_label: "",
|
||||
home_banner_image_path: "",
|
||||
zoom_meeting_label: "",
|
||||
zoom_subtitle: "",
|
||||
zoom_image_url: "",
|
||||
zoom_meeting_url: ""
|
||||
zoom_meeting_url: "",
|
||||
attendance_etika_url: ""
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -83,6 +101,11 @@ export default {
|
||||
this.bannerFile = files && files.length ? files[0] : null;
|
||||
},
|
||||
|
||||
onEtikaChange(e) {
|
||||
const files = e && e.target ? e.target.files : null;
|
||||
this.etikaFile = files && files.length ? files[0] : null;
|
||||
},
|
||||
|
||||
async fetch() {
|
||||
this.loading = true;
|
||||
try {
|
||||
@@ -96,7 +119,8 @@ export default {
|
||||
zoom_meeting_label: d.zoom_meeting_label || "",
|
||||
zoom_subtitle: d.zoom_subtitle || "",
|
||||
zoom_image_url: d.zoom_image_url || "",
|
||||
zoom_meeting_url: d.zoom_meeting_url || ""
|
||||
zoom_meeting_url: d.zoom_meeting_url || "",
|
||||
attendance_etika_url: d.attendance_etika_url || ""
|
||||
};
|
||||
} else {
|
||||
this.util.showResult(res, "error");
|
||||
@@ -120,6 +144,7 @@ export default {
|
||||
// zoom_image_url is intentionally not editable from UI (uses default icon / design).
|
||||
fd.append("zoom_meeting_url", this.form.zoom_meeting_url || "");
|
||||
if (this.bannerFile) fd.append("home_banner_image", this.bannerFile);
|
||||
if (this.etikaFile) fd.append("attendance_etika_file", this.etikaFile);
|
||||
|
||||
const res = await axios.post(config.API + "admin/portal-settings", fd, {
|
||||
headers: { "Content-Type": "multipart/form-data" }
|
||||
@@ -128,6 +153,7 @@ export default {
|
||||
if (res && res.data && res.data.status === "success") {
|
||||
this.util.notify("Berjaya simpan tetapan portal.", "success");
|
||||
this.bannerFile = null;
|
||||
this.etikaFile = null;
|
||||
await this.fetch();
|
||||
} else {
|
||||
this.util.showResult(res, "error");
|
||||
|
||||
Reference in New Issue
Block a user