Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved: empty state in case of no cycle count items and UI for the counted count for hard count (#555) #574

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"inventory variance": "inventory variance",
"Instance Url": "Instance Url",
"items": "items",
"item counted": "item counted",
"items counted": "items counted",
"Item has been removed from the cycle count": "Item has been removed from the cycle count",
"Item added to upload list": "Item added to upload list",
Expand Down
8 changes: 6 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,13 @@ function timeFromNow(time: any) {
return DateTime.local().plus(timeDiff).toRelative();
}

function getCycleCountStats(id: string) {
function getCycleCountStats(id: string, isHardCount = false) {
const stats = cycleCountStats(id)
return stats ? `${stats.itemCounted}/${stats.totalItems}` : "0/0"
if(stats) {
return isHardCount ? `${stats.itemCounted}` : `${stats.itemCounted}/${stats.totalItems}`
} else {
return isHardCount ? "0" : "0/0"
}
}

function getFacilityName(id: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/views/Assigned.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<ion-label>
<!-- TODO: make it dynamic currently not getting stats correctly -->
{{ getCycleCountStats(count.inventoryCountImportId) }}
{{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }}
<p>{{ translate("counted") }}</p>
</ion-label>

Expand Down
4 changes: 2 additions & 2 deletions src/views/AssignedDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</div>
<div class="filters ion-padding">
<ion-list>
<ion-item>
<ion-item v-if="currentCycleCount.countTypeEnumId !== 'HARD_COUNT'">
<ion-label>{{ translate("Progress") }}</ion-label>
<ion-label slot="end">{{ getProgress() }}</ion-label>
</ion-item>
Expand Down Expand Up @@ -118,7 +118,7 @@
</div>
</template>
<p v-else class="empty-state">
{{ translate("No items found") }}
{{ translate("No items added to count") }}
</p>
</template>
<template v-else>
Expand Down
2 changes: 1 addition & 1 deletion src/views/Closed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</ion-chip>

<ion-label>
{{ getCycleCountStats(count.inventoryCountImportId) }}
{{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }}
<p>{{ translate("products counted") }}</p>
</ion-label>

Expand Down
4 changes: 2 additions & 2 deletions src/views/Count.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<p>{{ getDateWithOrdinalSuffix(count.createdDate) }}</p>
</ion-label>
</ion-card-title>
<ion-note>{{ getCycleCountStats(count.inventoryCountImportId) }} {{ translate("items counted") }}</ion-note>
<ion-note>{{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }} {{ translate((count.countTypeEnumId === "HARD_COUNT" && getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") === "1") ? "item counted" : "items counted") }}</ion-note>
</ion-card-header>
<ion-item>
{{ translate("Due date") }}
Expand All @@ -83,7 +83,7 @@
<p>{{ getDateWithOrdinalSuffix(count.createdDate) }}</p>
</ion-label>
</ion-card-title>
<ion-note>{{ getCycleCountStats(count.inventoryCountImportId) }} {{ translate("items counted") }}</ion-note>
<ion-note>{{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }} {{ translate((count.countTypeEnumId === "HARD_COUNT" && getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") === "1") ? "item counted" : "items counted") }}</ion-note>
</ion-card-header>
<div class="header">
<div class="search">
Expand Down
2 changes: 1 addition & 1 deletion src/views/CountDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
</template>
<template v-else>
<div class="empty-state">
<p>{{ translate("No products found.") }}</p>
<p>{{ translate("No items added to count") }}</p>
</div>
</template>
</main>
Expand Down
2 changes: 1 addition & 1 deletion src/views/DraftDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<ion-icon slot="icon-only" :icon="isProductAvailableInCycleCount ? checkmarkCircle : addCircleOutline"/>
</ion-button>
</ion-item>
<p v-else-if="queryString">{{ translate("No product found") }}</p>
<p v-else-if="queryString">{{ translate("No items added to count") }}</p>
</div>

<hr />
Expand Down
2 changes: 1 addition & 1 deletion src/views/PendingReview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<ion-label>
<!-- TODO: make it dynamic currently not getting stats correctly -->
{{ getCycleCountStats(count.inventoryCountImportId) }}
{{ getCycleCountStats(count.inventoryCountImportId, count.countTypeEnumId === "HARD_COUNT") }}
<p>{{ translate("counted") }}</p>
</ion-label>

Expand Down
2 changes: 1 addition & 1 deletion src/views/PendingReviewDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
</template>

<p v-else class="empty-state">
{{ translate("No items found") }}
{{ translate("No items added to count") }}
</p>
</template>
<template v-else>
Expand Down
Loading