feat: scope user to area

This commit is contained in:
Methapon2001 2024-11-27 15:33:03 +07:00
parent 2eabc5fcd7
commit dee1bab91c
3 changed files with 16 additions and 1 deletions

View file

@ -1,13 +1,19 @@
<script setup lang="ts">
import SelectUser from 'src/components/shared/select/SelectUser.vue';
import { watch } from 'vue';
const localEmployee = defineModel<boolean>('localEmployee', { required: true });
const employeeId = defineModel<string>('employeeId', { required: false });
defineProps<{
readonly?: boolean;
districtId?: string;
cost?: boolean;
}>();
watch(localEmployee, (lhs, rhs) => {
if (lhs && !rhs) employeeId.value = '';
});
</script>
<template>
<div class="row items-center q-px-md q-py-xs">
@ -32,9 +38,13 @@ defineProps<{
<div class="col-12 row">
<SelectUser
:key="localEmployee.toString()"
class="col-md-5 col-12"
v-model:value="employeeId"
:params="{ userType: 'MESSENGER' }"
:params="{
userType: 'MESSENGER',
responsibleDistrictId: localEmployee ? districtId : undefined,
}"
:readonly
:label="$t('general.select', { msg: $t('personnel.MESSENGER') })"
/>

View file

@ -11,6 +11,7 @@ import { useRequestList } from 'src/stores/request-list';
const props = defineProps<{
step: Step;
responsibleAreaDistrictId?: string;
}>();
const requestListStore = useRequestList();
@ -152,6 +153,7 @@ function assignToForm() {
class="surface-1"
v-model:local-employee="formData.localEmployee"
v-model:employee-id="formData.employeeId"
:district-id="responsibleAreaDistrictId"
/>
</section>
<section class="col-12">

View file

@ -529,6 +529,9 @@ async function triggerViewFile(opt: {
value.stepStatus?.[pageState.currentStep - 1]?.attributes
?.form
"
:responsible-area-district-id="
data.quotation.customerBranch.districtId
"
/>
<PropertiesExpansion
:id="value.id"