= {
async fetchCycleCountImportSystemMessages({commit} ,payload) {
let systemMessages;
try {
- const fifteenMinutesEarlier = DateTime.now().minus({ minutes: 15 });
+ const twentyFourHoursEarlier = DateTime.now().minus({ hours: 24 });
const resp = await CountService.fetchCycleCountImportSystemMessages({
systemMessageTypeId: "ImportInventoryCounts",
- initDate_from: fifteenMinutesEarlier.toMillis(),
+ initDate_from: twentyFourHoursEarlier.toMillis(),
orderByField: 'initDate desc, processedDate desc',
- pageSize: 10
+ pageSize: 100
})
if (!hasError(resp)) {
systemMessages = resp.data
diff --git a/src/utils/index.ts b/src/utils/index.ts
index f81696da..4d30ff32 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -157,4 +157,11 @@ const jsonToCsv = (file: any, options: JsonToCsvOption = {}) => {
return blob;
};
-export { jsonToCsv, showToast, hasError, handleDateTimeInput, getCycleCountStats, getDateTime, getDateWithOrdinalSuffix, getDerivedStatusForCount, getFacilityName, getPartyName, getProductIdentificationValue, timeFromNow, parseCsv }
+const downloadCsv = (csv: any, fileName: any) => {
+ const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
+ saveAs(blob, fileName ? fileName : "CycleCountImport.csv");
+
+ return blob;
+};
+
+export { downloadCsv, jsonToCsv, showToast, hasError, handleDateTimeInput, getCycleCountStats, getDateTime, getDateWithOrdinalSuffix, getDerivedStatusForCount, getFacilityName, getPartyName, getProductIdentificationValue, timeFromNow, parseCsv }
diff --git a/src/views/BulkUpload.vue b/src/views/BulkUpload.vue
index ee620309..b0868a3e 100644
--- a/src/views/BulkUpload.vue
+++ b/src/views/BulkUpload.vue
@@ -72,8 +72,8 @@
{{ getFileProcessingStatus(systemMessage) }}
-
-
+
+
@@ -105,20 +105,19 @@ import {
IonToolbar,
onIonViewDidEnter,
alertController,
- modalController
+ modalController,
+ popoverController
} from '@ionic/vue';
-import { addOutline, cloudUploadOutline, trashBinOutline } from "ionicons/icons";
+import { addOutline, cloudUploadOutline, ellipsisVerticalOutline, trashBinOutline } from "ionicons/icons";
import { translate } from '@/i18n';
import { computed, ref } from "vue";
import { useStore } from 'vuex';
-import { useRouter } from 'vue-router'
import { hasError, jsonToCsv, parseCsv, showToast } from "@/utils";
import CreateMappingModal from "@/components/CreateMappingModal.vue";
import { CountService } from "@/services/CountService"
-import logger from "@/logger";
+import CycleCountUploadActionPopover from "@/components/CycleCountUploadActionPopover.vue"
const store = useStore();
-const router = useRouter()
const fieldMappings = computed(() => store.getters["user/getFieldMappings"])
const systemMessages = computed(() => store.getters["count/getCycleCountImportSystemMessages"])
@@ -187,26 +186,25 @@ function getFileProcessingStatus(systemMessage) {
processingStatus = "processing"
} else if (systemMessage.statusId === 'SmsgCancelled') {
processingStatus = 'cancelled'
+ } else if (systemMessage.statusId === 'SmsgError') {
+ processingStatus = 'error'
}
return processingStatus;
}
-async function cancelUpload (systemMessage) {
- try {
- const resp = await CountService.cancelCycleCountFileProcessing({
- systemMessageId: systemMessage.systemMessageId,
- statusId: 'SmsgCancelled'
- });
- if (!hasError(resp)) {
- showToast(translate('Cycle count cancelled successfully.'))
- await store.dispatch('count/fetchCycleCountImportSystemMessages')
- } else {
- throw resp.data;
- }
- } catch (err) {
- showToast(translate('Failed to cancel uploaded cycle count.'))
- logger.error(err);
- }
+
+async function openUploadActionPopover(event, systemMessage){
+ const popover = await popoverController.create({
+ component: CycleCountUploadActionPopover,
+ event,
+ componentProps: {
+ systemMessage,
+ fileName: extractFilename(systemMessage.messageText)
+ },
+ showBackdrop: false,
+ });
+ await popover.present();
}
+
async function parse(event) {
const file = event.target.files[0];
try {