DONE: error on banner where it is not updated, use uploaded file for etika.pdf

This commit is contained in:
ISMAIL MASSERAN
2026-04-30 13:14:23 +08:00
parent b93b51c005
commit 4569decd92
10 changed files with 99 additions and 11 deletions
@@ -76,9 +76,6 @@
<option value="1">Fizikal</option>
<option value="2">Maya</option>
</select>
<small class="form-text text-muted attendance-helper-text">
Sila pilih kehadiran (Maya/Fizikal) kemudian klik SAYA TERIMA.
</small>
</div>
<div v-if="selectedKehadiran === '1'" class="form-group attendance-field">
@@ -145,8 +142,7 @@
<p class="attendance-page-subtitle">
Sila semak maklumat anda, pilih kaedah kehadiran, dan sahkan penyertaan sebelum meneruskan.
</p>
<a href="https://drive.google.com/uc?export=download&id=1O5DVDIbGy-w0bejV6RqtJGIty-_5LJD8"
target="_blank" class="attendance-download-button">
<a :href="etikaUrl" target="_blank" class="attendance-download-button">
Muat Turun Etika Mesyuarat Agung
</a>
</div>
@@ -442,6 +438,7 @@ export default {
loading: false,
userSubmitted: false, // Add a flag to track if the user has already submitted
selectedKehadiran: '0',
portalSettings: null,
}
},
@@ -450,9 +447,17 @@ export default {
var el = document.getElementById('kehadiran');
if (el) this.selectedKehadiran = el.value || '0';
}
this.fetchPortalSettings();
},
computed: {
etikaUrl: function () {
var url = this.portalSettings && this.portalSettings.attendance_etika_url
? String(this.portalSettings.attendance_etika_url).trim()
: '';
if (url) return url;
return 'https://drive.google.com/uc?export=download&id=1O5DVDIbGy-w0bejV6RqtJGIty-_5LJD8';
},
/**
* Status 2 = pilihan raya sedang berjalan (butang SAYA TERIMA dibuka).
*/
@@ -485,6 +490,17 @@ export default {
},
methods: {
fetchPortalSettings: async function () {
try {
this.util.setAuthorization();
const res = await axios.get(config.API + "portal-settings");
if (res && res.data && res.data.status === "success") {
this.portalSettings = res.data.data || null;
}
} catch (e) {
// Non-critical — fall back to default URL.
}
},
onPhysicalGateCodeInput: function (e) {
var el = e.target;
var upper = el.value.toUpperCase();
@@ -224,7 +224,13 @@ export default {
const p = this.portalSettings && this.portalSettings.home_banner_image_path
? this.portalSettings.home_banner_image_path
: "/images/banner.jpeg";
return p;
const v = this.portalSettings && this.portalSettings.updated_at
? encodeURIComponent(this.portalSettings.updated_at)
: "";
if (!v) return p;
return p.includes("?") ? `${p}&v=${v}` : `${p}?v=${v}`;
},
/**
* Maya: boleh mengundi selepas daftar kehadiran. Fizikal: perlu disahkan pentadbir dahulu.