diff --git a/src/components/AddNewSessionModal.vue b/src/components/AddNewSessionModal.vue
new file mode 100644
index 00000000..ecd872b0
--- /dev/null
+++ b/src/components/AddNewSessionModal.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+ New session
+
+
+
+
+ Name
+
+ Add a name to help identify what inventory is counted in this session
+
+
+
+ Area
+
+
+
+ {{ area.label }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/composables/useInventoryCountImportItem.ts b/src/composables/useInventoryCountImportItem.ts
index 28c9896b..e2b9e201 100644
--- a/src/composables/useInventoryCountImportItem.ts
+++ b/src/composables/useInventoryCountImportItem.ts
@@ -2,9 +2,10 @@ import { ref, computed, ComputedRef } from 'vue';
import Dexie, { Table } from 'dexie';
import { useProductMaster } from './useProductMaster';
import { hasError } from '@hotwax/oms-api';
-import api from '@/api';
+import api, { client } from '@/api';
import { wrap } from 'comlink';
import type { InventorySyncWorker } from '@/workers/inventorySyncWorker';
+import store from '@/store';
/**
* Schema definitions
@@ -84,6 +85,8 @@ export function useInventoryCountImport() {
const syncStatus = ref<'idle'>('idle');
const currentImport = ref(null);
const productMaster = useProductMaster();
+ const maargInstanceUrl = store.getters["user/getInstanceUrl"];
+ const omsRedirectionInfo = store.getters["user/getOmsRedirectionInfo"];
/** Loads a specific inventory import record session */
async function loadSession(inventoryCountImportId: string): Promise {
@@ -253,6 +256,21 @@ export function useInventoryCountImport() {
}
}
+ async function createSessionOnServer (payload: any) {
+
+ const resp = await client({
+ url: `rest/s1/inventory-cycle-count/cycleCounts/workEfforts/${payload.workEffortId}/sessions`,
+ method: "POST",
+ baseURL: maargInstanceUrl,
+ data: payload,
+ headers: {
+ "Authorization": 'Bearer ' + omsRedirectionInfo.token,
+ 'Content-Type': 'application/json'
+ }
+ })
+ return resp;
+ }
+
return {
currentImport,
syncStatus,
@@ -263,6 +281,7 @@ export function useInventoryCountImport() {
pendingItems,
loadInventoryItemsFromBackend,
startAggregationScheduler,
- startSyncWorker
+ startSyncWorker,
+ createSessionOnServer
};
}
\ No newline at end of file
diff --git a/src/router/index.ts b/src/router/index.ts
index a800df54..0bbe6dbf 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -17,6 +17,8 @@ import Settings from "@/views/Settings.vue";
import HardCount from "@/views/HardCount.vue"
import HardCountDetail from "@/views/HardCountDetail.vue"
import SessionCountDetail from "@/views/SessionCountDetail.vue"
+import Draft from "@/views/Draft.vue";
+import Closed from "@/views/Closed.vue";
// Defining types for the meta values
declare module 'vue-router' {
@@ -108,6 +110,16 @@ const routes: Array = [
permissionId: "APP_DRAFT_VIEW"
}
},
+ {
+ path: '/draft',
+ name: 'Draft',
+ component: Draft,
+ beforeEnter: authGuard,
+ props: true,
+ meta: {
+ permissionId: "APP_DRAFT_VIEW"
+ }
+ },
{
path: '/assigned',
name: 'Assigned',
@@ -117,6 +129,15 @@ const routes: Array = [
permissionId: "APP_ASSIGNED_VIEW"
}
},
+ {
+ path: '/closed',
+ name: 'Closed',
+ component: Closed,
+ beforeEnter: authGuard,
+ meta: {
+ permissionId: "APP_CLOSED_VIEW"
+ }
+ },
{
path: '/assigned/:inventoryCountImportId',
name: 'AssignedDetail',
@@ -194,9 +215,9 @@ router.beforeEach((to, from) => {
// - If using ionViewWillLeave/DidLeave hook to clear the filters, the filters are also cleared when moving to and fro from the details page of the same parent page, but in this case we do not want to clear the filters
//
// Added check that if the `to` page has the same url pattern as the `from` page and vice-versa then do not clear the filters, used this approach as parent and child page paths are identical
- if(!(to.path.includes(from.path) || from.path.includes(to.path))) {
- store.dispatch("count/clearQuery")
- }
+ // if(!(to.path.includes(from.path) || from.path.includes(to.path))) {
+ // store.dispatch("count/clearQuery")
+ // }
})
diff --git a/src/services/CountService.ts b/src/services/CountService.ts
index a55a14af..7dd8e38b 100644
--- a/src/services/CountService.ts
+++ b/src/services/CountService.ts
@@ -13,13 +13,28 @@ const getAssignedWorkEfforts = async (params: any): Promise => {
params
});
}
-const getInventoryCountImportsByWorkEffort = async (params: any): Promise => {
+const getWorkEfforts = async (params: any): Promise => {
return api({
- url: `inventory-cycle-count/cycleCounts/workEfforts/${params.workEffortId}/imports`,
+ url: "inventory-cycle-count/cycleCounts/workEfforts",
method: "get",
params
});
}
+const getInventoryCountImportsByWorkEffort = async (params: any): Promise => {
+ return api({
+ url: `inventory-cycle-count/cycleCounts/workEfforts/${params.workEffortId}/sessions`,
+ method: "get",
+ });
+}
+
+const addSessionInCount = async (payload: any): Promise => {
+ return api({
+ url: `inventory-cycle-count/cycleCounts/workEfforts/${payload.workEffortId}/sessions`,
+ method: "post",
+ data: payload
+ }
+ );
+}
const getInventoryCountImportSession = async (params: { workEffortId: string; inventoryCountImportId: string; }): Promise => {
return await api({
url: `inventory-cycle-count/cycleCounts/workEfforts/${params.workEffortId}/sessions/${params.inventoryCountImportId}`,
@@ -31,5 +46,6 @@ const getInventoryCountImportSession = async (params: { workEffortId: string; in
export const CountService = {
getAssignedWorkEfforts,
getInventoryCountImportsByWorkEffort,
- getInventoryCountImportSession
+ addSessionInCount,
+ getWorkEfforts
}
\ No newline at end of file
diff --git a/src/store/modules/count/CountState.ts b/src/store/modules/count/CountState.ts
index 355d0fc9..b14854ed 100644
--- a/src/store/modules/count/CountState.ts
+++ b/src/store/modules/count/CountState.ts
@@ -1,5 +1,8 @@
export default interface CountState {
assignedWorkEfforts: Array,
+ draftWorkEfforts: Array,
+ inReviewWorkEfforts: Array,
+ closedWorkEfforts: Array,
total: number,
isScrollable: boolean,
query: {
diff --git a/src/store/modules/count/actions.ts b/src/store/modules/count/actions.ts
index 5ba2150b..8c7a1e79 100644
--- a/src/store/modules/count/actions.ts
+++ b/src/store/modules/count/actions.ts
@@ -37,14 +37,14 @@ const actions: ActionTree = {
if (!hasError(inventoryResp)) {
assignedWorkEfforts.push({
...workEffort,
- inventoryCountImports: inventoryResp.data || []
+ sessions: inventoryResp.data || []
})
}
} catch (err) {
logger.error(`Error fetching inventory imports for workEffortId ${workEffort.workEffortId}:`, err)
}
}
-
+ console.log("These are counts: ", assignedWorkEfforts);
total = assignedWorkEfforts.length
isScrollable = workEfforts.length >= params.pageSize
} else {
@@ -59,6 +59,37 @@ const actions: ActionTree = {
commit(types.COUNT_ASSIGNED_WORK_EFFORTS_UPDATED, { assignedWorkEfforts, total, isScrollable })
},
+ async getCycleCounts ({commit}, payload) {
+ let workEfforts = [];
+ console.log("This is payload again from the: ", payload);
+ try {
+ const resp = await CountService.getWorkEfforts(payload);
+ if (!resp || resp.status !== 200 || hasError(resp)) {
+ console.error(resp);
+ return;
+ }
+
+ workEfforts = resp.data;
+ const total = workEfforts?.length;
+ const isScrollable = total > payload.pageSize;
+
+ if (payload.currentStatusId === 'CYCLE_CNT_IN_CMPLTD') {
+ console.log("In Review");
+ commit(types.COUNT_IN_REVIEW_WORK_EFFORTS_UPDATED, { inReviewWorkEfforts: workEfforts, total, isScrollable })
+ } else if (payload.currentStatusId === 'CYCLE_CNT_CREATED') {
+ console.log("In Created");
+ commit(types.COUNT_DRAFT_WORK_EFFORTS_UPDATED, { draftWorkEfforts: workEfforts, total, isScrollable })
+ } else if (payload.currentStatusId === 'CYCLE_CNT_IN_PRGS') {
+ console.log("In Progress");
+ commit(types.COUNT_ASSIGNED_WORK_EFFORTS_UPDATED, { assignedWorkEfforts: workEfforts, total, isScrollable })
+ } else if (payload.currentStatusId === "CYCLE_CNT_IN_CLOSED") {
+ console.log("In Closed");
+ commit(types.COUNT_CLOSED_WORK_EFFORTS_UPDATED, { closedWorkEfforts: workEfforts, total, isScrollable })
+ }
+ } catch (error) {
+ console.error(error);
+ }
+ },
setCountDetailPageActive({ commit }, isPageActive) {
commit(types.COUNT_DETAIL_PAGE_ACTIVE_UPDATED, isPageActive);
}
diff --git a/src/store/modules/count/getters.ts b/src/store/modules/count/getters.ts
index 65e283f1..6f0cae34 100644
--- a/src/store/modules/count/getters.ts
+++ b/src/store/modules/count/getters.ts
@@ -6,6 +6,15 @@ const getters: GetterTree = {
getAssignedWorkEfforts(state) {
return state.assignedWorkEfforts ? JSON.parse(JSON.stringify(state.assignedWorkEfforts)) : []
},
+ getDraftWorkEfforts(state) {
+ return state.draftWorkEfforts ? JSON.parse(JSON.stringify(state.draftWorkEfforts)) : []
+ },
+ getInReviewCounts(state) {
+ return state.inReviewWorkEfforts ? JSON.parse(JSON.stringify(state.inReviewWorkEfforts)) : []
+ },
+ getClosedCounts(state) {
+ return state.closedWorkEfforts ? JSON.parse(JSON.stringify(state.closedWorkEfforts)) : [];
+ },
getCycleCountsList(state) {
return state.cycleCounts.list ? JSON.parse(JSON.stringify(state.cycleCounts.list)) : []
},
diff --git a/src/store/modules/count/index.ts b/src/store/modules/count/index.ts
index d51e3abf..1d4d2e61 100644
--- a/src/store/modules/count/index.ts
+++ b/src/store/modules/count/index.ts
@@ -9,6 +9,9 @@ const countModule: Module = {
namespaced: true,
state: {
assignedWorkEfforts: [],
+ draftWorkEfforts: [],
+ inReviewWorkEfforts: [],
+ closedWorkEfforts: [],
total: 0,
isScrollable: true,
query: {
diff --git a/src/store/modules/count/mutation-types.ts b/src/store/modules/count/mutation-types.ts
index 247eb0ac..7b2598a3 100644
--- a/src/store/modules/count/mutation-types.ts
+++ b/src/store/modules/count/mutation-types.ts
@@ -1,3 +1,6 @@
export const SN_COUNT = "count"
export const COUNT_DETAIL_PAGE_ACTIVE_UPDATED = SN_COUNT + '/DETAIL_PAGE_ACTIVE_UPDATED'
-export const COUNT_ASSIGNED_WORK_EFFORTS_UPDATED = SN_COUNT + "/ASSIGNED_WORK_EFFORTS_UPDATED"
\ No newline at end of file
+export const COUNT_ASSIGNED_WORK_EFFORTS_UPDATED = SN_COUNT + "/ASSIGNED_WORK_EFFORTS_UPDATED"
+export const COUNT_DRAFT_WORK_EFFORTS_UPDATED = SN_COUNT + "/DRAFT_WORK_EFFORTS_UPDATED"
+export const COUNT_IN_REVIEW_WORK_EFFORTS_UPDATED = SN_COUNT + "/IN_REVIEW_WORK_EFFORTS_UPDATED"
+export const COUNT_CLOSED_WORK_EFFORTS_UPDATED = SN_COUNT + "/CLOSED_WORK_EFFORTS_UPDATED"
\ No newline at end of file
diff --git a/src/store/modules/count/mutations.ts b/src/store/modules/count/mutations.ts
index 01345b65..caf137a1 100644
--- a/src/store/modules/count/mutations.ts
+++ b/src/store/modules/count/mutations.ts
@@ -10,6 +10,18 @@ const mutations: MutationTree = {
state.assignedWorkEfforts = payload.assignedWorkEfforts
state.total = payload.total
state.isScrollable = payload.isScrollable;
+ },
+ [types.COUNT_DRAFT_WORK_EFFORTS_UPDATED] (state, payload) {
+ state.draftWorkEfforts = payload.draftWorkEfforts
+ state.isScrollable = payload.isScrollable;
+ },
+ [types.COUNT_IN_REVIEW_WORK_EFFORTS_UPDATED] (state, payload) {
+ state.inReviewWorkEfforts = payload.inReviewWorkEfforts
+ state.isScrollable = payload.isScrollable;
+ },
+ [types.COUNT_CLOSED_WORK_EFFORTS_UPDATED] (state, payload) {
+ state.closedWorkEfforts = payload.closedWorkEfforts
+ state.isScrollable = payload.isScrollable;
}
}
export default mutations;
diff --git a/src/views/Assigned.vue b/src/views/Assigned.vue
index 858065f3..b6129a0e 100644
--- a/src/views/Assigned.vue
+++ b/src/views/Assigned.vue
@@ -18,25 +18,19 @@
{{ translate("No cycle counts found") }}
-
+
{{ translate("HARD COUNT") }}
- {{ count.countImportName }}
- {{ count.inventoryCountImportId }}
+ {{ count.workEffortName }}
+ {{ count.workEffortId }}
{{ getFacilityName(count?.facilityId) }}
-
-
-
- {{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }}
- {{ translate("counted") }}
-
{{ getDateWithOrdinalSuffix(count.dueDate) }}
@@ -44,7 +38,7 @@
- {{ translate(getDerivedStatusForCount(count)?.label) }}
+ {{ count.currentStatusId }}
@@ -67,7 +61,7 @@ import { getCycleCountStats, getDateWithOrdinalSuffix, getDerivedStatusForCount,
import router from "@/router"
// import SearchBarAndSortBy from "@/components/SearchBarAndSortBy.vue";
-const cycleCounts = computed(() => store.getters["count/getCounts"])
+const cycleCounts = computed(() => store.getters["count/getAssignedWorkEfforts"])
const isScrollable = computed(() => store.getters["count/isCycleCountListScrollable"])
const isScrollingEnabled = ref(false);
@@ -113,9 +107,9 @@ async function fetchAssignedCycleCount(vSize?: any, vIndex?: any) {
const payload = {
pageSize,
pageIndex,
- statusId: "INV_COUNT_ASSIGNED"
+ currentStatusId: "CYCLE_CNT_IN_PRGS"
}
- await store.dispatch("count/fetchCycleCounts", payload)
+ await store.dispatch("count/getCycleCounts", payload)
}
diff --git a/src/views/Closed.vue b/src/views/Closed.vue
new file mode 100644
index 00000000..ade2ca0a
--- /dev/null
+++ b/src/views/Closed.vue
@@ -0,0 +1,77 @@
+
+
+
+
+ {{ translate("Closed")}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ translate("HARD COUNT") }}
+ {{ count.workEffortName }}
+ {{ count.workEffortId }}
+
+
+
+
+ {{ getFacilityName(count?.facilityId) }}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/Count.vue b/src/views/Count.vue
index f95e6ede..760330d3 100644
--- a/src/views/Count.vue
+++ b/src/views/Count.vue
@@ -30,7 +30,6 @@
created date
- number of items
{{ translate("Due date") }}
@@ -44,7 +43,7 @@
Sessions
-
+
Start new session
@@ -66,7 +65,6 @@
created date
- number of items
{{ translate("Due date") }}
@@ -79,7 +77,7 @@
Sessions
-
+
New
@@ -131,7 +129,6 @@
created date
- number of items
{{ translate("Due date") }}
@@ -184,20 +181,19 @@
-
+
-
+
{{ translate("HARD COUNT") }}
- {{ count.countImportName }}
+ {{ count.workEffortName }}
{{ getDateWithOrdinalSuffix(count.createdDate) }}
- {{ cycleCountStats(count.inventoryCountImportId)?.totalItems }} {{ translate("items") }}
{{ translate("Due date") }}
@@ -205,7 +201,38 @@
{{ getDateWithOrdinalSuffix(count.dueDate) }}
+
+
+
+ Sessions
+
+
+
+ New
+
+
+
+
+ Start new session
+
+
+
+
+
+
+ {{ session.countImportName }} + {{ session.facilityAreaId }}
+
+ created By {{ session.uploadedByUserLogin }}
+
+
+
+ {{ getSessionStatusDescription(session.statusId) }}
+
+
+
+
+
@@ -22,21 +22,15 @@
- {{ translate("HARD COUNT") }}
- {{ count.countImportName }}
- {{ count.inventoryCountImportId }}
+ {{ translate("HARD COUNT") }}
+ {{ count.workEffortName }}
+ {{ count.workEffortId }}
{{ getFacilityName(count?.facilityId) }}
-
-
-
- {{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }}
- {{ translate("counted") }}
-
{{ getDateWithOrdinalSuffix(count.dueDate) }}
@@ -44,7 +38,7 @@
- {{ translate(getDerivedStatusForCount(count)?.label) }}
+ {{ translate(count.currentStatusId) }}
@@ -67,7 +61,7 @@ import Filters from "@/components/Filters.vue"
import { getCycleCountStats, getDateWithOrdinalSuffix, getDerivedStatusForCount, getFacilityName } from "@/utils"
import SearchBarAndSortBy from "@/components/SearchBarAndSortBy.vue";
-const cycleCounts = computed(() => store.getters["count/getCounts"])
+const cycleCounts = computed(() => store.getters["count/getInReviewCounts"])
const isScrollable = computed(() => store.getters["count/isCycleCountListScrollable"])
const isScrollingEnabled = ref(false);
@@ -113,9 +107,9 @@ async function fetchPendingCycleCounts(vSize?: any, vIndex?: any) {
const payload = {
pageSize,
pageIndex,
- statusId: "INV_COUNT_REVIEW"
+ currentStatusId: "CYCLE_CNT_IN_CMPLTD"
}
- await store.dispatch("count/fetchCycleCounts", payload)
+ await store.dispatch("count/getCycleCounts", payload)
}