2024-06-10 16:42:59 +07:00
|
|
|
<script setup lang="ts">
|
2024-07-09 11:19:10 +07:00
|
|
|
import { ref, watch, reactive } from 'vue';
|
2024-06-28 14:38:16 +07:00
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
|
import { onMounted } from 'vue';
|
|
|
|
|
import { storeToRefs } from 'pinia';
|
2024-07-09 11:19:10 +07:00
|
|
|
import type { QTableProps } from 'quasar';
|
2024-06-28 14:38:16 +07:00
|
|
|
import ItemCard from 'components/ItemCard.vue';
|
2024-06-10 16:42:59 +07:00
|
|
|
import AppBox from 'components/app/AppBox.vue';
|
2024-06-12 15:37:17 +07:00
|
|
|
import AddButton from 'components/AddButton.vue';
|
2024-06-28 14:14:23 +07:00
|
|
|
import ProductCardComponent from 'components/04_product-service/ProductCardComponent.vue';
|
2024-06-10 16:42:59 +07:00
|
|
|
import StatCard from 'components/StatCardComponent.vue';
|
2024-06-28 14:14:23 +07:00
|
|
|
import DrawerInfo from 'components/DrawerInfo.vue';
|
|
|
|
|
import BasicInformation from 'components/04_product-service/BasicInformation.vue';
|
|
|
|
|
import FormDialog from 'components/FormDialog.vue';
|
2024-06-12 15:37:17 +07:00
|
|
|
import TooltipComponent from 'components/TooltipComponent.vue';
|
2024-06-28 14:14:23 +07:00
|
|
|
import ButtonAddComponent from 'components/ButtonAddCompoent.vue';
|
|
|
|
|
import BasicInfoProduct from 'components/04_product-service/BasicInfoProduct.vue';
|
|
|
|
|
import PriceDataComponent from 'components/04_product-service/PriceDataComponent.vue';
|
|
|
|
|
import ProfileUpload from 'components/ProfileUpload.vue';
|
2024-06-17 17:59:09 +07:00
|
|
|
import TotalProductCardComponent from 'components/04_product-service/TotalProductCardComponent.vue';
|
2024-06-28 14:14:23 +07:00
|
|
|
import FormServiceWork from 'components/04_product-service/FormServiceWork.vue';
|
|
|
|
|
import ServiceProperties from 'components/04_product-service/ServiceProperties.vue';
|
|
|
|
|
import WorkNameManagement from 'components/04_product-service/WorkNameManagement.vue';
|
2024-06-18 11:47:53 +00:00
|
|
|
import useOptionStore from 'src/stores/options';
|
2024-06-28 14:14:23 +07:00
|
|
|
import FormServiceProperties from 'components/04_product-service/FormServiceProperties.vue';
|
|
|
|
|
import InfoForm from 'components/02_personnel-management/InfoForm.vue';
|
2024-06-28 14:38:16 +07:00
|
|
|
import NoData from 'components/NoData.vue';
|
2024-07-01 13:48:48 +07:00
|
|
|
import PaginationComponent from 'src/components/PaginationComponent.vue';
|
2024-06-14 09:31:45 +07:00
|
|
|
|
2024-06-26 17:21:26 +07:00
|
|
|
import useFlowStore from 'src/stores/flow';
|
2024-07-04 11:38:10 +07:00
|
|
|
import useMyBranchStore from 'src/stores/my-branch';
|
|
|
|
|
|
|
|
|
|
const useMyBranch = useMyBranchStore();
|
|
|
|
|
|
|
|
|
|
const { fetchListOptionBranch } = useMyBranch;
|
|
|
|
|
|
2024-06-14 09:31:45 +07:00
|
|
|
import { Status } from 'src/stores/types';
|
2024-06-26 17:21:26 +07:00
|
|
|
|
2024-07-02 09:58:59 +00:00
|
|
|
import useUtilsStore, { dialog, dialogWarningClose } from 'src/stores/utils';
|
2024-06-11 15:04:01 +07:00
|
|
|
|
|
|
|
|
import useProductServiceStore from 'src/stores/product-service';
|
2024-06-14 15:18:59 +07:00
|
|
|
import {
|
|
|
|
|
ProductGroup,
|
|
|
|
|
ProductGroupCreate,
|
2024-06-17 17:59:09 +07:00
|
|
|
ProductCreate,
|
|
|
|
|
ProductList,
|
2024-06-18 14:20:37 +07:00
|
|
|
ServiceCreate,
|
2024-06-18 15:41:30 +07:00
|
|
|
Service,
|
|
|
|
|
ServiceById,
|
2024-06-20 18:02:02 +07:00
|
|
|
WorkItems,
|
|
|
|
|
Attributes,
|
2024-06-25 14:31:08 +07:00
|
|
|
ServiceAndProduct,
|
2024-06-14 15:18:59 +07:00
|
|
|
} from 'src/stores/product-service/types';
|
2024-06-11 15:04:01 +07:00
|
|
|
|
2024-06-28 14:38:16 +07:00
|
|
|
const flowStore = useFlowStore();
|
2024-07-02 09:58:59 +00:00
|
|
|
const utilsStore = useUtilsStore();
|
2024-06-11 15:04:01 +07:00
|
|
|
const productServiceStore = useProductServiceStore();
|
2024-06-18 11:47:53 +00:00
|
|
|
const optionStore = useOptionStore();
|
2024-06-11 15:04:01 +07:00
|
|
|
|
|
|
|
|
const {
|
2024-06-17 17:59:09 +07:00
|
|
|
fetchStatsProductType,
|
2024-06-12 15:37:17 +07:00
|
|
|
createProductServiceType,
|
|
|
|
|
editProductServiceType,
|
|
|
|
|
deleteProductServiceType,
|
|
|
|
|
fetchListProductServiceType,
|
|
|
|
|
|
2024-06-11 15:04:01 +07:00
|
|
|
fetchStatsProductGroup,
|
|
|
|
|
fetchListProductService,
|
|
|
|
|
createProductService,
|
2024-06-11 16:29:00 +07:00
|
|
|
editProductService,
|
2024-06-11 15:46:51 +07:00
|
|
|
deleteProductService,
|
2024-06-17 17:59:09 +07:00
|
|
|
|
2024-06-18 16:26:49 +07:00
|
|
|
fetchStatsProduct,
|
2024-06-17 17:59:09 +07:00
|
|
|
fetchListProduct,
|
|
|
|
|
createProduct,
|
2024-06-19 13:51:45 +07:00
|
|
|
editProduct,
|
|
|
|
|
deleteProduct,
|
2024-06-18 15:41:30 +07:00
|
|
|
|
2024-06-24 09:44:38 +07:00
|
|
|
fetchStatsService,
|
2024-06-18 16:08:50 +07:00
|
|
|
fetchListService,
|
2024-06-18 15:41:30 +07:00
|
|
|
fetchListServiceById,
|
2024-06-18 16:08:50 +07:00
|
|
|
createService,
|
2024-06-18 16:14:50 +07:00
|
|
|
deleteService,
|
2024-06-21 14:50:43 +07:00
|
|
|
editService,
|
2024-06-21 15:59:18 +07:00
|
|
|
|
|
|
|
|
createWork,
|
|
|
|
|
editWork,
|
|
|
|
|
deleteWork,
|
2024-06-25 14:31:08 +07:00
|
|
|
|
|
|
|
|
fetchListProductAndService,
|
2024-06-11 15:04:01 +07:00
|
|
|
} = productServiceStore;
|
|
|
|
|
|
2024-06-21 15:59:18 +07:00
|
|
|
const { workNameItems } = storeToRefs(productServiceStore);
|
|
|
|
|
|
2024-06-10 16:42:59 +07:00
|
|
|
const stat = ref<
|
|
|
|
|
{
|
2024-07-03 14:13:22 +07:00
|
|
|
icon: string;
|
2024-06-10 16:42:59 +07:00
|
|
|
count: number;
|
|
|
|
|
label: string;
|
2024-06-12 15:37:17 +07:00
|
|
|
color: 'pink' | 'purple' | 'green' | 'orange';
|
2024-06-10 16:42:59 +07:00
|
|
|
}[]
|
|
|
|
|
>([
|
2024-07-03 14:13:22 +07:00
|
|
|
{ icon: 'mdi-folder', count: 0, label: 'productAndService', color: 'pink' },
|
|
|
|
|
{
|
2024-07-09 15:23:42 +07:00
|
|
|
icon: 'mdi-folder-table',
|
2024-07-03 14:13:22 +07:00
|
|
|
count: 0,
|
|
|
|
|
label: 'productAndServiceType',
|
|
|
|
|
color: 'purple',
|
|
|
|
|
},
|
2024-07-09 15:23:42 +07:00
|
|
|
{ icon: 'mdi-server-network', count: 0, label: 'service', color: 'orange' },
|
2024-07-03 14:13:22 +07:00
|
|
|
{ icon: 'mdi-folder', count: 0, label: 'product', color: 'green' },
|
2024-06-10 16:42:59 +07:00
|
|
|
]);
|
|
|
|
|
|
2024-06-11 12:01:35 +07:00
|
|
|
const { t } = useI18n();
|
2024-07-03 10:08:51 +00:00
|
|
|
const baseUrl = ref<string>(import.meta.env.VITE_API_BASE_URL);
|
2024-06-11 12:01:35 +07:00
|
|
|
|
2024-06-28 14:38:16 +07:00
|
|
|
const inputSearch = ref('');
|
|
|
|
|
const inputSearchProductAndService = ref('');
|
2024-06-19 18:00:38 +07:00
|
|
|
|
2024-06-28 14:38:16 +07:00
|
|
|
const currentStatusProduct = ref(false);
|
|
|
|
|
const drawerInfo = ref(false);
|
|
|
|
|
const isEdit = ref(false);
|
2024-06-21 14:50:43 +07:00
|
|
|
|
2024-07-09 11:19:10 +07:00
|
|
|
const modeView = ref(false);
|
|
|
|
|
|
2024-06-28 14:38:16 +07:00
|
|
|
const dialogInputForm = ref(false);
|
|
|
|
|
const dialogProduct = ref(false);
|
|
|
|
|
const dialogService = ref(false);
|
|
|
|
|
const dialogProductEdit = ref(false);
|
|
|
|
|
const dialogServiceEdit = ref(false);
|
2024-06-21 14:50:43 +07:00
|
|
|
|
2024-06-28 14:38:16 +07:00
|
|
|
const statusToggle = ref(false);
|
|
|
|
|
const profileSubmit = ref(false);
|
|
|
|
|
const infoProductEdit = ref(false);
|
|
|
|
|
const infoServiceEdit = ref(false);
|
2024-06-19 13:51:45 +07:00
|
|
|
|
2024-06-18 14:00:20 +07:00
|
|
|
const imageProduct = ref<File | undefined>(undefined);
|
2024-06-14 14:45:17 +07:00
|
|
|
const profileUrl = ref<string | null>('');
|
2024-06-11 16:52:35 +07:00
|
|
|
|
2024-06-28 14:38:16 +07:00
|
|
|
const pathGroupName = ref('');
|
|
|
|
|
const pathTypeName = ref('');
|
2024-06-20 18:02:02 +07:00
|
|
|
|
2024-06-28 14:38:16 +07:00
|
|
|
const dialogProductServiceType = ref(false);
|
|
|
|
|
const dialogTotalProduct = ref(false);
|
2024-06-11 15:11:55 +07:00
|
|
|
const productMode = ref<'group' | 'type' | 'service' | 'product'>('group');
|
2024-06-17 17:59:09 +07:00
|
|
|
|
2024-06-14 15:18:59 +07:00
|
|
|
const productGroup = ref<ProductGroup[]>();
|
|
|
|
|
const productType = ref<ProductGroup[]>();
|
2024-06-25 14:31:08 +07:00
|
|
|
const product = ref<(ProductList & { type: 'product' })[]>();
|
2024-06-27 09:41:39 +07:00
|
|
|
const productIsAdd = ref<(ProductList & { type: 'product' })[]>();
|
2024-06-25 14:31:08 +07:00
|
|
|
const service = ref<(Service & { type: 'service' })[]>();
|
2024-06-24 13:07:00 +07:00
|
|
|
const resultSearchProduct = ref<ProductList[]>();
|
2024-06-25 14:31:08 +07:00
|
|
|
const productAndService = ref<ServiceAndProduct[]>([]);
|
2024-06-17 17:59:09 +07:00
|
|
|
|
2024-07-09 11:19:10 +07:00
|
|
|
const productAndServiceTab = ref<'product' | 'service'>('service');
|
2024-06-28 14:38:16 +07:00
|
|
|
const manageWorkNameDialog = ref(false);
|
2024-06-11 16:29:00 +07:00
|
|
|
const previousValue = ref();
|
|
|
|
|
|
2024-06-20 09:10:34 +00:00
|
|
|
const propertiesOption = ref();
|
|
|
|
|
|
2024-06-17 17:59:09 +07:00
|
|
|
const formDataGroup = ref<ProductGroupCreate>({
|
2024-06-11 12:01:35 +07:00
|
|
|
remark: '',
|
|
|
|
|
detail: '',
|
|
|
|
|
name: '',
|
|
|
|
|
code: '',
|
|
|
|
|
});
|
|
|
|
|
|
2024-06-17 17:59:09 +07:00
|
|
|
const formDataProduct = ref<ProductCreate>({
|
2024-07-04 11:38:10 +07:00
|
|
|
registeredBranchId: '',
|
2024-06-17 17:59:09 +07:00
|
|
|
productTypeId: '',
|
|
|
|
|
remark: '',
|
|
|
|
|
serviceCharge: 0,
|
|
|
|
|
agentPrice: 0,
|
|
|
|
|
price: 0,
|
|
|
|
|
process: 0,
|
|
|
|
|
detail: '',
|
|
|
|
|
name: '',
|
|
|
|
|
code: '',
|
2024-06-18 14:00:20 +07:00
|
|
|
image: undefined,
|
2024-06-17 17:59:09 +07:00
|
|
|
});
|
|
|
|
|
|
2024-06-18 14:20:37 +07:00
|
|
|
const formDataProductService = ref<ServiceCreate>({
|
|
|
|
|
work: [],
|
|
|
|
|
attributes: {
|
|
|
|
|
additional: [],
|
|
|
|
|
},
|
|
|
|
|
detail: '',
|
|
|
|
|
name: '',
|
|
|
|
|
code: '',
|
2024-06-25 14:31:08 +07:00
|
|
|
productTypeId: '',
|
2024-07-04 11:38:10 +07:00
|
|
|
registeredBranchId: '',
|
2024-06-18 14:20:37 +07:00
|
|
|
});
|
|
|
|
|
|
2024-06-18 02:01:02 +00:00
|
|
|
const serviceTab = [
|
|
|
|
|
{
|
|
|
|
|
name: 'serviceInformation',
|
|
|
|
|
label: 'serviceInformation',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'workInformation',
|
|
|
|
|
label: 'workInformation',
|
|
|
|
|
},
|
|
|
|
|
];
|
2024-07-05 03:57:43 +00:00
|
|
|
const hideStat = ref(false);
|
2024-06-20 18:02:02 +07:00
|
|
|
|
2024-07-09 11:19:10 +07:00
|
|
|
const tbColumn = {
|
2024-07-09 14:38:22 +07:00
|
|
|
|
|
|
|
|
groupAndType: [
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
name: 'name',
|
|
|
|
|
align:'left',
|
|
|
|
|
label: 'name',
|
|
|
|
|
field: 'name',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'detail',
|
|
|
|
|
align:'left',
|
|
|
|
|
label: 'detail',
|
|
|
|
|
field: 'detail',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'formDialogInputRemark',
|
|
|
|
|
align:'left',
|
|
|
|
|
label: 'formDialogInputRemark',
|
|
|
|
|
field: 'remark',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'createdAt',
|
|
|
|
|
align:'left',
|
|
|
|
|
label: 'createdAt',
|
|
|
|
|
field: 'createdAt',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
2024-07-09 11:19:10 +07:00
|
|
|
product: [
|
|
|
|
|
{ name: 'productName', align: 'left', label: 'productName', field: 'name' },
|
|
|
|
|
{
|
|
|
|
|
name: 'productDetail',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'productDetail',
|
|
|
|
|
field: 'detail',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'productProcessingTime',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'productProcessingTime',
|
|
|
|
|
field: 'process',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'priceInformation',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'priceInformation',
|
|
|
|
|
field: 'name',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
service: [
|
|
|
|
|
{ name: 'serviceName', align: 'left', label: 'serviceName', field: 'name' },
|
|
|
|
|
{
|
|
|
|
|
name: 'serviceDetail',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'serviceDetail',
|
|
|
|
|
field: 'detail',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'serviceWorkTotal',
|
|
|
|
|
align: 'left',
|
|
|
|
|
label: 'serviceWorkTotal',
|
|
|
|
|
field: (v) => v.work.length,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
} satisfies {
|
2024-07-09 14:38:22 +07:00
|
|
|
groupAndType: QTableProps['columns'];
|
2024-07-09 11:19:10 +07:00
|
|
|
product: QTableProps['columns'];
|
|
|
|
|
service: QTableProps['columns'];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const tbControl = reactive({
|
2024-07-09 14:38:22 +07:00
|
|
|
|
|
|
|
|
groupAndType: {
|
|
|
|
|
fieldDisplay: ['name', 'detail', 'formDialogInputRemark', 'createdAt'],
|
|
|
|
|
fieldSelected: ['name', 'detail', 'formDialogInputRemark', 'createdAt'],
|
|
|
|
|
},
|
2024-07-09 11:19:10 +07:00
|
|
|
product: {
|
|
|
|
|
fieldDisplay: [
|
|
|
|
|
'productName',
|
|
|
|
|
'productDetail',
|
|
|
|
|
'productProcessingTime',
|
|
|
|
|
'priceInformation',
|
|
|
|
|
],
|
|
|
|
|
fieldSelected: [
|
|
|
|
|
'productName',
|
|
|
|
|
'productDetail',
|
|
|
|
|
'productProcessingTime',
|
|
|
|
|
'priceInformation',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
service: {
|
|
|
|
|
fieldDisplay: ['serviceName', 'serviceDetail', 'serviceWorkTotal'],
|
|
|
|
|
fieldSelected: ['serviceName', 'serviceDetail', 'serviceWorkTotal'],
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2024-06-20 18:02:02 +07:00
|
|
|
const workItems = ref<WorkItems[]>([]);
|
2024-06-21 11:06:35 +00:00
|
|
|
const workNameRef = ref();
|
2024-06-26 13:11:03 +07:00
|
|
|
const selectProduct = ref<ProductList[]>([]);
|
|
|
|
|
const currentWorkIndex = ref<number>(0);
|
2024-06-20 18:02:02 +07:00
|
|
|
|
2024-06-18 02:01:02 +00:00
|
|
|
const currentServiceTab = ref('serviceInformation');
|
2024-06-18 11:47:53 +00:00
|
|
|
const propertiesDialog = ref<boolean>(false);
|
2024-06-18 02:01:02 +00:00
|
|
|
|
2024-06-25 14:31:08 +07:00
|
|
|
const totalProduct = ref<number>(0);
|
|
|
|
|
const totalService = ref<number>(0);
|
|
|
|
|
const totalProductAndService = ref<number>(0);
|
|
|
|
|
|
2024-06-26 13:11:03 +07:00
|
|
|
// แบ่งหน้า
|
|
|
|
|
const currentPageGroup = ref<number>(1);
|
|
|
|
|
const maxPageGroup = ref<number>(1);
|
2024-06-26 13:12:41 +07:00
|
|
|
const pageSizeGroup = ref<number>(30);
|
2024-06-26 13:11:03 +07:00
|
|
|
const currentPageType = ref<number>(1);
|
|
|
|
|
const maxPageType = ref<number>(1);
|
2024-07-01 10:33:39 +07:00
|
|
|
const pageSizeType = ref<number>(30);
|
2024-06-26 13:39:38 +07:00
|
|
|
const maxPageServiceAndProduct = ref<number>(1);
|
2024-07-02 04:35:04 +00:00
|
|
|
const pageSizeServiceAndProduct = ref<number>(10);
|
2024-07-01 14:20:24 +07:00
|
|
|
const currentPageServiceAndProduct = ref<number>(1);
|
2024-07-01 13:48:48 +07:00
|
|
|
const totalType = ref<number>(0);
|
|
|
|
|
const totalGroup = ref<number>(0);
|
2024-07-01 14:20:24 +07:00
|
|
|
const total = ref<number>(0);
|
2024-06-26 11:26:29 +07:00
|
|
|
|
2024-06-26 13:11:03 +07:00
|
|
|
// เก็บ id ที่เข้ามา
|
2024-06-11 15:46:51 +07:00
|
|
|
const currentId = ref<string>('');
|
2024-06-12 15:37:17 +07:00
|
|
|
const currentIdType = ref<string>('');
|
2024-06-18 16:10:42 +07:00
|
|
|
const currentIdService = ref<string>('');
|
2024-06-19 13:51:45 +07:00
|
|
|
const currentIdProduct = ref<string>('');
|
2024-06-18 16:10:42 +07:00
|
|
|
|
2024-07-04 11:38:10 +07:00
|
|
|
const branchOption = ref<{ id: string; name: string }[]>([]);
|
|
|
|
|
|
2024-06-26 13:11:03 +07:00
|
|
|
const currentStatus = ref<Status | 'All'>('All');
|
|
|
|
|
|
2024-06-14 14:45:17 +07:00
|
|
|
const inputFile = (() => {
|
|
|
|
|
const element = document.createElement('input');
|
|
|
|
|
element.type = 'file';
|
|
|
|
|
element.accept = 'image/*';
|
|
|
|
|
|
|
|
|
|
const reader = new FileReader();
|
|
|
|
|
reader.addEventListener('load', () => {
|
|
|
|
|
if (typeof reader.result === 'string') profileUrl.value = reader.result;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
element.addEventListener('change', () => {
|
2024-06-18 14:00:20 +07:00
|
|
|
imageProduct.value = element.files?.[0];
|
|
|
|
|
if (imageProduct.value) {
|
|
|
|
|
reader.readAsDataURL(imageProduct.value);
|
2024-06-14 14:45:17 +07:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return element;
|
|
|
|
|
})();
|
|
|
|
|
|
2024-06-25 14:51:58 +07:00
|
|
|
async function searchProduct(isAdd: boolean = true) {
|
|
|
|
|
const res = await fetchListProduct({
|
|
|
|
|
query: inputSearchProductAndService.value,
|
|
|
|
|
});
|
2024-06-24 13:07:00 +07:00
|
|
|
|
2024-06-25 14:51:58 +07:00
|
|
|
if (res) {
|
|
|
|
|
if (isAdd) {
|
|
|
|
|
resultSearchProduct.value = res.result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isAdd) {
|
|
|
|
|
product.value = res.result.map((v) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
type: 'product',
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-25 14:51:58 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-25 14:31:08 +07:00
|
|
|
async function featchStatsService() {
|
|
|
|
|
const resStatsService = await fetchStatsService();
|
|
|
|
|
|
|
|
|
|
totalService.value = resStatsService;
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-25 14:31:08 +07:00
|
|
|
}
|
|
|
|
|
|
2024-07-04 11:38:10 +07:00
|
|
|
async function fetchListOfOptionBranch() {
|
|
|
|
|
const res = await fetchListOptionBranch({ pageSize: 999 });
|
|
|
|
|
|
|
|
|
|
if (res) branchOption.value = res.result;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-25 14:31:08 +07:00
|
|
|
async function featchStatsProduct() {
|
|
|
|
|
const resStatsProduct = await fetchStatsProduct({
|
|
|
|
|
productTypeId: currentIdType.value,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
totalProduct.value = resStatsProduct;
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-25 14:31:08 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-12 15:37:17 +07:00
|
|
|
async function fetchListType() {
|
|
|
|
|
const res = await fetchListProductServiceType({
|
2024-06-26 13:11:03 +07:00
|
|
|
page: currentPageType.value,
|
|
|
|
|
pageSize: pageSizeType.value,
|
2024-07-01 09:53:51 +07:00
|
|
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
2024-06-12 15:37:17 +07:00
|
|
|
productGroupId: currentId.value,
|
2024-06-17 17:59:09 +07:00
|
|
|
status:
|
|
|
|
|
currentStatus.value === 'All'
|
|
|
|
|
? undefined
|
|
|
|
|
: currentStatus.value === 'ACTIVE'
|
|
|
|
|
? 'ACTIVE'
|
|
|
|
|
: 'INACTIVE',
|
2024-06-12 15:37:17 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
2024-06-26 13:11:03 +07:00
|
|
|
currentPageType.value = res.page;
|
2024-07-01 13:48:48 +07:00
|
|
|
totalType.value = res.total;
|
2024-06-26 13:11:03 +07:00
|
|
|
maxPageType.value = Math.ceil(res.total / pageSizeType.value);
|
2024-06-26 11:26:29 +07:00
|
|
|
productType.value = res.result;
|
2024-06-12 15:37:17 +07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function fetchListGroups() {
|
2024-06-17 17:59:09 +07:00
|
|
|
const res = await fetchListProductService({
|
2024-06-26 13:11:03 +07:00
|
|
|
page: currentPageGroup.value,
|
|
|
|
|
pageSize: pageSizeGroup.value,
|
2024-07-01 09:53:51 +07:00
|
|
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
2024-06-17 17:59:09 +07:00
|
|
|
status:
|
|
|
|
|
currentStatus.value === 'All'
|
|
|
|
|
? undefined
|
|
|
|
|
: currentStatus.value === 'ACTIVE'
|
|
|
|
|
? 'ACTIVE'
|
|
|
|
|
: 'INACTIVE',
|
|
|
|
|
});
|
2024-06-12 15:37:17 +07:00
|
|
|
|
|
|
|
|
if (res) {
|
2024-06-26 13:11:03 +07:00
|
|
|
currentPageGroup.value = res.page;
|
2024-07-01 13:48:48 +07:00
|
|
|
totalGroup.value = res.total;
|
2024-06-26 13:11:03 +07:00
|
|
|
maxPageGroup.value = Math.ceil(res.total / pageSizeGroup.value);
|
2024-06-26 11:26:29 +07:00
|
|
|
productGroup.value = res.result;
|
2024-06-12 15:37:17 +07:00
|
|
|
}
|
|
|
|
|
}
|
2024-06-11 15:46:51 +07:00
|
|
|
|
2024-06-27 09:41:39 +07:00
|
|
|
async function fetchListOfProductIsAdd(productTypeId: string) {
|
|
|
|
|
const res = await fetchListProduct({
|
|
|
|
|
status:
|
|
|
|
|
currentStatus.value === 'INACTIVE'
|
|
|
|
|
? 'INACTIVE'
|
|
|
|
|
: currentStatus.value === 'ACTIVE'
|
|
|
|
|
? 'ACTIVE'
|
|
|
|
|
: undefined,
|
|
|
|
|
productTypeId,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
productIsAdd.value = res.result.map((v) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
type: 'product',
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-01 10:33:39 +07:00
|
|
|
async function fetchListOfProduct() {
|
2024-06-25 14:31:08 +07:00
|
|
|
const res = await fetchListProduct({
|
2024-07-01 14:20:24 +07:00
|
|
|
page: currentPageServiceAndProduct.value,
|
|
|
|
|
pageSize: pageSizeServiceAndProduct.value,
|
2024-07-01 09:53:51 +07:00
|
|
|
query: !!inputSearchProductAndService.value
|
|
|
|
|
? inputSearchProductAndService.value
|
|
|
|
|
: undefined,
|
2024-06-25 14:31:08 +07:00
|
|
|
status:
|
|
|
|
|
currentStatus.value === 'INACTIVE'
|
|
|
|
|
? 'INACTIVE'
|
|
|
|
|
: currentStatus.value === 'ACTIVE'
|
|
|
|
|
? 'ACTIVE'
|
|
|
|
|
: undefined,
|
2024-07-01 10:33:39 +07:00
|
|
|
productTypeId: currentIdType.value,
|
2024-06-25 14:31:08 +07:00
|
|
|
});
|
2024-06-17 17:59:09 +07:00
|
|
|
|
|
|
|
|
if (res) {
|
2024-07-01 14:20:24 +07:00
|
|
|
total.value = res.total;
|
2024-07-01 10:33:39 +07:00
|
|
|
totalProduct.value = res.total;
|
2024-07-01 14:20:24 +07:00
|
|
|
currentPageServiceAndProduct.value = res.page;
|
|
|
|
|
maxPageServiceAndProduct.value = Math.ceil(
|
|
|
|
|
res.total / pageSizeServiceAndProduct.value,
|
|
|
|
|
);
|
2024-06-26 13:39:38 +07:00
|
|
|
|
2024-06-25 14:31:08 +07:00
|
|
|
product.value = res.result.map((v) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
type: 'product',
|
|
|
|
|
};
|
|
|
|
|
});
|
2024-06-17 17:59:09 +07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-18 16:08:50 +07:00
|
|
|
async function fetchListOfService() {
|
2024-06-25 14:31:08 +07:00
|
|
|
const res = await fetchListService({
|
2024-07-01 14:20:24 +07:00
|
|
|
page: currentPageServiceAndProduct.value,
|
2024-07-01 09:53:51 +07:00
|
|
|
query: !!inputSearchProductAndService.value
|
|
|
|
|
? inputSearchProductAndService.value
|
|
|
|
|
: undefined,
|
2024-07-01 14:20:24 +07:00
|
|
|
pageSize: pageSizeServiceAndProduct.value,
|
2024-06-25 14:31:08 +07:00
|
|
|
status:
|
|
|
|
|
currentStatus.value === 'INACTIVE'
|
|
|
|
|
? 'INACTIVE'
|
|
|
|
|
: currentStatus.value === 'ACTIVE'
|
|
|
|
|
? 'ACTIVE'
|
|
|
|
|
: undefined,
|
|
|
|
|
productTypeId: currentIdType.value,
|
|
|
|
|
});
|
2024-06-18 16:08:50 +07:00
|
|
|
|
|
|
|
|
if (res) {
|
2024-07-01 10:33:39 +07:00
|
|
|
totalService.value = res.total;
|
2024-07-01 14:20:24 +07:00
|
|
|
total.value = res.total;
|
|
|
|
|
currentPageServiceAndProduct.value = res.page;
|
|
|
|
|
maxPageServiceAndProduct.value = Math.ceil(
|
|
|
|
|
res.total / pageSizeServiceAndProduct.value,
|
|
|
|
|
);
|
2024-06-25 14:31:08 +07:00
|
|
|
service.value = res.result.map((v) => {
|
|
|
|
|
return {
|
|
|
|
|
...v,
|
|
|
|
|
type: 'service',
|
|
|
|
|
};
|
|
|
|
|
});
|
2024-06-18 16:08:50 +07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-11 12:01:35 +07:00
|
|
|
async function submitType() {
|
2024-06-12 15:37:17 +07:00
|
|
|
if (drawerInfo.value) {
|
|
|
|
|
await editProductServiceType(currentIdType.value, {
|
2024-06-17 17:59:09 +07:00
|
|
|
...formDataGroup.value,
|
2024-06-12 15:37:17 +07:00
|
|
|
productGroupId: currentId.value,
|
|
|
|
|
});
|
|
|
|
|
drawerInfo.value = false;
|
|
|
|
|
} else {
|
|
|
|
|
dialogInputForm.value = false;
|
2024-06-17 17:59:09 +07:00
|
|
|
const res = await createProductServiceType(
|
|
|
|
|
currentId.value,
|
|
|
|
|
formDataGroup.value,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
stat.value[1].count = stat.value[1].count + 1;
|
|
|
|
|
}
|
2024-06-12 15:37:17 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await fetchListType();
|
2024-06-11 12:01:35 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-11 15:11:55 +07:00
|
|
|
const itemCard = [
|
|
|
|
|
{
|
|
|
|
|
icon: 'mdi:server-network',
|
|
|
|
|
text: 'บริการ',
|
|
|
|
|
color: 'var(--orange-5)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: 'mdi:shopping',
|
|
|
|
|
text: 'สินค้า',
|
|
|
|
|
color: 'var(--green-9)',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2024-06-24 14:29:31 +07:00
|
|
|
async function toggleStatusProduct(id: string, status: Status) {
|
|
|
|
|
await editProduct(id, {
|
|
|
|
|
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
|
|
|
|
|
});
|
|
|
|
|
|
2024-07-08 16:52:00 +07:00
|
|
|
await alternativeFetch();
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-24 14:29:31 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function toggleStatusService(id: string, status: Status) {
|
|
|
|
|
await editService(id, {
|
|
|
|
|
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
|
|
|
|
|
});
|
|
|
|
|
|
2024-07-08 16:52:00 +07:00
|
|
|
await alternativeFetch();
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-24 14:29:31 +07:00
|
|
|
}
|
2024-06-19 18:00:38 +07:00
|
|
|
async function toggleStatusType(id: string, status: Status) {
|
|
|
|
|
await editProductServiceType(id, {
|
|
|
|
|
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await fetchListType();
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-19 18:00:38 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function toggleStatusGroup(id: string, status: Status) {
|
|
|
|
|
await editProductService(id, {
|
|
|
|
|
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await fetchListGroups();
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-19 18:00:38 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-25 14:31:08 +07:00
|
|
|
async function fetchListOfProductAndService() {
|
|
|
|
|
const res = await fetchListProductAndService({
|
2024-06-26 13:39:38 +07:00
|
|
|
page: currentPageServiceAndProduct.value,
|
|
|
|
|
pageSize: pageSizeServiceAndProduct.value,
|
2024-07-01 10:33:39 +07:00
|
|
|
query: !!inputSearchProductAndService.value
|
|
|
|
|
? inputSearchProductAndService.value
|
|
|
|
|
: undefined,
|
2024-06-25 14:31:08 +07:00
|
|
|
status:
|
|
|
|
|
currentStatus.value === 'INACTIVE'
|
|
|
|
|
? 'INACTIVE'
|
|
|
|
|
: currentStatus.value === 'ACTIVE'
|
|
|
|
|
? 'ACTIVE'
|
|
|
|
|
: undefined,
|
|
|
|
|
productTypeId: currentIdType.value,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
if (currentStatus.value === 'All') {
|
|
|
|
|
totalProductAndService.value = res.total;
|
|
|
|
|
}
|
2024-06-26 13:39:38 +07:00
|
|
|
|
2024-07-01 14:20:24 +07:00
|
|
|
total.value = res.total;
|
2024-06-26 13:39:38 +07:00
|
|
|
currentPageServiceAndProduct.value = res.page;
|
|
|
|
|
maxPageServiceAndProduct.value = Math.ceil(
|
|
|
|
|
res.total / pageSizeServiceAndProduct.value,
|
|
|
|
|
);
|
2024-06-25 14:31:08 +07:00
|
|
|
productAndService.value = res.result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-18 16:14:50 +07:00
|
|
|
async function deleteServiceById(serviceId?: string) {
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('deleteConfirmTitle'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('deleteConfirmMessage'),
|
|
|
|
|
action: async () => {
|
2024-06-25 14:31:08 +07:00
|
|
|
const res = await deleteService(serviceId ?? currentIdService.value);
|
2024-06-18 16:14:50 +07:00
|
|
|
|
2024-06-28 15:51:13 +07:00
|
|
|
if (productAndServiceTab.value === 'service') {
|
2024-07-09 11:19:10 +07:00
|
|
|
await fetchListOfService();
|
2024-06-28 15:51:13 +07:00
|
|
|
}
|
2024-06-21 14:50:43 +07:00
|
|
|
|
|
|
|
|
dialogServiceEdit.value = false;
|
2024-06-25 14:31:08 +07:00
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
totalService.value = totalService.value - 1;
|
|
|
|
|
}
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-24 09:44:38 +07:00
|
|
|
calculateStats();
|
2024-06-18 16:14:50 +07:00
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-19 13:51:45 +07:00
|
|
|
async function deleteTypeOfProduct(id?: string) {
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('deleteConfirmTitle'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('deleteConfirmMessage'),
|
|
|
|
|
action: async () => {
|
2024-06-25 14:31:08 +07:00
|
|
|
const res = await deleteProduct(id ?? currentIdProduct.value);
|
2024-06-28 15:51:13 +07:00
|
|
|
|
|
|
|
|
if (productAndServiceTab.value === 'product') {
|
2024-07-01 10:33:39 +07:00
|
|
|
await fetchListOfProduct();
|
2024-06-28 15:51:13 +07:00
|
|
|
}
|
2024-06-19 13:51:45 +07:00
|
|
|
|
|
|
|
|
dialogProductEdit.value = false;
|
|
|
|
|
|
2024-06-25 14:31:08 +07:00
|
|
|
if (res) {
|
|
|
|
|
totalProduct.value = totalProduct.value - 1;
|
|
|
|
|
}
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-24 09:44:38 +07:00
|
|
|
calculateStats();
|
2024-06-19 13:51:45 +07:00
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// type or group
|
2024-06-17 17:59:09 +07:00
|
|
|
async function deleteProductById(productId?: string) {
|
2024-06-11 12:01:35 +07:00
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('deleteConfirmTitle'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('deleteConfirmMessage'),
|
|
|
|
|
action: async () => {
|
2024-06-11 16:52:35 +07:00
|
|
|
if (productMode.value === 'type') {
|
2024-06-11 15:46:51 +07:00
|
|
|
// Product Type
|
2024-06-17 17:59:09 +07:00
|
|
|
await deleteProductServiceType(productId ?? currentIdType.value);
|
2024-06-12 15:37:17 +07:00
|
|
|
await fetchListType();
|
2024-06-17 17:59:09 +07:00
|
|
|
}
|
|
|
|
|
if (productMode.value === 'group') {
|
2024-06-11 15:46:51 +07:00
|
|
|
// Product Group
|
2024-06-17 17:59:09 +07:00
|
|
|
const res = await deleteProductService(productId ?? currentId.value);
|
2024-06-12 15:37:17 +07:00
|
|
|
if (res) {
|
|
|
|
|
}
|
2024-06-11 15:46:51 +07:00
|
|
|
await fetchListGroups();
|
|
|
|
|
}
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-24 09:44:38 +07:00
|
|
|
calculateStats();
|
2024-06-11 12:01:35 +07:00
|
|
|
drawerInfo.value = false;
|
|
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-06-11 15:04:01 +07:00
|
|
|
|
2024-06-11 16:29:00 +07:00
|
|
|
function undoProductGroup() {
|
2024-06-17 17:59:09 +07:00
|
|
|
formDataGroup.value = {
|
2024-06-11 16:29:00 +07:00
|
|
|
remark: previousValue.value.remark,
|
|
|
|
|
detail: previousValue.value.detail,
|
|
|
|
|
name: previousValue.value.name,
|
|
|
|
|
code: previousValue.value.code,
|
|
|
|
|
};
|
|
|
|
|
isEdit.value = false;
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-11 16:29:00 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-17 17:59:09 +07:00
|
|
|
function assignFormDataGroup(data: ProductGroup) {
|
2024-06-11 16:29:00 +07:00
|
|
|
previousValue.value = data;
|
|
|
|
|
|
2024-06-17 17:59:09 +07:00
|
|
|
formDataGroup.value = {
|
|
|
|
|
remark: data.remark,
|
|
|
|
|
detail: data.detail,
|
|
|
|
|
name: data.name,
|
|
|
|
|
code: data.code,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 16:53:33 +07:00
|
|
|
const prevService = ref<ServiceCreate>({
|
|
|
|
|
work: [],
|
|
|
|
|
attributes: {
|
|
|
|
|
additional: [],
|
|
|
|
|
},
|
|
|
|
|
detail: '',
|
|
|
|
|
name: '',
|
|
|
|
|
code: '',
|
2024-06-25 14:31:08 +07:00
|
|
|
productTypeId: '',
|
2024-07-04 11:38:10 +07:00
|
|
|
registeredBranchId: '',
|
2024-06-24 16:53:33 +07:00
|
|
|
});
|
|
|
|
|
|
2024-06-26 17:44:13 +07:00
|
|
|
const currentService = ref<ServiceById>();
|
|
|
|
|
|
2024-06-18 15:41:30 +07:00
|
|
|
async function assignFormDataProductService(id: string) {
|
|
|
|
|
const res = await fetchListServiceById(id);
|
|
|
|
|
|
|
|
|
|
if (res) {
|
2024-06-24 16:53:33 +07:00
|
|
|
statusToggle.value = res.status === 'INACTIVE' ? false : true;
|
2024-07-01 11:04:24 +00:00
|
|
|
profileUrl.value = res.imageUrl;
|
|
|
|
|
profileSubmit.value = true;
|
|
|
|
|
|
2024-06-26 17:44:13 +07:00
|
|
|
currentService.value = JSON.parse(JSON.stringify(res));
|
2024-06-24 16:53:33 +07:00
|
|
|
|
|
|
|
|
prevService.value = {
|
2024-06-18 15:41:30 +07:00
|
|
|
code: res.code,
|
|
|
|
|
name: res.name,
|
|
|
|
|
detail: res.detail,
|
|
|
|
|
attributes: res.attributes,
|
|
|
|
|
work: [],
|
2024-06-24 16:25:33 +07:00
|
|
|
status: res.status,
|
2024-06-25 14:31:08 +07:00
|
|
|
productTypeId: res.productTypeId,
|
2024-07-04 11:38:10 +07:00
|
|
|
registeredBranchId: res.registeredBranchId,
|
2024-06-18 15:41:30 +07:00
|
|
|
};
|
|
|
|
|
|
2024-06-24 16:53:33 +07:00
|
|
|
formDataProductService.value = { ...prevService.value };
|
|
|
|
|
|
2024-06-18 15:41:30 +07:00
|
|
|
res.work.forEach((item) => {
|
2024-06-24 16:53:33 +07:00
|
|
|
prevService.value.work.push({
|
2024-06-18 15:41:30 +07:00
|
|
|
name: item.name,
|
|
|
|
|
attributes: item.attributes,
|
|
|
|
|
productId: item.productOnWork.map(
|
|
|
|
|
(productOnWorkItem) => productOnWorkItem.product.id,
|
|
|
|
|
),
|
|
|
|
|
});
|
|
|
|
|
});
|
2024-06-21 14:50:43 +07:00
|
|
|
|
2024-06-24 16:53:33 +07:00
|
|
|
formDataProductService.value.work = prevService.value.work;
|
|
|
|
|
|
2024-06-21 14:50:43 +07:00
|
|
|
workItems.value = res.work.map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id,
|
|
|
|
|
name: item.name,
|
|
|
|
|
attributes: item.attributes,
|
|
|
|
|
product: item.productOnWork.map((productOnWorkItem) => {
|
|
|
|
|
return {
|
|
|
|
|
...productOnWorkItem.product,
|
2024-06-26 17:44:13 +07:00
|
|
|
nameEn: productOnWorkItem.product.name,
|
2024-06-21 14:50:43 +07:00
|
|
|
};
|
|
|
|
|
}),
|
|
|
|
|
};
|
|
|
|
|
});
|
2024-06-18 15:41:30 +07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-25 14:58:56 +07:00
|
|
|
const prevProduct = ref<ProductCreate>({
|
|
|
|
|
productTypeId: '',
|
|
|
|
|
remark: '',
|
|
|
|
|
serviceCharge: 0,
|
|
|
|
|
agentPrice: 0,
|
|
|
|
|
price: 0,
|
|
|
|
|
process: 0,
|
|
|
|
|
detail: '',
|
|
|
|
|
name: '',
|
|
|
|
|
code: '',
|
|
|
|
|
image: undefined,
|
2024-07-04 11:38:10 +07:00
|
|
|
registeredBranchId: '',
|
2024-06-25 14:58:56 +07:00
|
|
|
});
|
|
|
|
|
|
2024-06-17 17:59:09 +07:00
|
|
|
function assignFormDataProduct(data: ProductList) {
|
2024-06-20 13:59:25 +07:00
|
|
|
statusToggle.value = data.status === 'INACTIVE' ? false : true;
|
2024-07-03 10:08:51 +00:00
|
|
|
profileUrl.value = `${baseUrl.value}/product/${data?.id}/image`;
|
|
|
|
|
profileSubmit.value = true;
|
2024-06-20 13:59:25 +07:00
|
|
|
|
2024-06-25 14:58:56 +07:00
|
|
|
prevProduct.value = {
|
2024-06-17 17:59:09 +07:00
|
|
|
productTypeId: data.productTypeId,
|
2024-06-11 16:29:00 +07:00
|
|
|
remark: data.remark,
|
2024-06-17 17:59:09 +07:00
|
|
|
serviceCharge: data.serviceCharge,
|
|
|
|
|
agentPrice: data.agentPrice,
|
|
|
|
|
price: data.price,
|
|
|
|
|
process: data.process,
|
2024-06-20 13:21:50 +07:00
|
|
|
detail: data.detail === '' ? '-' : data.detail,
|
2024-06-11 16:29:00 +07:00
|
|
|
name: data.name,
|
|
|
|
|
code: data.code,
|
2024-06-18 14:00:20 +07:00
|
|
|
image: undefined,
|
2024-07-04 11:38:10 +07:00
|
|
|
registeredBranchId: data.registeredBranchId,
|
2024-06-11 16:29:00 +07:00
|
|
|
};
|
2024-06-25 14:58:56 +07:00
|
|
|
|
|
|
|
|
formDataProduct.value = { ...prevProduct.value };
|
2024-06-11 16:29:00 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-17 17:59:09 +07:00
|
|
|
function clearFormGroup() {
|
|
|
|
|
formDataGroup.value = {
|
2024-06-11 15:04:01 +07:00
|
|
|
remark: '',
|
|
|
|
|
detail: '',
|
|
|
|
|
name: '',
|
|
|
|
|
code: '',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dialogInputForm.value = false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-17 17:59:09 +07:00
|
|
|
function clearFormProduct() {
|
|
|
|
|
formDataProduct.value = {
|
|
|
|
|
productTypeId: '',
|
|
|
|
|
remark: '',
|
|
|
|
|
serviceCharge: 0,
|
|
|
|
|
agentPrice: 0,
|
|
|
|
|
price: 0,
|
|
|
|
|
process: 0,
|
|
|
|
|
detail: '',
|
|
|
|
|
name: '',
|
|
|
|
|
code: '',
|
2024-06-18 14:00:20 +07:00
|
|
|
image: undefined,
|
2024-07-04 11:38:10 +07:00
|
|
|
registeredBranchId: '',
|
2024-06-17 17:59:09 +07:00
|
|
|
};
|
2024-07-01 11:04:24 +00:00
|
|
|
imageProduct.value = undefined;
|
2024-06-17 17:59:09 +07:00
|
|
|
dialogProduct.value = false;
|
2024-06-19 13:51:45 +07:00
|
|
|
dialogProductEdit.value = false;
|
2024-07-01 08:52:56 +00:00
|
|
|
profileUrl.value = '';
|
|
|
|
|
profileSubmit.value = false;
|
2024-06-17 17:59:09 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-18 16:08:50 +07:00
|
|
|
function clearFormService() {
|
|
|
|
|
formDataProductService.value = {
|
|
|
|
|
code: '',
|
|
|
|
|
name: '',
|
|
|
|
|
detail: '',
|
|
|
|
|
attributes: {
|
|
|
|
|
additional: [],
|
|
|
|
|
},
|
|
|
|
|
work: [],
|
2024-06-24 16:25:33 +07:00
|
|
|
status: undefined,
|
2024-06-25 14:31:08 +07:00
|
|
|
productTypeId: '',
|
2024-07-04 11:38:10 +07:00
|
|
|
registeredBranchId: '',
|
2024-06-18 16:08:50 +07:00
|
|
|
};
|
2024-06-21 11:40:18 +07:00
|
|
|
|
2024-06-21 14:50:43 +07:00
|
|
|
workItems.value = [];
|
2024-06-21 11:40:18 +07:00
|
|
|
selectProduct.value = [];
|
2024-06-18 16:08:50 +07:00
|
|
|
dialogService.value = false;
|
2024-06-21 14:50:43 +07:00
|
|
|
dialogServiceEdit.value = false;
|
2024-07-01 08:52:56 +00:00
|
|
|
profileUrl.value = '';
|
|
|
|
|
profileSubmit.value = false;
|
2024-07-01 11:04:24 +00:00
|
|
|
imageProduct.value = undefined;
|
2024-06-18 16:08:50 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-21 11:40:18 +07:00
|
|
|
function assignFormDataProductServiceCreate() {
|
2024-06-21 14:50:43 +07:00
|
|
|
formDataProductService.value.work = [];
|
|
|
|
|
|
2024-06-21 11:40:18 +07:00
|
|
|
workItems.value.forEach((item) => {
|
|
|
|
|
formDataProductService.value.work.push({
|
|
|
|
|
name: item.name,
|
|
|
|
|
attributes: item.attributes,
|
|
|
|
|
productId: item.product.map((productItem) => productItem.id),
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-18 16:08:50 +07:00
|
|
|
async function submitService() {
|
2024-06-21 11:40:18 +07:00
|
|
|
assignFormDataProductServiceCreate();
|
2024-06-21 14:50:43 +07:00
|
|
|
formDataProductService.value.image = imageProduct.value;
|
2024-06-25 14:31:08 +07:00
|
|
|
formDataProductService.value.productTypeId = currentIdType.value;
|
2024-06-21 14:50:43 +07:00
|
|
|
|
|
|
|
|
if (dialogService.value) {
|
2024-07-03 10:08:51 +00:00
|
|
|
formDataProductService.value.productTypeId = currentIdType.value;
|
2024-07-04 13:28:28 +07:00
|
|
|
|
|
|
|
|
if (formDataProductService.value.registeredBranchId === '') {
|
|
|
|
|
formDataProductService.value.registeredBranchId = null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-26 14:21:14 +07:00
|
|
|
await createService(formDataProductService.value);
|
|
|
|
|
totalService.value = totalService.value + 1;
|
2024-06-21 14:50:43 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dialogServiceEdit.value) {
|
2024-06-26 14:21:14 +07:00
|
|
|
await editService(currentIdService.value, {
|
2024-06-21 14:50:43 +07:00
|
|
|
...formDataProductService.value,
|
2024-06-24 16:53:33 +07:00
|
|
|
status: statusToggle.value
|
|
|
|
|
? formDataProductService.value.status
|
|
|
|
|
: 'INACTIVE',
|
2024-06-21 14:50:43 +07:00
|
|
|
});
|
2024-06-18 16:08:50 +07:00
|
|
|
}
|
2024-06-26 14:21:14 +07:00
|
|
|
|
|
|
|
|
if (productAndServiceTab.value === 'service') {
|
|
|
|
|
await fetchListOfService();
|
|
|
|
|
}
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-18 16:08:50 +07:00
|
|
|
clearFormService();
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-17 17:59:09 +07:00
|
|
|
async function submitProduct() {
|
|
|
|
|
formDataProduct.value.productTypeId = currentIdType.value;
|
2024-06-18 14:00:20 +07:00
|
|
|
if (profileSubmit.value) {
|
|
|
|
|
formDataProduct.value.image = imageProduct.value;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-19 13:51:45 +07:00
|
|
|
if (dialogProduct.value) {
|
|
|
|
|
const res = await createProduct(formDataProduct.value);
|
2024-06-18 16:26:49 +07:00
|
|
|
|
2024-06-19 13:51:45 +07:00
|
|
|
if (res) {
|
|
|
|
|
stat.value[3].count = stat.value[3].count + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dialogProductEdit.value) {
|
2024-06-20 13:59:25 +07:00
|
|
|
await editProduct(currentIdProduct.value, {
|
|
|
|
|
...formDataProduct.value,
|
|
|
|
|
status: statusToggle.value ? 'ACTIVE' : 'INACTIVE',
|
|
|
|
|
});
|
2024-06-18 16:26:49 +07:00
|
|
|
}
|
2024-06-25 14:31:08 +07:00
|
|
|
totalProduct.value = totalProduct.value + 1;
|
2024-06-18 16:32:17 +07:00
|
|
|
clearFormProduct();
|
2024-06-26 14:21:14 +07:00
|
|
|
|
|
|
|
|
if (productAndServiceTab.value === 'product') {
|
2024-07-01 10:33:39 +07:00
|
|
|
await fetchListOfProduct();
|
2024-06-26 14:21:14 +07:00
|
|
|
}
|
2024-06-26 17:21:26 +07:00
|
|
|
|
|
|
|
|
flowStore.rotate();
|
2024-06-17 17:59:09 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-11 15:04:01 +07:00
|
|
|
async function submitGroup() {
|
2024-06-11 16:29:00 +07:00
|
|
|
if (drawerInfo.value) {
|
2024-06-17 17:59:09 +07:00
|
|
|
await editProductService(currentId.value, formDataGroup.value);
|
2024-06-11 16:29:00 +07:00
|
|
|
} else {
|
2024-06-17 17:59:09 +07:00
|
|
|
const res = await createProductService(formDataGroup.value);
|
2024-06-12 15:37:17 +07:00
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
stat.value[0].count = stat.value[0].count + 1;
|
|
|
|
|
}
|
2024-06-11 16:29:00 +07:00
|
|
|
}
|
2024-06-11 15:04:01 +07:00
|
|
|
|
2024-06-14 09:31:45 +07:00
|
|
|
drawerInfo.value = false;
|
2024-06-11 15:46:51 +07:00
|
|
|
await fetchListGroups();
|
2024-06-17 17:59:09 +07:00
|
|
|
clearFormGroup();
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-11 15:04:01 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-21 11:06:35 +00:00
|
|
|
function confirmDeleteWork(id: string) {
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('deleteConfirmTitle'),
|
|
|
|
|
actionText: t('delete'),
|
|
|
|
|
message: t('deleteConfirmMessage'),
|
|
|
|
|
action: async () => {
|
|
|
|
|
deleteWork(id);
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-21 11:06:35 +00:00
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 09:01:44 +00:00
|
|
|
function triggerConfirmCloseWork() {
|
|
|
|
|
const isWorkNameEdit =
|
|
|
|
|
workNameRef.value && workNameRef.value.isWorkNameEdit
|
|
|
|
|
? workNameRef.value.isWorkNameEdit()
|
|
|
|
|
: false;
|
|
|
|
|
if (isWorkNameEdit) {
|
|
|
|
|
dialogWarningClose(t, {
|
|
|
|
|
action: () => {
|
|
|
|
|
manageWorkNameDialog.value = false;
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
manageWorkNameDialog.value = false;
|
|
|
|
|
}
|
2024-06-21 11:06:35 +00:00
|
|
|
}
|
|
|
|
|
|
2024-06-20 18:02:02 +07:00
|
|
|
const tempValueProperties = ref<Attributes>({
|
|
|
|
|
additional: [],
|
|
|
|
|
});
|
|
|
|
|
const currentPropertiesMode = ref<'service' | 'work'>('service');
|
|
|
|
|
|
2024-06-20 09:10:34 +00:00
|
|
|
function openPropertiesDialog(type: 'service' | 'work') {
|
|
|
|
|
if (type === 'service') {
|
2024-06-24 07:21:36 +00:00
|
|
|
propertiesOption.value = optionStore.globalOption.servicePropertiesField;
|
2024-06-20 09:10:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type === 'work') {
|
2024-06-24 07:21:36 +00:00
|
|
|
propertiesOption.value = optionStore.globalOption.workPropertiesField;
|
2024-06-20 09:10:34 +00:00
|
|
|
}
|
2024-06-20 18:02:02 +07:00
|
|
|
|
|
|
|
|
currentPropertiesMode.value = type;
|
2024-06-20 09:10:34 +00:00
|
|
|
propertiesDialog.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 09:44:38 +07:00
|
|
|
async function calculateStats() {
|
2024-06-12 15:37:17 +07:00
|
|
|
const resStatsGroup = await fetchStatsProductGroup();
|
2024-06-17 17:59:09 +07:00
|
|
|
const resStatsType = await fetchStatsProductType();
|
2024-06-24 09:44:38 +07:00
|
|
|
const resStatsService = await fetchStatsService();
|
2024-06-18 16:26:49 +07:00
|
|
|
const resStatsProduct = await fetchStatsProduct();
|
|
|
|
|
|
2024-06-12 15:37:17 +07:00
|
|
|
stat.value[0].count = resStatsGroup ?? 0;
|
2024-06-17 17:59:09 +07:00
|
|
|
stat.value[1].count = resStatsType ?? 0;
|
2024-06-24 09:44:38 +07:00
|
|
|
stat.value[2].count = resStatsService ?? 0;
|
2024-06-18 16:26:49 +07:00
|
|
|
stat.value[3].count = resStatsProduct ?? 0;
|
2024-06-24 09:44:38 +07:00
|
|
|
}
|
2024-06-12 15:37:17 +07:00
|
|
|
|
2024-06-25 14:31:08 +07:00
|
|
|
async function fetchStatus() {
|
|
|
|
|
if (productAndServiceTab.value === 'product') {
|
2024-07-01 10:33:39 +07:00
|
|
|
await fetchListOfProduct();
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-25 14:31:08 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (productAndServiceTab.value === 'service') {
|
|
|
|
|
await fetchListOfService();
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-25 14:31:08 +07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-01 14:20:24 +07:00
|
|
|
async function alternativeFetch() {
|
|
|
|
|
if (productAndServiceTab.value === 'product') {
|
|
|
|
|
await fetchListOfProduct();
|
|
|
|
|
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
if (productAndServiceTab.value === 'service') {
|
|
|
|
|
await fetchListOfService();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-26 17:44:13 +07:00
|
|
|
function cloneData() {
|
|
|
|
|
if (!currentService.value) return;
|
|
|
|
|
formDataProductService.value = {
|
|
|
|
|
...prevService.value,
|
|
|
|
|
attributes: JSON.parse(JSON.stringify(currentService.value.attributes)),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
workItems.value = currentService.value.work.map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
id: item.id,
|
|
|
|
|
name: item.name,
|
|
|
|
|
attributes: JSON.parse(JSON.stringify(item.attributes)),
|
|
|
|
|
product: item.productOnWork.map((productOnWorkItem) => {
|
|
|
|
|
return {
|
|
|
|
|
...productOnWorkItem.product,
|
|
|
|
|
nameEn: productOnWorkItem.product.name,
|
|
|
|
|
};
|
|
|
|
|
}),
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 09:44:38 +07:00
|
|
|
onMounted(async () => {
|
2024-07-02 09:58:59 +00:00
|
|
|
utilsStore.currentTitle.title = 'mainProductTitle';
|
2024-07-08 14:08:57 +07:00
|
|
|
utilsStore.currentTitle.path = [{ text: 'mainProductCaption' }];
|
2024-07-02 09:58:59 +00:00
|
|
|
|
2024-06-24 09:44:38 +07:00
|
|
|
calculateStats();
|
2024-06-11 15:46:51 +07:00
|
|
|
await fetchListGroups();
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-11 15:04:01 +07:00
|
|
|
});
|
2024-06-13 11:31:21 +07:00
|
|
|
|
2024-06-24 13:07:00 +07:00
|
|
|
watch(productMode, () => {
|
|
|
|
|
inputSearch.value = '';
|
|
|
|
|
currentStatus.value = 'All';
|
2024-07-08 16:29:37 +07:00
|
|
|
const tmp: typeof utilsStore.currentTitle.path = [];
|
|
|
|
|
|
|
|
|
|
if (productMode.value === 'type' || productMode.value === 'service') {
|
|
|
|
|
tmp.push({
|
|
|
|
|
text: 'productGroup',
|
|
|
|
|
argsi18n: { name: pathGroupName.value },
|
|
|
|
|
handler: () => {
|
|
|
|
|
productMode.value = 'type';
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (productMode.value === 'service') {
|
|
|
|
|
tmp.push({ text: 'productType', argsi18n: { name: pathTypeName.value } });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
utilsStore.currentTitle.path = tmp;
|
2024-06-24 13:07:00 +07:00
|
|
|
});
|
2024-06-14 09:31:45 +07:00
|
|
|
|
2024-06-14 13:37:11 +07:00
|
|
|
watch(currentStatus, async () => {
|
2024-06-17 17:59:09 +07:00
|
|
|
if (productMode.value === 'group') {
|
|
|
|
|
await fetchListGroups();
|
|
|
|
|
} else {
|
|
|
|
|
await fetchListType();
|
|
|
|
|
}
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-14 13:37:11 +07:00
|
|
|
});
|
2024-06-26 13:11:03 +07:00
|
|
|
|
2024-07-01 09:53:51 +07:00
|
|
|
watch(inputSearch, async () => {
|
|
|
|
|
if (productMode.value === 'group') {
|
|
|
|
|
await fetchListGroups();
|
2024-07-01 10:33:39 +07:00
|
|
|
flowStore.rotate();
|
2024-07-01 09:53:51 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (productMode.value === 'type') {
|
|
|
|
|
await fetchListType();
|
2024-07-01 10:33:39 +07:00
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
watch(inputSearchProductAndService, async () => {
|
2024-07-01 14:20:24 +07:00
|
|
|
await alternativeFetch();
|
2024-07-01 09:53:51 +07:00
|
|
|
});
|
2024-06-10 16:42:59 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-06-14 09:31:45 +07:00
|
|
|
<ButtonAddComponent style="z-index: 999">
|
|
|
|
|
<q-fab-action
|
|
|
|
|
v-if="productMode === 'group'"
|
2024-06-14 13:37:11 +07:00
|
|
|
id="btn-add-product-group"
|
2024-06-14 09:31:45 +07:00
|
|
|
style="color: white; background-color: hsla(var(--pink-6-hsl))"
|
|
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-folder-multiple-plus"
|
|
|
|
|
:label="$t('productAndService')"
|
|
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
2024-06-17 17:59:09 +07:00
|
|
|
clearFormGroup();
|
2024-06-14 09:31:45 +07:00
|
|
|
dialogInputForm = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
<q-fab-action
|
|
|
|
|
v-if="productMode === 'type'"
|
2024-06-14 13:37:11 +07:00
|
|
|
id="btn-add-product-type"
|
2024-06-14 09:31:45 +07:00
|
|
|
:label="$t('productAndServiceType')"
|
|
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
|
|
|
|
style="color: white; background-color: hsla(var(--purple-11-hsl))"
|
|
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-folder-multiple-plus"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
2024-06-17 17:59:09 +07:00
|
|
|
clearFormGroup();
|
2024-06-14 09:31:45 +07:00
|
|
|
dialogInputForm = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
></q-fab-action>
|
2024-06-14 14:45:17 +07:00
|
|
|
<q-fab-action
|
|
|
|
|
v-if="productMode === 'service'"
|
2024-06-19 13:51:45 +07:00
|
|
|
:label="$t('buttonAddProduct')"
|
2024-06-14 14:45:17 +07:00
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
|
|
|
|
style="color: white; background-color: hsla(var(--green-11-hsl))"
|
|
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-folder-multiple-plus"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
2024-06-20 13:21:50 +07:00
|
|
|
clearFormProduct();
|
2024-07-04 11:38:10 +07:00
|
|
|
fetchListOfOptionBranch();
|
2024-06-14 14:45:17 +07:00
|
|
|
dialogProduct = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
></q-fab-action>
|
|
|
|
|
<q-fab-action
|
|
|
|
|
v-if="productMode === 'service'"
|
2024-06-18 02:01:02 +00:00
|
|
|
:label="$t('addService')"
|
2024-06-14 14:45:17 +07:00
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
2024-06-26 14:21:14 +07:00
|
|
|
style="color: white; background-color: hsla(var(--orange-6-hsl))"
|
2024-06-14 14:45:17 +07:00
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-folder-multiple-plus"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
2024-06-17 17:59:09 +07:00
|
|
|
clearFormGroup();
|
2024-07-01 08:52:56 +00:00
|
|
|
clearFormService();
|
2024-07-04 11:38:10 +07:00
|
|
|
fetchListOfOptionBranch();
|
2024-06-18 02:01:02 +00:00
|
|
|
currentServiceTab = 'serviceInformation';
|
|
|
|
|
dialogService = true;
|
2024-06-14 14:45:17 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
></q-fab-action>
|
2024-06-14 09:31:45 +07:00
|
|
|
</ButtonAddComponent>
|
|
|
|
|
|
2024-07-02 09:58:59 +00:00
|
|
|
<div class="column full-height no-wrap">
|
2024-07-04 04:12:10 +00:00
|
|
|
<div
|
2024-06-17 17:59:09 +07:00
|
|
|
v-if="stat[0].count === 0"
|
2024-07-04 04:12:10 +00:00
|
|
|
class="column col bordered rounded q-pa-md"
|
2024-06-12 15:37:17 +07:00
|
|
|
:no-padding="productGroup?.length !== 0"
|
2024-06-11 16:52:35 +07:00
|
|
|
>
|
2024-06-13 11:03:56 +07:00
|
|
|
<TooltipComponent
|
|
|
|
|
class="self-end"
|
|
|
|
|
title="messageTooltipNoProduct"
|
|
|
|
|
caption="messageTooltipProductCreate"
|
|
|
|
|
imgSrc="personnel-table-"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<div class="row items-center justify-center" style="flex-grow: 1">
|
|
|
|
|
<AddButton
|
|
|
|
|
label="productCreate"
|
|
|
|
|
@trigger="() => (dialogInputForm = true)"
|
2024-06-12 15:37:17 +07:00
|
|
|
/>
|
2024-06-13 11:03:56 +07:00
|
|
|
</div>
|
2024-07-04 04:12:10 +00:00
|
|
|
</div>
|
2024-06-12 15:37:17 +07:00
|
|
|
|
2024-07-02 09:58:59 +00:00
|
|
|
<div v-if="stat[0].count !== 0" class="column full-height no-wrap">
|
2024-07-09 11:19:10 +07:00
|
|
|
<div class="text-body-2 q-mb-xs flex items-center">
|
2024-07-05 06:13:55 +00:00
|
|
|
{{ $t('dataSum') }}
|
|
|
|
|
<q-btn
|
|
|
|
|
class="q-ml-xs"
|
|
|
|
|
icon="mdi-pin"
|
|
|
|
|
color="primary"
|
|
|
|
|
size="sm"
|
|
|
|
|
flat
|
|
|
|
|
dense
|
|
|
|
|
rounded
|
|
|
|
|
@click="hideStat = !hideStat"
|
|
|
|
|
:style="hideStat ? 'rotate: 90deg' : ''"
|
|
|
|
|
style="transition: 0.1s ease-in-out"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-07-09 11:19:10 +07:00
|
|
|
<transition name="slide">
|
|
|
|
|
<div v-if="!hideStat" class="scroll q-mb-md">
|
2024-07-05 06:13:55 +00:00
|
|
|
<div style="display: inline-block">
|
|
|
|
|
<StatCard
|
|
|
|
|
label-i18n
|
|
|
|
|
:branch="stat"
|
|
|
|
|
:dark="$q.dark.isActive"
|
|
|
|
|
nowrap
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
|
|
<!-- group/type -->
|
2024-07-04 04:14:41 +00:00
|
|
|
<div
|
2024-06-12 15:37:17 +07:00
|
|
|
v-if="productMode === 'group' || productMode === 'type'"
|
2024-07-09 14:38:22 +07:00
|
|
|
class="surface-2 col bordered rounded column no-wrap"
|
2024-06-12 15:37:17 +07:00
|
|
|
>
|
2024-07-09 14:38:22 +07:00
|
|
|
<div class="row q-px-md q-py-sm items-center">
|
2024-06-12 15:37:17 +07:00
|
|
|
<div
|
|
|
|
|
v-if="productMode === 'group' || productMode === 'type'"
|
2024-07-09 14:38:22 +07:00
|
|
|
class="row full-width justify-between"
|
2024-06-12 15:37:17 +07:00
|
|
|
>
|
|
|
|
|
<q-input
|
|
|
|
|
style="width: 300px"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
2024-07-09 14:38:22 +07:00
|
|
|
unelavated
|
2024-06-12 15:37:17 +07:00
|
|
|
:label="$t('search')"
|
2024-07-09 14:38:22 +07:00
|
|
|
class="q-mr-md"
|
2024-06-12 15:37:17 +07:00
|
|
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
|
|
|
|
v-model="inputSearch"
|
2024-07-09 14:38:22 +07:00
|
|
|
debounce="250"
|
2024-06-12 15:37:17 +07:00
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="mdi-magnify" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
2024-07-09 14:38:22 +07:00
|
|
|
|
|
|
|
|
<div class="row" style="gap: var(--size-2)">
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-tune-vertical-variant"
|
|
|
|
|
size="sm"
|
|
|
|
|
:color="$q.dark.isActive ? 'dark' : 'white'"
|
|
|
|
|
:text-color="$q.dark.isActive ? 'white' : 'dark'"
|
|
|
|
|
class="bordered rounded"
|
|
|
|
|
unelevated
|
|
|
|
|
>
|
|
|
|
|
<q-menu class="bordered">
|
|
|
|
|
<q-list v-close-popup dense>
|
|
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
|
|
|
|
currentStatus = 'All';
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('all') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
|
|
|
|
currentStatus = 'ACTIVE';
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('statusACTIVE') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
|
|
|
|
currentStatus = 'INACTIVE';
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('statusINACTIVE') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
|
|
|
|
|
|
|
|
|
<q-select
|
|
|
|
|
v-if="modeView === false"
|
|
|
|
|
id="select-field"
|
|
|
|
|
for="select-field"
|
|
|
|
|
:options=" tbControl.groupAndType.fieldDisplay.map(x => ({ label: $t(x), value: x })) "
|
|
|
|
|
:display-value="$t('displayField')"
|
|
|
|
|
v-model="tbControl.groupAndType.fieldSelected"
|
|
|
|
|
option-label="label"
|
|
|
|
|
option-value="value"
|
|
|
|
|
map-options
|
|
|
|
|
emit-value
|
|
|
|
|
outlined
|
|
|
|
|
multiple
|
|
|
|
|
dense
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<q-btn-toggle
|
|
|
|
|
v-model="modeView"
|
|
|
|
|
id="btn-mode"
|
|
|
|
|
dense
|
|
|
|
|
class="no-shadow bordered rounded surface-1"
|
|
|
|
|
:toggle-color="$q.dark.isActive ? 'grey-9' : 'grey-2'"
|
|
|
|
|
size="xs"
|
|
|
|
|
:options="[
|
|
|
|
|
{ value: true, slot: 'folder' },
|
|
|
|
|
{ value: false, slot: 'list' },
|
|
|
|
|
]"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:folder>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-view-grid-outline"
|
|
|
|
|
size="16px"
|
|
|
|
|
class="q-px-sm q-py-xs rounded"
|
|
|
|
|
:style="{
|
|
|
|
|
color: $q.dark.isActive
|
|
|
|
|
? modeView
|
|
|
|
|
? '#C9D3DB '
|
|
|
|
|
: '#787B7C'
|
|
|
|
|
: modeView
|
|
|
|
|
? '#787B7C'
|
|
|
|
|
: '#C9D3DB',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:list>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-format-list-bulleted"
|
|
|
|
|
class="q-px-sm q-py-xs rounded"
|
|
|
|
|
size="16px"
|
|
|
|
|
:style="{
|
|
|
|
|
color: $q.dark.isActive
|
|
|
|
|
? modeView === false
|
|
|
|
|
? '#C9D3DB'
|
|
|
|
|
: '#787B7C'
|
|
|
|
|
: modeView === false
|
|
|
|
|
? '#787B7C'
|
|
|
|
|
: '#C9D3DB',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</q-btn-toggle>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-07-09 15:23:42 +07:00
|
|
|
<div class="col flex scroll full-height q-pa-md surface-1 ">
|
|
|
|
|
<div class="full-width">
|
2024-07-09 14:38:22 +07:00
|
|
|
<q-table
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
:grid="modeView"
|
|
|
|
|
:rows="
|
|
|
|
|
(productMode === 'type' ? productType : productGroup) || []
|
|
|
|
|
"
|
|
|
|
|
:columns="tbColumn.groupAndType"
|
2024-07-09 15:23:42 +07:00
|
|
|
class=" full-width "
|
2024-07-09 14:38:22 +07:00
|
|
|
card-container-class="q-gutter-md "
|
|
|
|
|
row-key="name"
|
|
|
|
|
:rows-per-page-options="[0]"
|
|
|
|
|
hide-pagination
|
|
|
|
|
:visible-columns="tbControl.groupAndType.fieldSelected"
|
2024-06-12 15:37:17 +07:00
|
|
|
>
|
2024-07-09 14:38:22 +07:00
|
|
|
<template v-slot:header="props">
|
|
|
|
|
<q-tr class="surface-2" :props="props">
|
|
|
|
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
|
|
|
|
{{ $t(col.label) }}
|
|
|
|
|
</q-th>
|
|
|
|
|
<q-th auto-width />
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:body="props">
|
|
|
|
|
<q-tr
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-muted': props.row.status === 'INACTIVE',
|
|
|
|
|
'status-active': props.row.status !== 'INACTIVE',
|
|
|
|
|
'status-inactive': props.row.status === 'INACTIVE',
|
|
|
|
|
}"
|
|
|
|
|
:props="props"
|
|
|
|
|
@click="async ()=>{
|
|
|
|
|
if (productMode === 'type') {
|
|
|
|
|
pathTypeName = props.row.name;
|
|
|
|
|
currentIdType = props.row.id;
|
|
|
|
|
productMode = 'service';
|
|
|
|
|
productAndServiceTab = 'service';
|
|
|
|
|
|
|
|
|
|
await fetchListOfProduct();
|
|
|
|
|
await fetchListOfService();
|
|
|
|
|
await fetchListOfProductAndService();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
|
|
|
|
|
pathGroupName = props.row.name;
|
|
|
|
|
currentId = props.row.id;
|
|
|
|
|
productMode = 'type';
|
|
|
|
|
await fetchListType();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<q-td v-if="tbControl.groupAndType.fieldSelected.includes('name')">
|
|
|
|
|
<div class="row items-center">
|
|
|
|
|
<div
|
|
|
|
|
style="
|
|
|
|
|
width: 50px;
|
|
|
|
|
display: flex;
|
|
|
|
|
margin-bottom: var(--size-2);
|
|
|
|
|
"
|
|
|
|
|
>
|
2024-07-09 15:23:42 +07:00
|
|
|
<div :class="`icon-color-${productMode ==='group' ? 'pink' : 'purple'}`" class="table__icon">
|
2024-07-09 14:38:22 +07:00
|
|
|
|
|
|
|
|
|
2024-07-09 15:23:42 +07:00
|
|
|
<q-icon
|
|
|
|
|
size="md"
|
|
|
|
|
style="scale: 0.8"
|
|
|
|
|
:name="productMode === 'group' ? 'mdi-folder' : 'mdi-folder-table'"
|
|
|
|
|
/>
|
2024-07-09 14:38:22 +07:00
|
|
|
|
|
|
|
|
|
2024-07-09 15:23:42 +07:00
|
|
|
|
2024-07-09 14:38:22 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col">
|
|
|
|
|
<div class="col">
|
|
|
|
|
{{ props.row.name }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col app-text-muted">
|
|
|
|
|
{{ props.row.code || '-' }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-td>
|
|
|
|
|
<q-td v-if="tbControl.groupAndType.fieldSelected.includes('detail')">
|
|
|
|
|
{{ props.row.detail || '-' }}
|
|
|
|
|
</q-td>
|
|
|
|
|
|
|
|
|
|
<q-td v-if="tbControl.groupAndType.fieldSelected.includes('formDialogInputRemark')">
|
|
|
|
|
{{ props.row.remark || '-' }}
|
|
|
|
|
</q-td>
|
|
|
|
|
|
|
|
|
|
<q-td v-if="tbControl.groupAndType.fieldSelected.includes('createdAt')">
|
|
|
|
|
88585
|
|
|
|
|
</q-td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<q-td>
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-eye-outline"
|
|
|
|
|
size="sm"
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
flat
|
|
|
|
|
@click.stop="
|
2024-06-25 14:31:08 +07:00
|
|
|
() => {
|
2024-07-09 14:38:22 +07:00
|
|
|
|
|
|
|
|
if (productMode === 'type') {
|
|
|
|
|
currentStatusProduct =
|
|
|
|
|
props.row.status === 'INACTIVE';
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
currentIdType = props.row.id;
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = false;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currentStatusProduct = props.row.status === 'INACTIVE';
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = false;
|
|
|
|
|
currentId = props.row.id;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-25 14:31:08 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-07-09 14:38:22 +07:00
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-dots-vertical"
|
|
|
|
|
size="sm"
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
flat
|
|
|
|
|
@click.stop
|
|
|
|
|
:key="props.row.id"
|
2024-06-12 15:37:17 +07:00
|
|
|
>
|
2024-07-09 14:38:22 +07:00
|
|
|
<q-menu class="bordered">
|
|
|
|
|
<q-list v-close-popup>
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-view`"
|
|
|
|
|
@click.stop="
|
|
|
|
|
() => {
|
|
|
|
|
if (productMode === 'type') {
|
|
|
|
|
currentStatusProduct =
|
|
|
|
|
props.row.status === 'INACTIVE';
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
currentIdType = props.row.id;
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = false;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currentStatusProduct = props.row.status === 'INACTIVE';
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = false;
|
|
|
|
|
currentId = props.row.id;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
clickable
|
|
|
|
|
dense
|
|
|
|
|
class="row q-py-sm"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-eye-outline"
|
|
|
|
|
class="col-3"
|
|
|
|
|
size="xs"
|
|
|
|
|
style="color: hsl(var(--green-6-hsl))"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('viewDetail') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-edit`"
|
|
|
|
|
clickable
|
|
|
|
|
dense
|
|
|
|
|
class="row q-py-sm"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
|
|
|
|
if (productMode === 'type') {
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
currentIdType = props.row.id;
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = true;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = true;
|
|
|
|
|
currentId = props.row.id;
|
|
|
|
|
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-pencil-outline"
|
|
|
|
|
class="col-3"
|
|
|
|
|
size="xs"
|
|
|
|
|
style="color: hsl(var(--cyan-6-hsl))"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('edit') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-delete`"
|
|
|
|
|
dense
|
|
|
|
|
:clickable="props.row.status === 'CREATED'"
|
|
|
|
|
class="row"
|
|
|
|
|
:class="{
|
|
|
|
|
'surface-3': props.row.status !== 'CREATED',
|
|
|
|
|
'app-text-muted': props.row.status !== 'CREATED',
|
|
|
|
|
}"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
@click="()=>{
|
|
|
|
|
if (productMode === 'type') {
|
|
|
|
|
deleteProductById(props.row.id);
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
deleteProductById(props.row.id)
|
|
|
|
|
}
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-trash-can-outline"
|
|
|
|
|
size="xs"
|
|
|
|
|
class="col-3"
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-negative':
|
|
|
|
|
props.row.status === 'CREATED',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('delete') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
|
|
|
|
|
<q-item dense>
|
|
|
|
|
<q-item-section class="q-py-sm">
|
|
|
|
|
<div class="q-pa-sm surface-2 rounded">
|
|
|
|
|
<q-toggle
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-status`"
|
|
|
|
|
dense
|
|
|
|
|
size="sm"
|
|
|
|
|
:label="
|
|
|
|
|
props.row.status !== 'INACTIVE'
|
|
|
|
|
? $t('switchOnLabel')
|
|
|
|
|
: $t('switchOffLabel')
|
|
|
|
|
"
|
|
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
if (productMode === 'type') {
|
|
|
|
|
toggleStatusType(props.row.id, props.row.status);
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
toggleStatusGroup(props.row.id, props.row.status);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:model-value="props.row.status !== 'INACTIVE'"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:item="props">
|
|
|
|
|
<div class="col-3">
|
|
|
|
|
<ProductCardComponent
|
|
|
|
|
:isType="productMode === 'type'"
|
|
|
|
|
:count-product="props.row._count.product"
|
|
|
|
|
:count-type="props.row._count.type"
|
|
|
|
|
:count-service="props.row._count.service"
|
|
|
|
|
:title="props.row.name"
|
|
|
|
|
:subtitle="props.row.code"
|
|
|
|
|
:date="new Date(props.row.updatedAt)"
|
|
|
|
|
:status="props.row.status"
|
|
|
|
|
:id="props.row.id"
|
|
|
|
|
:isDisabled="props.row.status === 'INACTIVE'"
|
|
|
|
|
:color="
|
|
|
|
|
{
|
|
|
|
|
type: $q.dark.isActive
|
|
|
|
|
? 'var(--purple-7-hsl)'
|
|
|
|
|
: 'var(--violet-11-hsl)',
|
|
|
|
|
group: 'var(--pink-6-hsl)',
|
|
|
|
|
}[productMode] || 'var(--pink-6-hsl)'
|
|
|
|
|
"
|
|
|
|
|
@toggleStatus="
|
|
|
|
|
if (productMode === 'type') {
|
|
|
|
|
toggleStatusType(props.row.id, props.row.status);
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
toggleStatusGroup(props.row.id, props.row.status);
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@viewCard="
|
2024-06-25 14:31:08 +07:00
|
|
|
() => {
|
2024-07-09 14:38:22 +07:00
|
|
|
if (productMode === 'type') {
|
|
|
|
|
currentStatusProduct =
|
|
|
|
|
props.row.status === 'INACTIVE';
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
currentIdType = props.row.id;
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = false;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currentStatusProduct = props.row.status === 'INACTIVE';
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = false;
|
|
|
|
|
currentId = props.row.id;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
2024-06-25 14:31:08 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-07-09 14:38:22 +07:00
|
|
|
@updateCard="
|
2024-06-25 14:31:08 +07:00
|
|
|
() => {
|
2024-07-09 14:38:22 +07:00
|
|
|
if (productMode === 'type') {
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
currentIdType = props.row.id;
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = true;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
assignFormDataGroup(props.row);
|
|
|
|
|
isEdit = true;
|
|
|
|
|
currentId = props.row.id;
|
|
|
|
|
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
2024-06-25 14:31:08 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-07-09 14:38:22 +07:00
|
|
|
@deleteCard="
|
|
|
|
|
() => {
|
|
|
|
|
if (productMode === 'type') {
|
|
|
|
|
deleteProductById(props.row.id);
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
|
|
|
|
deleteProductById(props.row.id)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@on-click="
|
|
|
|
|
async () => {
|
|
|
|
|
if (productMode === 'type') {
|
|
|
|
|
pathTypeName = props.row.name;
|
|
|
|
|
currentIdType = props.row.id;
|
|
|
|
|
productMode = 'service';
|
|
|
|
|
productAndServiceTab = 'service';
|
|
|
|
|
|
|
|
|
|
await fetchListOfProduct();
|
|
|
|
|
await fetchListOfService();
|
|
|
|
|
await fetchListOfProductAndService();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
if (productMode === 'group') {
|
2024-06-17 17:59:09 +07:00
|
|
|
|
2024-07-09 14:38:22 +07:00
|
|
|
pathGroupName = props.row.name;
|
|
|
|
|
currentId = props.row.id;
|
|
|
|
|
productMode = 'type';
|
|
|
|
|
await fetchListType();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</q-table>
|
|
|
|
|
|
|
|
|
|
<!-- <div
|
2024-07-08 11:15:31 +07:00
|
|
|
:class="`${$q.screen.gt.sm ? 'col-3' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`"
|
|
|
|
|
v-for="(v, i) in productMode === 'type'
|
|
|
|
|
? productType
|
|
|
|
|
: productGroup"
|
|
|
|
|
:key="i"
|
|
|
|
|
>
|
|
|
|
|
<ProductCardComponent
|
|
|
|
|
v-if="productMode === 'type'"
|
|
|
|
|
isType
|
|
|
|
|
:count-product="v._count.product"
|
|
|
|
|
:count-type="v._count.type"
|
|
|
|
|
:count-service="v._count.service"
|
|
|
|
|
:title="v.name"
|
|
|
|
|
:subtitle="v.code"
|
|
|
|
|
:date="new Date(v.updatedAt)"
|
|
|
|
|
:status="v.status"
|
|
|
|
|
:id="v.id"
|
|
|
|
|
:isDisabled="v.status === 'INACTIVE'"
|
|
|
|
|
:color="
|
|
|
|
|
$q.dark.isActive
|
|
|
|
|
? 'var(--purple-7-hsl)'
|
|
|
|
|
: 'var(--violet-11-hsl)'
|
|
|
|
|
"
|
|
|
|
|
@toggleStatus="toggleStatusType(v.id, v.status)"
|
|
|
|
|
@viewCard="
|
|
|
|
|
() => {
|
|
|
|
|
currentStatusProduct = v.status === 'INACTIVE';
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
currentIdType = v.id;
|
|
|
|
|
assignFormDataGroup(v);
|
|
|
|
|
isEdit = false;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@updateCard="
|
|
|
|
|
() => {
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
currentIdType = v.id;
|
|
|
|
|
assignFormDataGroup(v);
|
|
|
|
|
isEdit = true;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@deleteCard="
|
|
|
|
|
() => {
|
|
|
|
|
deleteProductById(v.id);
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@on-click="
|
|
|
|
|
async () => {
|
|
|
|
|
pathTypeName = v.name;
|
|
|
|
|
currentIdType = v.id;
|
|
|
|
|
productMode = 'service';
|
2024-07-09 11:19:10 +07:00
|
|
|
productAndServiceTab = 'service';
|
2024-07-08 11:15:31 +07:00
|
|
|
// await featchStatsService();
|
|
|
|
|
// await featchStatsProduct();
|
|
|
|
|
await fetchListOfProduct();
|
|
|
|
|
await fetchListOfService();
|
|
|
|
|
await fetchListOfProductAndService();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
<ProductCardComponent
|
|
|
|
|
v-else-if="productMode === 'group'"
|
|
|
|
|
:title="v.name"
|
|
|
|
|
:subtitle="v.code"
|
|
|
|
|
:count-product="v._count.product"
|
|
|
|
|
:count-type="v._count.type"
|
|
|
|
|
:count-service="v._count.service"
|
|
|
|
|
:date="new Date(v.updatedAt)"
|
|
|
|
|
:status="v.status"
|
|
|
|
|
color="var(--pink-6-hsl)"
|
|
|
|
|
:id="v.id"
|
|
|
|
|
:isDisabled="v.status === 'INACTIVE'"
|
|
|
|
|
@toggleStatus="toggleStatusGroup(v.id, v.status)"
|
|
|
|
|
@viewCard="
|
|
|
|
|
() => {
|
|
|
|
|
currentStatusProduct = v.status === 'INACTIVE';
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
assignFormDataGroup(v);
|
|
|
|
|
isEdit = false;
|
|
|
|
|
currentId = v.id;
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@updateCard="
|
|
|
|
|
() => {
|
|
|
|
|
clearFormGroup();
|
|
|
|
|
assignFormDataGroup(v);
|
|
|
|
|
isEdit = true;
|
|
|
|
|
currentId = v.id;
|
|
|
|
|
|
|
|
|
|
drawerInfo = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@deleteCard="deleteProductById(v.id)"
|
|
|
|
|
@on-click="
|
|
|
|
|
async () => {
|
|
|
|
|
pathGroupName = v.name;
|
|
|
|
|
currentId = v.id;
|
|
|
|
|
productMode = 'type';
|
|
|
|
|
await fetchListType();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
2024-07-09 14:38:22 +07:00
|
|
|
</div> -->
|
2024-06-12 15:37:17 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-17 17:59:09 +07:00
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
v-if="
|
|
|
|
|
(productMode === 'type' && productType?.length === 0) ||
|
2024-07-01 09:53:51 +07:00
|
|
|
(productGroup?.length === 0 && productMode === 'group')
|
2024-06-17 17:59:09 +07:00
|
|
|
"
|
2024-06-26 04:56:48 +00:00
|
|
|
class="flex justify-center items-center q-mt-lg"
|
2024-06-17 17:59:09 +07:00
|
|
|
style="min-height: 70vh; background-color: var(--surface-2)"
|
|
|
|
|
>
|
2024-07-01 09:53:51 +07:00
|
|
|
<NoData :not-found="!!inputSearch" />
|
2024-06-17 17:59:09 +07:00
|
|
|
</div>
|
2024-06-28 14:14:23 +07:00
|
|
|
<template v-else>
|
|
|
|
|
<div
|
2024-07-01 09:53:51 +07:00
|
|
|
v-if="productMode === 'group'"
|
2024-07-08 14:08:57 +07:00
|
|
|
class="row items-center justify-between q-px-md q-py-sm"
|
2024-06-28 14:14:23 +07:00
|
|
|
>
|
2024-07-04 14:55:09 +07:00
|
|
|
<div class="col-4">
|
|
|
|
|
<div class="row items-center">
|
|
|
|
|
<div class="app-text-muted" style="width: 80px">
|
|
|
|
|
{{ $t('showing') }}
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2024-07-05 07:48:02 +00:00
|
|
|
<q-btn-dropdown
|
|
|
|
|
dense
|
|
|
|
|
unelevated
|
|
|
|
|
:label="pageSizeGroup"
|
|
|
|
|
class="bordered q-pl-md"
|
|
|
|
|
>
|
2024-07-04 14:55:09 +07:00
|
|
|
<q-list>
|
|
|
|
|
<q-item
|
|
|
|
|
v-for="v in [10, 30, 50, 100, 500, 1000]"
|
2024-07-05 02:42:09 +00:00
|
|
|
:key="v"
|
2024-07-04 14:55:09 +07:00
|
|
|
clickable
|
|
|
|
|
v-close-popup
|
|
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
pageSizeGroup = v;
|
|
|
|
|
await fetchListGroups();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>{{ v }}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-btn-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-4 row justify-center app-text-muted">
|
2024-07-01 13:48:48 +07:00
|
|
|
{{
|
|
|
|
|
$t('recordsPage', {
|
|
|
|
|
resultcurrentPage: productGroup?.length,
|
|
|
|
|
total: totalGroup,
|
|
|
|
|
})
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
2024-07-04 14:55:09 +07:00
|
|
|
|
|
|
|
|
<div class="col-4 row justify-end">
|
|
|
|
|
<PaginationComponent
|
|
|
|
|
v-model:current-page="currentPageGroup"
|
|
|
|
|
v-model:max-page="maxPageGroup"
|
|
|
|
|
:fetch-data="
|
|
|
|
|
async () => {
|
|
|
|
|
await fetchListGroups();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-28 14:14:23 +07:00
|
|
|
</div>
|
2024-06-26 11:26:29 +07:00
|
|
|
|
2024-06-28 14:14:23 +07:00
|
|
|
<div
|
2024-07-01 09:53:51 +07:00
|
|
|
v-if="productMode === 'type'"
|
2024-07-05 07:48:02 +00:00
|
|
|
class="row justify-between items-center"
|
2024-06-28 14:14:23 +07:00
|
|
|
>
|
2024-07-04 14:55:09 +07:00
|
|
|
<div class="col-4">
|
|
|
|
|
<div class="row items-center">
|
|
|
|
|
<div class="app-text-muted" style="width: 80px">
|
|
|
|
|
{{ $t('showing') }}
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2024-07-05 07:48:02 +00:00
|
|
|
<q-btn-dropdown
|
|
|
|
|
dense
|
|
|
|
|
unelevated
|
|
|
|
|
:label="pageSizeType"
|
|
|
|
|
class="bordered q-pl-md"
|
|
|
|
|
>
|
2024-07-04 14:55:09 +07:00
|
|
|
<q-list>
|
|
|
|
|
<q-item
|
|
|
|
|
v-for="v in [10, 30, 50, 100, 500, 1000]"
|
2024-07-05 02:42:09 +00:00
|
|
|
:key="v"
|
2024-07-04 14:55:09 +07:00
|
|
|
clickable
|
|
|
|
|
v-close-popup
|
|
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
pageSizeType = v;
|
|
|
|
|
await fetchListType();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>{{ v }}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-btn-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-4 row justify-center app-text-muted">
|
2024-07-01 13:48:48 +07:00
|
|
|
{{
|
|
|
|
|
$t('recordsPage', {
|
|
|
|
|
resultcurrentPage: productType?.length,
|
|
|
|
|
total: totalType,
|
|
|
|
|
})
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
2024-07-04 14:55:09 +07:00
|
|
|
<div class="col-4 row justify-end">
|
|
|
|
|
<PaginationComponent
|
|
|
|
|
v-model:current-page="currentPageType"
|
|
|
|
|
v-model:max-page="maxPageType"
|
|
|
|
|
:fetch-data="
|
|
|
|
|
async () => {
|
|
|
|
|
await fetchListType();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-28 14:14:23 +07:00
|
|
|
</div>
|
|
|
|
|
</template>
|
2024-07-02 09:58:59 +00:00
|
|
|
</div>
|
2024-07-05 06:13:55 +00:00
|
|
|
|
|
|
|
|
<!-- product/service -->
|
2024-07-02 09:58:59 +00:00
|
|
|
<div
|
|
|
|
|
v-else-if="productMode === 'service'"
|
2024-07-09 11:50:38 +07:00
|
|
|
class="surface-2 col bordered rounded column no-wrap"
|
2024-07-09 11:35:46 +07:00
|
|
|
style="overflow: hidden"
|
2024-07-02 09:58:59 +00:00
|
|
|
>
|
2024-07-05 06:13:55 +00:00
|
|
|
<div
|
2024-07-09 11:19:10 +07:00
|
|
|
class="row justify-between items-center q-px-md q-py-sm rounded surface-2"
|
2024-07-05 06:13:55 +00:00
|
|
|
style="z-index: 1"
|
|
|
|
|
>
|
2024-07-08 17:16:34 +07:00
|
|
|
<div>
|
2024-06-14 12:01:58 +07:00
|
|
|
<q-input
|
|
|
|
|
style="width: 300px"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
unelavated
|
|
|
|
|
:label="$t('search')"
|
|
|
|
|
class="q-mr-md"
|
|
|
|
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
2024-06-25 14:51:58 +07:00
|
|
|
v-model="inputSearchProductAndService"
|
2024-06-26 11:26:29 +07:00
|
|
|
debounce="250"
|
2024-06-14 12:01:58 +07:00
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="mdi-magnify" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
2024-07-08 17:16:34 +07:00
|
|
|
</div>
|
2024-07-09 11:19:10 +07:00
|
|
|
<div class="row" style="gap: var(--size-2)">
|
2024-06-14 12:01:58 +07:00
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-tune-vertical-variant"
|
|
|
|
|
size="sm"
|
|
|
|
|
:color="$q.dark.isActive ? 'dark' : 'white'"
|
|
|
|
|
:text-color="$q.dark.isActive ? 'white' : 'dark'"
|
|
|
|
|
class="bordered rounded q-py-sm"
|
|
|
|
|
unelevated
|
|
|
|
|
>
|
|
|
|
|
<q-menu class="bordered">
|
|
|
|
|
<q-list v-close-popup dense>
|
|
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
2024-06-25 14:31:08 +07:00
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
currentStatus = 'All';
|
|
|
|
|
await fetchStatus();
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-06-14 12:01:58 +07:00
|
|
|
>
|
|
|
|
|
{{ $t('all') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
2024-06-25 14:31:08 +07:00
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
currentStatus = 'ACTIVE';
|
|
|
|
|
await fetchStatus();
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-06-14 12:01:58 +07:00
|
|
|
>
|
|
|
|
|
{{ $t('statusACTIVE') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
2024-06-25 14:31:08 +07:00
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
currentStatus = 'INACTIVE';
|
|
|
|
|
await fetchStatus();
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-06-14 12:01:58 +07:00
|
|
|
>
|
|
|
|
|
{{ $t('statusINACTIVE') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
2024-07-09 11:19:10 +07:00
|
|
|
<q-btn-toggle
|
|
|
|
|
v-model="modeView"
|
|
|
|
|
id="btn-mode"
|
|
|
|
|
dense
|
|
|
|
|
class="no-shadow bordered rounded surface-1"
|
|
|
|
|
:toggle-color="$q.dark.isActive ? 'grey-9' : 'grey-2'"
|
|
|
|
|
size="xs"
|
|
|
|
|
:options="[
|
|
|
|
|
{ value: true, slot: 'folder' },
|
|
|
|
|
{ value: false, slot: 'list' },
|
|
|
|
|
]"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:folder>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-view-grid-outline"
|
|
|
|
|
size="16px"
|
|
|
|
|
class="q-px-sm q-py-xs rounded"
|
|
|
|
|
:style="{
|
|
|
|
|
color: $q.dark.isActive
|
|
|
|
|
? modeView
|
|
|
|
|
? '#C9D3DB '
|
|
|
|
|
: '#787B7C'
|
|
|
|
|
: modeView
|
|
|
|
|
? '#787B7C'
|
|
|
|
|
: '#C9D3DB',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:list>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-format-list-bulleted"
|
|
|
|
|
class="q-px-sm q-py-xs rounded"
|
|
|
|
|
size="16px"
|
|
|
|
|
:style="{
|
|
|
|
|
color: $q.dark.isActive
|
|
|
|
|
? modeView === false
|
|
|
|
|
? '#C9D3DB'
|
|
|
|
|
: '#787B7C'
|
|
|
|
|
: modeView === false
|
|
|
|
|
? '#787B7C'
|
|
|
|
|
: '#C9D3DB',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</q-btn-toggle>
|
2024-06-14 12:01:58 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-17 17:59:09 +07:00
|
|
|
|
2024-06-11 16:52:35 +07:00
|
|
|
<div
|
2024-06-26 11:26:29 +07:00
|
|
|
v-if="
|
|
|
|
|
(productAndServiceTab === 'product' && product?.length === 0) ||
|
|
|
|
|
(productAndServiceTab === 'service' && service?.length === 0)
|
|
|
|
|
"
|
2024-07-09 11:32:23 +07:00
|
|
|
class="flex justify-center items-center surface-1 col"
|
2024-06-11 16:52:35 +07:00
|
|
|
>
|
2024-07-01 10:33:39 +07:00
|
|
|
<NoData :not-found="!!inputSearchProductAndService" />
|
2024-06-10 17:42:37 +07:00
|
|
|
</div>
|
2024-07-05 06:13:55 +00:00
|
|
|
<!-- tab -->
|
2024-07-09 11:50:38 +07:00
|
|
|
<template v-else>
|
2024-07-08 17:16:34 +07:00
|
|
|
<q-tabs
|
|
|
|
|
dense
|
|
|
|
|
v-model="productAndServiceTab"
|
2024-07-09 11:50:38 +07:00
|
|
|
class="bordered-b q-px-md"
|
2024-07-08 17:16:34 +07:00
|
|
|
align="left"
|
2024-06-24 15:25:46 +07:00
|
|
|
>
|
2024-07-08 17:16:34 +07:00
|
|
|
<q-tab
|
2024-07-09 11:19:10 +07:00
|
|
|
name="service"
|
2024-07-08 17:16:34 +07:00
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
currentPageServiceAndProduct = 1;
|
|
|
|
|
inputSearchProductAndService = '';
|
|
|
|
|
currentStatus = 'All';
|
2024-07-09 11:19:10 +07:00
|
|
|
// await fetchListOfService();
|
2024-07-08 17:16:34 +07:00
|
|
|
flowStore.rotate();
|
2024-06-24 15:25:46 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-07-08 17:16:34 +07:00
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class="row"
|
|
|
|
|
:class="
|
2024-07-09 11:19:10 +07:00
|
|
|
productAndServiceTab === 'service'
|
2024-07-08 17:16:34 +07:00
|
|
|
? 'text-bold'
|
|
|
|
|
: 'app-text-muted'
|
|
|
|
|
"
|
|
|
|
|
>
|
2024-07-09 11:19:10 +07:00
|
|
|
{{ $t('service') }}
|
2024-07-08 17:16:34 +07:00
|
|
|
</div>
|
|
|
|
|
</q-tab>
|
|
|
|
|
<q-tab
|
|
|
|
|
name="product"
|
|
|
|
|
@click="
|
2024-07-04 11:38:10 +07:00
|
|
|
async () => {
|
2024-07-08 17:16:34 +07:00
|
|
|
currentPageServiceAndProduct = 1;
|
|
|
|
|
inputSearchProductAndService = '';
|
|
|
|
|
currentStatus = 'All';
|
|
|
|
|
// await fetchListOfProduct();
|
|
|
|
|
flowStore.rotate();
|
2024-06-24 15:25:46 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-07-08 17:16:34 +07:00
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class="row"
|
|
|
|
|
:class="
|
|
|
|
|
productAndServiceTab === 'product'
|
|
|
|
|
? 'text-bold'
|
|
|
|
|
: 'app-text-muted'
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('product') }}
|
|
|
|
|
</div>
|
|
|
|
|
</q-tab>
|
|
|
|
|
</q-tabs>
|
2024-07-09 11:50:38 +07:00
|
|
|
<div class="col flex scroll full-height q-pa-md surface-1">
|
2024-07-09 11:19:10 +07:00
|
|
|
<div class="full-width">
|
|
|
|
|
<q-table
|
|
|
|
|
class="full-width"
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
:rows-per-page-options="[0]"
|
|
|
|
|
:rows="{ product, service }[productAndServiceTab] || []"
|
|
|
|
|
:columns="
|
|
|
|
|
{
|
|
|
|
|
product: tbColumn.product,
|
|
|
|
|
service: tbColumn.service,
|
|
|
|
|
}[productAndServiceTab]
|
2024-07-08 17:16:34 +07:00
|
|
|
"
|
2024-07-09 11:19:10 +07:00
|
|
|
:grid="modeView"
|
|
|
|
|
card-container-class="row q-col-gutter-md"
|
|
|
|
|
row-key="name"
|
|
|
|
|
hide-pagination
|
|
|
|
|
:visible-columns="
|
|
|
|
|
{
|
|
|
|
|
product: tbControl.product.fieldSelected,
|
|
|
|
|
service: tbControl.service.fieldSelected,
|
|
|
|
|
}[productAndServiceTab]
|
2024-07-08 17:16:34 +07:00
|
|
|
"
|
2024-07-09 11:19:10 +07:00
|
|
|
>
|
|
|
|
|
<template v-slot:header="props">
|
|
|
|
|
<q-tr class="surface-2" :props="props">
|
|
|
|
|
<q-th
|
|
|
|
|
v-for="col in props.cols"
|
|
|
|
|
:key="col.name"
|
|
|
|
|
:props="props"
|
|
|
|
|
>
|
|
|
|
|
{{ $t(col.label) }}
|
|
|
|
|
</q-th>
|
|
|
|
|
<q-th auto-width />
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:body="props">
|
|
|
|
|
<q-tr
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-muted': props.row.status === 'INACTIVE',
|
|
|
|
|
}"
|
|
|
|
|
:props="props"
|
|
|
|
|
>
|
|
|
|
|
<q-td
|
|
|
|
|
v-if="
|
|
|
|
|
{
|
|
|
|
|
product: tbControl.product.fieldSelected,
|
|
|
|
|
service: tbControl.service.fieldSelected,
|
|
|
|
|
}[productAndServiceTab].includes(
|
|
|
|
|
{ product: 'productName', service: 'serviceName' }[
|
|
|
|
|
productAndServiceTab
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<div class="row items-center">
|
|
|
|
|
<div
|
|
|
|
|
:class="{
|
|
|
|
|
'status-active': props.row.status !== 'INACTIVE',
|
|
|
|
|
'status-inactive': props.row.status === 'INACTIVE',
|
|
|
|
|
}"
|
|
|
|
|
style="
|
|
|
|
|
width: 50px;
|
|
|
|
|
display: flex;
|
|
|
|
|
margin-bottom: var(--size-2);
|
|
|
|
|
"
|
|
|
|
|
>
|
2024-07-09 15:23:42 +07:00
|
|
|
<div class="table__icon" :class="`icon-color-${productAndServiceTab ==='product' ? 'orange' : 'green'}`">
|
2024-07-09 11:19:10 +07:00
|
|
|
<q-icon
|
|
|
|
|
size="md"
|
|
|
|
|
style="scale: 0.8"
|
2024-07-09 15:23:42 +07:00
|
|
|
:name="productAndServiceTab === 'product' ? 'mdi-folder' : 'mdi-server-network'"
|
2024-07-09 11:19:10 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col">
|
|
|
|
|
<div class="col">{{ props.row.name }}</div>
|
|
|
|
|
<div class="col app-text-muted">
|
|
|
|
|
{{ props.row.code }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-td>
|
|
|
|
|
<q-td
|
|
|
|
|
v-if="
|
|
|
|
|
{
|
|
|
|
|
product: tbControl.product.fieldSelected,
|
|
|
|
|
service: tbControl.service.fieldSelected,
|
|
|
|
|
}[productAndServiceTab].includes(
|
|
|
|
|
{
|
|
|
|
|
product: 'productDetail',
|
|
|
|
|
service: 'serviceDetail',
|
|
|
|
|
}[productAndServiceTab],
|
|
|
|
|
)
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{ props.row.detail }}
|
|
|
|
|
</q-td>
|
|
|
|
|
<q-td
|
|
|
|
|
v-if="
|
|
|
|
|
{
|
|
|
|
|
product: tbControl.product.fieldSelected,
|
|
|
|
|
service: tbControl.service.fieldSelected,
|
|
|
|
|
}[productAndServiceTab].includes(
|
|
|
|
|
{
|
|
|
|
|
product: 'productProcessingTime',
|
|
|
|
|
service: 'serviceWorkTotal',
|
|
|
|
|
}[productAndServiceTab],
|
|
|
|
|
)
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{
|
|
|
|
|
{
|
2024-07-09 11:25:39 +07:00
|
|
|
product: props.row.process,
|
2024-07-09 11:19:10 +07:00
|
|
|
service: props.row.work?.length,
|
|
|
|
|
}[productAndServiceTab]
|
|
|
|
|
}}
|
|
|
|
|
</q-td>
|
|
|
|
|
<q-td
|
|
|
|
|
v-if="
|
|
|
|
|
{
|
|
|
|
|
product: tbControl.product.fieldSelected,
|
|
|
|
|
service: tbControl.service.fieldSelected,
|
|
|
|
|
}[productAndServiceTab].includes(
|
|
|
|
|
{
|
2024-07-09 11:25:39 +07:00
|
|
|
product: 'priceInformation',
|
2024-07-09 11:19:10 +07:00
|
|
|
service: 'empty',
|
|
|
|
|
}[productAndServiceTab],
|
|
|
|
|
)
|
|
|
|
|
"
|
|
|
|
|
>
|
2024-07-09 11:25:39 +07:00
|
|
|
price
|
2024-07-09 11:19:10 +07:00
|
|
|
</q-td>
|
|
|
|
|
<q-td>
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-eye-outline"
|
|
|
|
|
size="sm"
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
flat
|
|
|
|
|
@click.stop="
|
|
|
|
|
async () => {
|
|
|
|
|
if (props.row.type === 'product') {
|
|
|
|
|
currentIdProduct = props.row.id;
|
|
|
|
|
assignFormDataProduct(props.row);
|
|
|
|
|
dialogProductEdit = true;
|
|
|
|
|
}
|
|
|
|
|
if (props.row.type === 'service') {
|
|
|
|
|
currentIdService = props.row.id;
|
|
|
|
|
infoServiceEdit = false;
|
|
|
|
|
assignFormDataProductService(props.row.id);
|
|
|
|
|
dialogServiceEdit = true;
|
|
|
|
|
}
|
|
|
|
|
await fetchListOfOptionBranch();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-dots-vertical"
|
|
|
|
|
size="sm"
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
flat
|
|
|
|
|
@click.stop
|
|
|
|
|
>
|
|
|
|
|
<q-menu class="bordered">
|
|
|
|
|
<q-list v-close-popup>
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-view`"
|
|
|
|
|
@click.stop="
|
|
|
|
|
async () => {
|
|
|
|
|
if (props.row.type === 'product') {
|
|
|
|
|
currentIdProduct = props.row.id;
|
|
|
|
|
assignFormDataProduct(props.row);
|
|
|
|
|
dialogProductEdit = true;
|
|
|
|
|
}
|
|
|
|
|
if (props.row.type === 'service') {
|
|
|
|
|
currentIdService = props.row.id;
|
|
|
|
|
infoServiceEdit = false;
|
|
|
|
|
assignFormDataProductService(props.row.id);
|
|
|
|
|
dialogServiceEdit = true;
|
|
|
|
|
}
|
|
|
|
|
await fetchListOfOptionBranch();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
clickable
|
|
|
|
|
dense
|
|
|
|
|
class="row q-py-sm"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-eye-outline"
|
|
|
|
|
class="col-3"
|
|
|
|
|
size="xs"
|
|
|
|
|
style="color: hsl(var(--green-6-hsl))"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('viewDetail') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-edit`"
|
|
|
|
|
clickable
|
|
|
|
|
dense
|
|
|
|
|
class="row q-py-sm"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
if (props.row.type === 'product') {
|
|
|
|
|
currentIdProduct = props.row.id;
|
|
|
|
|
infoProductEdit = true;
|
|
|
|
|
assignFormDataProduct(props.row);
|
|
|
|
|
dialogProductEdit = true;
|
|
|
|
|
}
|
|
|
|
|
if (props.row.type === 'service') {
|
|
|
|
|
currentIdService = props.row.id;
|
|
|
|
|
infoServiceEdit = true;
|
|
|
|
|
assignFormDataProductService(props.row.id);
|
|
|
|
|
dialogServiceEdit = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await fetchListOfOptionBranch();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-pencil-outline"
|
|
|
|
|
class="col-3"
|
|
|
|
|
size="xs"
|
|
|
|
|
style="color: hsl(var(--cyan-6-hsl))"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('edit') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-delete`"
|
|
|
|
|
dense
|
|
|
|
|
:clickable="props.row.status === 'CREATED'"
|
|
|
|
|
class="row"
|
|
|
|
|
:class="{
|
|
|
|
|
'surface-3': props.row.status !== 'CREATED',
|
|
|
|
|
'app-text-muted':
|
|
|
|
|
props.row.status !== 'CREATED',
|
|
|
|
|
}"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
@click=""
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-trash-can-outline"
|
|
|
|
|
size="xs"
|
|
|
|
|
class="col-3"
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-negative':
|
|
|
|
|
props.row.status === 'CREATED',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('delete') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
|
|
|
|
|
<q-item dense>
|
|
|
|
|
<q-item-section class="q-py-sm">
|
|
|
|
|
<div class="q-pa-sm surface-2 rounded">
|
|
|
|
|
<q-toggle
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-status`"
|
|
|
|
|
dense
|
|
|
|
|
size="sm"
|
|
|
|
|
:label="
|
|
|
|
|
props.row.status !== 'INACTIVE'
|
|
|
|
|
? $t('switchOnLabel')
|
|
|
|
|
: $t('switchOffLabel')
|
|
|
|
|
"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
|
|
|
|
if (props.row.type === 'product') {
|
|
|
|
|
toggleStatusProduct(
|
|
|
|
|
props.row.id,
|
|
|
|
|
props.row.status,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (props.row.type === 'service') {
|
|
|
|
|
toggleStatusService(
|
|
|
|
|
props.row.id,
|
|
|
|
|
props.row.status,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:model-value="
|
|
|
|
|
props.row.status === 'CREATED' ||
|
|
|
|
|
props.row.status === 'ACTIVE'
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:item="{ row }">
|
2024-07-09 11:50:38 +07:00
|
|
|
<div class="col-12 col-md-4 col-lg-2">
|
2024-07-09 11:19:10 +07:00
|
|
|
<TotalProductCardComponent
|
|
|
|
|
:data="row"
|
|
|
|
|
:key="row.id"
|
|
|
|
|
:title="row.name"
|
|
|
|
|
:isDisabled="row.status === 'INACTIVE' ? true : false"
|
|
|
|
|
@toggleStatus="
|
|
|
|
|
() => {
|
|
|
|
|
if (row.type === 'product') {
|
|
|
|
|
toggleStatusProduct(row.id, row.status);
|
|
|
|
|
}
|
|
|
|
|
if (row.type === 'service') {
|
|
|
|
|
toggleStatusService(row.id, row.status);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@menuViewDetail="
|
|
|
|
|
async () => {
|
|
|
|
|
if (row.type === 'product') {
|
|
|
|
|
currentIdProduct = row.id;
|
|
|
|
|
assignFormDataProduct(row);
|
|
|
|
|
dialogProductEdit = true;
|
|
|
|
|
}
|
|
|
|
|
if (row.type === 'service') {
|
|
|
|
|
currentIdService = row.id;
|
|
|
|
|
infoServiceEdit = false;
|
|
|
|
|
assignFormDataProductService(row.id);
|
|
|
|
|
dialogServiceEdit = true;
|
|
|
|
|
}
|
|
|
|
|
await fetchListOfOptionBranch();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@menuEdit="
|
|
|
|
|
async () => {
|
|
|
|
|
if (row.type === 'product') {
|
|
|
|
|
currentIdProduct = row.id;
|
|
|
|
|
infoProductEdit = true;
|
|
|
|
|
assignFormDataProduct(row);
|
|
|
|
|
dialogProductEdit = true;
|
|
|
|
|
}
|
|
|
|
|
if (row.type === 'service') {
|
|
|
|
|
currentIdService = row.id;
|
|
|
|
|
infoServiceEdit = true;
|
|
|
|
|
assignFormDataProductService(row.id);
|
|
|
|
|
dialogServiceEdit = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await fetchListOfOptionBranch();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</q-table>
|
2024-07-08 17:16:34 +07:00
|
|
|
</div>
|
2024-06-24 15:25:46 +07:00
|
|
|
</div>
|
2024-07-09 11:50:38 +07:00
|
|
|
</template>
|
2024-07-05 06:13:55 +00:00
|
|
|
<!-- footer -->
|
2024-07-09 11:50:38 +07:00
|
|
|
<div class="row items-center justify-between q-py-sm q-px-md surface-2">
|
2024-07-04 14:55:09 +07:00
|
|
|
<div class="col-4">
|
|
|
|
|
<div class="row items-center">
|
|
|
|
|
<div class="app-text-muted" style="width: 80px">
|
|
|
|
|
{{ $t('showing') }}
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<q-btn-dropdown
|
|
|
|
|
dense
|
|
|
|
|
unelevated
|
|
|
|
|
:label="pageSizeServiceAndProduct"
|
2024-07-05 07:48:02 +00:00
|
|
|
class="bordered q-pl-md"
|
2024-07-04 14:55:09 +07:00
|
|
|
>
|
|
|
|
|
<q-list>
|
|
|
|
|
<q-item
|
|
|
|
|
v-for="v in [10, 30, 50, 100, 500, 1000]"
|
2024-07-05 02:42:09 +00:00
|
|
|
:key="v"
|
2024-07-04 14:55:09 +07:00
|
|
|
clickable
|
|
|
|
|
v-close-popup
|
|
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
pageSizeServiceAndProduct = v;
|
|
|
|
|
await fetchListOfProductAndService();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>{{ v }}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-btn-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-4 row justify-center app-text-muted">
|
2024-07-01 14:20:24 +07:00
|
|
|
{{
|
|
|
|
|
$t('recordsPage', {
|
|
|
|
|
resultcurrentPage:
|
2024-07-09 11:19:10 +07:00
|
|
|
productAndServiceTab === 'product'
|
|
|
|
|
? product?.length
|
|
|
|
|
: service?.length,
|
2024-07-01 14:20:24 +07:00
|
|
|
total: total,
|
|
|
|
|
})
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
2024-07-04 14:55:09 +07:00
|
|
|
<div class="col-4 row justify-end">
|
|
|
|
|
<PaginationComponent
|
|
|
|
|
v-model:current-page="currentPageServiceAndProduct"
|
|
|
|
|
v-model:max-page="maxPageServiceAndProduct"
|
|
|
|
|
:fetch-data="
|
|
|
|
|
async () => {
|
|
|
|
|
await alternativeFetch();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-26 13:39:38 +07:00
|
|
|
</div>
|
2024-07-02 09:58:59 +00:00
|
|
|
</div>
|
2024-06-12 15:37:17 +07:00
|
|
|
</div>
|
2024-06-10 16:42:59 +07:00
|
|
|
</div>
|
2024-06-11 12:01:35 +07:00
|
|
|
|
|
|
|
|
<FormDialog
|
|
|
|
|
v-model:modal="dialogInputForm"
|
|
|
|
|
noAddress
|
2024-06-12 15:37:17 +07:00
|
|
|
:title="$t('addProduct')"
|
|
|
|
|
:submit="() => (productMode === 'type' ? submitType() : submitGroup())"
|
2024-06-24 09:07:06 +00:00
|
|
|
:close="clearFormGroup"
|
2024-06-11 12:01:35 +07:00
|
|
|
>
|
|
|
|
|
<template #information>
|
|
|
|
|
<BasicInformation
|
|
|
|
|
dense
|
2024-06-11 16:52:35 +07:00
|
|
|
:isType="productMode === 'type'"
|
2024-06-17 17:59:09 +07:00
|
|
|
v-model:remark="formDataGroup.remark"
|
|
|
|
|
v-model:name="formDataGroup.name"
|
|
|
|
|
v-model:detail="formDataGroup.detail"
|
2024-06-11 12:01:35 +07:00
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</FormDialog>
|
|
|
|
|
|
|
|
|
|
<DrawerInfo
|
2024-06-24 09:44:38 +07:00
|
|
|
:show-edit="!currentStatusProduct"
|
2024-06-11 12:01:35 +07:00
|
|
|
ref="formDialogRef"
|
|
|
|
|
v-model:drawerOpen="drawerInfo"
|
2024-06-28 14:14:23 +07:00
|
|
|
:title="
|
|
|
|
|
$t(productMode === 'group' ? 'productGroup' : 'productType', {
|
|
|
|
|
name: formDataGroup.code,
|
|
|
|
|
})
|
|
|
|
|
"
|
2024-06-11 16:29:00 +07:00
|
|
|
:undo="() => undoProductGroup()"
|
2024-06-11 12:01:35 +07:00
|
|
|
:isEdit="isEdit"
|
|
|
|
|
:editData="() => (isEdit = true)"
|
2024-06-11 16:52:35 +07:00
|
|
|
:submit="() => (productMode === 'type' ? submitType() : submitGroup())"
|
2024-06-11 12:01:35 +07:00
|
|
|
:delete-data="() => deleteProductById()"
|
|
|
|
|
:close="() => (drawerInfo = false)"
|
|
|
|
|
>
|
|
|
|
|
<template #info>
|
2024-06-27 04:55:39 +00:00
|
|
|
<InfoForm noAddress>
|
|
|
|
|
<template #information>
|
|
|
|
|
<!-- <AppBox class="q-ma-md" bordered> -->
|
|
|
|
|
<BasicInformation
|
|
|
|
|
dense
|
|
|
|
|
:isType="productMode === 'type'"
|
|
|
|
|
:readonly="!isEdit"
|
|
|
|
|
v-model:remark="formDataGroup.remark"
|
|
|
|
|
v-model:name="formDataGroup.name"
|
|
|
|
|
v-model:code="formDataGroup.code"
|
|
|
|
|
v-model:detail="formDataGroup.detail"
|
|
|
|
|
/>
|
|
|
|
|
<!-- </AppBox> -->
|
|
|
|
|
</template>
|
|
|
|
|
</InfoForm>
|
2024-06-11 12:01:35 +07:00
|
|
|
</template>
|
|
|
|
|
</DrawerInfo>
|
2024-06-11 15:11:55 +07:00
|
|
|
|
|
|
|
|
<FormDialog
|
|
|
|
|
v-model:modal="dialogProductServiceType"
|
|
|
|
|
:title="'สร้างสินค้าและบริการ'"
|
|
|
|
|
no-footer
|
|
|
|
|
no-app-box
|
2024-06-18 11:47:53 +00:00
|
|
|
max-width="80%"
|
2024-06-24 09:07:06 +00:00
|
|
|
:close="() => (dialogProductServiceType = false)"
|
2024-06-11 15:11:55 +07:00
|
|
|
>
|
|
|
|
|
<template #body>
|
|
|
|
|
<div class="row q-gutter-xl q-pa-sm">
|
|
|
|
|
<ItemCard
|
|
|
|
|
class="col"
|
|
|
|
|
v-for="i in itemCard"
|
|
|
|
|
changeColor
|
|
|
|
|
:key="i.text"
|
|
|
|
|
:icon="i.icon"
|
|
|
|
|
:text="i.text"
|
|
|
|
|
:color="i.color"
|
|
|
|
|
@trigger="
|
|
|
|
|
() => {
|
|
|
|
|
dialogProductServiceType = false;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</FormDialog>
|
|
|
|
|
|
|
|
|
|
<FormDialog
|
|
|
|
|
v-model:modal="dialogTotalProduct"
|
|
|
|
|
noAddress
|
|
|
|
|
noAppBox
|
2024-06-19 18:00:38 +07:00
|
|
|
title="สินค้าทั้งหมด"
|
2024-06-11 15:11:55 +07:00
|
|
|
:submit="
|
|
|
|
|
() => {
|
2024-06-20 18:02:02 +07:00
|
|
|
selectProduct.forEach((i) => {
|
|
|
|
|
workItems[currentWorkIndex].product.push({
|
|
|
|
|
...i,
|
|
|
|
|
nameEn: '',
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
dialogTotalProduct = false;
|
|
|
|
|
selectProduct = [];
|
2024-06-11 15:11:55 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-06-24 13:07:00 +07:00
|
|
|
:close="
|
|
|
|
|
() => {
|
2024-06-25 09:45:55 +07:00
|
|
|
dialogTotalProduct = false;
|
2024-06-25 14:51:58 +07:00
|
|
|
inputSearchProductAndService = '';
|
2024-06-24 13:07:00 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-06-11 15:11:55 +07:00
|
|
|
>
|
2024-06-25 09:45:55 +07:00
|
|
|
<div class="full-width full-height">
|
2024-06-24 13:53:22 +07:00
|
|
|
<div class="row items-center">
|
2024-06-19 18:00:38 +07:00
|
|
|
<q-space />
|
|
|
|
|
<q-input
|
|
|
|
|
outlined
|
2024-07-09 11:54:03 +07:00
|
|
|
style="width: 250px"
|
2024-06-19 18:00:38 +07:00
|
|
|
dense
|
|
|
|
|
:label="$t('search')"
|
|
|
|
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
2024-06-25 14:51:58 +07:00
|
|
|
v-model="inputSearchProductAndService"
|
2024-06-19 18:00:38 +07:00
|
|
|
debounce="500"
|
2024-06-24 13:07:00 +07:00
|
|
|
@update:model-value="searchProduct()"
|
2024-06-19 18:00:38 +07:00
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="mdi-magnify" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
2024-06-13 15:59:09 +07:00
|
|
|
</div>
|
2024-06-24 13:53:22 +07:00
|
|
|
<div>
|
2024-07-09 11:54:03 +07:00
|
|
|
<AppBox
|
|
|
|
|
no-padding
|
|
|
|
|
class="row q-mt-sm q-col-gutter-sm"
|
|
|
|
|
style="background: none"
|
|
|
|
|
>
|
2024-06-25 09:45:55 +07:00
|
|
|
<div
|
|
|
|
|
class="col-12 text-center"
|
|
|
|
|
v-if="resultSearchProduct?.length === 0"
|
|
|
|
|
>
|
|
|
|
|
<NoData />
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-06-24 13:53:22 +07:00
|
|
|
<div
|
|
|
|
|
:class="`${$q.screen.gt.sm ? 'col-3 ' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`"
|
2024-06-25 14:51:58 +07:00
|
|
|
v-for="i in (!!inputSearchProductAndService
|
2024-06-24 13:53:22 +07:00
|
|
|
? resultSearchProduct
|
2024-06-27 09:41:39 +07:00
|
|
|
: productIsAdd
|
2024-06-24 13:53:22 +07:00
|
|
|
)?.filter((i) => {
|
|
|
|
|
if (i.status === 'INACTIVE') {
|
|
|
|
|
return false;
|
2024-06-20 15:05:44 +07:00
|
|
|
}
|
2024-06-24 13:53:22 +07:00
|
|
|
return true;
|
|
|
|
|
})"
|
|
|
|
|
:key="i.id"
|
|
|
|
|
>
|
|
|
|
|
<TotalProductCardComponent
|
|
|
|
|
:index="selectProduct.findIndex((v) => v.id === i.id)"
|
|
|
|
|
:isAddProduct="!!selectProduct.find((v) => v.id === i.id)"
|
|
|
|
|
:isSelected="true"
|
2024-06-25 14:31:08 +07:00
|
|
|
:data="{ ...i, type: 'product' }"
|
2024-06-24 13:53:22 +07:00
|
|
|
:title="i.name"
|
|
|
|
|
:status="i.status === 'INACTIVE' ? true : false"
|
|
|
|
|
@menuViewDetail="
|
|
|
|
|
() => {
|
|
|
|
|
currentIdProduct = i.id;
|
|
|
|
|
assignFormDataProduct(i);
|
|
|
|
|
dialogProductEdit = true;
|
2024-06-20 15:05:44 +07:00
|
|
|
}
|
2024-06-24 13:53:22 +07:00
|
|
|
"
|
|
|
|
|
@menuEdit="
|
|
|
|
|
() => {
|
|
|
|
|
currentIdProduct = i.id;
|
|
|
|
|
infoProductEdit = true;
|
|
|
|
|
assignFormDataProduct(i);
|
|
|
|
|
dialogProductEdit = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@viewDetail="
|
|
|
|
|
() => {
|
|
|
|
|
currentIdProduct = i.id;
|
|
|
|
|
infoProductEdit = false;
|
|
|
|
|
assignFormDataProduct(i);
|
|
|
|
|
dialogProductEdit = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@select="
|
|
|
|
|
(data) => {
|
|
|
|
|
const tempValue = selectProduct.find((v) => v.id === i.id);
|
|
|
|
|
|
|
|
|
|
if (tempValue) {
|
|
|
|
|
selectProduct = selectProduct.filter((v) => v.id !== i.id);
|
|
|
|
|
} else {
|
|
|
|
|
selectProduct.push(data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</AppBox>
|
|
|
|
|
</div>
|
2024-06-19 18:00:38 +07:00
|
|
|
</div>
|
2024-06-11 15:11:55 +07:00
|
|
|
</FormDialog>
|
2024-06-14 14:45:17 +07:00
|
|
|
|
2024-06-17 17:59:09 +07:00
|
|
|
<!-- Add Product -->
|
2024-06-14 14:45:17 +07:00
|
|
|
<FormDialog
|
|
|
|
|
v-model:modal="dialogProduct"
|
|
|
|
|
noAddress
|
2024-06-19 13:51:45 +07:00
|
|
|
:title="$t('buttonAddProduct')"
|
2024-06-14 14:45:17 +07:00
|
|
|
:submit="
|
|
|
|
|
() => {
|
2024-06-17 17:59:09 +07:00
|
|
|
submitProduct();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:close="
|
|
|
|
|
() => {
|
|
|
|
|
dialogProduct = false;
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-17 17:59:09 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<template #prepend>
|
|
|
|
|
<ProfileUpload
|
|
|
|
|
isProduct
|
|
|
|
|
v-model:url-profile="profileUrl"
|
|
|
|
|
v-model:status-toggle="statusToggle"
|
|
|
|
|
v-model:profile-submit="profileSubmit"
|
|
|
|
|
@input-file="inputFile.click()"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
2024-06-21 08:49:20 +00:00
|
|
|
<template #information>
|
2024-06-17 17:59:09 +07:00
|
|
|
<BasicInfoProduct
|
2024-07-04 11:38:10 +07:00
|
|
|
:options-branch="branchOption"
|
|
|
|
|
v-model:registered-branch-id="formDataProduct.registeredBranchId"
|
2024-06-17 17:59:09 +07:00
|
|
|
v-model:detail="formDataProduct.detail"
|
|
|
|
|
v-model:remark="formDataProduct.remark"
|
|
|
|
|
v-model:name="formDataProduct.name"
|
|
|
|
|
v-model:code="formDataProduct.code"
|
2024-06-18 16:35:40 +07:00
|
|
|
v-model:process="formDataProduct.process"
|
2024-06-17 17:59:09 +07:00
|
|
|
dense
|
|
|
|
|
separator
|
|
|
|
|
/>
|
2024-06-21 08:49:20 +00:00
|
|
|
</template>
|
|
|
|
|
<template #person>
|
2024-06-17 17:59:09 +07:00
|
|
|
<PriceDataComponent
|
|
|
|
|
v-model:price="formDataProduct.price"
|
|
|
|
|
v-model:agent-price="formDataProduct.agentPrice"
|
|
|
|
|
v-model:service-charge="formDataProduct.serviceCharge"
|
|
|
|
|
dense
|
|
|
|
|
/>
|
2024-06-21 08:49:20 +00:00
|
|
|
</template>
|
2024-06-17 17:59:09 +07:00
|
|
|
</FormDialog>
|
|
|
|
|
|
|
|
|
|
<!-- edit product -->
|
|
|
|
|
<FormDialog
|
2024-06-24 13:07:00 +07:00
|
|
|
:edit="!(formDataProduct.status === 'INACTIVE')"
|
2024-06-19 13:51:45 +07:00
|
|
|
:isEdit="infoProductEdit"
|
|
|
|
|
v-model:modal="dialogProductEdit"
|
2024-06-17 17:59:09 +07:00
|
|
|
noAddress
|
2024-06-19 13:51:45 +07:00
|
|
|
:title="$t('editProduct')"
|
|
|
|
|
:editData="() => (infoProductEdit = true)"
|
2024-06-25 14:58:56 +07:00
|
|
|
:undo="
|
|
|
|
|
() => {
|
|
|
|
|
formDataProduct = { ...prevProduct };
|
|
|
|
|
infoProductEdit = false;
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-25 14:58:56 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-06-19 13:51:45 +07:00
|
|
|
:deleteData="
|
|
|
|
|
() => {
|
|
|
|
|
deleteTypeOfProduct();
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-06-17 17:59:09 +07:00
|
|
|
:submit="
|
|
|
|
|
() => {
|
|
|
|
|
submitProduct();
|
2024-06-14 14:45:17 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:close="
|
|
|
|
|
() => {
|
2024-06-19 13:51:45 +07:00
|
|
|
dialogProductEdit = false;
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-14 14:45:17 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<template #prepend>
|
|
|
|
|
<ProfileUpload
|
|
|
|
|
isProduct
|
|
|
|
|
v-model:url-profile="profileUrl"
|
|
|
|
|
v-model:status-toggle="statusToggle"
|
|
|
|
|
v-model:profile-submit="profileSubmit"
|
|
|
|
|
@input-file="inputFile.click()"
|
2024-06-20 13:59:25 +07:00
|
|
|
:label-status-toggle="'formDialogTitleProductStatus'"
|
2024-06-14 14:45:17 +07:00
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
2024-06-21 08:49:20 +00:00
|
|
|
<template #information>
|
2024-06-17 17:59:09 +07:00
|
|
|
<BasicInfoProduct
|
2024-07-04 11:38:10 +07:00
|
|
|
:options-branch="branchOption"
|
2024-06-19 13:51:45 +07:00
|
|
|
:readonly="!infoProductEdit"
|
2024-07-04 11:38:10 +07:00
|
|
|
v-model:registered-branch-id="formDataProduct.registeredBranchId"
|
2024-06-17 17:59:09 +07:00
|
|
|
v-model:detail="formDataProduct.detail"
|
|
|
|
|
v-model:remark="formDataProduct.remark"
|
|
|
|
|
v-model:name="formDataProduct.name"
|
|
|
|
|
v-model:code="formDataProduct.code"
|
2024-06-18 16:39:34 +07:00
|
|
|
v-model:process="formDataProduct.process"
|
2024-06-17 17:59:09 +07:00
|
|
|
dense
|
|
|
|
|
separator
|
|
|
|
|
/>
|
2024-06-21 08:49:20 +00:00
|
|
|
</template>
|
|
|
|
|
<template #person>
|
2024-06-17 17:59:09 +07:00
|
|
|
<PriceDataComponent
|
2024-06-19 13:51:45 +07:00
|
|
|
:readonly="!infoProductEdit"
|
2024-06-17 17:59:09 +07:00
|
|
|
v-model:price="formDataProduct.price"
|
|
|
|
|
v-model:agent-price="formDataProduct.agentPrice"
|
|
|
|
|
v-model:service-charge="formDataProduct.serviceCharge"
|
|
|
|
|
dense
|
|
|
|
|
/>
|
2024-06-21 08:49:20 +00:00
|
|
|
</template>
|
2024-06-14 14:45:17 +07:00
|
|
|
</FormDialog>
|
2024-06-18 02:01:02 +00:00
|
|
|
|
2024-06-18 11:47:53 +00:00
|
|
|
<!-- add service -->
|
2024-06-18 02:01:02 +00:00
|
|
|
<FormDialog
|
|
|
|
|
no-address
|
2024-06-25 09:35:06 +00:00
|
|
|
no-app-box
|
2024-06-21 08:49:20 +00:00
|
|
|
height="95vh"
|
2024-06-18 02:01:02 +00:00
|
|
|
:title="$t('addService')"
|
|
|
|
|
v-model:modal="dialogService"
|
2024-06-28 02:21:21 +00:00
|
|
|
:tabs-list="serviceTab"
|
2024-06-18 02:01:02 +00:00
|
|
|
v-model:current-tab="currentServiceTab"
|
2024-06-21 11:40:18 +07:00
|
|
|
:submit="
|
|
|
|
|
() => {
|
|
|
|
|
submitService();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:close="
|
|
|
|
|
() => {
|
2024-06-24 09:07:06 +00:00
|
|
|
clearFormService();
|
2024-06-21 11:40:18 +07:00
|
|
|
dialogService = false;
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-21 11:40:18 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-06-18 02:01:02 +00:00
|
|
|
>
|
|
|
|
|
<template #prepend>
|
|
|
|
|
<ProfileUpload
|
2024-06-18 02:28:29 +00:00
|
|
|
isService
|
2024-06-18 02:01:02 +00:00
|
|
|
v-model:url-profile="profileUrl"
|
|
|
|
|
v-model:status-toggle="statusToggle"
|
|
|
|
|
v-model:profile-submit="profileSubmit"
|
|
|
|
|
@input-file="inputFile.click()"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
2024-07-01 08:40:37 +00:00
|
|
|
<div
|
|
|
|
|
v-if="currentServiceTab === 'serviceInformation'"
|
|
|
|
|
class="col-md-10 col-sm-12"
|
|
|
|
|
>
|
2024-06-25 09:35:06 +00:00
|
|
|
<div class="surface-1 rounded bordered q-pa-lg full-width row">
|
|
|
|
|
<BasicInformation
|
|
|
|
|
dense
|
|
|
|
|
service
|
2024-07-04 13:28:28 +07:00
|
|
|
:options-branch="branchOption"
|
|
|
|
|
v-model:registered-branch-id="
|
|
|
|
|
formDataProductService.registeredBranchId
|
|
|
|
|
"
|
2024-06-25 09:35:06 +00:00
|
|
|
v-model:service-code="formDataProductService.code"
|
|
|
|
|
v-model:service-description="formDataProductService.detail"
|
|
|
|
|
v-model:service-name-th="formDataProductService.name"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="surface-1 rounded bordered q-mt-md q-pa-lg row">
|
|
|
|
|
<FormServiceProperties
|
|
|
|
|
v-model:service-attributes="formDataProductService.attributes"
|
|
|
|
|
@service-properties="
|
|
|
|
|
() => {
|
|
|
|
|
tempValueProperties = formDataProductService.attributes;
|
|
|
|
|
openPropertiesDialog('service');
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
v-if="currentServiceTab === 'workInformation'"
|
2024-07-01 08:40:37 +00:00
|
|
|
class="surface-1 rounded bordered col-md-10 col-sm-12 q-pa-lg"
|
2024-06-25 09:35:06 +00:00
|
|
|
>
|
2024-06-18 02:01:02 +00:00
|
|
|
<FormServiceWork
|
2024-06-20 18:02:02 +07:00
|
|
|
v-model:work-items="workItems"
|
2024-06-18 02:01:02 +00:00
|
|
|
dense
|
2024-06-20 18:02:02 +07:00
|
|
|
@addProduct="
|
2024-06-25 14:31:08 +07:00
|
|
|
async (index) => {
|
2024-06-27 09:41:39 +07:00
|
|
|
await fetchListOfProductIsAdd(currentIdType);
|
2024-06-20 18:02:02 +07:00
|
|
|
currentWorkIndex = index;
|
|
|
|
|
dialogTotalProduct = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-06-21 15:59:18 +07:00
|
|
|
@manage-work-name="
|
|
|
|
|
() => {
|
|
|
|
|
manageWorkNameDialog = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-06-20 18:02:02 +07:00
|
|
|
@work-properties="
|
|
|
|
|
(index) => {
|
|
|
|
|
currentWorkIndex = index;
|
|
|
|
|
tempValueProperties = workItems[index].attributes;
|
|
|
|
|
openPropertiesDialog('work');
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-06-18 02:01:02 +00:00
|
|
|
/>
|
2024-06-25 09:35:06 +00:00
|
|
|
</div>
|
2024-06-18 02:01:02 +00:00
|
|
|
</FormDialog>
|
2024-06-18 11:47:53 +00:00
|
|
|
|
|
|
|
|
<!-- service properties -->
|
|
|
|
|
<FormDialog
|
|
|
|
|
no-address
|
|
|
|
|
no-app-box
|
2024-06-24 02:19:41 +00:00
|
|
|
height="75vh"
|
2024-06-18 11:47:53 +00:00
|
|
|
width="75%"
|
2024-06-24 04:45:58 +00:00
|
|
|
:title="$t('properties')"
|
2024-06-18 11:47:53 +00:00
|
|
|
v-model:modal="propertiesDialog"
|
2024-06-20 18:02:02 +07:00
|
|
|
:submit="
|
|
|
|
|
() => {
|
|
|
|
|
if (currentPropertiesMode === 'service') {
|
|
|
|
|
formDataProductService.attributes = tempValueProperties;
|
|
|
|
|
}
|
|
|
|
|
if (currentPropertiesMode === 'work') {
|
|
|
|
|
workItems[currentWorkIndex].attributes = tempValueProperties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
propertiesDialog = false;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:close="
|
|
|
|
|
() => {
|
|
|
|
|
propertiesDialog = false;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-06-18 11:47:53 +00:00
|
|
|
>
|
|
|
|
|
<ServiceProperties
|
2024-06-20 09:10:34 +00:00
|
|
|
v-model:properties-option="propertiesOption"
|
2024-06-20 18:02:02 +07:00
|
|
|
v-model:form-service-properties="tempValueProperties"
|
2024-06-18 11:47:53 +00:00
|
|
|
/>
|
|
|
|
|
</FormDialog>
|
2024-06-20 09:10:34 +00:00
|
|
|
|
|
|
|
|
<!-- manage work name -->
|
|
|
|
|
<FormDialog
|
|
|
|
|
no-address
|
|
|
|
|
no-app-box
|
2024-06-21 11:06:35 +00:00
|
|
|
no-footer
|
2024-06-24 02:19:41 +00:00
|
|
|
height="65vh"
|
2024-06-20 09:10:34 +00:00
|
|
|
width="65%"
|
|
|
|
|
v-model:modal="manageWorkNameDialog"
|
2024-06-24 09:01:44 +00:00
|
|
|
:title="$t('manage')"
|
|
|
|
|
:close="triggerConfirmCloseWork"
|
2024-06-20 09:10:34 +00:00
|
|
|
>
|
2024-06-21 11:06:35 +00:00
|
|
|
<WorkNameManagement
|
|
|
|
|
ref="workNameRef"
|
|
|
|
|
v-model:nameList="workNameItems"
|
|
|
|
|
@delete="confirmDeleteWork"
|
|
|
|
|
@edit="editWork"
|
|
|
|
|
@add="createWork"
|
|
|
|
|
/>
|
2024-06-20 09:10:34 +00:00
|
|
|
</FormDialog>
|
2024-06-21 14:50:43 +07:00
|
|
|
|
|
|
|
|
<!-- edit service -->
|
|
|
|
|
<FormDialog
|
|
|
|
|
no-address
|
2024-06-25 11:04:34 +00:00
|
|
|
:no-app-box="currentServiceTab !== 'workInformation'"
|
2024-06-24 16:53:33 +07:00
|
|
|
:edit="!(formDataProductService.status === 'INACTIVE')"
|
2024-06-24 10:13:23 +00:00
|
|
|
height="95vh"
|
2024-06-21 14:50:43 +07:00
|
|
|
:isEdit="infoServiceEdit"
|
|
|
|
|
:title="$t('service', { msg: formDataProductService.name })"
|
2024-06-28 02:21:21 +00:00
|
|
|
:tabs-list="serviceTab"
|
2024-06-21 14:50:43 +07:00
|
|
|
v-model:modal="dialogServiceEdit"
|
|
|
|
|
v-model:current-tab="currentServiceTab"
|
|
|
|
|
:submit="
|
|
|
|
|
() => {
|
|
|
|
|
submitService();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:close="
|
|
|
|
|
() => {
|
|
|
|
|
clearFormService();
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-21 14:50:43 +07:00
|
|
|
dialogServiceEdit = false;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:edit-data="
|
|
|
|
|
() => {
|
|
|
|
|
infoServiceEdit = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-06-24 16:53:33 +07:00
|
|
|
:undo="
|
|
|
|
|
() => {
|
|
|
|
|
infoServiceEdit = false;
|
2024-06-26 17:44:13 +07:00
|
|
|
cloneData();
|
2024-06-24 16:53:33 +07:00
|
|
|
statusToggle = prevService.status === 'INACTIVE' ? false : true;
|
2024-06-26 17:21:26 +07:00
|
|
|
flowStore.rotate();
|
2024-06-24 16:53:33 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-06-21 14:50:43 +07:00
|
|
|
:delete-data="() => deleteServiceById()"
|
|
|
|
|
>
|
|
|
|
|
<template #prepend>
|
|
|
|
|
<ProfileUpload
|
|
|
|
|
isService
|
2024-07-01 11:04:24 +00:00
|
|
|
:readonly="!infoServiceEdit"
|
2024-06-21 14:50:43 +07:00
|
|
|
v-model:url-profile="profileUrl"
|
|
|
|
|
v-model:status-toggle="statusToggle"
|
|
|
|
|
v-model:profile-submit="profileSubmit"
|
|
|
|
|
@input-file="inputFile.click()"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
2024-06-25 11:04:34 +00:00
|
|
|
<div
|
|
|
|
|
v-if="currentServiceTab === 'serviceInformation'"
|
|
|
|
|
class="col-md-10 col-sm-12"
|
|
|
|
|
>
|
2024-06-25 09:35:06 +00:00
|
|
|
<div class="surface-1 rounded bordered q-pa-lg full-width row">
|
|
|
|
|
<BasicInformation
|
|
|
|
|
:readonly="!infoServiceEdit"
|
|
|
|
|
v-if="currentServiceTab === 'serviceInformation'"
|
|
|
|
|
dense
|
|
|
|
|
service
|
2024-07-04 13:28:28 +07:00
|
|
|
:options-branch="branchOption"
|
|
|
|
|
v-model:registered-branch-id="
|
|
|
|
|
formDataProductService.registeredBranchId
|
|
|
|
|
"
|
2024-06-25 09:35:06 +00:00
|
|
|
v-model:service-code="formDataProductService.code"
|
|
|
|
|
v-model:service-description="formDataProductService.detail"
|
|
|
|
|
v-model:service-name-th="formDataProductService.name"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="surface-1 rounded bordered q-mt-md q-pa-lg row">
|
|
|
|
|
<FormServiceProperties
|
|
|
|
|
:readonly="!infoServiceEdit"
|
|
|
|
|
v-model:service-attributes="formDataProductService.attributes"
|
|
|
|
|
@service-properties="
|
|
|
|
|
() => {
|
|
|
|
|
tempValueProperties = formDataProductService.attributes;
|
|
|
|
|
openPropertiesDialog('service');
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-06-25 11:04:34 +00:00
|
|
|
<template #information>
|
2024-06-21 14:50:43 +07:00
|
|
|
<FormServiceWork
|
|
|
|
|
:readonly="!infoServiceEdit"
|
|
|
|
|
v-model:work-items="workItems"
|
|
|
|
|
v-if="currentServiceTab === 'workInformation'"
|
|
|
|
|
dense
|
|
|
|
|
@addProduct="
|
2024-06-25 14:31:08 +07:00
|
|
|
async (index) => {
|
2024-07-09 11:54:03 +07:00
|
|
|
await fetchListOfProductIsAdd(currentIdType);
|
2024-06-21 14:50:43 +07:00
|
|
|
currentWorkIndex = index;
|
|
|
|
|
dialogTotalProduct = true;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@manage-work-name="manageWorkNameDialog = true"
|
|
|
|
|
@work-properties="
|
|
|
|
|
(index) => {
|
|
|
|
|
currentWorkIndex = index;
|
|
|
|
|
tempValueProperties = workItems[index].attributes;
|
|
|
|
|
openPropertiesDialog('work');
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
2024-06-25 11:04:34 +00:00
|
|
|
</template>
|
2024-06-21 14:50:43 +07:00
|
|
|
</FormDialog>
|
2024-06-10 16:42:59 +07:00
|
|
|
</template>
|
|
|
|
|
|
2024-06-11 12:01:35 +07:00
|
|
|
<style scoped>
|
|
|
|
|
.hover-underline:hover {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
}
|
2024-07-09 14:38:22 +07:00
|
|
|
|
|
|
|
|
.status-active {
|
|
|
|
|
--_branch-status-color: var(--green-6-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-inactive {
|
|
|
|
|
--_branch-status-color: var(--red-4-hsl);
|
|
|
|
|
--_branch-badge-bg: var(--red-4-hsl);
|
|
|
|
|
filter: grayscale(0.5);
|
|
|
|
|
opacity: 0.5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon-color-purple {
|
|
|
|
|
--_color: var(--violet-11-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon-color-pink {
|
|
|
|
|
--_color: var(--pink-6-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon-color-orange {
|
|
|
|
|
--_color: var(--orange-5-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon-color-green {
|
|
|
|
|
--_color: var(--teal-10-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dark .icon-color-purple {
|
|
|
|
|
--_color: var(--violet-10-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dark .icon-color-green {
|
|
|
|
|
--_color: var(--teal-8-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dark .icon-color-orange {
|
|
|
|
|
--_color: var(--orange-6-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-09 15:23:42 +07:00
|
|
|
.table__icon {
|
2024-07-09 14:38:22 +07:00
|
|
|
|
|
|
|
|
background-color: hsla(var(--_color) / 0.15);
|
|
|
|
|
color: hsla(var(--_color) / 1);
|
|
|
|
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
padding: var(--size-1);
|
|
|
|
|
position: relative;
|
|
|
|
|
transform: rotate(45deg);
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
content: ' ';
|
|
|
|
|
display: block;
|
|
|
|
|
block-size: 0.5rem;
|
|
|
|
|
aspect-ratio: 1;
|
|
|
|
|
position: absolute;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
right: -0.1rem;
|
|
|
|
|
top: calc(50% - 0.25rem);
|
|
|
|
|
bottom: calc(50% - 0.25rem);
|
|
|
|
|
background-color: hsla(var(--_branch-status-color) / 1);
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-09 15:23:42 +07:00
|
|
|
&:deep(.q-icon) {
|
2024-07-09 14:38:22 +07:00
|
|
|
transform: rotate(-45deg);
|
|
|
|
|
color: hsla(var(--_branch-card-bg) / 1);
|
|
|
|
|
}
|
2024-07-09 15:23:42 +07:00
|
|
|
|
|
|
|
|
|
2024-07-09 14:38:22 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-11 12:01:35 +07:00
|
|
|
</style>
|
2024-07-09 14:38:22 +07:00
|
|
|
toggleStatusGroup(props.row
|