@ -5,7 +5,7 @@
< h6 v -text = " announcement.title " / >
< BaseButton
v - if = "isAdmin"
v - if = "securityStore. isAdmin"
icon = "edit"
label = "Edit"
type = "black"
@ -18,37 +18,23 @@
< / BaseCard >
< / template >
< script >
import { mapGetters , useStore } from "vuex" ;
import { useRouter } from "vue-router" ;
import { reactive , toRefs } from "vue" ;
import BaseButton from "../basecomponents/BaseButton.vue" ;
< script setup >
import BaseButton from "../basecomponents/BaseButton.vue"
import BaseCard from "../basecomponents/BaseCard.vue"
import { useSecurityStore } from "../../store/securityStore"
export default {
name : 'SystemAnnouncementCard' ,
components : { BaseCard , BaseButton } ,
props : {
announcement : Object ,
} ,
setup ( ) {
const router = useRouter ( ) ;
const state = reactive ( {
handleAnnouncementClick : function ( announcement ) {
router
. push ( { path : ` /main/admin/system_announcements.php? ` , query : { id : announcement [ 'id' ] , action : 'edit' } } )
. catch ( ( ) => {
} ) ;
}
} ) ;
const securityStore = useSecurityStore ( )
return toRefs ( state ) ;
defineProps ( {
announcement : {
type : Object ,
required : true ,
} ,
computed : {
... mapGetters ( {
'isAdmin' : 'security/isAdmin' ,
} ) ,
}
} ;
} )
function handleAnnouncementClick ( announcement ) {
/ / u n t i l a n n o u n c e m e n t i s m i g r a t e d t o v u e w e n e e d t o u s e a b r o w s e r a c t i o n
/ / w h e n a n n o u n c e m e n t i s m i g r a t e d w e s h o u l d u s e r o u t e r . p u s h h e r e
location . assign ( ` /main/admin/system_announcements.php?id= ${ announcement [ "id" ] } &action=edit ` )
}
< / script >