DONE: add portal setting endpoint for admin to update
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<div class="home-section-container home-hero-section">
|
||||
<section class="home-hero-wrap">
|
||||
<div class="hero-banner home-hero-banner">
|
||||
<img src="/images/banner-mat28-new.jpg" alt="Banner" class="hero-banner-image">
|
||||
<img :src="bannerUrl" alt="Banner" class="hero-banner-image">
|
||||
<div class="home-hero-banner-shine" aria-hidden="true"></div>
|
||||
</div>
|
||||
<div class="hero-banner-caption home-hero-caption">
|
||||
@@ -192,11 +192,18 @@ export default {
|
||||
claimCode: "",
|
||||
claimExpiresAt: "",
|
||||
claimError: "",
|
||||
matLinkUrl: "https://linktr.ee/kopkb"
|
||||
matLinkUrl: "https://linktr.ee/kopkb",
|
||||
portalSettings: null,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
bannerUrl() {
|
||||
const p = this.portalSettings && this.portalSettings.home_banner_image_path
|
||||
? this.portalSettings.home_banner_image_path
|
||||
: "/images/banner.jpeg";
|
||||
return p;
|
||||
},
|
||||
/**
|
||||
* Maya: boleh mengundi selepas daftar kehadiran. Fizikal: perlu disahkan pentadbir dahulu.
|
||||
*/
|
||||
@@ -231,6 +238,9 @@ export default {
|
||||
const user = this.data?.user || {};
|
||||
const election = this.data?.election || {};
|
||||
const noAnggota = user.no_anggota;
|
||||
const matLabel = (this.portalSettings && this.portalSettings.home_mat_label)
|
||||
? this.portalSettings.home_mat_label
|
||||
: "MAT KE-29";
|
||||
const links = [
|
||||
{
|
||||
key: "calon",
|
||||
@@ -243,7 +253,7 @@ export default {
|
||||
},
|
||||
{
|
||||
key: "mat28",
|
||||
title: "MAT KE-28",
|
||||
title: matLabel,
|
||||
desc: "Pautan luar ke maklumat mesyuarat dan sumber berkaitan",
|
||||
icon: "fa-globe",
|
||||
href: this.matLinkUrl,
|
||||
@@ -339,6 +349,7 @@ export default {
|
||||
|
||||
mounted() {
|
||||
this.syncBarcodeFromUser();
|
||||
this.fetchPortalSettings();
|
||||
},
|
||||
|
||||
watch: {
|
||||
@@ -348,6 +359,18 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
async fetchPortalSettings() {
|
||||
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 defaults.
|
||||
}
|
||||
},
|
||||
|
||||
syncBarcodeFromUser() {
|
||||
if (this.data?.user?.no_kp) {
|
||||
this.noKp = this.data.user.no_kp;
|
||||
|
||||
Reference in New Issue
Block a user