From 9fe5da494dc8544aa9f5ff4c47bd1d750b6a67ca Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 25 Feb 2025 17:12:54 +0700 Subject: [PATCH 01/14] feat!: remove local build and use gitea instead --- .github/workflows/local-build-dev.yaml | 31 -------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .github/workflows/local-build-dev.yaml diff --git a/.github/workflows/local-build-dev.yaml b/.github/workflows/local-build-dev.yaml deleted file mode 100644 index 43d852cf..00000000 --- a/.github/workflows/local-build-dev.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: local-build-dev - -# Intended for local network use. -# Remote access is possible if the host has a public IP address. - -on: - workflow_dispatch: - -env: - REGISTRY: ${{ vars.DOCKER_REGISTRY }} - -jobs: - local-build-dev: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - config-inline: | - [registry."${{ env.REGISTRY }}"] - http = true - insecure = true - - name: Build and Push Docker Image - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/amd64 - push: true - tags: ${{ env.REGISTRY }}/jws/jws-frontend:dev - allow: security.insecure From e225a6afb17c71138254e16406fdb3249892bb95 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 25 Feb 2025 18:01:52 +0700 Subject: [PATCH 02/14] feat: add spellcheck workflow --- .github/workflows/spellcheck.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/spellcheck.yaml diff --git a/.github/workflows/spellcheck.yaml b/.github/workflows/spellcheck.yaml new file mode 100644 index 00000000..7a850773 --- /dev/null +++ b/.github/workflows/spellcheck.yaml @@ -0,0 +1,24 @@ +name: Spelling + +permissions: + contents: read + +on: + push: + branches: + - develop + +env: + CLICOLOR: 1 + +jobs: + spelling: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Spell Check Repo + uses: crate-ci/typos@v1.29.9 + with: + files: ./src From 4d7c4964de840a781711234ee0229266e40660a9 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 26 Feb 2025 09:53:19 +0700 Subject: [PATCH 03/14] feat: swap save and edit button logic in credit note form --- src/pages/11_credit-note/FormPage.vue | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/pages/11_credit-note/FormPage.vue b/src/pages/11_credit-note/FormPage.vue index a38098e9..0dde0352 100644 --- a/src/pages/11_credit-note/FormPage.vue +++ b/src/pages/11_credit-note/FormPage.vue @@ -853,6 +853,21 @@ onMounted(async () => { :label="$t('dialog.action.close')" outlined /> + + - - From c9483465b00a9e41db75f67bf3e735dcf0603014 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Wed, 26 Feb 2025 09:54:44 +0700 Subject: [PATCH 04/14] refactor:handle btn close tab --- src/pages/12_debit-note/FormPage.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/12_debit-note/FormPage.vue b/src/pages/12_debit-note/FormPage.vue index 9224cc4c..df375d65 100644 --- a/src/pages/12_debit-note/FormPage.vue +++ b/src/pages/12_debit-note/FormPage.vue @@ -1296,7 +1296,10 @@ async function submitAccepted() { id="btn-close" @click="closeTab()" :label="$t('dialog.action.close')" - v-if="pageState.mode === 'info' && closeAble()" + v-if=" + (pageState.mode === 'info' || pageState.mode === 'create') && + closeAble() + " />
From 4c23cecc5cb3e716b3598038239987f927e38390 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 26 Feb 2025 10:55:57 +0700 Subject: [PATCH 05/14] refactor: action --- .../gitea-local.yaml => .forgejo/workflows/deploy.yaml | 6 +----- {.github => .forgejo}/workflows/spellcheck.yaml | 7 ++----- 2 files changed, 3 insertions(+), 10 deletions(-) rename .github/workflows/gitea-local.yaml => .forgejo/workflows/deploy.yaml (97%) rename {.github => .forgejo}/workflows/spellcheck.yaml (85%) diff --git a/.github/workflows/gitea-local.yaml b/.forgejo/workflows/deploy.yaml similarity index 97% rename from .github/workflows/gitea-local.yaml rename to .forgejo/workflows/deploy.yaml index 6b2afdbe..73067494 100644 --- a/.github/workflows/gitea-local.yaml +++ b/.forgejo/workflows/deploy.yaml @@ -1,8 +1,4 @@ -name: Gitea Action - -run-name: Build ${{ github.actor }} - -# Intended for local gitea instance only. +name: Deploy Local on: workflow_dispatch: diff --git a/.github/workflows/spellcheck.yaml b/.forgejo/workflows/spellcheck.yaml similarity index 85% rename from .github/workflows/spellcheck.yaml rename to .forgejo/workflows/spellcheck.yaml index 7a850773..b6a397f3 100644 --- a/.github/workflows/spellcheck.yaml +++ b/.forgejo/workflows/spellcheck.yaml @@ -1,12 +1,9 @@ -name: Spelling +name: Spell Check permissions: contents: read -on: - push: - branches: - - develop +on: [push, pull_request] env: CLICOLOR: 1 From d4d8f0268e927709ef75224821b206aed4b0fad1 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 26 Feb 2025 12:00:47 +0700 Subject: [PATCH 06/14] feat(conf): add typos ignore condition --- .typos.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .typos.toml diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 00000000..5664db5d --- /dev/null +++ b/.typos.toml @@ -0,0 +1,2 @@ +[default] +extend-ignore-re = ["(?Rm)^.*(#|//)\\s*spellchecker:disable-line$"] From 16bcecc8d62afc48d98a29368271ed1a3d380afe Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 26 Feb 2025 15:19:57 +0700 Subject: [PATCH 07/14] feat: add support for 'Restart' task status in task order management --- src/pages/09_task-order/TableEmployee.vue | 26 +++++++++- .../09_task-order/TaskStatusComponent.vue | 3 +- .../09_task-order/order_view/MainPage.vue | 48 +++++++++++++------ 3 files changed, 59 insertions(+), 18 deletions(-) diff --git a/src/pages/09_task-order/TableEmployee.vue b/src/pages/09_task-order/TableEmployee.vue index ea78c7d4..e8b931cc 100644 --- a/src/pages/09_task-order/TableEmployee.vue +++ b/src/pages/09_task-order/TableEmployee.vue @@ -113,7 +113,8 @@ function handleCheckAll() { validate ? status === TaskStatus.Success || status === TaskStatus.Complete || - status === TaskStatus.Redo + status === TaskStatus.Redo || + status === TaskStatus.Restart : status === TaskStatus.Failed || status === TaskStatus.Success || status === TaskStatus.Complete || @@ -196,6 +197,7 @@ function handleCheck( row.taskStatus === TaskStatus.Success || row.taskStatus === TaskStatus.Complete || row.taskStatus === TaskStatus.Redo || + row.taskStatus === TaskStatus.Restart || (selectedEmployee.value.length > 0 && selectedEmployee.value.some((v) => v._template?.id !== row._template?.id)) ) { @@ -311,7 +313,7 @@ function disableCheckAll() { class="" > - + + + {{ $t(`taskOrder.status.Restart`) }} + 0 && selectedEmployee.some( (v) => v._template?.id !== props.row._template?.id, diff --git a/src/pages/09_task-order/TaskStatusComponent.vue b/src/pages/09_task-order/TaskStatusComponent.vue index 2ab602d8..30a7195b 100644 --- a/src/pages/09_task-order/TaskStatusComponent.vue +++ b/src/pages/09_task-order/TaskStatusComponent.vue @@ -41,7 +41,8 @@ function inactiveCheck() { currStatus.value?.value === TaskStatus.Redo || currStatus.value?.value === TaskStatus.Success || currStatus.value?.value === TaskStatus.Complete || - currStatus.value?.value === TaskStatus.Canceled + currStatus.value?.value === TaskStatus.Canceled || + currStatus.value?.value === TaskStatus.Restart ); } diff --git a/src/pages/09_task-order/order_view/MainPage.vue b/src/pages/09_task-order/order_view/MainPage.vue index 9b13b24d..bb69f6e6 100644 --- a/src/pages/09_task-order/order_view/MainPage.vue +++ b/src/pages/09_task-order/order_view/MainPage.vue @@ -227,6 +227,7 @@ const messengerListGroup = computed(() => }); if (indexUser === -1) { + // If user does not exist in acc, create a new entry acc.push({ responsibleUser: task.responsibleUser, list: [ @@ -236,27 +237,38 @@ const messengerListGroup = computed(() => }, ], }); - if (selectedEmployee.value.length < acc.length) { - selectedEmployee.value.push([[]]); - } - } + } else { + const userEntry = acc[indexUser]; - if (indexUser !== -1) { - const indexProduct = acc[indexUser].list.findIndex( + // Find product in user's list + const indexProduct = userEntry.list.findIndex( (v) => v.product.id === task.requestWork.productService.product.id, ); if (indexProduct === -1) { - acc[indexUser].list.push({ + // If product does not exist in user's list, add it + userEntry.list.push({ product: task.requestWork.productService.product, list: [record], }); - } - - if (indexProduct !== -1) { - acc[indexUser].list[indexProduct].list.push(record); + } else { + // Append task to the correct product's list + userEntry.list[indexProduct].list.push(record); } } + + // Ensure `selectedEmployee.value` grows dynamically + while (selectedEmployee.value.length < acc.length) { + selectedEmployee.value.push([]); + } + + acc.forEach((accItem, index) => { + const length = accItem.list.length; + + while (selectedEmployee.value[index].length < length) { + selectedEmployee.value[index].push([]); + } + }); } return acc; @@ -1106,15 +1118,21 @@ watch( step-on :checkbox-on=" view === TaskOrderStatus.Validate && - fullTaskOrder?.userTask.find( + (fullTaskOrder?.userTask.find( (l) => l.userId === v.responsibleUser.id, - )?.userTaskStatus === UserTaskStatus.Submit + )?.userTaskStatus === UserTaskStatus.Submit || + fullTaskOrder?.userTask.find( + (l) => l.userId === v.responsibleUser.id, + )?.userTaskStatus === UserTaskStatus.Restart) " :check-all=" - view === TaskOrderStatus.Validate && + (view === TaskOrderStatus.Validate && + fullTaskOrder?.userTask.find( + (l) => l.userId === v.responsibleUser.id, + )?.userTaskStatus === UserTaskStatus.Submit) || fullTaskOrder?.userTask.find( (l) => l.userId === v.responsibleUser.id, - )?.userTaskStatus === UserTaskStatus.Submit + )?.userTaskStatus === UserTaskStatus.Restart " :rows="sortList(list)" @change-all-status=" From 896e1ba360e2ebc79e9b30970de9b7aa1e1990c8 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 26 Feb 2025 16:09:44 +0700 Subject: [PATCH 08/14] feat: add disabled display field product service --- .../shared/table/TableProductAndService.vue | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/components/shared/table/TableProductAndService.vue b/src/components/shared/table/TableProductAndService.vue index e209eade..d5273a49 100644 --- a/src/components/shared/table/TableProductAndService.vue +++ b/src/components/shared/table/TableProductAndService.vue @@ -45,6 +45,8 @@ type ExclusiveProps = { type: 'service' | 'product'; grid?: boolean; disabledWorkerId?: string[]; + disabledProductFields?: (typeof columnsProduct)[number]['name'][]; + disabledServiceFields?: (typeof columnsService)[number]['name'][]; rows: Product[]; }; @@ -76,7 +78,7 @@ const columnsProduct = [ label: 'productService.product.priceInformation', field: (v: Product) => v, }, -] satisfies QTableColumn[]; +] as const satisfies QTableColumn[]; const columnsService = [ { @@ -110,7 +112,7 @@ const columnsService = [ label: 'general.createdAt', field: (v: Service) => dateFormatJS({ date: v.createdAt }), }, -] satisfies QTableColumn[]; +] as const satisfies QTableColumn[]; const props = defineProps(); @@ -165,7 +167,18 @@ function selectedIndex(item: any) { :props="props" > @@ -209,7 +222,17 @@ function selectedIndex(item: any) { class="text-center" > From 3b57812678faa0bf2cc1dec106bfa9fe51abd8bb Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Wed, 26 Feb 2025 16:17:12 +0700 Subject: [PATCH 09/14] refactor: add order in table --- .../shared/table/TableProductAndService.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/shared/table/TableProductAndService.vue b/src/components/shared/table/TableProductAndService.vue index d5273a49..e1801167 100644 --- a/src/components/shared/table/TableProductAndService.vue +++ b/src/components/shared/table/TableProductAndService.vue @@ -58,6 +58,13 @@ const columnsProduct = [ field: (_) => '#check', }, + { + name: 'order', + align: 'center', + label: 'general.order', + field: (e: Product & { _index: number }) => e._index + 1, + }, + { name: '#productName', align: 'left', @@ -87,6 +94,12 @@ const columnsService = [ label: '', field: (_) => '#check', }, + { + name: 'order', + align: 'center', + label: 'general.order', + field: (e: Service & { _index: number }) => e._index + 1, + }, { name: '#serviceName', From a856436095ad163443c12872e1a3cd8c8c73649a Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 26 Feb 2025 17:04:54 +0700 Subject: [PATCH 10/14] feat: add action dialog --- src/i18n/eng.ts | 4 + src/i18n/tha.ts | 4 + .../08_request-list/FormResponsibleUser.vue | 1 - src/pages/08_request-list/RequestAction.vue | 222 ++++++++++++++++++ 4 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 src/pages/08_request-list/RequestAction.vue diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 63508253..14cac28a 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -915,6 +915,10 @@ export default { salesRepresentative: 'Sales Representative', ref: 'Reference', + action: { + title: 'Action', + configure: 'Configure', + }, status: { work: { Pending: 'Await for order', diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index d60b0045..049b0771 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -904,6 +904,10 @@ export default { noWorkflowTemplate: 'คุณไม่ได้เลือกแม่แบบขั้นตอนการทำงาน', salesRepresentative: 'พนักงานขาย', ref: 'อ้างอิง', + action: { + title: 'จัดการ', + configure: 'กำหนดค่า', + }, status: { work: { Pending: 'รอสั่งงาน', diff --git a/src/pages/08_request-list/FormResponsibleUser.vue b/src/pages/08_request-list/FormResponsibleUser.vue index 5e407f57..b2bf9bb8 100644 --- a/src/pages/08_request-list/FormResponsibleUser.vue +++ b/src/pages/08_request-list/FormResponsibleUser.vue @@ -12,7 +12,6 @@ const responsibleUserId = defineModel('responsibleUserId', { defineProps<{ readonly?: boolean; districtId?: string; - cost?: boolean; }>(); watch(responsibleUserLocal, (lhs, rhs) => { diff --git a/src/pages/08_request-list/RequestAction.vue b/src/pages/08_request-list/RequestAction.vue new file mode 100644 index 00000000..ac3fe8ea --- /dev/null +++ b/src/pages/08_request-list/RequestAction.vue @@ -0,0 +1,222 @@ + + + + From 00aedd2fe924474724e5329be639ebc0660c7a60 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 27 Feb 2025 17:37:37 +0700 Subject: [PATCH 11/14] refactor(ci): use same var instead ssh host can use multiple by using comma (,) --- .forgejo/workflows/deploy.yaml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml index 73067494..cca3d42a 100644 --- a/.forgejo/workflows/deploy.yaml +++ b/.forgejo/workflows/deploy.yaml @@ -33,22 +33,14 @@ jobs: platforms: linux/amd64 tags: ${{ env.CONTAINER_IMAGE_NAME }} push: true - - name: Remote Deploy Development + - name: Remote Development uses: appleboy/ssh-action@v1.2.1 with: - host: ${{ vars.SSH_DEVELOPMENT_HOST }} - port: ${{ vars.SSH_DEVELOPMENT_PORT }} - username: ${{ secrets.SSH_DEVELOPMENT_USER }} - password: ${{ secrets.SSH_DEVELOPMENT_PASSWORD }} - script: eval "${{ secrets.SSH_DEVELOPMENT_DEPLOY_CMD }}" & wait - - name: Remote Deploy Test - uses: appleboy/ssh-action@v1.2.1 - with: - host: ${{ vars.SSH_TEST_HOST }} - port: ${{ vars.SSH_TEST_PORT }} - username: ${{ secrets.SSH_TEST_USER }} - password: ${{ secrets.SSH_TEST_PASSWORD }} - script: eval "${{ secrets.SSH_TEST_DEPLOY_CMD }}" & wait + host: ${{ vars.SSH_DEPLOY_HOST }} + port: ${{ vars.SSH_DEPLOY_PORT }} + username: ${{ secrets.SSH_DEPLOY_USER }} + password: ${{ secrets.SSH_DEPLOY_PASSWORD }} + script: eval "${{ secrets.SSH_DEPLOY_CMD }}" - name: Notify Discord Success if: success() run: | From 4dc26a3ccd8f5113d5b1688a2e8b8e3df2adcd5e Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 27 Feb 2025 17:42:32 +0700 Subject: [PATCH 12/14] fix(ci): step name --- .forgejo/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml index cca3d42a..86b83f01 100644 --- a/.forgejo/workflows/deploy.yaml +++ b/.forgejo/workflows/deploy.yaml @@ -33,7 +33,7 @@ jobs: platforms: linux/amd64 tags: ${{ env.CONTAINER_IMAGE_NAME }} push: true - - name: Remote Development + - name: Remote Deploy uses: appleboy/ssh-action@v1.2.1 with: host: ${{ vars.SSH_DEPLOY_HOST }} From a3d04f5025f39dbb6145cb59f8262775a59abc23 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 27 Feb 2025 17:42:13 +0700 Subject: [PATCH 13/14] feat: update manage field for localization and add actionRequestWork function --- src/i18n/eng.ts | 2 +- src/i18n/tha.ts | 2 +- src/stores/request-list/index.ts | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 14cac28a..c822240c 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -20,7 +20,7 @@ export default { confirm: 'Confirm', login: 'Login', logout: 'Logout', - manage: 'Manage', + manage: 'Manage {text}', theme: 'Theme', light: 'Light', dark: 'Dark', diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index 049b0771..c3205cbc 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -20,7 +20,7 @@ export default { confirm: 'ยืนยัน', login: 'เข้าสู่ระบบ', logout: 'ออกจากระบบ', - manage: 'จัดการ', + manage: 'จัดการ{text}', theme: 'ธีม', light: 'สว่าง', dark: 'มืด', diff --git a/src/stores/request-list/index.ts b/src/stores/request-list/index.ts index 0bce74cb..cabff09c 100644 --- a/src/stores/request-list/index.ts +++ b/src/stores/request-list/index.ts @@ -276,6 +276,24 @@ export const useRequestList = defineStore('request-list', () => { return false; } + async function actionRequestWork( + requestDataId: string, + step: number, + body: (Omit & { + requestWorkId: string; + })[], + successAll?: boolean, + ) { + const res = await api.put( + `/request-data/${requestDataId}/request-work/step-status/${step}`, + body, + { params: { successAll } }, + ); + + if (res.status < 400) return res.data; + return null; + } + return { data, page, @@ -296,6 +314,8 @@ export const useRequestList = defineStore('request-list', () => { editStatusRequestWork, cancelRequest, + + actionRequestWork, }; }); From 9c1f7b0de41b8d376be781822c8b9a1c40e4b346 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 27 Feb 2025 17:42:34 +0700 Subject: [PATCH 14/14] feat: enhance request action handling with form data and product filtering --- src/pages/08_request-list/RequestAction.vue | 11 +- src/pages/08_request-list/RequestListView.vue | 120 ++++++++++++------ 2 files changed, 92 insertions(+), 39 deletions(-) diff --git a/src/pages/08_request-list/RequestAction.vue b/src/pages/08_request-list/RequestAction.vue index ac3fe8ea..b9fbf082 100644 --- a/src/pages/08_request-list/RequestAction.vue +++ b/src/pages/08_request-list/RequestAction.vue @@ -19,7 +19,13 @@ defineProps<{ }>(); defineEmits<{ - (e: 'submit'): void; + ( + e: 'submit', + data: { + form: { responsibleUserLocal: boolean; responsibleUserId: string }; + selected: { _work: RequestWork }[]; + }, + ): void; }>(); enum Step { @@ -58,6 +64,7 @@ function prev() { $t('menu.product'), $t('requestList.action.configure'), ]" + :key="i" > @@ -150,7 +157,7 @@ function prev() { v-if="step === Step.Configure" id="btn-save" solid - @click="$emit('submit')" + @click="$emit('submit', { form, selected })" />
diff --git a/src/pages/08_request-list/RequestListView.vue b/src/pages/08_request-list/RequestListView.vue index 5010461c..2f5ee598 100644 --- a/src/pages/08_request-list/RequestListView.vue +++ b/src/pages/08_request-list/RequestListView.vue @@ -11,9 +11,10 @@ import PropertiesExpansion from './PropertiesExpansion.vue'; import FormGroupHead from './FormGroupHead.vue'; import AvatarGroup from 'src/components/shared/AvatarGroup.vue'; import { StateButton } from 'components/button'; -import { CancelButton } from 'components/button'; +import { CancelButton, MainButton } from 'components/button'; import DutyExpansion from './DutyExpansion.vue'; import MessengerExpansion from './MessengerExpansion.vue'; +import RequestAction from './RequestAction.vue'; // NOTE: Store import { @@ -68,9 +69,41 @@ const statusFile = ref({ const refDocumentExpansion = ref[]>([]); const data = ref(); const flow = ref(); +const productsList = computed(() => + workList.value + ?.filter((v) => + v.productService.work?.attributes.workflowStep?.[ + pageState.currentStep - 1 + ]?.productsId.includes(v.productService.productId), + ) + .map((v) => { + const _props = + v.productService.work?.attributes?.workflowStep[ + pageState.currentStep - 1 + ]?.attributes?.properties; + return Object.assign(v, { + _documentExpansion: _props.some( + (v: PropVariant) => v.fieldName === 'documentCheck', + ), + _formExpansion: _props.some( + (v: PropVariant) => v.fieldName === 'designForm', + ), + _dutyExpansion: _props.some((v: PropVariant) => v.fieldName === 'duty'), + _messengerExpansion: _props.some( + (v: PropVariant) => v.fieldName === 'messenger', + ), + }); + }) + .sort( + (lhs, rhs) => + lhs.productService.installmentNo - rhs.productService.installmentNo, + ), +); + const pageState = reactive({ hideMetaData: false, currentStep: 1, + requestActionDialog: false, }); // NOTE: Function @@ -342,6 +375,31 @@ function closeTab() { cancel: () => {}, }); } + +function openRequestAction() { + pageState.requestActionDialog = true; +} + +async function submitRequestAction(data: { + form: { responsibleUserLocal: boolean; responsibleUserId: string }; + selected: { _work: RequestWork }[]; +}) { + const requestWorksId = data.selected.map((s) => s._work.id); + + const res = await requestListStore.actionRequestWork( + route.params['requestListId'] as string, + pageState.currentStep, + requestWorksId.map((v) => ({ + responsibleUserId: data.form.responsibleUserId, + responsibleUserLocal: data.form.responsibleUserLocal, + requestWorkId: v!, + })), + ); + if (res) { + await getData(); + pageState.requestActionDialog = false; + } +}