fix(04): group & type readonly state

This commit is contained in:
puriphatt 2024-08-08 02:25:12 +00:00
parent 6d1c5ece72
commit 0ef7cf4f11

View file

@ -31,6 +31,7 @@ import TreeCompoent from 'src/components/TreeCompoent.vue';
import DialogForm from 'src/components/DialogForm.vue'; import DialogForm from 'src/components/DialogForm.vue';
import ProfileBanner from 'src/components/ProfileBanner.vue'; import ProfileBanner from 'src/components/ProfileBanner.vue';
import SideMenu from 'src/components/SideMenu.vue'; import SideMenu from 'src/components/SideMenu.vue';
import ImageUploadDialog from 'src/components/ImageUploadDialog.vue';
import useFlowStore from 'src/stores/flow'; import useFlowStore from 'src/stores/flow';
import useMyBranchStore from 'src/stores/my-branch'; import useMyBranchStore from 'src/stores/my-branch';
@ -145,6 +146,7 @@ const { t } = useI18n();
const baseUrl = ref<string>(import.meta.env.VITE_API_BASE_URL); const baseUrl = ref<string>(import.meta.env.VITE_API_BASE_URL);
const holdDialog = ref(false); const holdDialog = ref(false);
const imageDialog = ref(false);
const currentNode = ref<ProductGroup>(); const currentNode = ref<ProductGroup>();
const expandedTree = ref<string[]>([]); const expandedTree = ref<string[]>([]);
const editByTree = ref<'group' | 'type' | undefined>(); const editByTree = ref<'group' | 'type' | undefined>();
@ -182,6 +184,7 @@ const treeProductTypeAndGroup = computed(() => {
return tempValue; return tempValue;
}); });
const profileFileImg = ref<File | null>(null);
const inputSearch = ref(''); const inputSearch = ref('');
const inputSearchProductAndService = ref(''); const inputSearchProductAndService = ref('');
@ -3359,6 +3362,7 @@ watch(
: '--violet-11' : '--violet-11'
}-hsl)/0.1)`" }-hsl)/0.1)`"
v-model:toggle-status="currentStatusGroupType" v-model:toggle-status="currentStatusGroupType"
@view="imageDialog = true"
@update:toggle-status=" @update:toggle-status="
() => { () => {
currentStatusGroupType = currentStatusGroupType =
@ -3464,6 +3468,7 @@ watch(
:active="currentStatusGroupType !== 'INACTIVE'" :active="currentStatusGroupType !== 'INACTIVE'"
hideFade hideFade
useToggle useToggle
:readonly="!isEdit"
:icon="productMode === 'group' ? 'mdi-folder' : 'mdi-folder-table'" :icon="productMode === 'group' ? 'mdi-folder' : 'mdi-folder-table'"
:fallbackCover="`/images/product-service-${productMode}-banner.png`" :fallbackCover="`/images/product-service-${productMode}-banner.png`"
v-model:toggle-status="currentStatusGroupType" v-model:toggle-status="currentStatusGroupType"
@ -3491,6 +3496,7 @@ watch(
bgColor: 'var(--surface-1)', bgColor: 'var(--surface-1)',
}, },
]" ]"
@view="imageDialog = true"
@update:toggle-status=" @update:toggle-status="
async (v) => { async (v) => {
await triggerChangeStatus(currentIdGroupType, v, productMode); await triggerChangeStatus(currentIdGroupType, v, productMode);
@ -4219,6 +4225,40 @@ watch(
</q-list> </q-list>
</div> </div>
</q-dialog> </q-dialog>
<ImageUploadDialog
ref="refImageUpload"
v-model:dialogState="imageDialog"
v-model:file="profileFileImg"
clearButton
>
<template #error>
<div class="full-height full-width" style="background: white">
<div
class="full-height full-width flex justify-center items-center"
:style="`background: hsla(var(${
productMode === 'group'
? '--pink-6'
: $q.dark.isActive
? '--violet-10'
: '--violet-11'
}-hsl)/0.1)`"
>
<q-icon
size="15rem"
:name="productMode === 'group' ? 'mdi-folder' : 'mdi-folder-table'"
:style="`color: hsla(var(${
productMode === 'group'
? '--pink-6'
: $q.dark.isActive
? '--violet-10'
: '--violet-11'
}-hsl)/1)`"
></q-icon>
</div>
</div>
</template>
</ImageUploadDialog>
</template> </template>
<style scoped> <style scoped>