refactor: assign data if is branch_manager
This commit is contained in:
parent
762fcd84b2
commit
306b5d6005
1 changed files with 9 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import useFlowStore from 'stores/flow';
|
||||
import useUserStore from 'stores/user';
|
||||
import useBranchStore from 'stores/branch';
|
||||
import { isRoleInclude } from 'src/stores/utils';
|
||||
|
||||
import {
|
||||
User,
|
||||
|
|
@ -44,6 +45,7 @@ import ImageUploadDialog from 'components/ImageUploadDialog.vue';
|
|||
import { AddressForm } from 'components/form';
|
||||
import DialogForm from 'components/DialogForm.vue';
|
||||
import KebabAction from 'src/components/shared/KebabAction.vue';
|
||||
import useMyBranch from 'src/stores/my-branch';
|
||||
|
||||
const { locale, t } = useI18n();
|
||||
const $q = useQuasar();
|
||||
|
|
@ -54,7 +56,9 @@ const flowStore = useFlowStore();
|
|||
const userStore = useUserStore();
|
||||
const branchStore = useBranchStore();
|
||||
const adrressStore = useAddressStore();
|
||||
const useMyBranchStore = useMyBranch();
|
||||
const { data: userData } = storeToRefs(userStore);
|
||||
const { myBranch } = storeToRefs(useMyBranchStore);
|
||||
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL;
|
||||
|
||||
const defaultFormData = {
|
||||
|
|
@ -337,6 +341,11 @@ async function openDialog(
|
|||
|
||||
if (action === 'FORM') {
|
||||
modal.value = true;
|
||||
|
||||
if (isRoleInclude(['branch_manager'])) {
|
||||
hqId.value = myBranch.value?.[0].headOfficeId || '';
|
||||
brId.value = myBranch.value?.[0].id;
|
||||
}
|
||||
} else if (action === 'INFO') {
|
||||
if (!userData.value) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue