Skip to content

Commit

Permalink
Improved: logic for fetching the cycle count details from details page (
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Jan 22, 2025
1 parent 5dee057 commit d33703f
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/services/CountService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ const fetchCycleCountStats = async (payload: any): Promise<any> => {
})
}

const fetchCycleCount = async (inventoryCountImportId: string): Promise<any> => {
const fetchCycleCount = async (params: any): Promise<any> => {
return api({
url: `cycleCounts/${inventoryCountImportId}`,
method: "GET"
url: `cycleCounts/${params.inventoryCountImportId}`,
method: "GET",
params
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/AssignedDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ onIonViewWillEnter(async () => {
currentCycleCount.value = {}
try {
const resp = await CountService.fetchCycleCount(props.inventoryCountImportId as string)
const resp = await CountService.fetchCycleCount({inventoryCountImportId: props.inventoryCountImportId})
if(!hasError(resp) && resp.data?.inventoryCountImportId && resp.data.statusId === "INV_COUNT_ASSIGNED") {
currentCycleCount.value = {
Expand Down
2 changes: 1 addition & 1 deletion src/views/Closed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async function fetchClosedCycleCounts(vSize?: any, vIndex?: any) {
const payload = {
pageSize,
pageIndex,
statusId: "INV_COUNT_CLOSED,INV_COUNT_COMPLETED,INV_COUNT_REJECTED",
statusId: "INV_COUNT_COMPLETED,INV_COUNT_REJECTED",
statusId_op: "in"
}
await store.dispatch("count/fetchCycleCounts", payload)
Expand Down
4 changes: 2 additions & 2 deletions src/views/ClosedDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ onIonViewWillEnter(async () => {
currentCycleCount.value = {}
try {
const resp = await CountService.fetchCycleCount(props.inventoryCountImportId as string)
const resp = await CountService.fetchCycleCount({inventoryCountImportId: props.inventoryCountImportId, statusId: "INV_COUNT_COMPLETED,INV_COUNT_REJECTED", statusId_op: "in"})
if(!hasError(resp) && resp.data?.inventoryCountImportId && ["INV_COUNT_COMPLETED", "INV_COUNT_REJECTED", "INV_COUNT_CLOSED"].includes(resp.data?.statusId)) {
if(!hasError(resp) && resp.data?.inventoryCountImportId) {
currentCycleCount.value = {
countName: resp.data.countImportName,
countId: resp.data.inventoryCountImportId,
Expand Down
3 changes: 1 addition & 2 deletions src/views/CountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,9 @@ function inputCountValidation(event) {
}
async function fetchCycleCount() {
let payload = props?.id
let resp
try {
resp = await CountService.fetchCycleCount(payload)
resp = await CountService.fetchCycleCount({inventoryCountImportId: props?.id})
if (!hasError(resp)) {
cycleCount.value = resp?.data
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/views/DraftDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ onIonViewWillEnter(async () => {
emitter.emit("presentLoader", { message: "Loading cycle count details" })
currentCycleCount.value = {}
try {
const resp = await CountService.fetchCycleCount(props.inventoryCountImportId as string)
const resp = await CountService.fetchCycleCount({inventoryCountImportId: props.inventoryCountImportId})
if(!hasError(resp) && resp.data?.inventoryCountImportId && resp.data.statusId === "INV_COUNT_CREATED") {
currentCycleCount.value = {
Expand Down
2 changes: 1 addition & 1 deletion src/views/HardCountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ function handleProductClick(item: any) {

async function fetchCycleCount() {
try {
const resp = await CountService.fetchCycleCount(props?.id)
const resp = await CountService.fetchCycleCount({inventoryCountImportId: props?.id})
if(!hasError(resp)) {
cycleCount.value = resp?.data
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/views/PendingReviewDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ onIonViewWillEnter(async () => {

currentCycleCount.value = {}
try {
const resp = await CountService.fetchCycleCount(props.inventoryCountImportId as string)
const resp = await CountService.fetchCycleCount({inventoryCountImportId: props.inventoryCountImportId})

if(!hasError(resp) && resp.data?.inventoryCountImportId && resp.data?.statusId === "INV_COUNT_REVIEW") {
currentCycleCount.value = {
Expand Down

0 comments on commit d33703f

Please sign in to comment.