feat: manage work name & work properties
This commit is contained in:
parent
799d465600
commit
ff4297fb13
4 changed files with 174 additions and 34 deletions
|
|
@ -58,8 +58,8 @@ defineProps<{
|
||||||
|
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
(e: 'addProduct'): void;
|
(e: 'addProduct'): void;
|
||||||
(e: 'deleteWork'): void;
|
(e: 'manageWorkName'): void;
|
||||||
(e: 'deleteProduct'): void;
|
(e: 'workProperties'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
function addWork() {
|
function addWork() {
|
||||||
|
|
@ -116,6 +116,8 @@ function confirmDelete(items: unknown[], index: number) {
|
||||||
@move-product-up="moveItemUp"
|
@move-product-up="moveItemUp"
|
||||||
@move-product-down="moveItemDown"
|
@move-product-down="moveItemDown"
|
||||||
@delete-product="confirmDelete"
|
@delete-product="confirmDelete"
|
||||||
|
@manage-work-name="$emit('manageWorkName')"
|
||||||
|
@work-properties="$emit('workProperties')"
|
||||||
></WorkManagementComponent>
|
></WorkManagementComponent>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,9 @@ defineEmits<{
|
||||||
(e: 'moveProductUp', items: unknown[], index: number): void;
|
(e: 'moveProductUp', items: unknown[], index: number): void;
|
||||||
(e: 'moveProductDown', items: unknown[], index: number): void;
|
(e: 'moveProductDown', items: unknown[], index: number): void;
|
||||||
(e: 'deleteProduct', items: unknown[], index: number): void;
|
(e: 'deleteProduct', items: unknown[], index: number): void;
|
||||||
|
|
||||||
|
(e: 'manageWorkName'): void;
|
||||||
|
(e: 'workProperties'): void;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -61,37 +64,72 @@ defineEmits<{
|
||||||
style="color: hsl(var(--text-mute-2))"
|
style="color: hsl(var(--text-mute-2))"
|
||||||
@click.stop="$emit('moveWorkDown')"
|
@click.stop="$emit('moveWorkDown')"
|
||||||
/>
|
/>
|
||||||
<q-input
|
<div
|
||||||
for="input-work-name"
|
for="input-work-name"
|
||||||
dense
|
class="bordered col rounded q-py-sm q-px-md"
|
||||||
outlined
|
|
||||||
borderless
|
|
||||||
class="col"
|
|
||||||
hide-bottom-space
|
|
||||||
:placeholder="$t('workName')"
|
:placeholder="$t('workName')"
|
||||||
v-model="workName"
|
|
||||||
:input-style="'color: hsl(var(--text-mute-2))'"
|
:input-style="'color: hsl(var(--text-mute-2))'"
|
||||||
style="background-color: var(--surface-1)"
|
style="background-color: var(--surface-1); z-index: 2"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<q-btn
|
||||||
<q-btn
|
dense
|
||||||
dense
|
unelevated
|
||||||
unelevated
|
round
|
||||||
round
|
padding="0"
|
||||||
padding="0"
|
style="background-color: var(--surface-tab)"
|
||||||
style="background-color: var(--surface-tab)"
|
@click.stop="$emit('workProperties')"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
icon="basil:settings-adjust-solid"
|
icon="basil:settings-adjust-solid"
|
||||||
width="24px"
|
width="24px"
|
||||||
style="color: var(--stone-7)"
|
style="color: var(--stone-7)"
|
||||||
/>
|
/>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<span class="text-body2 q-pl-sm" style="color: var(--foreground)">
|
<span class="text-body2 q-pl-sm" style="color: var(--foreground)">
|
||||||
{{ $t('workNo') }} {{ index + 1 }} :
|
{{ $t('workNo') }} {{ index + 1 }} :
|
||||||
</span>
|
<span class="app-text-muted-2">{{ $t('workName') }}</span>
|
||||||
</template>
|
</span>
|
||||||
</q-input>
|
|
||||||
|
<q-menu fit anchor="bottom left" self="top left">
|
||||||
|
<q-item>
|
||||||
|
<div class="full-width flex items-center justify-between">
|
||||||
|
ชื่องาน
|
||||||
|
<q-btn
|
||||||
|
dense
|
||||||
|
unelevated
|
||||||
|
class="bordered q-px-sm"
|
||||||
|
style="
|
||||||
|
border-radius: var(--radius-2);
|
||||||
|
color: hsl(var(--info-bg));
|
||||||
|
"
|
||||||
|
@click.stop="$emit('manageWorkName')"
|
||||||
|
>
|
||||||
|
<q-icon name="mdi-cog" size="xs" class="q-mr-sm" />
|
||||||
|
จัดการ
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable>
|
||||||
|
<div class="full-width flex items-center">
|
||||||
|
<q-icon
|
||||||
|
v-if="false"
|
||||||
|
name="mdi-checkbox-marked"
|
||||||
|
size="xs"
|
||||||
|
color="primary"
|
||||||
|
class="q-mr-sm"
|
||||||
|
/>
|
||||||
|
<q-icon
|
||||||
|
v-else
|
||||||
|
name="mdi-checkbox-blank-outline"
|
||||||
|
size="xs"
|
||||||
|
style="color: hsl(var(--text-mute))"
|
||||||
|
class="q-mr-sm"
|
||||||
|
/>
|
||||||
|
{{ 'asd' }}
|
||||||
|
</div>
|
||||||
|
</q-item>
|
||||||
|
</q-menu>
|
||||||
|
</div>
|
||||||
<q-btn
|
<q-btn
|
||||||
id="btn-delete-work"
|
id="btn-delete-work"
|
||||||
icon="mdi-trash-can-outline"
|
icon="mdi-trash-can-outline"
|
||||||
|
|
|
||||||
74
src/components/04_product-service/WorkNameManagement.vue
Normal file
74
src/components/04_product-service/WorkNameManagement.vue
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
const text = 'demo text';
|
||||||
|
const isEdit = ref(false);
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div class="full-width column no-wrap" style="height: 50vh">
|
||||||
|
<div
|
||||||
|
v-if="true"
|
||||||
|
class="bordered rounded surface-1 flex col column justify-between"
|
||||||
|
>
|
||||||
|
<q-list class="full-width col scroll">
|
||||||
|
<q-item class="items-center row q-px-lg">
|
||||||
|
<q-btn
|
||||||
|
id="btn-delete-work-name"
|
||||||
|
icon="mdi-trash-can-outline"
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="negative"
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
v-if="!isEdit"
|
||||||
|
id="btn-edit-work-name"
|
||||||
|
icon="mdi-pencil-outline"
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
class="q-ml-md"
|
||||||
|
color="primary"
|
||||||
|
@click="isEdit = true"
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
v-else
|
||||||
|
id="btn-edit-work-name"
|
||||||
|
icon="mdi-check"
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
class="q-ml-md"
|
||||||
|
color="primary"
|
||||||
|
@click="isEdit = false"
|
||||||
|
/>
|
||||||
|
<!-- outlined -->
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
:borderless="!isEdit"
|
||||||
|
:readonly="!isEdit"
|
||||||
|
:outlined="isEdit"
|
||||||
|
class="q-ml-xl col"
|
||||||
|
v-model="text"
|
||||||
|
placeholder="ชื่องาน"
|
||||||
|
></q-input>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
|
||||||
|
<div class="bordered-t full-width">
|
||||||
|
<q-item clickable>
|
||||||
|
<span class="q-px-lg flex items-center app-text-muted-2">
|
||||||
|
<q-icon name="mdi-plus" class="q-mr-md" />
|
||||||
|
เพิ่มงานใหม่
|
||||||
|
</span>
|
||||||
|
</q-item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
class="bordered rounded surface-1 flex justify-center items-center col"
|
||||||
|
>
|
||||||
|
<NoData />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
@ -16,6 +16,7 @@ import ProfileUpload from 'src/components/ProfileUpload.vue';
|
||||||
import TotalProductCardComponent from 'components/04_product-service/TotalProductCardComponent.vue';
|
import TotalProductCardComponent from 'components/04_product-service/TotalProductCardComponent.vue';
|
||||||
import FormServiceWork from 'src/components/04_product-service/FormServiceWork.vue';
|
import FormServiceWork from 'src/components/04_product-service/FormServiceWork.vue';
|
||||||
import ServiceProperties from 'src/components/04_product-service/ServiceProperties.vue';
|
import ServiceProperties from 'src/components/04_product-service/ServiceProperties.vue';
|
||||||
|
import WorkNameManagement from 'src/components/04_product-service/WorkNameManagement.vue';
|
||||||
import useOptionStore from 'src/stores/options';
|
import useOptionStore from 'src/stores/options';
|
||||||
|
|
||||||
import { Status } from 'src/stores/types';
|
import { Status } from 'src/stores/types';
|
||||||
|
|
@ -110,8 +111,11 @@ const product = ref<ProductList[]>();
|
||||||
const service = ref<Service[]>();
|
const service = ref<Service[]>();
|
||||||
|
|
||||||
const productAndServiceTab = ref<string>('all');
|
const productAndServiceTab = ref<string>('all');
|
||||||
|
const manageWorkNameDialog = ref<boolean>(false);
|
||||||
const previousValue = ref();
|
const previousValue = ref();
|
||||||
|
|
||||||
|
const propertiesOption = ref();
|
||||||
|
|
||||||
const formDataGroup = ref<ProductGroupCreate>({
|
const formDataGroup = ref<ProductGroupCreate>({
|
||||||
remark: '',
|
remark: '',
|
||||||
detail: '',
|
detail: '',
|
||||||
|
|
@ -528,6 +532,18 @@ async function submitGroup() {
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openPropertiesDialog(type: 'service' | 'work') {
|
||||||
|
if (type === 'service') {
|
||||||
|
propertiesOption.value =
|
||||||
|
optionStore.globalOption.tha.servicePropertiesField;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'work') {
|
||||||
|
propertiesOption.value = optionStore.globalOption.tha.workPropertiesField;
|
||||||
|
}
|
||||||
|
propertiesDialog.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const resStatsGroup = await fetchStatsProductGroup();
|
const resStatsGroup = await fetchStatsProductGroup();
|
||||||
const resStatsType = await fetchStatsProductType();
|
const resStatsType = await fetchStatsProductType();
|
||||||
|
|
@ -1378,12 +1394,14 @@ watch(currentStatus, async () => {
|
||||||
v-if="currentServiceTab === 'serviceInformation'"
|
v-if="currentServiceTab === 'serviceInformation'"
|
||||||
dense
|
dense
|
||||||
service
|
service
|
||||||
@service-properties="propertiesDialog = true"
|
@service-properties="openPropertiesDialog('service')"
|
||||||
/>
|
/>
|
||||||
<FormServiceWork
|
<FormServiceWork
|
||||||
v-if="currentServiceTab === 'workInformation'"
|
v-if="currentServiceTab === 'workInformation'"
|
||||||
dense
|
dense
|
||||||
@addProduct="dialogTotalProduct = true"
|
@addProduct="dialogTotalProduct = true"
|
||||||
|
@manage-work-name="manageWorkNameDialog = true"
|
||||||
|
@work-properties="openPropertiesDialog('work')"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</FormDialog>
|
</FormDialog>
|
||||||
|
|
@ -1394,18 +1412,26 @@ watch(currentStatus, async () => {
|
||||||
no-footer
|
no-footer
|
||||||
no-app-box
|
no-app-box
|
||||||
width="75%"
|
width="75%"
|
||||||
height="1000px"
|
|
||||||
title="Properties"
|
title="Properties"
|
||||||
v-model:modal="propertiesDialog"
|
v-model:modal="propertiesDialog"
|
||||||
>
|
>
|
||||||
<ServiceProperties
|
<ServiceProperties
|
||||||
v-model:properties-option="
|
v-model:properties-option="propertiesOption"
|
||||||
optionStore.globalOption.tha.servicePropertiesField
|
|
||||||
"
|
|
||||||
v-model:form-service-properties="formDataProductService.attributes"
|
v-model:form-service-properties="formDataProductService.attributes"
|
||||||
@add-properties="console.log('')"
|
@add-properties="console.log('')"
|
||||||
/>
|
/>
|
||||||
</FormDialog>
|
</FormDialog>
|
||||||
|
|
||||||
|
<!-- manage work name -->
|
||||||
|
<FormDialog
|
||||||
|
no-address
|
||||||
|
no-app-box
|
||||||
|
width="65%"
|
||||||
|
title="จัดการ"
|
||||||
|
v-model:modal="manageWorkNameDialog"
|
||||||
|
>
|
||||||
|
<WorkNameManagement />
|
||||||
|
</FormDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue