@managesome/eposmatic-toolkit 0.3.8 → 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/package.json +6 -3
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { convertPriceFromCents, convertPriceToCents } from './price-conversion';
|
|
2
|
+
/**
|
|
3
|
+
* Converts all monetary fields on an instore shift session from cents to dollars.
|
|
4
|
+
*/
|
|
5
|
+
export function getTenantInstoreShiftSessionFromCents(session) {
|
|
6
|
+
return {
|
|
7
|
+
...session,
|
|
8
|
+
...(session.opening != null
|
|
9
|
+
? {
|
|
10
|
+
opening: {
|
|
11
|
+
...session.opening,
|
|
12
|
+
...(typeof session.opening.cash_amount === 'number'
|
|
13
|
+
? {
|
|
14
|
+
cash_amount: convertPriceFromCents(session.opening.cash_amount),
|
|
15
|
+
}
|
|
16
|
+
: {}),
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
: {}),
|
|
20
|
+
...(session.closing != null
|
|
21
|
+
? {
|
|
22
|
+
closing: {
|
|
23
|
+
...session.closing,
|
|
24
|
+
...(typeof session.closing.cash_amount === 'number'
|
|
25
|
+
? {
|
|
26
|
+
cash_amount: convertPriceFromCents(session.closing.cash_amount),
|
|
27
|
+
}
|
|
28
|
+
: {}),
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
: {}),
|
|
32
|
+
...(typeof session.cash_in_total === 'number'
|
|
33
|
+
? {
|
|
34
|
+
cash_in_total: convertPriceFromCents(session.cash_in_total),
|
|
35
|
+
}
|
|
36
|
+
: {}),
|
|
37
|
+
...(typeof session.cash_out_total === 'number'
|
|
38
|
+
? {
|
|
39
|
+
cash_out_total: convertPriceFromCents(session.cash_out_total),
|
|
40
|
+
}
|
|
41
|
+
: {}),
|
|
42
|
+
...(typeof session.expected_drawer_total === 'number'
|
|
43
|
+
? {
|
|
44
|
+
expected_drawer_total: convertPriceFromCents(session.expected_drawer_total),
|
|
45
|
+
}
|
|
46
|
+
: {}),
|
|
47
|
+
...(typeof session.actual_drawer_total === 'number'
|
|
48
|
+
? {
|
|
49
|
+
actual_drawer_total: convertPriceFromCents(session.actual_drawer_total),
|
|
50
|
+
}
|
|
51
|
+
: {}),
|
|
52
|
+
...(typeof session.difference === 'number'
|
|
53
|
+
? {
|
|
54
|
+
difference: convertPriceFromCents(session.difference),
|
|
55
|
+
}
|
|
56
|
+
: {}),
|
|
57
|
+
...(session.reopened_iterations != null
|
|
58
|
+
? {
|
|
59
|
+
reopened_iterations: session.reopened_iterations.map((iteration) => ({
|
|
60
|
+
...iteration,
|
|
61
|
+
...(iteration.opening != null
|
|
62
|
+
? {
|
|
63
|
+
opening: {
|
|
64
|
+
...iteration.opening,
|
|
65
|
+
...(typeof iteration.opening.cash_amount === 'number'
|
|
66
|
+
? {
|
|
67
|
+
cash_amount: convertPriceFromCents(iteration.opening.cash_amount),
|
|
68
|
+
}
|
|
69
|
+
: {}),
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
: {}),
|
|
73
|
+
...(iteration.closing != null
|
|
74
|
+
? {
|
|
75
|
+
closing: {
|
|
76
|
+
...iteration.closing,
|
|
77
|
+
...(typeof iteration.closing.cash_amount === 'number'
|
|
78
|
+
? {
|
|
79
|
+
cash_amount: convertPriceFromCents(iteration.closing.cash_amount),
|
|
80
|
+
}
|
|
81
|
+
: {}),
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
: {}),
|
|
85
|
+
...(typeof iteration.cash_in_total === 'number'
|
|
86
|
+
? {
|
|
87
|
+
cash_in_total: convertPriceFromCents(iteration.cash_in_total),
|
|
88
|
+
}
|
|
89
|
+
: {}),
|
|
90
|
+
...(typeof iteration.cash_out_total === 'number'
|
|
91
|
+
? {
|
|
92
|
+
cash_out_total: convertPriceFromCents(iteration.cash_out_total),
|
|
93
|
+
}
|
|
94
|
+
: {}),
|
|
95
|
+
...(typeof iteration.expected_drawer_total === 'number'
|
|
96
|
+
? {
|
|
97
|
+
expected_drawer_total: convertPriceFromCents(iteration.expected_drawer_total),
|
|
98
|
+
}
|
|
99
|
+
: {}),
|
|
100
|
+
...(typeof iteration.actual_drawer_total === 'number'
|
|
101
|
+
? {
|
|
102
|
+
actual_drawer_total: convertPriceFromCents(iteration.actual_drawer_total),
|
|
103
|
+
}
|
|
104
|
+
: {}),
|
|
105
|
+
...(typeof iteration.difference === 'number'
|
|
106
|
+
? {
|
|
107
|
+
difference: convertPriceFromCents(iteration.difference),
|
|
108
|
+
}
|
|
109
|
+
: {}),
|
|
110
|
+
})),
|
|
111
|
+
}
|
|
112
|
+
: {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Converts all monetary fields on an instore shift session from dollars to cents.
|
|
117
|
+
*/
|
|
118
|
+
export function getTenantInstoreShiftSessionWithCents(session) {
|
|
119
|
+
return {
|
|
120
|
+
...session,
|
|
121
|
+
...(session.opening != null
|
|
122
|
+
? {
|
|
123
|
+
opening: {
|
|
124
|
+
...session.opening,
|
|
125
|
+
...(typeof session.opening.cash_amount === 'number'
|
|
126
|
+
? {
|
|
127
|
+
cash_amount: convertPriceToCents(session.opening.cash_amount),
|
|
128
|
+
}
|
|
129
|
+
: {}),
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
: {}),
|
|
133
|
+
...(session.closing != null
|
|
134
|
+
? {
|
|
135
|
+
closing: {
|
|
136
|
+
...session.closing,
|
|
137
|
+
...(typeof session.closing.cash_amount === 'number'
|
|
138
|
+
? {
|
|
139
|
+
cash_amount: convertPriceToCents(session.closing.cash_amount),
|
|
140
|
+
}
|
|
141
|
+
: {}),
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
: {}),
|
|
145
|
+
...(typeof session.cash_in_total === 'number'
|
|
146
|
+
? {
|
|
147
|
+
cash_in_total: convertPriceToCents(session.cash_in_total),
|
|
148
|
+
}
|
|
149
|
+
: {}),
|
|
150
|
+
...(typeof session.cash_out_total === 'number'
|
|
151
|
+
? {
|
|
152
|
+
cash_out_total: convertPriceToCents(session.cash_out_total),
|
|
153
|
+
}
|
|
154
|
+
: {}),
|
|
155
|
+
...(typeof session.expected_drawer_total === 'number'
|
|
156
|
+
? {
|
|
157
|
+
expected_drawer_total: convertPriceToCents(session.expected_drawer_total),
|
|
158
|
+
}
|
|
159
|
+
: {}),
|
|
160
|
+
...(typeof session.actual_drawer_total === 'number'
|
|
161
|
+
? {
|
|
162
|
+
actual_drawer_total: convertPriceToCents(session.actual_drawer_total),
|
|
163
|
+
}
|
|
164
|
+
: {}),
|
|
165
|
+
...(typeof session.difference === 'number'
|
|
166
|
+
? {
|
|
167
|
+
difference: convertPriceToCents(session.difference),
|
|
168
|
+
}
|
|
169
|
+
: {}),
|
|
170
|
+
...(session.reopened_iterations != null
|
|
171
|
+
? {
|
|
172
|
+
reopened_iterations: session.reopened_iterations.map((iteration) => ({
|
|
173
|
+
...iteration,
|
|
174
|
+
...(iteration.opening != null
|
|
175
|
+
? {
|
|
176
|
+
opening: {
|
|
177
|
+
...iteration.opening,
|
|
178
|
+
...(typeof iteration.opening.cash_amount === 'number'
|
|
179
|
+
? {
|
|
180
|
+
cash_amount: convertPriceToCents(iteration.opening.cash_amount),
|
|
181
|
+
}
|
|
182
|
+
: {}),
|
|
183
|
+
},
|
|
184
|
+
}
|
|
185
|
+
: {}),
|
|
186
|
+
...(iteration.closing != null
|
|
187
|
+
? {
|
|
188
|
+
closing: {
|
|
189
|
+
...iteration.closing,
|
|
190
|
+
...(typeof iteration.closing.cash_amount === 'number'
|
|
191
|
+
? {
|
|
192
|
+
cash_amount: convertPriceToCents(iteration.closing.cash_amount),
|
|
193
|
+
}
|
|
194
|
+
: {}),
|
|
195
|
+
},
|
|
196
|
+
}
|
|
197
|
+
: {}),
|
|
198
|
+
...(typeof iteration.cash_in_total === 'number'
|
|
199
|
+
? {
|
|
200
|
+
cash_in_total: convertPriceToCents(iteration.cash_in_total),
|
|
201
|
+
}
|
|
202
|
+
: {}),
|
|
203
|
+
...(typeof iteration.cash_out_total === 'number'
|
|
204
|
+
? {
|
|
205
|
+
cash_out_total: convertPriceToCents(iteration.cash_out_total),
|
|
206
|
+
}
|
|
207
|
+
: {}),
|
|
208
|
+
...(typeof iteration.expected_drawer_total === 'number'
|
|
209
|
+
? {
|
|
210
|
+
expected_drawer_total: convertPriceToCents(iteration.expected_drawer_total),
|
|
211
|
+
}
|
|
212
|
+
: {}),
|
|
213
|
+
...(typeof iteration.actual_drawer_total === 'number'
|
|
214
|
+
? {
|
|
215
|
+
actual_drawer_total: convertPriceToCents(iteration.actual_drawer_total),
|
|
216
|
+
}
|
|
217
|
+
: {}),
|
|
218
|
+
...(typeof iteration.difference === 'number'
|
|
219
|
+
? {
|
|
220
|
+
difference: convertPriceToCents(iteration.difference),
|
|
221
|
+
}
|
|
222
|
+
: {}),
|
|
223
|
+
})),
|
|
224
|
+
}
|
|
225
|
+
: {}),
|
|
226
|
+
};
|
|
227
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { convertSpecialHoursFromCents, convertSpecialHoursToCents } from './platform-num';
|
|
2
|
+
import { convertPriceFromCents, convertPriceToCents } from './price-conversion';
|
|
3
|
+
export function getFormattedTenantStaff(tenantStaff, writeable) {
|
|
4
|
+
const convertItemSpecialHours = writeable ? convertSpecialHoursToCents : convertSpecialHoursFromCents;
|
|
5
|
+
const convertPrice = writeable ? convertPriceToCents : convertPriceFromCents;
|
|
6
|
+
const newPayload = {
|
|
7
|
+
...tenantStaff,
|
|
8
|
+
...(tenantStaff.operational_hours != null
|
|
9
|
+
? { operational_hours: convertItemSpecialHours(tenantStaff.operational_hours) }
|
|
10
|
+
: {}),
|
|
11
|
+
...(tenantStaff.cash_in_hand != null ? { cash_in_hand: convertPrice(tenantStaff.cash_in_hand) } : {}),
|
|
12
|
+
};
|
|
13
|
+
if (writeable) {
|
|
14
|
+
if (newPayload.operational_hours == null) {
|
|
15
|
+
delete newPayload.operational_hours;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return newPayload;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { convertDecimalToInt, convertIntToDecimal } from './price-conversion';
|
|
2
|
+
export function getTenantCashInHandTransactionWithInt(transaction) {
|
|
3
|
+
return {
|
|
4
|
+
...transaction,
|
|
5
|
+
...(typeof transaction.prev_cash_in_hand === 'number'
|
|
6
|
+
? {
|
|
7
|
+
prev_cash_in_hand: convertDecimalToInt(transaction.prev_cash_in_hand),
|
|
8
|
+
}
|
|
9
|
+
: {}),
|
|
10
|
+
...(typeof transaction.cash_in_hand === 'number'
|
|
11
|
+
? {
|
|
12
|
+
cash_in_hand: convertDecimalToInt(transaction.cash_in_hand),
|
|
13
|
+
}
|
|
14
|
+
: {}),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function getTenantCashInHandTransactionWithDecimal(transaction) {
|
|
18
|
+
return {
|
|
19
|
+
...transaction,
|
|
20
|
+
...(typeof transaction.prev_cash_in_hand === 'number'
|
|
21
|
+
? {
|
|
22
|
+
prev_cash_in_hand: convertIntToDecimal(transaction.prev_cash_in_hand),
|
|
23
|
+
}
|
|
24
|
+
: {}),
|
|
25
|
+
...(typeof transaction.cash_in_hand === 'number'
|
|
26
|
+
? {
|
|
27
|
+
cash_in_hand: convertIntToDecimal(transaction.cash_in_hand),
|
|
28
|
+
}
|
|
29
|
+
: {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ALL_DAY_INDEX } from '../../constants';
|
|
2
|
+
export function getTenantTime(desiredGMTOffset, date = new Date()) {
|
|
3
|
+
const localGMTOffsetMinutes = -date.getTimezoneOffset();
|
|
4
|
+
const localGMTOffset = localGMTOffsetMinutes / 60;
|
|
5
|
+
const currentUTCTime = date.getTime() - localGMTOffset * 60 * 60 * 1000; // Convert to UTC time
|
|
6
|
+
// Calculate the time in milliseconds by adding the desired GMT offset
|
|
7
|
+
const timeForDesiredGMTOffset = currentUTCTime + desiredGMTOffset * 60 * 60 * 1000; // Convert to milliseconds
|
|
8
|
+
// Create a new Date object using the adjusted time
|
|
9
|
+
const desiredTime = new Date(timeForDesiredGMTOffset);
|
|
10
|
+
return desiredTime;
|
|
11
|
+
}
|
|
12
|
+
export function getDaysDifference(date1, date2, gmtOffset) {
|
|
13
|
+
const date1Time = getTenantTime(gmtOffset, new Date(date1)).getTime();
|
|
14
|
+
const date2Time = getTenantTime(gmtOffset, new Date(date2)).getTime();
|
|
15
|
+
const millisecondsInADay = 24 * 60 * 60 * 1000;
|
|
16
|
+
return Math.floor((date1Time - date2Time) / millisecondsInADay);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* ISO 8601 week number (1-53) for a calendar date: weeks start on Monday, and
|
|
20
|
+
* week 1 is the week containing the year's first Thursday. Every week is
|
|
21
|
+
* exactly 7 days and the number can never exceed 53, so no clamp is needed.
|
|
22
|
+
*
|
|
23
|
+
* Pure UTC calendar math — independent of the runtime server's timezone.
|
|
24
|
+
*/
|
|
25
|
+
export function getIsoWeekOfYear(localYear, localMonth, localDay) {
|
|
26
|
+
const date = new Date(Date.UTC(localYear, localMonth - 1, localDay));
|
|
27
|
+
const dayNum = date.getUTCDay() || 7; // Monday = 1 ... Sunday = 7
|
|
28
|
+
// Move to the Thursday of the current ISO week.
|
|
29
|
+
date.setUTCDate(date.getUTCDate() + 4 - dayNum);
|
|
30
|
+
const isoYearStart = new Date(Date.UTC(date.getUTCFullYear(), 0, 1));
|
|
31
|
+
const diffInDays = (date.getTime() - isoYearStart.getTime()) / (24 * 60 * 60 * 1000);
|
|
32
|
+
return Math.ceil((diffInDays + 1) / 7);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns the start date ("YYYY-MM-DD") of the calendar week containing the
|
|
36
|
+
* given localDate. `weekStart` selects the first day of the week:
|
|
37
|
+
* 0 = Sunday, 1 = Monday (default, ISO-aligned).
|
|
38
|
+
*
|
|
39
|
+
* Every resulting week is exactly 7 days regardless of month/year boundaries —
|
|
40
|
+
* the recommended bucket for weekly analytics (same as GA's weekly granularity,
|
|
41
|
+
* and it never mixes partial weeks).
|
|
42
|
+
*/
|
|
43
|
+
export function getCalendarWeekStart(localDate, weekStart = 1) {
|
|
44
|
+
const [localYear, localMonth, localDay] = localDate.split('-').map(Number);
|
|
45
|
+
const date = new Date(Date.UTC(localYear, localMonth - 1, localDay));
|
|
46
|
+
const weekday = date.getUTCDay(); // 0 (Sun) - 6 (Sat)
|
|
47
|
+
const diff = (weekday - weekStart + 7) % 7;
|
|
48
|
+
date.setUTCDate(date.getUTCDate() - diff);
|
|
49
|
+
return date.toISOString().slice(0, 10);
|
|
50
|
+
}
|
|
51
|
+
export function getLocalDocumentFields(gmtOffset, date) {
|
|
52
|
+
const tenantDate = getTenantTime(gmtOffset, date);
|
|
53
|
+
const localSecond = tenantDate.getSeconds(); // 0 - 59
|
|
54
|
+
const localMinute = tenantDate.getMinutes(); // 0 - 59
|
|
55
|
+
const localHour = tenantDate.getHours(); // 0 - 23
|
|
56
|
+
const localDay = tenantDate.getDay(); // 0 (Sun) - 6 (Sat)
|
|
57
|
+
const localDate = tenantDate.getDate(); // 1 - 31
|
|
58
|
+
const localMonth = tenantDate.getMonth() + 1; // 1 - 12
|
|
59
|
+
const localYear = tenantDate.getFullYear(); // YYYY
|
|
60
|
+
// Week of month (1-5): day-of-month blocks 1-7 → 1, 8-14 → 2, ..., 29-31 → 5.
|
|
61
|
+
// Every block is exactly 7 days except the final one, and the value can never
|
|
62
|
+
// exceed 5 — no clamp is required (schema caps at 5).
|
|
63
|
+
const localWeek = Math.ceil(localDate / 7);
|
|
64
|
+
// Day of year (1-366) — pure calendar math (no server timezone dependence),
|
|
65
|
+
// so localDayOfYear can never contradict localDate/localMonth/localYear.
|
|
66
|
+
const localDayOfYear = Math.floor((Date.UTC(localYear, localMonth - 1, localDate) - Date.UTC(localYear, 0, 1)) / (24 * 60 * 60 * 1000)) +
|
|
67
|
+
1;
|
|
68
|
+
// Week of year (1-53) — ISO 8601 (Monday start, week 1 contains the first
|
|
69
|
+
// Thursday). ISO weeks never exceed 53, so no clamp is required (schema caps
|
|
70
|
+
// at 53).
|
|
71
|
+
const localWeekOfYear = getIsoWeekOfYear(localYear, localMonth, localDate);
|
|
72
|
+
// Calculate quarter (1-4)
|
|
73
|
+
const localQuarter = Math.ceil(localMonth / 3);
|
|
74
|
+
// Calculate semester (1-2)
|
|
75
|
+
const localSemester = Math.ceil(localMonth / 6);
|
|
76
|
+
// Format date and time strings
|
|
77
|
+
const localDateString = `${localYear}-${String(localMonth).padStart(2, '0')}-${String(localDate).padStart(2, '0')}`;
|
|
78
|
+
const localTimeString = `${String(localHour).padStart(2, '0')}:${String(localMinute).padStart(2, '0')}:${String(localSecond).padStart(2, '0')}`;
|
|
79
|
+
return {
|
|
80
|
+
localSecond,
|
|
81
|
+
localMinute,
|
|
82
|
+
localHour,
|
|
83
|
+
localDay,
|
|
84
|
+
localWeek,
|
|
85
|
+
localWeekOfYear,
|
|
86
|
+
localMonth,
|
|
87
|
+
localQuarter,
|
|
88
|
+
localSemester,
|
|
89
|
+
localYear,
|
|
90
|
+
localDate: localDateString,
|
|
91
|
+
localTime: localTimeString,
|
|
92
|
+
localDayOfYear,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Builds the full ILocalTimeFields for an order.
|
|
97
|
+
*
|
|
98
|
+
* The date components (day_index, localDate, localDay, localWeek,
|
|
99
|
+
* localWeekOfYear, localMonth, localQuarter, localSemester, localYear,
|
|
100
|
+
* localDayOfYear) come from the tenant's running business day — the same
|
|
101
|
+
* "YYYY-MM-DD" value held by `track_order_numbers.runningLocalDate` /
|
|
102
|
+
* `order.localDate` — so the order belongs to that business day even across
|
|
103
|
+
* midnight.
|
|
104
|
+
*
|
|
105
|
+
* The time components (localSecond, localMinute, localHour, localTime) come
|
|
106
|
+
* from the actual `order_settled_at` timestamp expressed in the tenant's time
|
|
107
|
+
* zone (`operational_time_zone_offset_gmt`).
|
|
108
|
+
*/
|
|
109
|
+
export function getLocalFieldsFromLocalDate(localDate, operational_time_zone_offset_gmt, createdAt) {
|
|
110
|
+
const [localYear, localMonth, localDay] = localDate.split('-').map(Number);
|
|
111
|
+
// localDate is already the tenant's local calendar date, so every date
|
|
112
|
+
// component is derived directly from the string using pure calendar math
|
|
113
|
+
// (no dependence on the server's timezone).
|
|
114
|
+
const weekday = new Date(Date.UTC(localYear, localMonth - 1, localDay)).getUTCDay();
|
|
115
|
+
// Week of month (1-5) — day-of-month blocks (1-7 → 1 ... 29-31 → 5). Same
|
|
116
|
+
// semantics as getLocalDocumentFields; never exceeds 5, no clamp required.
|
|
117
|
+
const localWeek = Math.ceil(localDay / 7);
|
|
118
|
+
// Day of year (1-366) and ISO week of year (1-53) — pure calendar math
|
|
119
|
+
// (no dependence on the server's timezone).
|
|
120
|
+
const localDayOfYear = Math.floor((Date.UTC(localYear, localMonth - 1, localDay) - Date.UTC(localYear, 0, 1)) / (24 * 60 * 60 * 1000)) + 1;
|
|
121
|
+
const localWeekOfYear = getIsoWeekOfYear(localYear, localMonth, localDay);
|
|
122
|
+
// Time components come from the actual settle timestamp in the tenant's
|
|
123
|
+
// timezone. The timestamp is normalized with new Date() since callers pass
|
|
124
|
+
// the field straight from the order (which may be a Date or an ISO string).
|
|
125
|
+
const timeFields = getLocalDocumentFields(operational_time_zone_offset_gmt, new Date(createdAt));
|
|
126
|
+
return {
|
|
127
|
+
day_index: ALL_DAY_INDEX[weekday],
|
|
128
|
+
localDate,
|
|
129
|
+
localTime: timeFields.localTime,
|
|
130
|
+
localSecond: timeFields.localSecond,
|
|
131
|
+
localMinute: timeFields.localMinute,
|
|
132
|
+
localHour: timeFields.localHour,
|
|
133
|
+
localDay: weekday,
|
|
134
|
+
localWeek,
|
|
135
|
+
localWeekOfYear,
|
|
136
|
+
localMonth,
|
|
137
|
+
localQuarter: Math.ceil(localMonth / 3),
|
|
138
|
+
localSemester: Math.ceil(localMonth / 6),
|
|
139
|
+
localYear,
|
|
140
|
+
localDayOfYear,
|
|
141
|
+
};
|
|
142
|
+
}
|