@managesome/eposmatic-toolkit 0.3.8 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/constants/ANALYTICS.js +146 -0
- package/esm/constants/API_ERRORS.js +6 -0
- package/esm/constants/COMMON.js +369 -0
- package/esm/constants/DELIVERY.js +45 -0
- package/esm/constants/DIALER_ENUMS.js +11 -0
- package/esm/constants/ENUMS.js +1988 -0
- package/esm/constants/FBR_ENUMS.js +18 -0
- package/esm/constants/HUBRISE_ENUMS.js +179 -0
- package/esm/constants/INTERNAL_ENUMS.js +49 -0
- package/esm/constants/NOTIFICATIONS.js +6 -0
- package/esm/constants/ORDER.js +251 -0
- package/esm/constants/PRA_ENUMS.js +18 -0
- package/esm/constants/REPORT_WEBVIEW.js +28 -0
- package/esm/constants/RFQ_GO.js +83 -0
- package/esm/constants/SMARTPAY_ENUMS.js +55 -0
- package/esm/constants/SOCKET.js +149 -0
- package/esm/constants/SRB_ENUMS.js +13 -0
- package/esm/constants/SWITCHPAY.js +28 -0
- package/esm/constants/TENANT_ENUMS.js +90 -0
- package/esm/constants/TENANT_PURCHASE_ORDER.js +91 -0
- package/esm/constants/WALLET.js +51 -0
- package/esm/constants/WAREHOUSE_ANALYTICS.js +28 -0
- package/esm/constants/WAREHOUSE_ENUMS.js +420 -0
- package/esm/constants/WAREHOUSE_PURCHASE_ORDER.js +97 -0
- package/esm/constants/WEBVIEW.js +43 -0
- package/esm/constants/WORKER_ENDPOINTS.js +79 -0
- package/esm/constants/index.js +27 -0
- package/esm/constants/types.js +2 -0
- package/esm/helpers/fbr/generate-invoice.js +94 -0
- package/esm/helpers/fbr/index.js +1 -0
- package/esm/helpers/hubrise/hubrise-catalog.js +304 -0
- package/esm/helpers/hubrise/index.js +1 -0
- package/esm/helpers/index.js +9 -0
- package/esm/helpers/kpra/generate-invoice.js +26 -0
- package/esm/helpers/kpra/index.js +1 -0
- package/esm/helpers/order/generate-order.js +508 -0
- package/esm/helpers/order/generate-warehouse-internal-movement.js +71 -0
- package/esm/helpers/order/generate-warehouse-purchase-order-rfq.js +176 -0
- package/esm/helpers/order/generate-warehouse-purchase-order.js +187 -0
- package/esm/helpers/order/generate-warehouse-sale-order-rfq.js +176 -0
- package/esm/helpers/order/generate-warehouse-sale-order.js +149 -0
- package/esm/helpers/order/index.js +6 -0
- package/esm/helpers/pra/generate-invoice.js +94 -0
- package/esm/helpers/pra/index.js +1 -0
- package/esm/helpers/srb/generate-invoice.js +68 -0
- package/esm/helpers/srb/index.js +1 -0
- package/esm/helpers/store/all-orders-actions.js +17 -0
- package/esm/helpers/store/all-tenant-purchase-orders-actions.js +45 -0
- package/esm/helpers/store/all-warehouse-purchase-order-rfqs-actions.js +66 -0
- package/esm/helpers/store/all-warehouse-purchase-order-vendor-return-actions.js +50 -0
- package/esm/helpers/store/all-warehouse-purchase-orders-actions.js +49 -0
- package/esm/helpers/store/all-warehouse-sale-order-invoices-actions.js +132 -0
- package/esm/helpers/store/all-warehouse-sale-order-rfqs-actions.js +66 -0
- package/esm/helpers/store/all-warehouse-sale-orders-actions.js +72 -0
- package/esm/helpers/store/cart-actions.js +3563 -0
- package/esm/helpers/store/catalog-actions.js +379 -0
- package/esm/helpers/store/common-order-actions.js +937 -0
- package/esm/helpers/store/common-tenant-purchase-order-actions.js +440 -0
- package/esm/helpers/store/common-warehouse-internal-movement-actions.js +95 -0
- package/esm/helpers/store/common-warehouse-purchase-order-actions.js +530 -0
- package/esm/helpers/store/common-warehouse-purchase-order-receipt-actions.js +33 -0
- package/esm/helpers/store/common-warehouse-purchase-order-rfq-actions.js +523 -0
- package/esm/helpers/store/common-warehouse-purchase-order-vendor-return-actions.js +25 -0
- package/esm/helpers/store/common-warehouse-sale-order-actions.js +483 -0
- package/esm/helpers/store/common-warehouse-sale-order-invoice-actions.js +54 -0
- package/esm/helpers/store/common-warehouse-sale-order-rfq-actions.js +523 -0
- package/esm/helpers/store/index.js +26 -0
- package/esm/helpers/store/offline-ordering.js +251 -0
- package/esm/helpers/store/tenant-purchase-orders-cart-actions.js +379 -0
- package/esm/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +360 -0
- package/esm/helpers/store/warehouse-purchase-orders-cart-actions.js +470 -0
- package/esm/helpers/store/warehouse-sale-order-rfq-cart-actions.js +359 -0
- package/esm/helpers/store/warehouse-sale-orders-cart-actions.js +456 -0
- package/esm/helpers/types/api-types.js +1 -0
- package/esm/helpers/types/cart-actions.js +1 -0
- package/esm/helpers/types/cart-helpers.js +1 -0
- package/esm/helpers/types/catalog.js +1 -0
- package/esm/helpers/types/common.js +1 -0
- package/esm/helpers/types/deliverect_menu.js +1 -0
- package/esm/helpers/types/email-templates.js +1 -0
- package/esm/helpers/types/fbr-generate-invoice.js +1 -0
- package/esm/helpers/types/halfhalf.js +1 -0
- package/esm/helpers/types/hubrise_catalog.js +1 -0
- package/esm/helpers/types/hubrise_customers.js +1 -0
- package/esm/helpers/types/hubrise_deliveries.js +1 -0
- package/esm/helpers/types/hubrise_location.js +1 -0
- package/esm/helpers/types/hubrise_orders.js +1 -0
- package/esm/helpers/types/index.js +33 -0
- package/esm/helpers/types/internal-leads.js +1 -0
- package/esm/helpers/types/inventory-catalog.js +1 -0
- package/esm/helpers/types/kpra-generate-invoice.js +1 -0
- package/esm/helpers/types/marketing.js +1 -0
- package/esm/helpers/types/order-engine.js +1 -0
- package/esm/helpers/types/pra-generate-invoice.js +1 -0
- package/esm/helpers/types/report-webview.js +1 -0
- package/esm/helpers/types/reports.js +1 -0
- package/esm/helpers/types/smartpay-apis.js +2 -0
- package/esm/helpers/types/specials.js +1 -0
- package/esm/helpers/types/split_bill.js +1 -0
- package/esm/helpers/types/srb-generate-invoice.js +1 -0
- package/esm/helpers/types/switchpay.js +1 -0
- package/esm/helpers/types/tenant-purchase-order-cart-actions.js +1 -0
- package/esm/helpers/types/warehouse-catalog.js +1 -0
- package/esm/helpers/types/warehouse-purchase-order-cart-actions.js +1 -0
- package/esm/helpers/types/warehouse-purchase-order-rfq-cart-actions.js +1 -0
- package/esm/helpers/types/warehouse-sale-order-cart-actions.js +1 -0
- package/esm/helpers/types/warehouse-sale-order-rfq-cart-actions.js +1 -0
- package/esm/helpers/types/workers.js +1 -0
- package/esm/helpers/utils/asaanbill-identifier-helpers.js +31 -0
- package/esm/helpers/utils/business-day-helpers.js +201 -0
- package/esm/helpers/utils/cart-helpers.js +156 -0
- package/esm/helpers/utils/catalog-conversion.js +129 -0
- package/esm/helpers/utils/code-redemption-helpers.js +452 -0
- package/esm/helpers/utils/color-helpers.js +31 -0
- package/esm/helpers/utils/common.js +368 -0
- package/esm/helpers/utils/crypt.js +40 -0
- package/esm/helpers/utils/customers-helpers.js +15 -0
- package/esm/helpers/utils/delivery-area-helpers.js +42 -0
- package/esm/helpers/utils/delivery-helpers.js +87 -0
- package/esm/helpers/utils/denominations-helpers.js +53 -0
- package/esm/helpers/utils/dinein.js +39 -0
- package/esm/helpers/utils/discount-helpers.js +55 -0
- package/esm/helpers/utils/email-helpers.js +111 -0
- package/esm/helpers/utils/error-helpers.js +14 -0
- package/esm/helpers/utils/expense.js +26 -0
- package/esm/helpers/utils/getFormFieldsDiff.js +15 -0
- package/esm/helpers/utils/gift-card-helpers.js +258 -0
- package/esm/helpers/utils/halfhalf-setup-helpers.js +779 -0
- package/esm/helpers/utils/hourly-comparison-report-helpers.js +851 -0
- package/esm/helpers/utils/hr-helpers.js +62 -0
- package/esm/helpers/utils/hubrise-utils.js +32 -0
- package/esm/helpers/utils/image-helpers.js +95 -0
- package/esm/helpers/utils/image-url-helpers.js +96 -0
- package/esm/helpers/utils/index.js +96 -0
- package/esm/helpers/utils/ingredients.js +26 -0
- package/esm/helpers/utils/internal-amount-helpers.js +49 -0
- package/esm/helpers/utils/inventory.js +123 -0
- package/esm/helpers/utils/inventory_entries.js +91 -0
- package/esm/helpers/utils/inventory_transactions.js +91 -0
- package/esm/helpers/utils/item-report-helpers.js +2603 -0
- package/esm/helpers/utils/items-comparison-report-helpers.js +1057 -0
- package/esm/helpers/utils/kds-helpers.js +43 -0
- package/esm/helpers/utils/location-helpers.js +13 -0
- package/esm/helpers/utils/menu-helpers.js +44 -0
- package/esm/helpers/utils/minified-catalog.js +428 -0
- package/esm/helpers/utils/offer-apply-helpers.js +613 -0
- package/esm/helpers/utils/offers-helpers.js +3351 -0
- package/esm/helpers/utils/operational-roles-helpers.js +33 -0
- package/esm/helpers/utils/order-engine.js +1409 -0
- package/esm/helpers/utils/order-history.js +208 -0
- package/esm/helpers/utils/payment-comparison-report-helpers.js +873 -0
- package/esm/helpers/utils/payment-helpers.js +302 -0
- package/esm/helpers/utils/pdf-generator.js +110 -0
- package/esm/helpers/utils/platform-catalog.js +306 -0
- package/esm/helpers/utils/platform-num.js +188 -0
- package/esm/helpers/utils/platform-specific-tenant-shifts.js +19 -0
- package/esm/helpers/utils/price-conversion.js +24 -0
- package/esm/helpers/utils/printer-helpers.js +319 -0
- package/esm/helpers/utils/public-holidays-helpers.js +8 -0
- package/esm/helpers/utils/ratings-comparison-report-helpers.js +1187 -0
- package/esm/helpers/utils/receipt-engine.js +1050 -0
- package/esm/helpers/utils/review-helpers.js +391 -0
- package/esm/helpers/utils/rider-tracking.js +12 -0
- package/esm/helpers/utils/riders-report-helpers.js +1590 -0
- package/esm/helpers/utils/sales-comparison-report-helpers.js +1259 -0
- package/esm/helpers/utils/sales-comparitive-report-helpers.js +939 -0
- package/esm/helpers/utils/sales-overview-report-helpers.js +1046 -0
- package/esm/helpers/utils/sales-summary-report-helpers.js +877 -0
- package/esm/helpers/utils/scan-code-helpers.js +31 -0
- package/esm/helpers/utils/selection-model.js +68 -0
- package/esm/helpers/utils/shift-window-helpers.js +148 -0
- package/esm/helpers/utils/simplified-catalog.js +107 -0
- package/esm/helpers/utils/simplified-halfhalf.js +101 -0
- package/esm/helpers/utils/simplified-specials.js +107 -0
- package/esm/helpers/utils/simplified-tenant.js +411 -0
- package/esm/helpers/utils/specials-helpers.js +727 -0
- package/esm/helpers/utils/tenant-calendar-helpers.js +67 -0
- package/esm/helpers/utils/tenant-cash-drawer-sessions-helpers.js +248 -0
- package/esm/helpers/utils/tenant-cash-drawers-helpers.js +31 -0
- package/esm/helpers/utils/tenant-cash-in-out-helpers.js +47 -0
- package/esm/helpers/utils/tenant-day-sessions-helpers.js +167 -0
- package/esm/helpers/utils/tenant-instore-shift-sessions-helpers.js +227 -0
- package/esm/helpers/utils/tenant-staff-helpers.js +19 -0
- package/esm/helpers/utils/tenant_cash_in_hand_transactions.js +31 -0
- package/esm/helpers/utils/time-helpers.js +142 -0
- package/esm/helpers/utils/void-items-report-helpers.js +529 -0
- package/esm/helpers/utils/void-order-items-helpers.js +32 -0
- package/esm/helpers/utils/voidations-summary-report-helpers.js +800 -0
- package/esm/helpers/utils/wallet-helpers.js +22 -0
- package/esm/helpers/utils/wallet-redemption-helpers.js +46 -0
- package/esm/helpers/utils/warehouse-catalog-conversion.js +117 -0
- package/esm/helpers/utils/warehouse-inventory.js +59 -0
- package/esm/helpers/utils/warehouse-purchase-order-engine.js +27 -0
- package/esm/helpers/utils/warehouse-purchase-order-receipt-engine.js +205 -0
- package/esm/helpers/utils/warehouse-purchase-order-x-report-helpers.js +1432 -0
- package/esm/helpers/utils/warehouse-sale-order-engine.js +27 -0
- package/esm/helpers/utils/warehouse-sale-order-receipt-engine.js +207 -0
- package/esm/helpers/utils/warehouse-sale-order-x-report-helpers.js +1 -0
- package/esm/helpers/utils/warehouse-sale-x-report-helpers.js +1434 -0
- package/esm/helpers/utils/warehouse-settings-helpers.js +37 -0
- package/esm/helpers/utils/warehouse-void-purchase-order-items-helpers.js +34 -0
- package/esm/helpers/utils/warehouse-void-purchase-order-items-report-helpers.js +18 -0
- package/esm/helpers/utils/warehouse-void-sale-order-items-helpers.js +34 -0
- package/esm/helpers/utils/warehouse-void-sale-order-items-report-helpers.js +18 -0
- package/esm/helpers/utils/warehouse_inventory_transactions.js +91 -0
- package/esm/helpers/utils/x-report-helpers.js +1850 -0
- package/esm/index.js +3 -0
- package/esm/schemas/index.js +2 -0
- package/esm/schemas/models/app_configs.js +36 -0
- package/esm/schemas/models/applied_order_discounts.js +103 -0
- package/esm/schemas/models/brands.js +56 -0
- package/esm/schemas/models/categories.js +74 -0
- package/esm/schemas/models/close_dates.js +63 -0
- package/esm/schemas/models/common-models.js +449 -0
- package/esm/schemas/models/courses.js +62 -0
- package/esm/schemas/models/customer_redemptions.js +82 -0
- package/esm/schemas/models/customers.js +269 -0
- package/esm/schemas/models/deliveries.js +137 -0
- package/esm/schemas/models/delivery_areas.js +97 -0
- package/esm/schemas/models/dinein_floors.js +55 -0
- package/esm/schemas/models/dinein_tables.js +97 -0
- package/esm/schemas/models/dinein_tables_fingerprints.js +96 -0
- package/esm/schemas/models/discounts.js +87 -0
- package/esm/schemas/models/expense_categories.js +61 -0
- package/esm/schemas/models/expense_details.js +130 -0
- package/esm/schemas/models/gift_cards.js +342 -0
- package/esm/schemas/models/halfhalf_setup.js +142 -0
- package/esm/schemas/models/index.js +111 -0
- package/esm/schemas/models/internal_customers.js +139 -0
- package/esm/schemas/models/internal_invoices.js +119 -0
- package/esm/schemas/models/internal_leads.js +78 -0
- package/esm/schemas/models/internal_operational_roles.js +85 -0
- package/esm/schemas/models/internal_staffs.js +65 -0
- package/esm/schemas/models/inventories.js +103 -0
- package/esm/schemas/models/inventory_categories.js +52 -0
- package/esm/schemas/models/inventory_transactions.js +143 -0
- package/esm/schemas/models/item_transactions.js +117 -0
- package/esm/schemas/models/items.js +341 -0
- package/esm/schemas/models/marketing_fingerprints.js +92 -0
- package/esm/schemas/models/menus.js +66 -0
- package/esm/schemas/models/messaging_devices.js +99 -0
- package/esm/schemas/models/modifier_extras.js +120 -0
- package/esm/schemas/models/offers.js +470 -0
- package/esm/schemas/models/offers_fingerprints.js +61 -0
- package/esm/schemas/models/operational_roles.js +155 -0
- package/esm/schemas/models/orders.js +1051 -0
- package/esm/schemas/models/printer_settings.js +245 -0
- package/esm/schemas/models/public_holidays.js +58 -0
- package/esm/schemas/models/reservations.js +127 -0
- package/esm/schemas/models/reviews.js +145 -0
- package/esm/schemas/models/rewards_usage.js +61 -0
- package/esm/schemas/models/riders.js +75 -0
- package/esm/schemas/models/specials.js +169 -0
- package/esm/schemas/models/staff_shifts.js +66 -0
- package/esm/schemas/models/tenant-activity-logs.js +126 -0
- package/esm/schemas/models/tenant_active_jobs.js +77 -0
- package/esm/schemas/models/tenant_calendar.js +89 -0
- package/esm/schemas/models/tenant_cash_drawer_sessions.js +208 -0
- package/esm/schemas/models/tenant_cash_drawers.js +60 -0
- package/esm/schemas/models/tenant_cash_in_hand_transactions.js +69 -0
- package/esm/schemas/models/tenant_cash_in_out.js +104 -0
- package/esm/schemas/models/tenant_clients.js +66 -0
- package/esm/schemas/models/tenant_day_sessions.js +166 -0
- package/esm/schemas/models/tenant_hr_attendance_records.js +87 -0
- package/esm/schemas/models/tenant_hr_biometric_enrollments.js +69 -0
- package/esm/schemas/models/tenant_hr_departments.js +42 -0
- package/esm/schemas/models/tenant_hr_documents.js +71 -0
- package/esm/schemas/models/tenant_hr_employees.js +172 -0
- package/esm/schemas/models/tenant_hr_leave_requests.js +80 -0
- package/esm/schemas/models/tenant_hr_payrolls.js +131 -0
- package/esm/schemas/models/tenant_hr_performance_reviews.js +58 -0
- package/esm/schemas/models/tenant_hr_policies.js +57 -0
- package/esm/schemas/models/tenant_hr_positions.js +48 -0
- package/esm/schemas/models/tenant_hr_shift_schedules.js +84 -0
- package/esm/schemas/models/tenant_hr_shifts.js +64 -0
- package/esm/schemas/models/tenant_instore_shift_sessions.js +204 -0
- package/esm/schemas/models/tenant_instore_shifts.js +63 -0
- package/esm/schemas/models/tenant_inventory_department_transactions.js +116 -0
- package/esm/schemas/models/tenant_inventory_department_utilities.js +85 -0
- package/esm/schemas/models/tenant_inventory_departments.js +55 -0
- package/esm/schemas/models/tenant_inventory_entries.js +131 -0
- package/esm/schemas/models/tenant_metadata.js +88 -0
- package/esm/schemas/models/tenant_order_item_instructions.js +66 -0
- package/esm/schemas/models/tenant_purchase_order_vendor_returns.js +80 -0
- package/esm/schemas/models/tenant_purchase_orders.js +158 -0
- package/esm/schemas/models/tenant_shifts.js +57 -0
- package/esm/schemas/models/tenant_staffs.js +129 -0
- package/esm/schemas/models/tenant_vendors.js +99 -0
- package/esm/schemas/models/tenants.js +811 -0
- package/esm/schemas/models/terminal_devices.js +63 -0
- package/esm/schemas/models/tokens.js +73 -0
- package/esm/schemas/models/track_order_numbers.js +42 -0
- package/esm/schemas/models/void_order_items.js +210 -0
- package/esm/schemas/models/vouchers.js +101 -0
- package/esm/schemas/models/wallet_transactions.js +128 -0
- package/esm/schemas/models/wallets.js +44 -0
- package/esm/schemas/models/warehouse-activity-logs.js +144 -0
- package/esm/schemas/models/warehouse_categories.js +83 -0
- package/esm/schemas/models/warehouse_clients.js +81 -0
- package/esm/schemas/models/warehouse_communications.js +226 -0
- package/esm/schemas/models/warehouse_internal_movements.js +463 -0
- package/esm/schemas/models/warehouse_inventory_entries.js +125 -0
- package/esm/schemas/models/warehouse_inventory_lot_serial_numbers.js +188 -0
- package/esm/schemas/models/warehouse_inventory_transactions.js +133 -0
- package/esm/schemas/models/warehouse_item_transactions.js +97 -0
- package/esm/schemas/models/warehouse_items.js +173 -0
- package/esm/schemas/models/warehouse_operational_roles.js +87 -0
- package/esm/schemas/models/warehouse_purchase_order_receipts.js +163 -0
- package/esm/schemas/models/warehouse_purchase_order_rfqs.js +339 -0
- package/esm/schemas/models/warehouse_purchase_order_vendor_returns.js +199 -0
- package/esm/schemas/models/warehouse_purchase_orders.js +334 -0
- package/esm/schemas/models/warehouse_sale_deliveries.js +155 -0
- package/esm/schemas/models/warehouse_sale_invoices.js +229 -0
- package/esm/schemas/models/warehouse_sale_order_rfqs.js +340 -0
- package/esm/schemas/models/warehouse_sale_orders.js +322 -0
- package/esm/schemas/models/warehouse_staffs.js +104 -0
- package/esm/schemas/models/warehouse_track_order_numbers.js +73 -0
- package/esm/schemas/models/warehouse_vendors.js +99 -0
- package/esm/schemas/models/warehouse_void_purchase_order_items.js +174 -0
- package/esm/schemas/models/warehouse_void_sale_order_items.js +174 -0
- package/esm/schemas/models/warehouses.js +253 -0
- package/esm/schemas/types/app_configs.js +1 -0
- package/esm/schemas/types/applied_order_discounts.js +1 -0
- package/esm/schemas/types/brands.js +1 -0
- package/esm/schemas/types/categories.js +1 -0
- package/esm/schemas/types/close_dates.js +1 -0
- package/esm/schemas/types/common.js +1 -0
- package/esm/schemas/types/courses.js +1 -0
- package/esm/schemas/types/customer_redemptions.js +1 -0
- package/esm/schemas/types/customers.js +1 -0
- package/esm/schemas/types/deliveries.js +1 -0
- package/esm/schemas/types/delivery_areas.js +1 -0
- package/esm/schemas/types/dinein_floors.js +1 -0
- package/esm/schemas/types/dinein_tables.js +1 -0
- package/esm/schemas/types/dinein_tables_fingerprints.js +1 -0
- package/esm/schemas/types/discounts.js +1 -0
- package/esm/schemas/types/expense_categories.js +1 -0
- package/esm/schemas/types/expense_details.js +1 -0
- package/esm/schemas/types/gift_cards.js +1 -0
- package/esm/schemas/types/halfhalf_setup.js +1 -0
- package/esm/schemas/types/index.js +113 -0
- package/esm/schemas/types/internal_customers.js +1 -0
- package/esm/schemas/types/internal_invoices.js +1 -0
- package/esm/schemas/types/internal_leads.js +1 -0
- package/esm/schemas/types/internal_operational_roles.js +16 -0
- package/esm/schemas/types/internal_staffs.js +1 -0
- package/esm/schemas/types/inventories.js +1 -0
- package/esm/schemas/types/inventory_categories.js +1 -0
- package/esm/schemas/types/inventory_department_transactions.js +1 -0
- package/esm/schemas/types/inventory_department_utilities.js +1 -0
- package/esm/schemas/types/inventory_departments.js +1 -0
- package/esm/schemas/types/inventory_transactions.js +1 -0
- package/esm/schemas/types/item_transactions.js +1 -0
- package/esm/schemas/types/items.js +1 -0
- package/esm/schemas/types/marketing_fingerprints.js +1 -0
- package/esm/schemas/types/menus.js +1 -0
- package/esm/schemas/types/messaging_devices.js +1 -0
- package/esm/schemas/types/modifier_extras.js +1 -0
- package/esm/schemas/types/multi_tenants.js +1 -0
- package/esm/schemas/types/offers.js +1 -0
- package/esm/schemas/types/offers_fingerprints.js +1 -0
- package/esm/schemas/types/operational_roles.js +15 -0
- package/esm/schemas/types/orders.js +1 -0
- package/esm/schemas/types/printer_settings.js +1 -0
- package/esm/schemas/types/public_holidays.js +1 -0
- package/esm/schemas/types/reservations.js +1 -0
- package/esm/schemas/types/reviews.js +1 -0
- package/esm/schemas/types/rewards_usage.js +1 -0
- package/esm/schemas/types/riders.js +1 -0
- package/esm/schemas/types/specials.js +1 -0
- package/esm/schemas/types/staff_shifts.js +1 -0
- package/esm/schemas/types/tenant-activity-logs.js +1 -0
- package/esm/schemas/types/tenant_active_jobs.js +1 -0
- package/esm/schemas/types/tenant_calendar.js +1 -0
- package/esm/schemas/types/tenant_cash_drawer_sessions.js +1 -0
- package/esm/schemas/types/tenant_cash_drawers.js +1 -0
- package/esm/schemas/types/tenant_cash_in_hand_transactions.js +1 -0
- package/esm/schemas/types/tenant_cash_in_out.js +1 -0
- package/esm/schemas/types/tenant_clients.js +1 -0
- package/esm/schemas/types/tenant_day_sessions.js +1 -0
- package/esm/schemas/types/tenant_hr_attendance_records.js +1 -0
- package/esm/schemas/types/tenant_hr_biometric_enrollments.js +1 -0
- package/esm/schemas/types/tenant_hr_departments.js +1 -0
- package/esm/schemas/types/tenant_hr_documents.js +1 -0
- package/esm/schemas/types/tenant_hr_employees.js +1 -0
- package/esm/schemas/types/tenant_hr_leave_requests.js +1 -0
- package/esm/schemas/types/tenant_hr_payrolls.js +1 -0
- package/esm/schemas/types/tenant_hr_performance_reviews.js +1 -0
- package/esm/schemas/types/tenant_hr_policies.js +1 -0
- package/esm/schemas/types/tenant_hr_positions.js +1 -0
- package/esm/schemas/types/tenant_hr_shift_schedules.js +1 -0
- package/esm/schemas/types/tenant_hr_shifts.js +1 -0
- package/esm/schemas/types/tenant_instore_shift_sessions.js +1 -0
- package/esm/schemas/types/tenant_instore_shifts.js +1 -0
- package/esm/schemas/types/tenant_inventory_entries.js +1 -0
- package/esm/schemas/types/tenant_metadata.js +1 -0
- package/esm/schemas/types/tenant_order_item_instructions.js +1 -0
- package/esm/schemas/types/tenant_purchase_order_vendor_returns.js +1 -0
- package/esm/schemas/types/tenant_purchase_orders.js +1 -0
- package/esm/schemas/types/tenant_shifts.js +1 -0
- package/esm/schemas/types/tenant_staffs.js +1 -0
- package/esm/schemas/types/tenant_vendors.js +1 -0
- package/esm/schemas/types/tenants.js +1 -0
- package/esm/schemas/types/terminal_devices.js +1 -0
- package/esm/schemas/types/tokens.js +1 -0
- package/esm/schemas/types/track_order_numbers.js +1 -0
- package/esm/schemas/types/void_order_items.js +1 -0
- package/esm/schemas/types/vouchers.js +1 -0
- package/esm/schemas/types/wallet_transactions.js +1 -0
- package/esm/schemas/types/wallets.js +1 -0
- package/esm/schemas/types/warehouse-activity-logs.js +1 -0
- package/esm/schemas/types/warehouse_categories.js +1 -0
- package/esm/schemas/types/warehouse_clients.js +1 -0
- package/esm/schemas/types/warehouse_communications.js +1 -0
- package/esm/schemas/types/warehouse_internal_movements.js +1 -0
- package/esm/schemas/types/warehouse_inventory_entries.js +1 -0
- package/esm/schemas/types/warehouse_inventory_lot_serial_numbers.js +1 -0
- package/esm/schemas/types/warehouse_inventory_transactions.js +1 -0
- package/esm/schemas/types/warehouse_item_transactions.js +1 -0
- package/esm/schemas/types/warehouse_items.js +1 -0
- package/esm/schemas/types/warehouse_operational_roles.js +15 -0
- package/esm/schemas/types/warehouse_purchase_order_receipts.js +18 -0
- package/esm/schemas/types/warehouse_purchase_order_rfqs.js +1 -0
- package/esm/schemas/types/warehouse_purchase_order_vendor_returns.js +1 -0
- package/esm/schemas/types/warehouse_purchase_orders.js +1 -0
- package/esm/schemas/types/warehouse_sale_deliveries.js +1 -0
- package/esm/schemas/types/warehouse_sale_invoices.js +1 -0
- package/esm/schemas/types/warehouse_sale_order_rfqs.js +1 -0
- package/esm/schemas/types/warehouse_sale_orders.js +1 -0
- package/esm/schemas/types/warehouse_staffs.js +1 -0
- package/esm/schemas/types/warehouse_track_order_numbers.js +1 -0
- package/esm/schemas/types/warehouse_vendors.js +1 -0
- package/esm/schemas/types/warehouse_void_purchase_order_items.js +1 -0
- package/esm/schemas/types/warehouse_void_sale_order_items.js +1 -0
- package/esm/schemas/types/warehouses.js +1 -0
- package/lib/helpers/types/api-types.d.ts +37 -0
- package/package.json +6 -3
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import ObjectID from 'bson-objectid';
|
|
2
|
+
import { isEqual } from 'lodash';
|
|
3
|
+
import { WAREHOUSE_SALES_ORDER_STATUS_ENUM } from '../../constants';
|
|
4
|
+
import { getPercentageAmount, parseFloatCeil, parseNum } from '../utils';
|
|
5
|
+
export function calculateCartWarehouseSaleOrderInfoAndSyncData(data, calculateItemMetadata) {
|
|
6
|
+
const isCompleted = data.order_status === WAREHOUSE_SALES_ORDER_STATUS_ENUM.COMPLETED;
|
|
7
|
+
/* ===============================><=============================== */
|
|
8
|
+
let subtotal = 0;
|
|
9
|
+
const categories = [];
|
|
10
|
+
const length = data.categories?.length ?? 0;
|
|
11
|
+
for (let c = 0; c < length; c++) {
|
|
12
|
+
const category = data.categories[c];
|
|
13
|
+
const newItems = [];
|
|
14
|
+
const itemsLength = category.items.length;
|
|
15
|
+
for (let i = 0; i < itemsLength; i++) {
|
|
16
|
+
const item = category.items[i];
|
|
17
|
+
// For sale orders, subtotal is already set as price * quantity
|
|
18
|
+
const itemSubtotal = parseNum(item.price * item.quantity);
|
|
19
|
+
const newItem = {
|
|
20
|
+
...item,
|
|
21
|
+
is_ready: item.is_ready || isCompleted,
|
|
22
|
+
subtotal: itemSubtotal,
|
|
23
|
+
// These values will be auto calculated
|
|
24
|
+
_discount_amount: 0,
|
|
25
|
+
_gross_amount: 0,
|
|
26
|
+
_gst_amount: 0,
|
|
27
|
+
_net_amount: 0,
|
|
28
|
+
};
|
|
29
|
+
delete newItem.void_reason;
|
|
30
|
+
newItems.push(newItem);
|
|
31
|
+
subtotal += itemSubtotal;
|
|
32
|
+
}
|
|
33
|
+
categories.push({
|
|
34
|
+
...category,
|
|
35
|
+
items: newItems,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
let grand_total = subtotal;
|
|
39
|
+
// GST is represented in percentage. We convert it to decimal
|
|
40
|
+
let gst_amount = 0;
|
|
41
|
+
const gst = data.gst ?? 0;
|
|
42
|
+
if (data.is_gst_inclusive) {
|
|
43
|
+
gst_amount = parseFloatCeil((grand_total * gst) / (100 + gst));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
gst_amount = getPercentageAmount(grand_total, gst);
|
|
47
|
+
grand_total += gst_amount;
|
|
48
|
+
}
|
|
49
|
+
grand_total = parseNum(grand_total);
|
|
50
|
+
const amount_collected = parseNum(grand_total);
|
|
51
|
+
const amount_earned = parseNum(grand_total);
|
|
52
|
+
if (calculateItemMetadata) {
|
|
53
|
+
let leftGrossAmount = subtotal;
|
|
54
|
+
let leftNetAmount = subtotal;
|
|
55
|
+
let leftDiscountAmount = 0;
|
|
56
|
+
let leftGstAmount = gst_amount;
|
|
57
|
+
categories.forEach((category, categoryIndex) => {
|
|
58
|
+
const isLastCategory = categoryIndex === categories.length - 1;
|
|
59
|
+
category.items.forEach((item, itemIndex) => {
|
|
60
|
+
const isLastItem = isLastCategory && itemIndex === category.items.length - 1;
|
|
61
|
+
let grossAmount = item.subtotal;
|
|
62
|
+
let netAmount = item.subtotal;
|
|
63
|
+
let itemTotalDiscountAmount = 0;
|
|
64
|
+
let itemGst = 0;
|
|
65
|
+
if (gst_amount > 0) {
|
|
66
|
+
itemGst = (item.subtotal / subtotal) * gst_amount;
|
|
67
|
+
}
|
|
68
|
+
grossAmount = parseFloatCeil(grossAmount);
|
|
69
|
+
const netAmountParsed = parseFloatCeil(netAmount);
|
|
70
|
+
const itemTotalDiscountAmountParsed = parseFloatCeil(itemTotalDiscountAmount);
|
|
71
|
+
itemGst = parseFloatCeil(itemGst);
|
|
72
|
+
leftGrossAmount -= grossAmount;
|
|
73
|
+
leftNetAmount -= netAmountParsed;
|
|
74
|
+
leftDiscountAmount -= itemTotalDiscountAmountParsed;
|
|
75
|
+
leftGstAmount -= itemGst;
|
|
76
|
+
if (isLastItem) {
|
|
77
|
+
grossAmount += leftGrossAmount;
|
|
78
|
+
netAmount += leftNetAmount;
|
|
79
|
+
itemTotalDiscountAmount += leftDiscountAmount;
|
|
80
|
+
itemGst += leftGstAmount;
|
|
81
|
+
}
|
|
82
|
+
item._gross_amount = Math.max(grossAmount, 0);
|
|
83
|
+
item._net_amount = Math.max(netAmount, 0);
|
|
84
|
+
item._discount_amount = Math.max(itemTotalDiscountAmount, 0);
|
|
85
|
+
item._gst_amount = Math.max(itemGst, 0);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const cartData = {
|
|
90
|
+
...data,
|
|
91
|
+
categories,
|
|
92
|
+
amount_collected,
|
|
93
|
+
amount_earned,
|
|
94
|
+
gst_amount,
|
|
95
|
+
price: parseNum(subtotal),
|
|
96
|
+
grand_total,
|
|
97
|
+
};
|
|
98
|
+
return cartData;
|
|
99
|
+
}
|
|
100
|
+
export const getWarehouseSaleOrderItemComparableData = (item) => ({
|
|
101
|
+
item_id: item.item_id,
|
|
102
|
+
name: item.name,
|
|
103
|
+
price: item.price,
|
|
104
|
+
special_instructions: item.special_instructions,
|
|
105
|
+
_id: item._id,
|
|
106
|
+
quantity: item.quantity,
|
|
107
|
+
});
|
|
108
|
+
const getUpdatedSaleOrderItem = (item) => ({
|
|
109
|
+
item_id: item.item_id,
|
|
110
|
+
name: item.name,
|
|
111
|
+
price: item.price,
|
|
112
|
+
special_instructions: item.special_instructions,
|
|
113
|
+
});
|
|
114
|
+
// =====================><=====================
|
|
115
|
+
export function getUpdatedWarehouseSaleOrderCartInfoOnInit(data, order) {
|
|
116
|
+
const merged = { ...data, ...order };
|
|
117
|
+
return calculateCartWarehouseSaleOrderInfoAndSyncData(merged);
|
|
118
|
+
}
|
|
119
|
+
export function getRemoveItemFromWarehouseSaleOrderCartData(data, payload) {
|
|
120
|
+
const orderItemIdsMap = {};
|
|
121
|
+
let categories;
|
|
122
|
+
if (data.categories != null) {
|
|
123
|
+
categories = [];
|
|
124
|
+
for (let i = 0; i < data.categories.length; i++) {
|
|
125
|
+
const category = data.categories[i];
|
|
126
|
+
const items = [];
|
|
127
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
128
|
+
const item = category.items[j];
|
|
129
|
+
if (item._id !== payload._id) {
|
|
130
|
+
items.push(item);
|
|
131
|
+
orderItemIdsMap[item._id] = item.quantity;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (items.length > 0) {
|
|
135
|
+
categories.push({
|
|
136
|
+
...category,
|
|
137
|
+
items,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const iterations = [];
|
|
143
|
+
if (data.iterations != null && data.iterations.length > 0) {
|
|
144
|
+
const [firstIteration, ...restIterations] = data.iterations;
|
|
145
|
+
const firstIterationCategories = [];
|
|
146
|
+
for (let i = 0; i < firstIteration.categories.length; i++) {
|
|
147
|
+
const category = firstIteration.categories[i];
|
|
148
|
+
const allPrevItems = [];
|
|
149
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
150
|
+
const prevItem = category.items[j];
|
|
151
|
+
if (prevItem._id === payload._id && payload.void_reason != null) {
|
|
152
|
+
const newItem = {
|
|
153
|
+
...prevItem,
|
|
154
|
+
void_reason: payload.void_reason,
|
|
155
|
+
};
|
|
156
|
+
allPrevItems.push(newItem);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
const currentItemQuantity = orderItemIdsMap[prevItem._id];
|
|
160
|
+
const isRemovedItem = !currentItemQuantity || currentItemQuantity < prevItem.quantity;
|
|
161
|
+
if (isRemovedItem) {
|
|
162
|
+
allPrevItems.push(prevItem);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
const updatedPrevItem = {
|
|
166
|
+
...prevItem,
|
|
167
|
+
};
|
|
168
|
+
delete updatedPrevItem.void_reason;
|
|
169
|
+
allPrevItems.push(updatedPrevItem);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (allPrevItems.length > 0) {
|
|
174
|
+
firstIterationCategories.push({
|
|
175
|
+
...category,
|
|
176
|
+
items: allPrevItems,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const firstIterationData = {
|
|
181
|
+
...firstIteration,
|
|
182
|
+
categories: firstIterationCategories,
|
|
183
|
+
};
|
|
184
|
+
iterations.push(firstIterationData);
|
|
185
|
+
iterations.push(...restIterations);
|
|
186
|
+
}
|
|
187
|
+
const order = {
|
|
188
|
+
...data,
|
|
189
|
+
...(iterations.length > 0 && { iterations }),
|
|
190
|
+
categories,
|
|
191
|
+
};
|
|
192
|
+
const newData = calculateCartWarehouseSaleOrderInfoAndSyncData(order);
|
|
193
|
+
return newData;
|
|
194
|
+
}
|
|
195
|
+
export function getUpdateWarehouseSaleOrderCartInfoData(data, payload) {
|
|
196
|
+
const order = {
|
|
197
|
+
...data,
|
|
198
|
+
...payload,
|
|
199
|
+
};
|
|
200
|
+
const newData = calculateCartWarehouseSaleOrderInfoAndSyncData(order);
|
|
201
|
+
return newData;
|
|
202
|
+
}
|
|
203
|
+
export function getAddItemToWarehouseSaleOrderCartData(data, payload) {
|
|
204
|
+
const { category_id, name, item, replace_id } = payload;
|
|
205
|
+
let mainItemId = item._id;
|
|
206
|
+
const orderData = { ...data };
|
|
207
|
+
// =====================><=====================
|
|
208
|
+
const categories = [...(orderData.categories ?? [])];
|
|
209
|
+
let didFindCategory = false;
|
|
210
|
+
const categoriesLength = categories.length;
|
|
211
|
+
for (let i = 0; i < categoriesLength; i++) {
|
|
212
|
+
const category = categories[i];
|
|
213
|
+
if (category.category_id !== category_id)
|
|
214
|
+
continue;
|
|
215
|
+
const updatedItem = getUpdatedSaleOrderItem(item);
|
|
216
|
+
const allItems = [...category.items];
|
|
217
|
+
let didFindItem = false;
|
|
218
|
+
let itemExists = false;
|
|
219
|
+
const totalItems = allItems.length;
|
|
220
|
+
for (let j = 0; j < totalItems; j++) {
|
|
221
|
+
const itm = allItems[j];
|
|
222
|
+
if (itm._id === item._id) {
|
|
223
|
+
allItems[j] = item;
|
|
224
|
+
didFindItem = true;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
if (itm.item_id === item.item_id) {
|
|
228
|
+
itemExists = true;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (!didFindItem && itemExists) {
|
|
232
|
+
for (let j = 0; j < totalItems; j++) {
|
|
233
|
+
const itm = allItems[j];
|
|
234
|
+
if (itm.item_id === item.item_id && isEqual(getUpdatedSaleOrderItem(itm), updatedItem)) {
|
|
235
|
+
mainItemId = replace_id ?? itm._id;
|
|
236
|
+
allItems[j] = {
|
|
237
|
+
...item,
|
|
238
|
+
_id: mainItemId,
|
|
239
|
+
quantity: item.quantity + itm.quantity,
|
|
240
|
+
};
|
|
241
|
+
didFindItem = true;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (!didFindItem) {
|
|
247
|
+
allItems.push(item);
|
|
248
|
+
}
|
|
249
|
+
categories[i] = {
|
|
250
|
+
...category,
|
|
251
|
+
items: allItems,
|
|
252
|
+
};
|
|
253
|
+
didFindCategory = true;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
if (!didFindCategory) {
|
|
257
|
+
categories.push({
|
|
258
|
+
category_id,
|
|
259
|
+
name,
|
|
260
|
+
items: [item],
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
// =====================><=====================
|
|
264
|
+
const iterations = [];
|
|
265
|
+
if (orderData.iterations != null && orderData.iterations.length > 0) {
|
|
266
|
+
const orderItemIdsMap = {};
|
|
267
|
+
for (let i = 0; i < categories.length; i++) {
|
|
268
|
+
const category = categories[i];
|
|
269
|
+
const items = category.items;
|
|
270
|
+
for (let j = 0; j < items.length; j++) {
|
|
271
|
+
const item = items[j];
|
|
272
|
+
orderItemIdsMap[item._id] = item.quantity;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const [firstIteration, ...restIterations] = orderData.iterations;
|
|
276
|
+
const firstIterationCategories = [];
|
|
277
|
+
for (let i = 0; i < firstIteration.categories.length; i++) {
|
|
278
|
+
const category = firstIteration.categories[i];
|
|
279
|
+
const allPrevItems = [];
|
|
280
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
281
|
+
const prevItem = category.items[j];
|
|
282
|
+
const currentItemQuantity = orderItemIdsMap[prevItem._id];
|
|
283
|
+
const isRemovedItem = !currentItemQuantity || currentItemQuantity < prevItem.quantity;
|
|
284
|
+
if (isRemovedItem) {
|
|
285
|
+
allPrevItems.push(prevItem);
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
const updatedPrevItem = {
|
|
289
|
+
...prevItem,
|
|
290
|
+
};
|
|
291
|
+
delete updatedPrevItem.void_reason;
|
|
292
|
+
allPrevItems.push(updatedPrevItem);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (allPrevItems.length > 0) {
|
|
296
|
+
firstIterationCategories.push({
|
|
297
|
+
...category,
|
|
298
|
+
items: allPrevItems,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
const firstIterationData = {
|
|
303
|
+
...firstIteration,
|
|
304
|
+
categories: firstIterationCategories,
|
|
305
|
+
};
|
|
306
|
+
iterations.push(firstIterationData);
|
|
307
|
+
iterations.push(...restIterations);
|
|
308
|
+
}
|
|
309
|
+
// =====================><=====================
|
|
310
|
+
const order = {
|
|
311
|
+
...orderData,
|
|
312
|
+
...(iterations.length > 0 && { iterations }),
|
|
313
|
+
categories,
|
|
314
|
+
};
|
|
315
|
+
const newData = calculateCartWarehouseSaleOrderInfoAndSyncData(order);
|
|
316
|
+
return newData;
|
|
317
|
+
}
|
|
318
|
+
export function getUpdateItemInWarehouseSaleOrderCartData(data, payload) {
|
|
319
|
+
const orderItemIdsMap = {};
|
|
320
|
+
let categories;
|
|
321
|
+
if (data.categories != null) {
|
|
322
|
+
categories = [];
|
|
323
|
+
for (let i = 0; i < data.categories.length; i++) {
|
|
324
|
+
const category = data.categories[i];
|
|
325
|
+
const items = [];
|
|
326
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
327
|
+
const item = category.items[j];
|
|
328
|
+
let newItem = item;
|
|
329
|
+
if (item._id === payload._id) {
|
|
330
|
+
newItem = {
|
|
331
|
+
...item,
|
|
332
|
+
...payload,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
if (newItem.quantity > 0) {
|
|
336
|
+
items.push(newItem);
|
|
337
|
+
orderItemIdsMap[newItem._id] = newItem.quantity;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (items.length > 0) {
|
|
341
|
+
categories.push({
|
|
342
|
+
...category,
|
|
343
|
+
items,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
const iterations = [];
|
|
349
|
+
if (payload.quantity != null && data.iterations != null && data.iterations.length > 0) {
|
|
350
|
+
const [firstIteration, ...restIterations] = data.iterations;
|
|
351
|
+
const firstIterationCategories = [];
|
|
352
|
+
for (let i = 0; i < firstIteration.categories.length; i++) {
|
|
353
|
+
const category = firstIteration.categories[i];
|
|
354
|
+
const allPrevItems = [];
|
|
355
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
356
|
+
const prevItem = category.items[j];
|
|
357
|
+
if (prevItem._id === payload._id && payload.void_reason != null) {
|
|
358
|
+
const updatedPrevItem = {
|
|
359
|
+
...prevItem,
|
|
360
|
+
void_reason: payload.void_reason,
|
|
361
|
+
};
|
|
362
|
+
allPrevItems.push(updatedPrevItem);
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
const currentItemQuantity = orderItemIdsMap[prevItem._id];
|
|
366
|
+
const isRemovedItem = !currentItemQuantity || currentItemQuantity < prevItem.quantity;
|
|
367
|
+
if (isRemovedItem) {
|
|
368
|
+
allPrevItems.push(prevItem);
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
const updatedPrevItem = {
|
|
372
|
+
...prevItem,
|
|
373
|
+
};
|
|
374
|
+
delete updatedPrevItem.void_reason;
|
|
375
|
+
allPrevItems.push(updatedPrevItem);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (allPrevItems.length > 0) {
|
|
380
|
+
firstIterationCategories.push({
|
|
381
|
+
...category,
|
|
382
|
+
items: allPrevItems,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const firstIterationData = {
|
|
387
|
+
...firstIteration,
|
|
388
|
+
categories: firstIterationCategories,
|
|
389
|
+
};
|
|
390
|
+
iterations.push(firstIterationData);
|
|
391
|
+
iterations.push(...restIterations);
|
|
392
|
+
}
|
|
393
|
+
const order = {
|
|
394
|
+
...data,
|
|
395
|
+
...(iterations.length > 0 && { iterations }),
|
|
396
|
+
categories,
|
|
397
|
+
};
|
|
398
|
+
const newData = calculateCartWarehouseSaleOrderInfoAndSyncData(order);
|
|
399
|
+
return newData;
|
|
400
|
+
}
|
|
401
|
+
export function getUpdateItemsInWarehouseSaleOrderCartData(data, payload) {
|
|
402
|
+
const newData = payload.reduce((acc, item) => getUpdateItemInWarehouseSaleOrderCartData(acc, item), data);
|
|
403
|
+
return newData;
|
|
404
|
+
}
|
|
405
|
+
export function getSplitWarehouseSaleOrderCartItemToTwo({ data, orderItemId, }) {
|
|
406
|
+
if (data.categories == null)
|
|
407
|
+
return data;
|
|
408
|
+
const newCategories = [];
|
|
409
|
+
for (let i = 0; i < data.categories.length; i++) {
|
|
410
|
+
const category = data.categories[i];
|
|
411
|
+
const newItems = [];
|
|
412
|
+
for (let j = 0; j < category.items.length; j++) {
|
|
413
|
+
const item = {
|
|
414
|
+
...category.items[j],
|
|
415
|
+
};
|
|
416
|
+
if (item._id !== orderItemId) {
|
|
417
|
+
newItems.push(item);
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
if (item.quantity === 1) {
|
|
421
|
+
newItems.push(item);
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
const prevQuantity = item.quantity;
|
|
425
|
+
const newQuantity = item.quantity - 1;
|
|
426
|
+
const prevItem = {
|
|
427
|
+
...item,
|
|
428
|
+
quantity: newQuantity,
|
|
429
|
+
subtotal: parseNum(item.price * newQuantity),
|
|
430
|
+
};
|
|
431
|
+
newItems.push(prevItem);
|
|
432
|
+
const _id = new ObjectID(Math.floor(new ObjectID(item._id).getTimestamp().getTime() / 1000) + 1).toHexString();
|
|
433
|
+
newItems.push({
|
|
434
|
+
...item,
|
|
435
|
+
_id,
|
|
436
|
+
quantity: 1,
|
|
437
|
+
subtotal: parseNum(item.price * 1),
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
newCategories.push({
|
|
441
|
+
...category,
|
|
442
|
+
items: newItems,
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
const order = {
|
|
446
|
+
...data,
|
|
447
|
+
categories: newCategories,
|
|
448
|
+
};
|
|
449
|
+
const newData = calculateCartWarehouseSaleOrderInfoAndSyncData(order);
|
|
450
|
+
return newData;
|
|
451
|
+
}
|
|
452
|
+
export function getAddItemsToWarehouseSaleOrderCartData(data, payload) {
|
|
453
|
+
const newData = payload.reduce((acc, item) => getAddItemToWarehouseSaleOrderCartData(acc, item), data);
|
|
454
|
+
return newData;
|
|
455
|
+
}
|
|
456
|
+
/* ======================><====================== */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from './api-types';
|
|
2
|
+
export * from './cart-actions';
|
|
3
|
+
export * from './cart-helpers';
|
|
4
|
+
export * from './catalog';
|
|
5
|
+
export * from './common';
|
|
6
|
+
export * from './email-templates';
|
|
7
|
+
export * from './fbr-generate-invoice';
|
|
8
|
+
export * from './halfhalf';
|
|
9
|
+
export * from './hubrise_catalog';
|
|
10
|
+
export * from './hubrise_customers';
|
|
11
|
+
export * from './hubrise_deliveries';
|
|
12
|
+
export * from './hubrise_location';
|
|
13
|
+
export * from './hubrise_orders';
|
|
14
|
+
export * from './internal-leads';
|
|
15
|
+
export * from './inventory-catalog';
|
|
16
|
+
export * from './kpra-generate-invoice';
|
|
17
|
+
export * from './marketing';
|
|
18
|
+
export * from './order-engine';
|
|
19
|
+
export * from './pra-generate-invoice';
|
|
20
|
+
export * from './report-webview';
|
|
21
|
+
export * from './reports';
|
|
22
|
+
export * from './smartpay-apis';
|
|
23
|
+
export * from './specials';
|
|
24
|
+
export * from './split_bill';
|
|
25
|
+
export * from './srb-generate-invoice';
|
|
26
|
+
export * from './switchpay';
|
|
27
|
+
export * from './tenant-purchase-order-cart-actions';
|
|
28
|
+
export * from './warehouse-catalog';
|
|
29
|
+
export * from './warehouse-purchase-order-cart-actions';
|
|
30
|
+
export * from './warehouse-purchase-order-rfq-cart-actions';
|
|
31
|
+
export * from './warehouse-sale-order-cart-actions';
|
|
32
|
+
export * from './warehouse-sale-order-rfq-cart-actions';
|
|
33
|
+
export * from './workers';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ASAANBILL_DQRC_IDENTIFIER_SEPARATOR, ASAANBILL_DQRC_PURPOSES, } from '../../constants';
|
|
2
|
+
// =======================>>><<<=======================
|
|
3
|
+
/**
|
|
4
|
+
* Builds an AsaanBill DQRC payment identifier:
|
|
5
|
+
* `<purpose>:<refId>:<paymentId>` (e.g. `order_payment:<order_id>:<payment._id>`).
|
|
6
|
+
*
|
|
7
|
+
* Re-adding with the SAME identifier makes AsaanBill DISCARD the previous
|
|
8
|
+
* (unpaid) PSID and issue a fresh QR — that is how DQRC amounts are updated.
|
|
9
|
+
*/
|
|
10
|
+
export function buildAsaanBillIdentifier(purpose, refId, paymentId) {
|
|
11
|
+
let identifier = `${purpose}${ASAANBILL_DQRC_IDENTIFIER_SEPARATOR}${refId}`;
|
|
12
|
+
if (paymentId) {
|
|
13
|
+
identifier += `${ASAANBILL_DQRC_IDENTIFIER_SEPARATOR}${paymentId}`;
|
|
14
|
+
}
|
|
15
|
+
return identifier;
|
|
16
|
+
}
|
|
17
|
+
/** Parses an identifier back into its parts, or null when malformed/unknown. */
|
|
18
|
+
export function parseAsaanBillIdentifier(identifier) {
|
|
19
|
+
if (!identifier)
|
|
20
|
+
return null;
|
|
21
|
+
const parts = identifier.split(ASAANBILL_DQRC_IDENTIFIER_SEPARATOR);
|
|
22
|
+
if (parts.length < 2)
|
|
23
|
+
return null;
|
|
24
|
+
const purpose = parts[0];
|
|
25
|
+
const refId = parts[1];
|
|
26
|
+
const paymentId = parts[2];
|
|
27
|
+
if (!ASAANBILL_DQRC_PURPOSES.includes(purpose)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return { purpose, refId, paymentId };
|
|
31
|
+
}
|