@managesome/eposmatic-toolkit 0.3.7 → 0.3.9
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/utils/order-engine.js +6 -1
- package/lib/tests/soldout-option-default-guard.test.d.ts +1 -0
- package/lib/tests/soldout-option-default-guard.test.js +126 -0
- package/package.json +6 -3
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
import { CURRENCY_SYMBOL_ENUM } from '../../constants';
|
|
3
|
+
import { getFormattedCancellationReason, localeAmount } from './common';
|
|
4
|
+
// Generate HTML template for void items report
|
|
5
|
+
export function getVoidItemsReportHtml(props) {
|
|
6
|
+
const { data, tenantName, from, to, width = 800, monochrome = false, currency_symbol } = props;
|
|
7
|
+
const hasVendorName = data.some((item) => typeof item.vendor_name === 'string' && item.vendor_name.trim().length > 0);
|
|
8
|
+
const hasClientName = data.some((item) => typeof item.client_name === 'string' && item.client_name.trim().length > 0);
|
|
9
|
+
const hasPartyNameColumn = hasVendorName || hasClientName;
|
|
10
|
+
const partyNameColumnTitle = hasVendorName && !hasClientName
|
|
11
|
+
? 'Vendor Name'
|
|
12
|
+
: hasClientName && !hasVendorName
|
|
13
|
+
? 'Client Name'
|
|
14
|
+
: 'Vendor/Client Name';
|
|
15
|
+
const mainStyle = width ? `style="width: ${width}px; max-width: ${width}px"` : '';
|
|
16
|
+
const fromFormatted = from ? moment(from).format('MMM DD, YYYY') : 'N/A';
|
|
17
|
+
const toFormatted = to ? moment(to).format('MMM DD, YYYY') : 'N/A';
|
|
18
|
+
const currentDate = moment().format('MMM DD, YYYY');
|
|
19
|
+
const currentTime = moment().format('hh:mm A');
|
|
20
|
+
const styles = `
|
|
21
|
+
<style>
|
|
22
|
+
* {
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
font-family: 'Arial', sans-serif;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
body {
|
|
30
|
+
background: #fff;
|
|
31
|
+
color: #000;
|
|
32
|
+
line-height: 1.4;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.container {
|
|
36
|
+
${mainStyle ? mainStyle.replace('style=', '').replace(/"/g, '') : ''}
|
|
37
|
+
margin: 0 auto;
|
|
38
|
+
padding: 20px;
|
|
39
|
+
background: #fff;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.header {
|
|
43
|
+
text-align: center;
|
|
44
|
+
margin-bottom: 30px;
|
|
45
|
+
border-bottom: 2px solid #000;
|
|
46
|
+
padding-bottom: 15px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.header h1 {
|
|
50
|
+
font-size: 24px;
|
|
51
|
+
font-weight: bold;
|
|
52
|
+
margin-bottom: 5px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.header h2 {
|
|
56
|
+
font-size: 16px;
|
|
57
|
+
font-weight: normal;
|
|
58
|
+
margin-bottom: 10px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.date-info {
|
|
62
|
+
font-size: 12px;
|
|
63
|
+
margin-bottom: 10px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.tenant-info {
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
font-weight: bold;
|
|
69
|
+
color: #000;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.table-container {
|
|
73
|
+
margin-top: 20px;
|
|
74
|
+
overflow-x: auto;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
table {
|
|
78
|
+
width: 100%;
|
|
79
|
+
border-collapse: collapse;
|
|
80
|
+
font-size: 11px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
th, td {
|
|
84
|
+
padding: 8px 6px;
|
|
85
|
+
border: 1px solid #ddd;
|
|
86
|
+
text-align: left;
|
|
87
|
+
vertical-align: top;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
th {
|
|
91
|
+
background-color: ${monochrome ? '#f0f0f0' : '#f8f9fa'};
|
|
92
|
+
font-weight: bold;
|
|
93
|
+
color: #000;
|
|
94
|
+
text-align: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.text-center {
|
|
98
|
+
text-align: center;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.text-right {
|
|
102
|
+
text-align: right;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.platform-tag {
|
|
106
|
+
background-color: ${monochrome ? '#e0e0e0' : '#e3f2fd'};
|
|
107
|
+
padding: 2px 6px;
|
|
108
|
+
border-radius: 3px;
|
|
109
|
+
font-size: 10px;
|
|
110
|
+
font-weight: bold;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.order-tag {
|
|
114
|
+
background-color: ${monochrome ? '#e0e0e0' : '#e8f5e8'};
|
|
115
|
+
color: ${monochrome ? '#000' : '#1976d2'};
|
|
116
|
+
padding: 2px 6px;
|
|
117
|
+
border-radius: 3px;
|
|
118
|
+
font-size: 10px;
|
|
119
|
+
font-weight: bold;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.quantity-removed {
|
|
123
|
+
background-color: ${monochrome ? '#e0e0e0' : '#ffebee'};
|
|
124
|
+
color: ${monochrome ? '#000' : '#d32f2f'};
|
|
125
|
+
padding: 2px 6px;
|
|
126
|
+
border-radius: 3px;
|
|
127
|
+
font-size: 10px;
|
|
128
|
+
font-weight: bold;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.void-reason {
|
|
132
|
+
max-width: 300px;
|
|
133
|
+
word-wrap: break-word;
|
|
134
|
+
font-size: 10px;
|
|
135
|
+
line-height: 1.3;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.footer {
|
|
139
|
+
margin-top: 30px;
|
|
140
|
+
text-align: center;
|
|
141
|
+
font-size: 10px;
|
|
142
|
+
border-top: 1px solid #ccc;
|
|
143
|
+
padding-top: 10px;
|
|
144
|
+
}
|
|
145
|
+
.receipt-footer-company {
|
|
146
|
+
font-weight: bold;
|
|
147
|
+
margin-bottom: 3px;
|
|
148
|
+
font-size: 16px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.receipt-footer-date {
|
|
152
|
+
font-size: 12px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.no-data {
|
|
156
|
+
text-align: center;
|
|
157
|
+
padding: 40px;
|
|
158
|
+
font-size: 14px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
${monochrome
|
|
162
|
+
? `
|
|
163
|
+
/* Receipt Printer Optimized Styles - Monochrome */
|
|
164
|
+
* {
|
|
165
|
+
font-family: "Roboto Condensed", Roboto, sans-serif !important;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.header {
|
|
169
|
+
margin-bottom: 8px !important;
|
|
170
|
+
padding-bottom: 4px !important;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.header h1 {
|
|
174
|
+
font-size: 20px !important;
|
|
175
|
+
margin-bottom: 2px !important;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.header h2 {
|
|
179
|
+
font-size: 17px !important;
|
|
180
|
+
margin-bottom: 2px !important;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.date-info {
|
|
184
|
+
font-size: 15px !important;
|
|
185
|
+
margin-bottom: 2px !important;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.tenant-info {
|
|
189
|
+
font-size: 17px !important;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.table-container {
|
|
193
|
+
margin-top: 4px !important;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
table {
|
|
197
|
+
font-size: 14px !important;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
th, td {
|
|
201
|
+
padding: 2px 3px !important;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.platform-tag,
|
|
205
|
+
.order-tag,
|
|
206
|
+
.quantity-removed {
|
|
207
|
+
padding: 1px 3px !important;
|
|
208
|
+
font-size: 13px !important;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.void-reason {
|
|
212
|
+
font-size: 13px !important;
|
|
213
|
+
line-height: 1.2 !important;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.footer {
|
|
217
|
+
margin-top: 8px !important;
|
|
218
|
+
padding-top: 4px !important;
|
|
219
|
+
font-size: 13px !important;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.receipt-footer-company {
|
|
223
|
+
font-size: 18px !important;
|
|
224
|
+
margin-bottom: 1px !important;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.receipt-footer-date {
|
|
228
|
+
font-size: 15px !important;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.no-data {
|
|
232
|
+
padding: 10px !important;
|
|
233
|
+
font-size: 16px !important;
|
|
234
|
+
}
|
|
235
|
+
`
|
|
236
|
+
: ''}
|
|
237
|
+
</style>
|
|
238
|
+
`;
|
|
239
|
+
const renderTableRows = () => {
|
|
240
|
+
if (data.length === 0) {
|
|
241
|
+
return `
|
|
242
|
+
<tr>
|
|
243
|
+
<td colspan="${hasPartyNameColumn ? 13 : 12}" class="no-data">
|
|
244
|
+
No void items data available for the selected period.
|
|
245
|
+
</td>
|
|
246
|
+
</tr>
|
|
247
|
+
`;
|
|
248
|
+
}
|
|
249
|
+
return data
|
|
250
|
+
.map((item) => {
|
|
251
|
+
const voidAmount = (item.subtotal || 0) - (item.total_adjusted_subtotal || 0);
|
|
252
|
+
const removedQuantity = (item.quantity || 0) - (item.total_adjusted_quantity || 0);
|
|
253
|
+
return `
|
|
254
|
+
<tr>
|
|
255
|
+
<td>
|
|
256
|
+
<span class="platform-tag">${item.platform || 'N/A'}</span>
|
|
257
|
+
</td>
|
|
258
|
+
<td class="text-center">
|
|
259
|
+
<span class="order-tag">${item.order_number || 'N/A'}</span>
|
|
260
|
+
</td>
|
|
261
|
+
<td class="text-center">
|
|
262
|
+
<span class="quantity-removed">${removedQuantity}</span>
|
|
263
|
+
</td>
|
|
264
|
+
<td>${item.name || 'N/A'}</td>
|
|
265
|
+
${hasPartyNameColumn ? `<td>${item.vendor_name || item.client_name || 'N/A'}</td>` : ''}
|
|
266
|
+
<td class="text-right">${localeAmount(currency_symbol, voidAmount)}</td>
|
|
267
|
+
<td class="void-reason">${item.void_reason ? getFormattedCancellationReason(item.void_reason) : 'N/A'}</td>
|
|
268
|
+
<td>${item.staff_name || 'N/A'}</td>
|
|
269
|
+
<td class="text-center">${item.quantity || 0}</td>
|
|
270
|
+
<td class="text-center">${item.total_adjusted_quantity || 0}</td>
|
|
271
|
+
<td class="text-center">${item.order_punched_at ? moment(item.order_punched_at).format('MMM DD, HH:mm') : 'N/A'}</td>
|
|
272
|
+
<td class="text-center">${item.updatedAt ? moment(item.updatedAt).format('MMM DD, HH:mm') : 'N/A'}</td>
|
|
273
|
+
<td class="text-center">${item.createdAt ? moment(item.createdAt).format('MMM DD, HH:mm') : 'N/A'}</td>
|
|
274
|
+
</tr>
|
|
275
|
+
`;
|
|
276
|
+
})
|
|
277
|
+
.join('');
|
|
278
|
+
};
|
|
279
|
+
return `
|
|
280
|
+
<!DOCTYPE html>
|
|
281
|
+
<html lang="en">
|
|
282
|
+
<head>
|
|
283
|
+
<meta charset="UTF-8">
|
|
284
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
285
|
+
<title>Void Items Report</title>
|
|
286
|
+
${styles}
|
|
287
|
+
</head>
|
|
288
|
+
<body>
|
|
289
|
+
<div class="container">
|
|
290
|
+
<div class="header">
|
|
291
|
+
<h1>Void Items Report</h1>
|
|
292
|
+
<h2>${tenantName || 'All Locations'}</h2>
|
|
293
|
+
<div class="date-info">
|
|
294
|
+
Period: ${fromFormatted} to ${toFormatted}
|
|
295
|
+
</div>
|
|
296
|
+
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<div class="table-container">
|
|
300
|
+
<table>
|
|
301
|
+
<thead>
|
|
302
|
+
<tr>
|
|
303
|
+
<th>Platform</th>
|
|
304
|
+
<th>Order Number</th>
|
|
305
|
+
<th>Quantity Removed</th>
|
|
306
|
+
<th>Item</th>
|
|
307
|
+
${hasPartyNameColumn ? `<th>${partyNameColumnTitle}</th>` : ''}
|
|
308
|
+
<th>Void Amount</th>
|
|
309
|
+
<th>Reason</th>
|
|
310
|
+
<th>Staff Name</th>
|
|
311
|
+
<th>Original Quantity</th>
|
|
312
|
+
<th>Adjusted Quantity</th>
|
|
313
|
+
<th>Order Punched At</th>
|
|
314
|
+
<th>Last Updated</th>
|
|
315
|
+
<th>Voided At</th>
|
|
316
|
+
</tr>
|
|
317
|
+
</thead>
|
|
318
|
+
<tbody>
|
|
319
|
+
${renderTableRows()}
|
|
320
|
+
</tbody>
|
|
321
|
+
</table>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
<div class="footer">
|
|
325
|
+
<div class="receipt-footer-company">${tenantName}</div>
|
|
326
|
+
<div class="receipt-footer-date">Exported on ${currentDate} ${currentTime}</div>
|
|
327
|
+
</div>
|
|
328
|
+
</div>
|
|
329
|
+
</body>
|
|
330
|
+
</html>
|
|
331
|
+
`;
|
|
332
|
+
}
|
|
333
|
+
export function getVoidItemsReportReceiptHtml(props) {
|
|
334
|
+
const { data, tenantName, from, to, width = 350, currency_symbol = CURRENCY_SYMBOL_ENUM.Rs } = props;
|
|
335
|
+
const fromFormatted = from ? moment(from).format('MMM DD, YYYY') : 'N/A';
|
|
336
|
+
const toFormatted = to ? moment(to).format('MMM DD, YYYY') : 'N/A';
|
|
337
|
+
const currentDate = moment().format('MMM DD, YYYY');
|
|
338
|
+
const currentTime = moment().format('hh:mm A');
|
|
339
|
+
const styles = `
|
|
340
|
+
<style>
|
|
341
|
+
* {
|
|
342
|
+
margin: 0;
|
|
343
|
+
padding: 0;
|
|
344
|
+
box-sizing: border-box;
|
|
345
|
+
font-family: 'Courier New', monospace;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
body {
|
|
349
|
+
background: #fff;
|
|
350
|
+
color: #000;
|
|
351
|
+
line-height: 1.2;
|
|
352
|
+
font-size: 12px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.receipt-container {
|
|
356
|
+
width: ${width}px;
|
|
357
|
+
max-width: ${width}px;
|
|
358
|
+
margin: 0 auto;
|
|
359
|
+
padding: 10px;
|
|
360
|
+
background: #fff;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.header {
|
|
364
|
+
text-align: center;
|
|
365
|
+
margin-bottom: 15px;
|
|
366
|
+
border-bottom: 1px solid #000;
|
|
367
|
+
padding-bottom: 10px;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.header h1 {
|
|
371
|
+
font-size: 16px;
|
|
372
|
+
font-weight: bold;
|
|
373
|
+
margin-bottom: 3px;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.header h2 {
|
|
377
|
+
font-size: 15px;
|
|
378
|
+
font-weight: normal;
|
|
379
|
+
margin-bottom: 5px;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.date-line {
|
|
383
|
+
font-size: 14px;
|
|
384
|
+
margin-bottom: 2px;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.items-section {
|
|
388
|
+
margin-bottom: 15px;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.items-title {
|
|
392
|
+
font-weight: bold;
|
|
393
|
+
font-size: 12px;
|
|
394
|
+
margin-bottom: 5px;
|
|
395
|
+
text-align: center;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.void-item {
|
|
399
|
+
margin-bottom: 8px;
|
|
400
|
+
padding-bottom: 6px;
|
|
401
|
+
border-bottom: 1px solid #000;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.item-header {
|
|
405
|
+
font-weight: bold;
|
|
406
|
+
font-size: 14px;
|
|
407
|
+
margin-bottom: 2px;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.item-detail {
|
|
411
|
+
display: flex;
|
|
412
|
+
justify-content: space-between;
|
|
413
|
+
font-size: 14px;
|
|
414
|
+
margin-bottom: 1px;
|
|
415
|
+
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.item-detail.reason {
|
|
419
|
+
flex-direction: column;
|
|
420
|
+
gap: 2px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.reason-text {
|
|
424
|
+
font-size: 14px;
|
|
425
|
+
word-wrap: break-word;
|
|
426
|
+
max-width: 100%;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.footer {
|
|
430
|
+
margin-top: 15px;
|
|
431
|
+
text-align: center;
|
|
432
|
+
font-size: 14px;
|
|
433
|
+
border-top: 1px solid #000;
|
|
434
|
+
padding-top: 8px;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.no-data {
|
|
438
|
+
text-align: center;
|
|
439
|
+
padding: 20px;
|
|
440
|
+
font-size: 14px;
|
|
441
|
+
}
|
|
442
|
+
</style>
|
|
443
|
+
`;
|
|
444
|
+
const renderItems = () => {
|
|
445
|
+
if (data.length === 0) {
|
|
446
|
+
return `
|
|
447
|
+
<div class="no-data">
|
|
448
|
+
No void items found for the selected period.
|
|
449
|
+
</div>
|
|
450
|
+
`;
|
|
451
|
+
}
|
|
452
|
+
return data
|
|
453
|
+
.slice(0, 20)
|
|
454
|
+
.map((item, index) => {
|
|
455
|
+
// Limit to first 20 items for receipt
|
|
456
|
+
const voidAmount = (item.subtotal || 0) - (item.total_adjusted_subtotal || 0);
|
|
457
|
+
const removedQuantity = (item.quantity || 0) - (item.total_adjusted_quantity || 0);
|
|
458
|
+
return `
|
|
459
|
+
<div class="void-item">
|
|
460
|
+
<div class="item-header">
|
|
461
|
+
${index + 1}. ${item.name || 'N/A'}
|
|
462
|
+
</div>
|
|
463
|
+
<div class="item-detail">
|
|
464
|
+
<span>Order #${item.order_number || 'N/A'}</span>
|
|
465
|
+
<span>${item.platform || 'N/A'}</span>
|
|
466
|
+
</div>
|
|
467
|
+
<div class="item-detail">
|
|
468
|
+
<span>Qty Removed: ${removedQuantity}</span>
|
|
469
|
+
<span>${localeAmount(currency_symbol, voidAmount)}</span>
|
|
470
|
+
</div>
|
|
471
|
+
<div class="item-detail">
|
|
472
|
+
<span >Staff: ${item.staff_name || 'N/A'}</span>
|
|
473
|
+
<span style='font-weight: bold;>${item.createdAt ? moment(item.createdAt).format('MMM DD, HH:mm') : 'N/A'}</span>
|
|
474
|
+
</div>
|
|
475
|
+
${item.void_reason
|
|
476
|
+
? `
|
|
477
|
+
<div class="item-detail reason">
|
|
478
|
+
<span style='font-weight: bold;'>Reason:</span>
|
|
479
|
+
<span class="reason-text">${(() => {
|
|
480
|
+
const formattedReason = getFormattedCancellationReason(item.void_reason) || 'Unknown';
|
|
481
|
+
return formattedReason.substring(0, 100) + (formattedReason.length > 100 ? '...' : '');
|
|
482
|
+
})()}</span>
|
|
483
|
+
</div>
|
|
484
|
+
`
|
|
485
|
+
: ''}
|
|
486
|
+
</div>
|
|
487
|
+
`;
|
|
488
|
+
})
|
|
489
|
+
.join('');
|
|
490
|
+
};
|
|
491
|
+
const additionalItemsNote = data.length > 20
|
|
492
|
+
? `
|
|
493
|
+
<div style="text-align: center; font-size: 9px; margin-bottom: 10px;">
|
|
494
|
+
... and ${data.length - 20} more items (showing first 20)
|
|
495
|
+
</div>
|
|
496
|
+
`
|
|
497
|
+
: '';
|
|
498
|
+
return `
|
|
499
|
+
<!DOCTYPE html>
|
|
500
|
+
<html lang="en">
|
|
501
|
+
<head>
|
|
502
|
+
<meta charset="UTF-8">
|
|
503
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
504
|
+
<title>Void Items Receipt</title>
|
|
505
|
+
${styles}
|
|
506
|
+
</head>
|
|
507
|
+
<body>
|
|
508
|
+
<div class="receipt-container">
|
|
509
|
+
<div class="header">
|
|
510
|
+
<h1 style='font-size: 16px;'>${tenantName || 'All Locations'}</h1>
|
|
511
|
+
<h2 style='font-weight: bold;'>VOID ITEMS REPORT</h2>
|
|
512
|
+
<div class="date-line">${fromFormatted} to ${toFormatted}</div>
|
|
513
|
+
</div>
|
|
514
|
+
|
|
515
|
+
<div class="items-section">
|
|
516
|
+
<div class="items-title">VOID ITEMS</div>
|
|
517
|
+
${renderItems()}
|
|
518
|
+
${additionalItemsNote}
|
|
519
|
+
</div>
|
|
520
|
+
|
|
521
|
+
<div class="footer">
|
|
522
|
+
<div style='font-weight: bold; font-size: 16px;'>${tenantName}</div>
|
|
523
|
+
<div>Exported on ${currentDate} ${currentTime}</div>
|
|
524
|
+
</div>
|
|
525
|
+
</div>
|
|
526
|
+
</body>
|
|
527
|
+
</html>
|
|
528
|
+
`;
|
|
529
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { sortByCreatedAt } from '../store/common-order-actions';
|
|
2
|
+
import { convertPriceFromCents } from './price-conversion';
|
|
3
|
+
export function getVoidOrderItemFromCents(voidOrderItem) {
|
|
4
|
+
return {
|
|
5
|
+
...voidOrderItem,
|
|
6
|
+
...(typeof voidOrderItem.subtotal === 'number'
|
|
7
|
+
? {
|
|
8
|
+
subtotal: convertPriceFromCents(voidOrderItem.subtotal),
|
|
9
|
+
}
|
|
10
|
+
: {}),
|
|
11
|
+
...(typeof voidOrderItem.total_adjusted_subtotal === 'number'
|
|
12
|
+
? {
|
|
13
|
+
total_adjusted_subtotal: convertPriceFromCents(voidOrderItem.total_adjusted_subtotal),
|
|
14
|
+
}
|
|
15
|
+
: {}),
|
|
16
|
+
...(voidOrderItem.adjustments != null
|
|
17
|
+
? {
|
|
18
|
+
adjustments: voidOrderItem.adjustments.map((adjustment) => ({
|
|
19
|
+
...adjustment,
|
|
20
|
+
...(typeof adjustment.subtotal === 'number'
|
|
21
|
+
? {
|
|
22
|
+
subtotal: convertPriceFromCents(adjustment.subtotal),
|
|
23
|
+
}
|
|
24
|
+
: {}),
|
|
25
|
+
})),
|
|
26
|
+
}
|
|
27
|
+
: {}),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function getFetchedVoidOrderItems(voidItems) {
|
|
31
|
+
return voidItems.map((voidOrderItem) => getVoidOrderItemFromCents(voidOrderItem)).sort(sortByCreatedAt);
|
|
32
|
+
}
|