API inbox noti
This commit is contained in:
parent
1cb3c891f6
commit
2c5fb8e93c
4 changed files with 32 additions and 48 deletions
|
|
@ -4,6 +4,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
import { useQuasar } from "quasar";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
|
||||
import { useroleUserDataStore } from "@/stores/roleUser";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useRouter } from "vue-router";
|
||||
|
|
@ -22,6 +23,7 @@ const {
|
|||
} = mixin;
|
||||
const $q = useQuasar();
|
||||
const DataStore = useInsigniaDataStore();
|
||||
const roleDataStore = useroleUserDataStore();
|
||||
|
||||
const modalNote = ref<boolean>(false);
|
||||
const modelPopupReject = ref<boolean>(false);
|
||||
|
|
@ -201,9 +203,6 @@ const props = defineProps({
|
|||
fecthInsigniaByOc: {
|
||||
type: Function,
|
||||
},
|
||||
roleUser: {
|
||||
type: String,
|
||||
},
|
||||
roundName: {
|
||||
type: String,
|
||||
},
|
||||
|
|
@ -231,7 +230,7 @@ onMounted(async () => {
|
|||
});
|
||||
const checkStatus = computed(() => {
|
||||
if (
|
||||
DataStore.roleUser === "insignia1" &&
|
||||
roleDataStore.insignia1Role &&
|
||||
(DataStore.requestStatus == "st1" || DataStore.requestStatus == "st4")
|
||||
) {
|
||||
return true;
|
||||
|
|
@ -574,7 +573,7 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
|
|||
<div class="row col-12">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<q-select
|
||||
v-if="props.roleUser == 'admin'"
|
||||
v-if="roleDataStore.adminRole"
|
||||
v-model="organization"
|
||||
label="หน่วยงาน"
|
||||
dense
|
||||
|
|
@ -683,7 +682,7 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
|
|||
v-if="
|
||||
(DataStore.isLock == false &&
|
||||
DataStore.requestStatus == 'st5' &&
|
||||
DataStore.roleUser == 'admin') ||
|
||||
roleDataStore.adminRole) ||
|
||||
checkStatus == true
|
||||
"
|
||||
>
|
||||
|
|
@ -804,14 +803,14 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
|
|||
v-if="
|
||||
(DataStore.isLock == false &&
|
||||
DataStore.requestStatus == 'st5' &&
|
||||
DataStore.roleUser == 'admin') ||
|
||||
roleDataStore.adminRole) ||
|
||||
checkStatus == true
|
||||
"
|
||||
>
|
||||
<q-btn
|
||||
v-if="
|
||||
roleUser == 'admin' ||
|
||||
(roleUser == 'insignia1' &&
|
||||
roleDataStore.adminRole ||
|
||||
(roleDataStore.insignia1Role &&
|
||||
(requestStatus == 'st1' || requestStatus == 'st4'))
|
||||
"
|
||||
icon="mdi-dots-vertical"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import type { QTableProps } from "quasar";
|
|||
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
|
||||
import { useRouter } from "vue-router";
|
||||
import DialogInformation from "@/components/Dialogs/Information.vue";
|
||||
import { useroleUserDataStore } from "@/stores/roleUser";
|
||||
|
||||
const roleDataStore = useroleUserDataStore();
|
||||
|
||||
const router = useRouter();
|
||||
const DataStore = useInsigniaDataStore();
|
||||
|
|
@ -20,9 +23,6 @@ const props = defineProps({
|
|||
fecthInsigniaByOc: {
|
||||
type: Function,
|
||||
},
|
||||
roleUser: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
const organization = ref<string>("1");
|
||||
|
|
@ -213,7 +213,7 @@ const closeReson = () => {
|
|||
<div class="row col-12">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<q-select
|
||||
v-if="props.roleUser == 'admin'"
|
||||
v-if="roleDataStore.adminRole"
|
||||
v-model="organization"
|
||||
label="หน่วยงาน"
|
||||
dense
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ import type { QTableProps } from "quasar";
|
|||
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
|
||||
import { useRouter } from "vue-router";
|
||||
import DialogInformation from "@/components/Dialogs/Information.vue";
|
||||
import { useroleUserDataStore } from "@/stores/roleUser";
|
||||
|
||||
const roleDataStore = useroleUserDataStore();
|
||||
const { adminRole } = roleDataStore;
|
||||
|
||||
const router = useRouter();
|
||||
const DataStore = useInsigniaDataStore();
|
||||
|
|
@ -21,9 +25,6 @@ const props = defineProps({
|
|||
fecthInsigniaByOc: {
|
||||
type: Function,
|
||||
},
|
||||
roleUser: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
const organization = ref<string>("1");
|
||||
|
|
@ -143,7 +144,6 @@ const columns = ref<QTableProps["columns"]>([
|
|||
},
|
||||
]);
|
||||
onMounted(async () => {
|
||||
|
||||
organizationOptions.value = DataStore.optionsTypeOc;
|
||||
organization.value = await (DataStore.agency != null
|
||||
? DataStore.agency
|
||||
|
|
@ -211,7 +211,7 @@ const closeReson = () => {
|
|||
<div class="row col-12">
|
||||
<div class="row col-12 q-col-gutter-sm">
|
||||
<q-select
|
||||
v-if="props.roleUser == 'admin'"
|
||||
v-if="roleDataStore.adminRole"
|
||||
v-model="organization"
|
||||
label="หน่วยงาน"
|
||||
dense
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import config from "@/app.config";
|
|||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
|
||||
import { useroleUserDataStore } from "@/stores/roleUser";
|
||||
|
||||
import cardTop from "@/modules/07_insignia/components/2_Manage/StatCard.vue";
|
||||
import tab1 from "@/modules/07_insignia/components/2_Manage/Tab1.vue";
|
||||
|
|
@ -18,6 +19,7 @@ import keycloak from "@/plugins/keycloak";
|
|||
|
||||
const roleUser = ref<string>("admin");
|
||||
|
||||
const roleDataStore = useroleUserDataStore();
|
||||
const DataStore = useInsigniaDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
|
||||
|
|
@ -40,25 +42,9 @@ const stat = ref<any>({
|
|||
|
||||
onMounted(async () => {
|
||||
tab.value = DataStore.mainTab;
|
||||
await checkRole();
|
||||
await fecthlistRound();
|
||||
});
|
||||
|
||||
const checkRole = async () => {
|
||||
if (keycloak.tokenParsed != null) {
|
||||
const insignia1 = await keycloak.tokenParsed.role.includes("insignia1");
|
||||
const insignia2 = await keycloak.tokenParsed.role.includes("insignia2");
|
||||
if (insignia1) {
|
||||
roleUser.value = "insignia1";
|
||||
} else if (insignia2) {
|
||||
roleUser.value = "insignia2";
|
||||
} else {
|
||||
roleUser.value = "admin";
|
||||
}
|
||||
DataStore.roleUser = roleUser.value;
|
||||
}
|
||||
};
|
||||
|
||||
const fecthlistRound = async () => {
|
||||
await http
|
||||
.get(config.API.listRoundInsignia())
|
||||
|
|
@ -104,7 +90,7 @@ const fecthAgency = async () => {
|
|||
.then(async (res) => {
|
||||
DataStore.agency = res.data.result;
|
||||
loadview.value = true;
|
||||
if (roleUser.value == "admin") {
|
||||
if (roleDataStore.adminRole) {
|
||||
await fecthType();
|
||||
}
|
||||
})
|
||||
|
|
@ -331,7 +317,9 @@ const requestSendNote = async () => {
|
|||
<q-space />
|
||||
<!-- สกจ. Freez ข้อมูล -->
|
||||
<q-btn
|
||||
v-if="roleUser == 'admin' && DataStore.isLock !== true && hideBottom"
|
||||
v-if="
|
||||
roleDataStore.adminRole && DataStore.isLock !== true && hideBottom
|
||||
"
|
||||
dense
|
||||
unelevated
|
||||
label="ล็อกข้อมูล"
|
||||
|
|
@ -343,7 +331,7 @@ const requestSendNote = async () => {
|
|||
</q-btn>
|
||||
</div>
|
||||
<div class="col-12"><q-separator /></div>
|
||||
<div v-if="roleUser == 'admin'" class="col-12 row bg-white">
|
||||
<div v-if="roleDataStore.adminRole" class="col-12 row bg-white">
|
||||
<div class="fit q-px-md q-py-sm">
|
||||
<div class="row col-12 q-col-gutter-sm fit">
|
||||
<cardTop
|
||||
|
|
@ -380,7 +368,7 @@ const requestSendNote = async () => {
|
|||
|
||||
<q-card flat bordered class="col-12 q-mt-sm" v-if="loading">
|
||||
<div
|
||||
v-if="roleUser == 'insignia1' && requestStatus == 'st4'"
|
||||
v-if="roleDataStore.insignia1Role && requestStatus == 'st4'"
|
||||
class="q-pa-md q-gutter-sm"
|
||||
>
|
||||
<q-banner
|
||||
|
|
@ -406,7 +394,7 @@ const requestSendNote = async () => {
|
|||
<q-tab name="reject" label="คนที่ไม่ยื่นขอ" />
|
||||
<q-tab name="delete" label="คนที่ถูกลบออก" />
|
||||
<q-tab
|
||||
v-if="roleUser == 'admin'"
|
||||
v-if="roleDataStore.adminRole"
|
||||
name="organization"
|
||||
label="หน่วยงานที่ยังไม่ได้ส่งรายชื่อ"
|
||||
/>
|
||||
|
|
@ -420,7 +408,6 @@ const requestSendNote = async () => {
|
|||
:roundId="round"
|
||||
:roundName="roundName"
|
||||
:fecthInsigniaByOc="fecthInsigniaByOc"
|
||||
:role-user="roleUser"
|
||||
:request-status="requestStatus"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
|
|
@ -429,7 +416,6 @@ const requestSendNote = async () => {
|
|||
:tab="tab"
|
||||
:roundId="round"
|
||||
:fecthInsigniaByOc="fecthInsigniaByOc"
|
||||
:role-user="roleUser"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="delete" class="q-pa-none">
|
||||
|
|
@ -437,23 +423,22 @@ const requestSendNote = async () => {
|
|||
:tab="tab"
|
||||
:roundId="round"
|
||||
:fecthInsigniaByOc="fecthInsigniaByOc"
|
||||
:role-user="roleUser"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel
|
||||
v-if="roleUser == 'admin'"
|
||||
v-if="roleDataStore.adminRole"
|
||||
name="organization"
|
||||
class="q-pa-none"
|
||||
>
|
||||
<tab4 :tab="tab" :roundId="round" :role-user="roleUser" />
|
||||
<tab4 :tab="tab" :roundId="round" />
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
|
||||
<!-- :role-user="roleUser" -->
|
||||
<q-toolbar class="q-py-md text-right">
|
||||
<q-space />
|
||||
<q-btn
|
||||
v-if="
|
||||
roleUser == 'insignia1' &&
|
||||
roleDataStore.insignia1Role &&
|
||||
(requestStatus == 'st1' || requestStatus == 'st4')
|
||||
"
|
||||
dense
|
||||
|
|
@ -464,7 +449,7 @@ const requestSendNote = async () => {
|
|||
@click="sendToDirector"
|
||||
/>
|
||||
<q-btn
|
||||
v-if="roleUser == 'insignia2' && requestStatus == 'st3'"
|
||||
v-if="roleDataStore.insignia2Role && requestStatus == 'st3'"
|
||||
dense
|
||||
unelevated
|
||||
label="ตีกลับ"
|
||||
|
|
@ -473,7 +458,7 @@ const requestSendNote = async () => {
|
|||
@click="popupBackToEdit"
|
||||
/>
|
||||
<q-btn
|
||||
v-if="roleUser == 'insignia2' && requestStatus == 'st3'"
|
||||
v-if="roleDataStore.insignia2Role && requestStatus == 'st3'"
|
||||
dense
|
||||
unelevated
|
||||
label="อนุมัติ"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue