@kreiseck/kasseneck-api 1.30.0 → 1.31.0
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/CHANGELOG.md +17 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +7 -5
- package/dist/cjs/models/index.d.ts +1 -1
- package/dist/cjs/models/index.js +4 -2
- package/dist/cjs/models/voucher.d.ts +18 -0
- package/dist/cjs/models/voucher.js +32 -1
- package/dist/cjs/pos/artikel.d.ts +12 -0
- package/dist/cjs/pos/artikel.js +2 -0
- package/dist/cjs/pos/client.js +11 -0
- package/dist/cjs/pos/errors.d.ts +1 -1
- package/dist/cjs/pos/errors.js +1 -0
- package/dist/cjs/pos/fremdgutschein-artikel.d.ts +66 -0
- package/dist/cjs/pos/fremdgutschein-artikel.js +74 -0
- package/dist/cjs/pos/index.d.ts +6 -3
- package/dist/cjs/pos/index.js +42 -4
- package/dist/cjs/pos/rabatt-vorlagen.d.ts +79 -0
- package/dist/cjs/pos/rabatt-vorlagen.js +156 -0
- package/dist/cjs/pos/schicht-lesen.js +8 -0
- package/dist/cjs/pos/schicht-typen.d.ts +15 -0
- package/dist/cjs/pos/settings.d.ts +69 -3
- package/dist/cjs/pos/settings.js +72 -5
- package/dist/cjs/pos/texte.d.ts +215 -0
- package/dist/cjs/pos/texte.js +124 -1
- package/dist/cjs/pos/zusaetze.d.ts +3 -3
- package/dist/cjs/pos/zusaetze.js +4 -2
- package/dist/cjs/receipt/shift-sheet.js +8 -0
- package/dist/cjs/stored/draht.js +1 -0
- package/dist/cjs/stored/einstellungen.js +50 -2
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +38 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.js +1 -1
- package/dist/esm/models/voucher.d.ts +18 -0
- package/dist/esm/models/voucher.js +30 -0
- package/dist/esm/pos/artikel.d.ts +12 -0
- package/dist/esm/pos/artikel.js +2 -0
- package/dist/esm/pos/client.js +12 -1
- package/dist/esm/pos/errors.d.ts +1 -1
- package/dist/esm/pos/errors.js +1 -0
- package/dist/esm/pos/fremdgutschein-artikel.d.ts +66 -0
- package/dist/esm/pos/fremdgutschein-artikel.js +67 -0
- package/dist/esm/pos/index.d.ts +6 -3
- package/dist/esm/pos/index.js +7 -3
- package/dist/esm/pos/rabatt-vorlagen.d.ts +79 -0
- package/dist/esm/pos/rabatt-vorlagen.js +148 -0
- package/dist/esm/pos/schicht-lesen.js +8 -0
- package/dist/esm/pos/schicht-typen.d.ts +15 -0
- package/dist/esm/pos/settings.d.ts +69 -3
- package/dist/esm/pos/settings.js +67 -4
- package/dist/esm/pos/texte.d.ts +215 -0
- package/dist/esm/pos/texte.js +122 -0
- package/dist/esm/pos/zusaetze.d.ts +3 -3
- package/dist/esm/pos/zusaetze.js +4 -2
- package/dist/esm/receipt/shift-sheet.js +8 -0
- package/dist/esm/stored/draht.js +1 -0
- package/dist/esm/stored/einstellungen.js +52 -4
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +38 -4
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/add-on-cases.json +6 -4
- package/fixtures/discount-preset-cases.json +1074 -0
- package/fixtures/external-voucher-article-cases.json +311 -0
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/invoice-api.schema.json +1 -1
- package/fixtures/invoice-texts.json +1 -1
- package/fixtures/pos-texts.json +205 -1
- package/fixtures/receipt-due-voucher-generated.json +1 -1
- package/fixtures/renames-1.0.json +18 -0
- package/fixtures/surface.json +49 -4
- package/fixtures/v3/antworten/belege.json +1 -1
- package/fixtures/v3/antworten/belegmail.json +1 -1
- package/fixtures/v3/antworten/berichte.json +1 -1
- package/fixtures/v3/antworten/kasse-belege.json +1 -1
- package/fixtures/v3/antworten/kasse.json +2 -2
- package/fixtures/v3/antworten/lager.json +1 -1
- package/fixtures/v3/antworten/rechnungen.json +1 -1
- package/fixtures/v3/antworten/storno.json +1 -1
- package/fixtures/v3/stored/belege.json +1 -1
- package/fixtures/v3/stored/kasse.json +2 -2
- package/fixtures/v3/stored/rechnungen.json +1 -1
- package/fixtures/v3/v3-vokabular.json +95 -9
- package/fixtures/v3/zahlbetrag-faelle.json +1 -1
- package/package.json +1 -1
package/dist/esm/pos/index.d.ts
CHANGED
|
@@ -6,16 +6,19 @@
|
|
|
6
6
|
* die Backend-Functions (die Rewrites-Waechter der Web-App leiten daraus ab)
|
|
7
7
|
* und sprechen den Kassenweg `/api/v3` (Schluessel und Werte englisch).
|
|
8
8
|
*/
|
|
9
|
-
export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, CART_WIDTH, type PosTipKind, type PosCartWidth, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
|
|
9
|
+
export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, tipKeptFor, type TipKeptDecision, DISCOUNT_PRESET_KIND, type PosDiscountPreset, type PosDiscountPresetKind, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, TIP_KEPT_MODE, type PosTipKeptMode, CART_WIDTH, type PosTipKind, type PosCartWidth, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
|
|
10
10
|
export { type ArticleGroup, type ArticleGroupPayload, fromArticleGroupPayload, type PosArticle, type PosArticlePayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, type QuantityRule, type QuantityDefaults, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
|
|
11
11
|
export { REFERENCE_MODES, type ReferenceMode, type PosReference, REFERENCE_INPUT_MAX, REFERENCE_LABEL_MAX, REFERENCE_HINT_MAX, REFERENCE_PATTERN_MAX, REFERENCE_PATTERN_TEMPLATES, cleanReferenceText, isValidReferencePattern, isDigitsOnlyPattern, type ReferenceCheckResult, checkReference, referenceLineName, fromReferencePayload, } from './kachel-referenz.js';
|
|
12
12
|
export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, type AddOnBlockReason, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
|
|
13
|
+
export { ARTICLE_EXTERNAL_VOUCHER_TYPES, type ArticleExternalVoucher, ARTICLE_EXTERNAL_VOUCHER_INVALID, ARTICLE_EXTERNAL_VOUCHER_VAT_RATES, EXTERNAL_VOUCHER_ARTICLE_REASONS, type ExternalVoucherArticleReason, type ExternalVoucherArticleInput, isArticleExternalVoucher, checkExternalVoucherValue, checkExternalVoucherArticle, type ExternalVoucherTileBlock, externalVoucherTileBlock, } from './fremdgutschein-artikel.js';
|
|
14
|
+
export { ownVoucherCodeShape, OWN_VOUCHER_CODE_SHAPES, type OwnVoucherCodeShape } from '../models/voucher.js';
|
|
13
15
|
export { getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, setMyPosLogo, posSettingsFromWire, type SetMyPosLogoOptions, } from './client.js';
|
|
14
16
|
export { POS_ERROR_CODES, type PosErrorCode, isPosErrorCode, posErrorCode, isPosError, type PosFieldError, posFieldErrors, } from './errors.js';
|
|
15
17
|
export { distributeDiscount } from '../receipt/discount.js';
|
|
16
18
|
export { cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf, type VoucherPerms, type RegisterScope, type RegisterUserPerms } from '../register/pairing.js';
|
|
17
19
|
export { type NetworkPrinter, type PrintJob, type PrintJobStatus, PRINT_JOB_STATUSES, type PrintJobSource, PRINT_JOB_SOURCES, isPrintJobFinished, type CreatePrintJobOptions, listMyPrinters, createPrintJob, getPrintJob, } from './drucker.js';
|
|
18
20
|
export { listMyTipRecipients } from './trinkgeld.js';
|
|
21
|
+
export { posDiscountPresets, discountPresetChipText, discountChipsFromPresets, checkDiscountPresets, discountBlockLines, INVALID_DISCOUNT_PRESET, DISCOUNT_PRESETS_MAX, DISCOUNT_PRESET_NAME_MAX, DISCOUNT_PRESET_PERCENT_BP, DISCOUNT_PRESET_AMOUNT_CENTS, DISCOUNT_PRESET_MESSAGES, type DiscountPresetReason, type DiscountPresetError, type DiscountPresetsCheck, type DiscountBlockLine, type DiscountTotal, } from './rabatt-vorlagen.js';
|
|
19
22
|
export { depFolderName } from './dep.js';
|
|
20
23
|
export { type RegisterInspectionInfo, type RegisterInspectionSignature, type InspectionSignatureStatus, type InspectionInfoRow, type InspectionInfoRowKey, type InspectionInfoSection, type InspectionInfoLinesOptions, getRegisterInspectionInfo, inspectionInfoRows, inspectionInfoLines, } from './kasseninfo.js';
|
|
21
24
|
export { type ConnectStateReport, reportConnectState } from './connect-bestand.js';
|
|
@@ -25,9 +28,9 @@ export type { Stocktake, StocktakeItem, StocktakeCount, StocktakeCountResult, St
|
|
|
25
28
|
export type { StocktakeStatus } from '../inventory/vertrag.js';
|
|
26
29
|
export { VOUCHER_KINDS, VOUCHER_STATUSES, checkVoucher, reprintVoucherLabel, VOUCHER_SETTINGS_DEFAULTS, posVoucherSettingsFromWire, VOUCHER_PAYOUTS, VOUCHER_TYPE_KINDS, VOUCHER_AMOUNT_MODES, VOUCHER_TYPE_VALIDITY_PATTERNS, EXTERNAL_VOUCHERS, type PosExternalVouchers, type VoucherKind, type VoucherStatus, type VoucherValidity, type VoucherArticle, type VoucherCheck, type PosVoucherSettings, type PosVoucherReturnType, type VoucherPayout, type VoucherTypeKind, type PosVoucherType, type VoucherLabelTemplate, } from './gutschein.js';
|
|
27
30
|
export { type GetMyDrawerStateOptions, type OpenMyShiftOptions, type RecordMyCashMovementOptions, type DrawerOpeningEntry, type LogMyDrawerOpeningsOptions, type GetMyShiftReportOptions, type TipPayout, type CloseMyShiftOptions, type AfterCountOption, type RecordMyShiftCountOptions, getMyDrawerState, openMyShift, recordMyCashMovement, logMyDrawerOpenings, getMyShiftReport, closeMyShift, recordMyShiftCount, sumDenominations, parseCentsAllowZero, newIdempotencyKey, shiftTipLines, durationText, type ShiftTipLine, type ShiftTipLineKey, } from './schicht.js';
|
|
28
|
-
export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATIONS, OPENING_REASONS, MANUAL_OPENING_REASONS, SHIFT_RECEIPT_KINDS, AFTER_COUNT_TYPES, type AfterCountType, type AfterCount, EXPECTED_PART_KEYS, DIFFERENCE_PART_TYPES, type ExpectedPartKey, type ShiftExpectedPart, type DifferencePartType, type ShiftDifferencePart, type LastShift, type ShiftCountResult, type EurDenomination, type MovementType, type ManualMovementType, type CashLocation, type OpeningReason, type ManualOpeningReason, type ShiftReceiptKind, type ShiftStatus, type ShiftActorRole, type Denominations, type ShiftActor, type DrawerInfo, type DrawerRights, type NonCashAmount, type ShiftTipTotals, type ShiftTip, type ShiftOwnerTip, type ShiftRunningTotals, type ShiftReconciliation, type Shift, type TipClaim, type DrawerOpening, type DrawerState, type CashMovement, type ShiftReceiptHeader, type ShiftReceiptMovement, type ShiftReceiptTip, type ShiftSummaryReceipt, type CashMovementReceipt, type ShiftReceipt, type OpenShiftResult, type CashMovementResult, type DrawerOpeningsResult, type ShiftReport, type CloseShiftResult, } from './schicht-typen.js';
|
|
31
|
+
export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATIONS, OPENING_REASONS, MANUAL_OPENING_REASONS, SHIFT_RECEIPT_KINDS, AFTER_COUNT_TYPES, type AfterCountType, type AfterCount, EXPECTED_PART_KEYS, DIFFERENCE_PART_TYPES, type ExpectedPartKey, type ShiftExpectedPart, type DifferencePartType, type ShiftDifferencePart, type LastShift, type ShiftCountResult, type EurDenomination, type MovementType, type ManualMovementType, type CashLocation, type OpeningReason, type ManualOpeningReason, type ShiftReceiptKind, type ShiftStatus, type ShiftActorRole, type Denominations, type ShiftActor, type DrawerInfo, type DrawerRights, type NonCashAmount, type ShiftTipTotals, type ShiftTip, type ShiftOwnerTip, type ShiftDiscount, type ShiftRunningTotals, type ShiftReconciliation, type Shift, type TipClaim, type DrawerOpening, type DrawerState, type CashMovement, type ShiftReceiptHeader, type ShiftReceiptMovement, type ShiftReceiptTip, type ShiftSummaryReceipt, type CashMovementReceipt, type ShiftReceipt, type OpenShiftResult, type CashMovementResult, type DrawerOpeningsResult, type ShiftReport, type CloseShiftResult, } from './schicht-typen.js';
|
|
29
32
|
export { type ShiftReceiptLayoutOptions, shiftReceiptLayout, cashMovementLayout } from '../receipt/shift-sheet.js';
|
|
30
33
|
export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputKind, type ReceiptOutputResult } from '../models/receipt-output.js';
|
|
31
34
|
export { RETURN_DISPOSITIONS, isReturnDisposition, type ReturnDisposition } from '../models/cancellation.js';
|
|
32
|
-
export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|
|
35
|
+
export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, EXTERNAL_VOUCHER_TILE_MESSAGES, EXTERNAL_VOUCHER_ARTICLE_MESSAGES, externalVoucherArticleErrorMessage, EXTERNAL_VOUCHERS_LABELS, EXTERNAL_VOUCHER_KIND_LABELS, TIP_KEPT_MODE_LABELS, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|
|
33
36
|
export { roundUpSuggestions } from './aufrunden.js';
|
package/dist/esm/pos/index.js
CHANGED
|
@@ -6,12 +6,15 @@
|
|
|
6
6
|
* die Backend-Functions (die Rewrites-Waechter der Web-App leiten daraus ab)
|
|
7
7
|
* und sprechen den Kassenweg `/api/v3` (Schluessel und Werte englisch).
|
|
8
8
|
*/
|
|
9
|
-
export { POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict,
|
|
9
|
+
export { POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, tipKeptFor, DISCOUNT_PRESET_KIND, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict,
|
|
10
10
|
// Die Enums als Laufzeitlisten, benannt nach ihrem Feld.
|
|
11
|
-
THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, CART_WIDTH, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
|
|
11
|
+
THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, TIP_KEPT_MODE, CART_WIDTH, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
|
|
12
12
|
export { fromArticleGroupPayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
|
|
13
13
|
export { REFERENCE_MODES, REFERENCE_INPUT_MAX, REFERENCE_LABEL_MAX, REFERENCE_HINT_MAX, REFERENCE_PATTERN_MAX, REFERENCE_PATTERN_TEMPLATES, cleanReferenceText, isValidReferencePattern, isDigitsOnlyPattern, checkReference, referenceLineName, fromReferencePayload, } from './kachel-referenz.js';
|
|
14
14
|
export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
|
|
15
|
+
export { ARTICLE_EXTERNAL_VOUCHER_TYPES, ARTICLE_EXTERNAL_VOUCHER_INVALID, ARTICLE_EXTERNAL_VOUCHER_VAT_RATES, EXTERNAL_VOUCHER_ARTICLE_REASONS, isArticleExternalVoucher, checkExternalVoucherValue, checkExternalVoucherArticle, externalVoucherTileBlock, } from './fremdgutschein-artikel.js';
|
|
16
|
+
// Form-Erkennung eigener Codes im Gutschein-Feld (Nachfrage statt Abweisung); dieselbe Funktion wie an der Wurzel.
|
|
17
|
+
export { ownVoucherCodeShape, OWN_VOUCHER_CODE_SHAPES } from '../models/voucher.js';
|
|
15
18
|
export { getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, setMyPosLogo, posSettingsFromWire, } from './client.js';
|
|
16
19
|
export { POS_ERROR_CODES, isPosErrorCode, posErrorCode, isPosError, posFieldErrors, } from './errors.js';
|
|
17
20
|
export { distributeDiscount } from '../receipt/discount.js';
|
|
@@ -20,6 +23,7 @@ export { distributeDiscount } from '../receipt/discount.js';
|
|
|
20
23
|
export { cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf } from '../register/pairing.js';
|
|
21
24
|
export { PRINT_JOB_STATUSES, PRINT_JOB_SOURCES, isPrintJobFinished, listMyPrinters, createPrintJob, getPrintJob, } from './drucker.js';
|
|
22
25
|
export { listMyTipRecipients } from './trinkgeld.js';
|
|
26
|
+
export { posDiscountPresets, discountPresetChipText, discountChipsFromPresets, checkDiscountPresets, discountBlockLines, INVALID_DISCOUNT_PRESET, DISCOUNT_PRESETS_MAX, DISCOUNT_PRESET_NAME_MAX, DISCOUNT_PRESET_PERCENT_BP, DISCOUNT_PRESET_AMOUNT_CENTS, DISCOUNT_PRESET_MESSAGES, } from './rabatt-vorlagen.js';
|
|
23
27
|
// Prüfung (DEP) an der Kasse: Ordner auf dem USB-Stick (gleich in Web-Kasse und Kassen-App).
|
|
24
28
|
export { depFolderName } from './dep.js';
|
|
25
29
|
// Prüfung an der Kasse: Kasseninfo für den Prüfer, am Bildschirm und als Ausdruck (gleich im Dart-Zwilling).
|
|
@@ -39,5 +43,5 @@ export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS } from '../models/receipt-
|
|
|
39
43
|
// Rueckgabe-Wahl beim Storno (Kassen-Dialog); dieselbe Liste wie an der Wurzel.
|
|
40
44
|
export { RETURN_DISPOSITIONS, isReturnDisposition } from '../models/cancellation.js';
|
|
41
45
|
// Was die Kasse selbst sagt: ein Katalog fuer Browser-Kasse und App.
|
|
42
|
-
export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, } from './texte.js';
|
|
46
|
+
export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, EXTERNAL_VOUCHER_TILE_MESSAGES, EXTERNAL_VOUCHER_ARTICLE_MESSAGES, externalVoucherArticleErrorMessage, EXTERNAL_VOUCHERS_LABELS, EXTERNAL_VOUCHER_KIND_LABELS, TIP_KEPT_MODE_LABELS, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, } from './texte.js';
|
|
43
47
|
export { roundUpSuggestions } from './aufrunden.js';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { PosBusinessSettings, PosDiscountPreset } from './settings.js';
|
|
2
|
+
/** Fehlercode, den der Server bei einer ungueltigen Vorlage sendet. */
|
|
3
|
+
export declare const INVALID_DISCOUNT_PRESET = "invalid_discount_preset";
|
|
4
|
+
/** Hoechstzahl der Vorlagen. */
|
|
5
|
+
export declare const DISCOUNT_PRESETS_MAX = 5;
|
|
6
|
+
/** Laenge des Namens in Zeichen (nach dem Trimmen). */
|
|
7
|
+
export declare const DISCOUNT_PRESET_NAME_MAX = 24;
|
|
8
|
+
/** Prozent in Basispunkten: 0,1 % bis 100 % in Schritten von 0,1 %. */
|
|
9
|
+
export declare const DISCOUNT_PRESET_PERCENT_BP: Readonly<{
|
|
10
|
+
min: 10;
|
|
11
|
+
max: 10000;
|
|
12
|
+
step: 10;
|
|
13
|
+
}>;
|
|
14
|
+
/** Betrag in Cent: 0,01 € bis 1.000.000,00 €. */
|
|
15
|
+
export declare const DISCOUNT_PRESET_AMOUNT_CENTS: Readonly<{
|
|
16
|
+
min: 1;
|
|
17
|
+
max: 100000000;
|
|
18
|
+
}>;
|
|
19
|
+
/** Wirksame Vorlagen: die gespeicherten (auch leer), sonst die Prozent-Chips als namenlose Prozent-Vorlagen. */
|
|
20
|
+
export declare function posDiscountPresets(business: Readonly<Pick<Partial<PosBusinessSettings>, 'discountPresets' | 'discountChips'>> | null | undefined): PosDiscountPreset[];
|
|
21
|
+
/**
|
|
22
|
+
* Die Prozent-Chips, die der Server aus den Vorlagen nach `discountChips` spiegelt (fuer aeltere Kassen):
|
|
23
|
+
* Prozent-Vorlagen in ihrer Reihenfolge, gleiche Werte nur einmal, Betrag-Vorlagen fallen weg.
|
|
24
|
+
*/
|
|
25
|
+
export declare function discountChipsFromPresets(presets: readonly PosDiscountPreset[] | null | undefined): number[];
|
|
26
|
+
/** Text auf dem Chip: `Mitarbeiter-Rabatt 20 %`, `Stammkunde 5,00 €`; ohne Namen nur der Wert (`10 %`). */
|
|
27
|
+
export declare function discountPresetChipText(preset: Readonly<PosDiscountPreset>): string;
|
|
28
|
+
/** Warum eine Vorlage abgelehnt wird; je Grund ein Satz im Katalog ([DISCOUNT_PRESET_MESSAGES]). */
|
|
29
|
+
export type DiscountPresetReason = 'list' | 'entry' | 'name' | 'duplicate' | 'kind' | 'percent' | 'amount' | 'unknown_field';
|
|
30
|
+
/** Grund -> Satz (Katalog `discount_preset.*`). */
|
|
31
|
+
export declare const DISCOUNT_PRESET_MESSAGES: {
|
|
32
|
+
readonly list: "discount_preset.list";
|
|
33
|
+
readonly entry: "discount_preset.entry";
|
|
34
|
+
readonly name: "discount_preset.name";
|
|
35
|
+
readonly duplicate: "discount_preset.duplicate";
|
|
36
|
+
readonly kind: "discount_preset.kind";
|
|
37
|
+
readonly percent: "discount_preset.percent";
|
|
38
|
+
readonly amount: "discount_preset.amount";
|
|
39
|
+
readonly unknown_field: "discount_preset.unknown_field";
|
|
40
|
+
};
|
|
41
|
+
/** Ein Fehler der Pruefung: `index` die Vorlage (`null` = die Liste), `field` das Feld (`null` = die ganze Vorlage). */
|
|
42
|
+
export interface DiscountPresetError {
|
|
43
|
+
index: number | null;
|
|
44
|
+
field: string | null;
|
|
45
|
+
reason: DiscountPresetReason;
|
|
46
|
+
message: string;
|
|
47
|
+
}
|
|
48
|
+
export type DiscountPresetsCheck = {
|
|
49
|
+
ok: true;
|
|
50
|
+
value: PosDiscountPreset[];
|
|
51
|
+
} | {
|
|
52
|
+
ok: false;
|
|
53
|
+
code: typeof INVALID_DISCOUNT_PRESET;
|
|
54
|
+
errors: DiscountPresetError[];
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Prueft die Liste der Vorlagen vor dem Schreiben, mit denselben Regeln wie der Server: hoechstens 5, Name 1 bis 24
|
|
58
|
+
* Zeichen nach dem Trimmen ohne Steuerzeichen, eindeutig ohne Ruecksicht auf Gross und Klein, Art `percent`/`amount`
|
|
59
|
+
* mit genau dem passenden Wertfeld (Prozent 0,1 bis 100 in Schritten von 0,1, Betrag 0,01 bis 1.000.000 €).
|
|
60
|
+
* `value` ist die normalisierte Liste (Name getrimmt). Der Server antwortet bei einem Fehler mit
|
|
61
|
+
* [INVALID_DISCOUNT_PRESET].
|
|
62
|
+
*/
|
|
63
|
+
export declare function checkDiscountPresets(list: unknown): DiscountPresetsCheck;
|
|
64
|
+
/** Eine Zeile des Rabatte-Blocks auf Z- und X-Bon: `label` und der Betrag als Abzug (negativ). */
|
|
65
|
+
export interface DiscountBlockLine {
|
|
66
|
+
label: string;
|
|
67
|
+
cents: number;
|
|
68
|
+
}
|
|
69
|
+
/** Ein Rabatt je Name aus dem Laufstand bzw. den Bon-Daten: `cents` gewaehrt (positiv), `count` Belege. */
|
|
70
|
+
export interface DiscountTotal {
|
|
71
|
+
name: string;
|
|
72
|
+
cents: number;
|
|
73
|
+
count: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Zeilen des Rabatte-Blocks auf Z-Bon und Zwischenbericht: je Name `<Name> (n×)` mit dem Abzug, ab zwei Eintraegen
|
|
77
|
+
* zusaetzlich `Rabatte gesamt`. Ein leerer Name heisst „Rabatt“. Ein voll stornierter Name (Betrag 0) entfaellt wie in der Liste des Servers. Ohne Rabatte leer (kein Block).
|
|
78
|
+
*/
|
|
79
|
+
export declare function discountBlockLines(discounts: readonly DiscountTotal[] | null | undefined): DiscountBlockLine[];
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { messageText, labelText } from './texte.js';
|
|
2
|
+
import { DISCOUNT_PRESET_KIND } from './settings.js';
|
|
3
|
+
/*
|
|
4
|
+
* Rabatt-Vorlagen der Kasse (benannte Rabatt-Chips): wirksame Liste, Chip-Text, Spiegelung nach `discountChips`,
|
|
5
|
+
* Pruefung und Bon-Block. Zwilling von functions-kasse/rabatt-vorlagen-core.js; der Vertrag sind die Pruefaelle
|
|
6
|
+
* fixtures/discount-preset-cases.json (byte-gleich mit dem Backend).
|
|
7
|
+
*/
|
|
8
|
+
/** Fehlercode, den der Server bei einer ungueltigen Vorlage sendet. */
|
|
9
|
+
export const INVALID_DISCOUNT_PRESET = 'invalid_discount_preset';
|
|
10
|
+
/** Hoechstzahl der Vorlagen. */
|
|
11
|
+
export const DISCOUNT_PRESETS_MAX = 5;
|
|
12
|
+
/** Laenge des Namens in Zeichen (nach dem Trimmen). */
|
|
13
|
+
export const DISCOUNT_PRESET_NAME_MAX = 24;
|
|
14
|
+
/** Prozent in Basispunkten: 0,1 % bis 100 % in Schritten von 0,1 %. */
|
|
15
|
+
export const DISCOUNT_PRESET_PERCENT_BP = Object.freeze({ min: 10, max: 10000, step: 10 });
|
|
16
|
+
/** Betrag in Cent: 0,01 € bis 1.000.000,00 €. */
|
|
17
|
+
export const DISCOUNT_PRESET_AMOUNT_CENTS = Object.freeze({ min: 1, max: 100000000 });
|
|
18
|
+
/** Wirksame Vorlagen: die gespeicherten (auch leer), sonst die Prozent-Chips als namenlose Prozent-Vorlagen. */
|
|
19
|
+
export function posDiscountPresets(business) {
|
|
20
|
+
const vorlagen = business?.discountPresets;
|
|
21
|
+
if (Array.isArray(vorlagen))
|
|
22
|
+
return vorlagen.map((v) => ({ ...v }));
|
|
23
|
+
const raus = [];
|
|
24
|
+
const chips = business?.discountChips;
|
|
25
|
+
for (const p of Array.isArray(chips) ? chips : []) {
|
|
26
|
+
const bp = typeof p === 'number' ? Math.round(p * 100) : NaN;
|
|
27
|
+
if (Number.isFinite(bp) && bp >= DISCOUNT_PRESET_PERCENT_BP.min && bp <= DISCOUNT_PRESET_PERCENT_BP.max) {
|
|
28
|
+
raus.push({ name: '', kind: 'percent', percentBp: bp });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return raus;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Die Prozent-Chips, die der Server aus den Vorlagen nach `discountChips` spiegelt (fuer aeltere Kassen):
|
|
35
|
+
* Prozent-Vorlagen in ihrer Reihenfolge, gleiche Werte nur einmal, Betrag-Vorlagen fallen weg.
|
|
36
|
+
*/
|
|
37
|
+
export function discountChipsFromPresets(presets) {
|
|
38
|
+
const raus = [];
|
|
39
|
+
for (const v of presets ?? []) {
|
|
40
|
+
if (!v || v.kind !== 'percent' || !Number.isInteger(v.percentBp))
|
|
41
|
+
continue;
|
|
42
|
+
const p = v.percentBp / 100;
|
|
43
|
+
if (!raus.includes(p))
|
|
44
|
+
raus.push(p);
|
|
45
|
+
}
|
|
46
|
+
return raus;
|
|
47
|
+
}
|
|
48
|
+
/** Prozent aus Basispunkten als Text mit Komma, ohne ueberfluessige Stellen: `1000` -> `10`, `1050` -> `10,5`. */
|
|
49
|
+
function prozentText(bp) {
|
|
50
|
+
const ganz = Math.trunc(bp / 100);
|
|
51
|
+
const rest = String(bp % 100).padStart(2, '0').replace(/0+$/, '');
|
|
52
|
+
return rest === '' ? String(ganz) : `${ganz},${rest}`;
|
|
53
|
+
}
|
|
54
|
+
/** Euro aus Cent mit Tausenderpunkt: `123456` -> `1.234,56 €`. */
|
|
55
|
+
function euroText(cents) {
|
|
56
|
+
const ganz = String(Math.trunc(cents / 100)).replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
|
57
|
+
return `${ganz},${String(cents % 100).padStart(2, '0')} €`;
|
|
58
|
+
}
|
|
59
|
+
/** Text auf dem Chip: `Mitarbeiter-Rabatt 20 %`, `Stammkunde 5,00 €`; ohne Namen nur der Wert (`10 %`). */
|
|
60
|
+
export function discountPresetChipText(preset) {
|
|
61
|
+
const wert = preset.kind === 'amount' ? euroText(preset.amountCents ?? 0) : `${prozentText(preset.percentBp ?? 0)} %`;
|
|
62
|
+
return preset.name ? `${preset.name} ${wert}` : wert;
|
|
63
|
+
}
|
|
64
|
+
/** Grund -> Satz (Katalog `discount_preset.*`). */
|
|
65
|
+
export const DISCOUNT_PRESET_MESSAGES = {
|
|
66
|
+
list: 'discount_preset.list',
|
|
67
|
+
entry: 'discount_preset.entry',
|
|
68
|
+
name: 'discount_preset.name',
|
|
69
|
+
duplicate: 'discount_preset.duplicate',
|
|
70
|
+
kind: 'discount_preset.kind',
|
|
71
|
+
percent: 'discount_preset.percent',
|
|
72
|
+
amount: 'discount_preset.amount',
|
|
73
|
+
unknown_field: 'discount_preset.unknown_field',
|
|
74
|
+
};
|
|
75
|
+
// Steuer- und Formatzeichen (Zeilenumbruch, Null, Zero-Width, Richtungswechsel): nie in einem Bon-Text.
|
|
76
|
+
const STEUERZEICHEN = /[\p{Cc}\p{Cf}\u2028\u2029]/u;
|
|
77
|
+
const WERTFELD = { percent: 'percentBp', amount: 'amountCents' };
|
|
78
|
+
const istObjekt = (x) => x !== null && typeof x === 'object' && !Array.isArray(x);
|
|
79
|
+
function fehler(index, field, reason) {
|
|
80
|
+
return { index, field, reason, message: messageText(DISCOUNT_PRESET_MESSAGES[reason]) };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Prueft die Liste der Vorlagen vor dem Schreiben, mit denselben Regeln wie der Server: hoechstens 5, Name 1 bis 24
|
|
84
|
+
* Zeichen nach dem Trimmen ohne Steuerzeichen, eindeutig ohne Ruecksicht auf Gross und Klein, Art `percent`/`amount`
|
|
85
|
+
* mit genau dem passenden Wertfeld (Prozent 0,1 bis 100 in Schritten von 0,1, Betrag 0,01 bis 1.000.000 €).
|
|
86
|
+
* `value` ist die normalisierte Liste (Name getrimmt). Der Server antwortet bei einem Fehler mit
|
|
87
|
+
* [INVALID_DISCOUNT_PRESET].
|
|
88
|
+
*/
|
|
89
|
+
export function checkDiscountPresets(list) {
|
|
90
|
+
if (!Array.isArray(list) || list.length > DISCOUNT_PRESETS_MAX) {
|
|
91
|
+
return { ok: false, code: INVALID_DISCOUNT_PRESET, errors: [fehler(null, null, 'list')] };
|
|
92
|
+
}
|
|
93
|
+
const errors = [];
|
|
94
|
+
const value = [];
|
|
95
|
+
const namen = new Set();
|
|
96
|
+
list.forEach((v, index) => {
|
|
97
|
+
if (!istObjekt(v)) {
|
|
98
|
+
errors.push(fehler(index, null, 'entry'));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const vorher = errors.length;
|
|
102
|
+
const name = typeof v.name === 'string' ? v.name.trim() : null;
|
|
103
|
+
if (name === null || name.length < 1 || [...name].length > DISCOUNT_PRESET_NAME_MAX || STEUERZEICHEN.test(name))
|
|
104
|
+
errors.push(fehler(index, 'name', 'name'));
|
|
105
|
+
else if (namen.has(name.toLocaleLowerCase('de')))
|
|
106
|
+
errors.push(fehler(index, 'name', 'duplicate'));
|
|
107
|
+
else
|
|
108
|
+
namen.add(name.toLocaleLowerCase('de'));
|
|
109
|
+
const kind = DISCOUNT_PRESET_KIND.includes(v.kind) ? v.kind : null;
|
|
110
|
+
if (!kind)
|
|
111
|
+
errors.push(fehler(index, 'kind', 'kind'));
|
|
112
|
+
for (const k of Object.keys(v)) {
|
|
113
|
+
if (k === 'name' || k === 'kind')
|
|
114
|
+
continue;
|
|
115
|
+
if (k !== 'percentBp' && k !== 'amountCents')
|
|
116
|
+
errors.push(fehler(index, k, 'unknown_field'));
|
|
117
|
+
else if (kind && WERTFELD[kind] !== k)
|
|
118
|
+
errors.push(fehler(index, k, 'unknown_field'));
|
|
119
|
+
}
|
|
120
|
+
if (kind === 'percent') {
|
|
121
|
+
const p = v.percentBp;
|
|
122
|
+
const g = DISCOUNT_PRESET_PERCENT_BP;
|
|
123
|
+
if (!Number.isInteger(p) || p < g.min || p > g.max || p % g.step !== 0)
|
|
124
|
+
errors.push(fehler(index, 'percentBp', 'percent'));
|
|
125
|
+
}
|
|
126
|
+
if (kind === 'amount') {
|
|
127
|
+
const c = v.amountCents;
|
|
128
|
+
const g = DISCOUNT_PRESET_AMOUNT_CENTS;
|
|
129
|
+
if (!Number.isInteger(c) || c < g.min || c > g.max)
|
|
130
|
+
errors.push(fehler(index, 'amountCents', 'amount'));
|
|
131
|
+
}
|
|
132
|
+
if (errors.length === vorher && kind) {
|
|
133
|
+
value.push({ name: name, kind, [WERTFELD[kind]]: v[WERTFELD[kind]] });
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return errors.length ? { ok: false, code: INVALID_DISCOUNT_PRESET, errors } : { ok: true, value };
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Zeilen des Rabatte-Blocks auf Z-Bon und Zwischenbericht: je Name `<Name> (n×)` mit dem Abzug, ab zwei Eintraegen
|
|
140
|
+
* zusaetzlich `Rabatte gesamt`. Ein leerer Name heisst „Rabatt“. Ein voll stornierter Name (Betrag 0) entfaellt wie in der Liste des Servers. Ohne Rabatte leer (kein Block).
|
|
141
|
+
*/
|
|
142
|
+
export function discountBlockLines(discounts) {
|
|
143
|
+
const liste = (discounts ?? []).filter((r) => r && Number.isSafeInteger(r.cents) && Number.isSafeInteger(r.count) && r.cents !== 0);
|
|
144
|
+
const zeilen = liste.map((r) => ({ label: labelText('shift_receipt.discount_line', { name: r.name || labelText('shift_receipt.discount_unnamed'), count: r.count }), cents: -r.cents }));
|
|
145
|
+
if (zeilen.length > 1)
|
|
146
|
+
zeilen.push({ label: labelText('shift_receipt.discounts_total'), cents: -liste.reduce((x, r) => x + r.cents, 0) });
|
|
147
|
+
return zeilen;
|
|
148
|
+
}
|
|
@@ -135,8 +135,14 @@ function laufstand(ort, w) {
|
|
|
135
135
|
raus.ownerTips = liste(ort, o, 'ownerTips', inhaberTrinkgeld);
|
|
136
136
|
if (o.unassignedTipCents !== undefined && o.unassignedTipCents !== null)
|
|
137
137
|
raus.unassignedTipCents = ganzzahl(ort, o, 'unassignedTipCents');
|
|
138
|
+
if (o.discounts !== undefined && o.discounts !== null)
|
|
139
|
+
raus.discounts = liste(ort, o, 'discounts', rabatt);
|
|
138
140
|
return raus;
|
|
139
141
|
}
|
|
142
|
+
function rabatt(ort, w) {
|
|
143
|
+
const o = pflichtObjekt(ort, w);
|
|
144
|
+
return { name: typeof o.name === 'string' ? o.name : '', cents: ganzzahl(ort, o, 'cents'), count: ganzzahl(ort, o, 'count') };
|
|
145
|
+
}
|
|
140
146
|
function inhaberTrinkgeld(ort, w) {
|
|
141
147
|
const o = pflichtObjekt(ort, w);
|
|
142
148
|
return { registerUserId: kennung(ort, o, 'registerUserId'), name: text(o.name), cents: ganzzahl(ort, o, 'cents') };
|
|
@@ -359,6 +365,8 @@ export function schichtBon(ort, w) {
|
|
|
359
365
|
// Ablauf der Kasse: nur, wenn der Server sie sendet (die Bons davor tragen sie nicht).
|
|
360
366
|
wennWert(r, o, 'openingCounted', () => wahr(ort, o, 'openingCounted'));
|
|
361
367
|
wennWert(r, o, 'interimDifferenceCents', () => ganzzahl(ort, o, 'interimDifferenceCents'));
|
|
368
|
+
// Nur Anzeige: gewaehrte Rabatte je Name; der Server sendet sie erst ab dem ersten Rabatt.
|
|
369
|
+
wennWert(r, o, 'discounts', () => liste(ort, o, 'discounts', rabatt));
|
|
362
370
|
wennWert(r, o, 'differenceParts', () => liste(ort, o, 'differenceParts', differenzTeil));
|
|
363
371
|
wennDa(r, o, 'countedBeforePayoutCents', () => ganzzahlOderNull(ort, o, 'countedBeforePayoutCents'));
|
|
364
372
|
wennDa(r, o, 'countedBeforePayoutDenominations', () => stueckelung(ort, o, 'countedBeforePayoutDenominations'));
|
|
@@ -158,6 +158,19 @@ export interface ShiftRunningTotals {
|
|
|
158
158
|
ownerTips?: ShiftOwnerTip[];
|
|
159
159
|
/** Trinkgeld ohne angemeldeten Empfänger in Cent (nur Anzeige, 1.28.0); fehlt = 0. */
|
|
160
160
|
unassignedTipCents?: number;
|
|
161
|
+
/**
|
|
162
|
+
* Gewaehrte Rabatte je Name (nur Anzeige, nie im Soll): `cents` gewaehrt (positiv), `count` Belege mit diesem
|
|
163
|
+
* Namen, ein Storno nimmt beides zurueck. Der Server sendet es erst ab dem ersten Rabatt (fehlt = keiner);
|
|
164
|
+
* auf dem Z-Bon steht es als Block ([discountBlockLines]).
|
|
165
|
+
*/
|
|
166
|
+
discounts?: ShiftDiscount[];
|
|
167
|
+
}
|
|
168
|
+
/** Ein Eintrag von [ShiftRunningTotals.discounts] bzw. [ShiftSummaryReceipt.discounts]. */
|
|
169
|
+
export interface ShiftDiscount {
|
|
170
|
+
/** Name der Rabattzeile am Beleg (`''` = unbenannt, „Rabatt“). */
|
|
171
|
+
name: string;
|
|
172
|
+
cents: number;
|
|
173
|
+
count: number;
|
|
161
174
|
}
|
|
162
175
|
/** Ein Eintrag von [ShiftRunningTotals.ownerTips]: Trinkgeld, das als Umsatz erfasst ist. */
|
|
163
176
|
export interface ShiftOwnerTip {
|
|
@@ -390,6 +403,8 @@ export interface ShiftSummaryReceipt extends ShiftReceiptHeader {
|
|
|
390
403
|
differenceCents: number | null;
|
|
391
404
|
comment: string | null;
|
|
392
405
|
openingsWithoutSale: number;
|
|
406
|
+
/** Gewaehrte Rabatte je Name; fehlt, wenn es keine gab (der Bon bleibt dann wie bisher). */
|
|
407
|
+
discounts?: ShiftDiscount[];
|
|
393
408
|
/** Entnommen bzw. eingelegt nach dem Zaehlen; fehlt, wenn kein Geld bewegt wurde. */
|
|
394
409
|
afterCount?: AfterCount;
|
|
395
410
|
/**
|
|
@@ -31,6 +31,29 @@ export declare const TIP_KINDS: readonly ["percent", "round_up", "total"];
|
|
|
31
31
|
export type PosTipKind = typeof TIP_KINDS[number];
|
|
32
32
|
/** Die zuerst offene Trinkgeld-Art (`business.tipStart`): dieselben Werte wie [TIP_KINDS]. */
|
|
33
33
|
export declare const TIP_START: readonly ["percent", "round_up", "total"];
|
|
34
|
+
/**
|
|
35
|
+
* Bar-Trinkgeld gleich behalten (`business.tipKeptMode`): `ask` = Schalter an der Kasse, vorbelegt mit
|
|
36
|
+
* `tipKeptByDefault`; `always`/`never` = kein Schalter, die Kasse setzt die Wahl selbst. Entscheidung ueber [tipKeptFor].
|
|
37
|
+
*/
|
|
38
|
+
export declare const TIP_KEPT_MODE: readonly ["ask", "always", "never"];
|
|
39
|
+
export type PosTipKeptMode = typeof TIP_KEPT_MODE[number];
|
|
40
|
+
/**
|
|
41
|
+
* Art einer Rabatt-Vorlage (`business.discountPresets[].kind`): Prozent oder fester Betrag
|
|
42
|
+
* (gespeichert `art`: `prozent | betrag`).
|
|
43
|
+
*/
|
|
44
|
+
export declare const DISCOUNT_PRESET_KIND: readonly ["percent", "amount"];
|
|
45
|
+
export type PosDiscountPresetKind = typeof DISCOUNT_PRESET_KIND[number];
|
|
46
|
+
/**
|
|
47
|
+
* Benannte Rabatt-Chips der Kasse: `kind` `percent` traegt `percentBp` (Basispunkte, 10 % = 1000), `amount` traegt
|
|
48
|
+
* `amountCents` (Cent). Der Name steht auf dem Chip und als Text der Rabattzeile am Beleg; ohne Namen (`''`) bleibt
|
|
49
|
+
* die Zeile „Rabatt“. Pruefen vor dem Schreiben: [checkDiscountPresets].
|
|
50
|
+
*/
|
|
51
|
+
export interface PosDiscountPreset {
|
|
52
|
+
name: string;
|
|
53
|
+
kind: PosDiscountPresetKind;
|
|
54
|
+
percentBp?: number;
|
|
55
|
+
amountCents?: number;
|
|
56
|
+
}
|
|
34
57
|
/** Breite der rechten Spalte (Korb) an diesem Geraet (`device.cartWidth`); in der schmalen Ansicht ohne Wirkung. */
|
|
35
58
|
export declare const CART_WIDTH: readonly ["narrow", "medium", "wide"];
|
|
36
59
|
export type PosCartWidth = typeof CART_WIDTH[number];
|
|
@@ -209,6 +232,25 @@ export interface PosBusinessSettings {
|
|
|
209
232
|
* Lesen ueber [posTipKeptByDefault]. Siehe [POS_BUSINESS_OPTIONAL_FIELDS].
|
|
210
233
|
*/
|
|
211
234
|
tipKeptByDefault?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Ob die Kasse beim Bar-Trinkgeld fragt (`ask`) oder es immer (`always`) bzw. nie (`never`) gleich behalten
|
|
237
|
+
* wird. Optional: der Server sendet das Feld nur, wenn es gespeichert ist; fehlt es (oder ist es unbekannt),
|
|
238
|
+
* gilt `ask`. Lesen ueber [posTipKeptMode], entscheiden ueber [tipKeptFor].
|
|
239
|
+
*/
|
|
240
|
+
tipKeptMode?: PosOpen<PosTipKeptMode>;
|
|
241
|
+
/**
|
|
242
|
+
* Benannte Rabatt-Chips (Prozent oder Betrag, hoechstens 5). Optional: der Server sendet das Feld nur, wenn es
|
|
243
|
+
* gespeichert ist; dann sind die Vorlagen die Quelle der Chips und `discountChips` spiegelt ihre Prozentwerte fuer
|
|
244
|
+
* aeltere Kassen. Fehlt es, gilt `discountChips`. Lesen ueber [posDiscountPresets]; eine Vorlage mit unbekannter
|
|
245
|
+
* Art verwirft der Leser.
|
|
246
|
+
*/
|
|
247
|
+
discountPresets?: PosDiscountPreset[];
|
|
248
|
+
/**
|
|
249
|
+
* Eigener Rabatt an der Kasse: `true` = neben den Rabatt-Chips das freie Feld (Betrag oder Prozent), `false` = nur
|
|
250
|
+
* die Chips. Optional: der Server sendet das Feld nur, wenn es gespeichert ist; fehlt es, gilt `true` (wie bisher).
|
|
251
|
+
* Lesen ueber [posCustomDiscountAllowed]. Siehe [POS_BUSINESS_OPTIONAL_FIELDS].
|
|
252
|
+
*/
|
|
253
|
+
customDiscountAllowed?: boolean;
|
|
212
254
|
/**
|
|
213
255
|
* Angebotene Trinkgeld-Arten (nichtleere Teilmenge von [TIP_KINDS], Reihenfolge wie
|
|
214
256
|
* gespeichert). Optional: der Server sendet das Feld nur, wenn es gespeichert ist; fehlt es,
|
|
@@ -312,14 +354,22 @@ export declare function _optionalerWert(wert: unknown, schreiben: boolean): bool
|
|
|
312
354
|
* [mergePosSettings] uebernimmt sie nur als Wahrheitswert; der Schreibweg
|
|
313
355
|
* nimmt nur `true`/`false`.
|
|
314
356
|
*/
|
|
315
|
-
export declare const POS_BUSINESS_OPTIONAL_FIELDS: readonly ["tipKeptByDefault"];
|
|
357
|
+
export declare const POS_BUSINESS_OPTIONAL_FIELDS: readonly ["tipKeptByDefault", "customDiscountAllowed"];
|
|
316
358
|
/**
|
|
317
359
|
* Optionale Betriebs-Einstellungen mit Wertemenge (Backend `BETRIEB_OPTIONAL`, Katalog
|
|
318
|
-
* `KASSE_BETRIEB_WERTE.tipKinds[]` und `.
|
|
360
|
+
* `KASSE_BETRIEB_WERTE.tipKinds[]`, `.tipStart` und `.tipKeptMode`): ohne Standardwert, der Server sendet sie nur,
|
|
319
361
|
* wenn sie gespeichert sind. [mergePosSettings] uebernimmt sie, wenn sie die Form haben
|
|
320
362
|
* (`tipKinds` eine nichtleere Liste von Texten, `tipStart` ein Text); den Wert prueft der Schreibweg.
|
|
321
363
|
*/
|
|
322
|
-
export declare const POS_BUSINESS_OPTIONAL_CHOICES: readonly ["tipKinds", "tipStart"];
|
|
364
|
+
export declare const POS_BUSINESS_OPTIONAL_CHOICES: readonly ["tipKinds", "tipStart", "tipKeptMode"];
|
|
365
|
+
/**
|
|
366
|
+
* Optionale Betriebs-Listen aus Objekten (Backend `BETRIEB_OPTIONAL.rabattVorlagen`): ohne Standardwert, der Server
|
|
367
|
+
* sendet sie nur, wenn sie gespeichert sind (auch als leere Liste). Der Leser uebernimmt die Eintraege, die die Form
|
|
368
|
+
* einer Vorlage haben ([_vorlagenLesen]); eine Vorlage mit unbekannter Art faellt weg.
|
|
369
|
+
*/
|
|
370
|
+
export declare const POS_BUSINESS_OPTIONAL_LISTS: readonly ["discountPresets"];
|
|
371
|
+
/** Die lesbaren Vorlagen einer Liste vom Draht oder aus dem Speicher; keine Liste -> `null` (Feld fehlt). */
|
|
372
|
+
export declare function _vorlagenLesen(wert: unknown): PosDiscountPreset[] | null;
|
|
323
373
|
/** Optionale Geraete-Einstellungen mit Wertemenge (Backend `GERAET_OPTIONAL`, Katalog `KASSE_GERAET_WERTE.cartWidth`). */
|
|
324
374
|
export declare const POS_DEVICE_OPTIONAL_CHOICES: readonly ["cartWidth"];
|
|
325
375
|
/** Hat der Wert die Form eines optionalen Wahlfeldes? Texte, die der Server neu einfuehren koennte, bleiben (kein Altwert 0.x). */
|
|
@@ -332,6 +382,22 @@ export declare function posTipStart(business: Readonly<Partial<PosBusinessSettin
|
|
|
332
382
|
export declare function posCartWidth(device: Readonly<Partial<PosDeviceSettings>> | null | undefined): PosOpen<PosCartWidth>;
|
|
333
383
|
/** Bar-Trinkgeld „gleich behalten“ vorbelegt? Fehlt die Einstellung, gilt aus. */
|
|
334
384
|
export declare function posTipKeptByDefault(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): boolean;
|
|
385
|
+
/** Darf an der Kasse ein eigener Rabatt (Betrag oder Prozent) eingetippt werden? Fehlt die Einstellung, gilt ja. */
|
|
386
|
+
export declare function posCustomDiscountAllowed(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): boolean;
|
|
387
|
+
/** Wirksame Stufe „Trinkgeld gleich behalten“: die gespeicherte, wenn sie bekannt ist, sonst `ask`. */
|
|
388
|
+
export declare function posTipKeptMode(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): PosTipKeptMode;
|
|
389
|
+
/** Ergebnis von [tipKeptFor]: zeigt die Kasse den Schalter, und wird das Bar-Trinkgeld gleich behalten? */
|
|
390
|
+
export interface TipKeptDecision {
|
|
391
|
+
showSwitch: boolean;
|
|
392
|
+
kept: boolean;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Die eine Regel fuer Web-Kasse und Kassen-App beim Bar-Trinkgeld: `ask` zeigt den Schalter, gewaehlt ist
|
|
396
|
+
* `wanted` (die Wahl am Schalter, ein Wahrheitswert), sonst die Vorbelegung `tipKeptByDefault`; `always` bzw. `never` zeigen
|
|
397
|
+
* keinen Schalter und behalten gleich bzw. lassen offen, eine Schalterwahl zaehlt dann nicht. `kept` geht als
|
|
398
|
+
* `tip.direkt` an den Beleg (der Server erzwingt die Stufe dort nicht).
|
|
399
|
+
*/
|
|
400
|
+
export declare function tipKeptFor(business: Readonly<Partial<PosBusinessSettings>> | null | undefined, wanted?: boolean | null): TipKeptDecision;
|
|
335
401
|
/**
|
|
336
402
|
* Die Wertemenge je Feld, soweit das Feld eine hat: dagegen prueft der
|
|
337
403
|
* Schreibweg vor dem Senden (ein deutscher Wert wie `'nacht'` geht so gar
|
package/dist/esm/pos/settings.js
CHANGED
|
@@ -33,6 +33,16 @@ export const TIP_MODE = ['amount', 'total', 'both'];
|
|
|
33
33
|
export const TIP_KINDS = ['percent', 'round_up', 'total'];
|
|
34
34
|
/** Die zuerst offene Trinkgeld-Art (`business.tipStart`): dieselben Werte wie [TIP_KINDS]. */
|
|
35
35
|
export const TIP_START = TIP_KINDS;
|
|
36
|
+
/**
|
|
37
|
+
* Bar-Trinkgeld gleich behalten (`business.tipKeptMode`): `ask` = Schalter an der Kasse, vorbelegt mit
|
|
38
|
+
* `tipKeptByDefault`; `always`/`never` = kein Schalter, die Kasse setzt die Wahl selbst. Entscheidung ueber [tipKeptFor].
|
|
39
|
+
*/
|
|
40
|
+
export const TIP_KEPT_MODE = ['ask', 'always', 'never'];
|
|
41
|
+
/**
|
|
42
|
+
* Art einer Rabatt-Vorlage (`business.discountPresets[].kind`): Prozent oder fester Betrag
|
|
43
|
+
* (gespeichert `art`: `prozent | betrag`).
|
|
44
|
+
*/
|
|
45
|
+
export const DISCOUNT_PRESET_KIND = ['percent', 'amount'];
|
|
36
46
|
/** Breite der rechten Spalte (Korb) an diesem Geraet (`device.cartWidth`); in der schmalen Ansicht ohne Wirkung. */
|
|
37
47
|
export const CART_WIDTH = ['narrow', 'medium', 'wide'];
|
|
38
48
|
export const CHECKOUT_MODE = ['page', 'panel'];
|
|
@@ -210,15 +220,39 @@ const OPTIONALE = new Set(POS_DEVICE_OPTIONAL_FIELDS);
|
|
|
210
220
|
* [mergePosSettings] uebernimmt sie nur als Wahrheitswert; der Schreibweg
|
|
211
221
|
* nimmt nur `true`/`false`.
|
|
212
222
|
*/
|
|
213
|
-
export const POS_BUSINESS_OPTIONAL_FIELDS = Object.freeze(['tipKeptByDefault']);
|
|
223
|
+
export const POS_BUSINESS_OPTIONAL_FIELDS = Object.freeze(['tipKeptByDefault', 'customDiscountAllowed']);
|
|
214
224
|
const OPTIONALE_SCHALTER = new Set(POS_BUSINESS_OPTIONAL_FIELDS);
|
|
215
225
|
/**
|
|
216
226
|
* Optionale Betriebs-Einstellungen mit Wertemenge (Backend `BETRIEB_OPTIONAL`, Katalog
|
|
217
|
-
* `KASSE_BETRIEB_WERTE.tipKinds[]` und `.
|
|
227
|
+
* `KASSE_BETRIEB_WERTE.tipKinds[]`, `.tipStart` und `.tipKeptMode`): ohne Standardwert, der Server sendet sie nur,
|
|
218
228
|
* wenn sie gespeichert sind. [mergePosSettings] uebernimmt sie, wenn sie die Form haben
|
|
219
229
|
* (`tipKinds` eine nichtleere Liste von Texten, `tipStart` ein Text); den Wert prueft der Schreibweg.
|
|
220
230
|
*/
|
|
221
|
-
export const POS_BUSINESS_OPTIONAL_CHOICES = Object.freeze(['tipKinds', 'tipStart']);
|
|
231
|
+
export const POS_BUSINESS_OPTIONAL_CHOICES = Object.freeze(['tipKinds', 'tipStart', 'tipKeptMode']);
|
|
232
|
+
/**
|
|
233
|
+
* Optionale Betriebs-Listen aus Objekten (Backend `BETRIEB_OPTIONAL.rabattVorlagen`): ohne Standardwert, der Server
|
|
234
|
+
* sendet sie nur, wenn sie gespeichert sind (auch als leere Liste). Der Leser uebernimmt die Eintraege, die die Form
|
|
235
|
+
* einer Vorlage haben ([_vorlagenLesen]); eine Vorlage mit unbekannter Art faellt weg.
|
|
236
|
+
*/
|
|
237
|
+
export const POS_BUSINESS_OPTIONAL_LISTS = Object.freeze(['discountPresets']);
|
|
238
|
+
/** Die lesbaren Vorlagen einer Liste vom Draht oder aus dem Speicher; keine Liste -> `null` (Feld fehlt). */
|
|
239
|
+
export function _vorlagenLesen(wert) {
|
|
240
|
+
if (!Array.isArray(wert))
|
|
241
|
+
return null;
|
|
242
|
+
const raus = [];
|
|
243
|
+
for (const e of wert) {
|
|
244
|
+
if (e === null || typeof e !== 'object' || Array.isArray(e))
|
|
245
|
+
continue;
|
|
246
|
+
const v = e;
|
|
247
|
+
if (typeof v.name !== 'string')
|
|
248
|
+
continue;
|
|
249
|
+
if (v.kind === 'percent' && Number.isSafeInteger(v.percentBp))
|
|
250
|
+
raus.push({ name: v.name, kind: 'percent', percentBp: v.percentBp });
|
|
251
|
+
else if (v.kind === 'amount' && Number.isSafeInteger(v.amountCents))
|
|
252
|
+
raus.push({ name: v.name, kind: 'amount', amountCents: v.amountCents });
|
|
253
|
+
}
|
|
254
|
+
return raus;
|
|
255
|
+
}
|
|
222
256
|
/** Optionale Geraete-Einstellungen mit Wertemenge (Backend `GERAET_OPTIONAL`, Katalog `KASSE_GERAET_WERTE.cartWidth`). */
|
|
223
257
|
export const POS_DEVICE_OPTIONAL_CHOICES = Object.freeze(['cartWidth']);
|
|
224
258
|
/** Hat der Wert die Form eines optionalen Wahlfeldes? Texte, die der Server neu einfuehren koennte, bleiben (kein Altwert 0.x). */
|
|
@@ -251,6 +285,29 @@ export function posCartWidth(device) {
|
|
|
251
285
|
export function posTipKeptByDefault(business) {
|
|
252
286
|
return !!business && business.tipKeptByDefault === true;
|
|
253
287
|
}
|
|
288
|
+
/** Darf an der Kasse ein eigener Rabatt (Betrag oder Prozent) eingetippt werden? Fehlt die Einstellung, gilt ja. */
|
|
289
|
+
export function posCustomDiscountAllowed(business) {
|
|
290
|
+
return business?.customDiscountAllowed !== false;
|
|
291
|
+
}
|
|
292
|
+
/** Wirksame Stufe „Trinkgeld gleich behalten“: die gespeicherte, wenn sie bekannt ist, sonst `ask`. */
|
|
293
|
+
export function posTipKeptMode(business) {
|
|
294
|
+
const m = business?.tipKeptMode;
|
|
295
|
+
return TIP_KEPT_MODE.includes(m) ? m : 'ask';
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Die eine Regel fuer Web-Kasse und Kassen-App beim Bar-Trinkgeld: `ask` zeigt den Schalter, gewaehlt ist
|
|
299
|
+
* `wanted` (die Wahl am Schalter, ein Wahrheitswert), sonst die Vorbelegung `tipKeptByDefault`; `always` bzw. `never` zeigen
|
|
300
|
+
* keinen Schalter und behalten gleich bzw. lassen offen, eine Schalterwahl zaehlt dann nicht. `kept` geht als
|
|
301
|
+
* `tip.direkt` an den Beleg (der Server erzwingt die Stufe dort nicht).
|
|
302
|
+
*/
|
|
303
|
+
export function tipKeptFor(business, wanted) {
|
|
304
|
+
const stufe = posTipKeptMode(business);
|
|
305
|
+
if (stufe === 'always')
|
|
306
|
+
return { showSwitch: false, kept: true };
|
|
307
|
+
if (stufe === 'never')
|
|
308
|
+
return { showSwitch: false, kept: false };
|
|
309
|
+
return { showSwitch: true, kept: typeof wanted === 'boolean' ? wanted : posTipKeptByDefault(business) };
|
|
310
|
+
}
|
|
254
311
|
/**
|
|
255
312
|
* Die Wertemenge je Feld, soweit das Feld eine hat: dagegen prueft der
|
|
256
313
|
* Schreibweg vor dem Senden (ein deutscher Wert wie `'nacht'` geht so gar
|
|
@@ -261,7 +318,7 @@ export const POS_BUSINESS_VALUES = Object.freeze({
|
|
|
261
318
|
tileStyle: TILE_STYLE, autoLogoutMinutes: AUTO_LOGOUT_MINUTES, quantity: QUANTITY, discount: DISCOUNT,
|
|
262
319
|
cardProvider: CARD_PROVIDER, tipMode: TIP_MODE, checkoutMode: CHECKOUT_MODE, receiptOutput: RECEIPT_OUTPUT,
|
|
263
320
|
doneScreenSeconds: DONE_SCREEN_SECONDS, watermarkSide: WATERMARK_SIDE, watermarkStrength: WATERMARK_STRENGTH,
|
|
264
|
-
logoScale: LOGO_SCALE, watermarkScale: WATERMARK_SCALE, tipKinds: TIP_KINDS, tipStart: TIP_START,
|
|
321
|
+
logoScale: LOGO_SCALE, watermarkScale: WATERMARK_SCALE, tipKinds: TIP_KINDS, tipStart: TIP_START, tipKeptMode: TIP_KEPT_MODE,
|
|
265
322
|
});
|
|
266
323
|
/** Wie [POS_BUSINESS_VALUES] fuer die Geraete-Einstellungen. */
|
|
267
324
|
export const POS_DEVICE_VALUES = Object.freeze({
|
|
@@ -298,6 +355,7 @@ const ALTWERTE_0X = Object.freeze({
|
|
|
298
355
|
terminalType: ['keins'],
|
|
299
356
|
tipKinds: ['prozent', 'aufrunden', 'gesamt'],
|
|
300
357
|
tipStart: ['prozent', 'aufrunden', 'gesamt'],
|
|
358
|
+
tipKeptMode: ['fragen', 'immer', 'nie'],
|
|
301
359
|
cartWidth: ['schmal', 'mittel', 'breit'],
|
|
302
360
|
});
|
|
303
361
|
/** Tasten-Aktionen der inneren Form (0.x). */
|
|
@@ -341,6 +399,11 @@ export function mergePosSettings(standard, stored) {
|
|
|
341
399
|
out[key] = wert;
|
|
342
400
|
if (OPTIONALE_WAHL.has(key) && _optionalerWahlwert(key, wert))
|
|
343
401
|
out[key] = Array.isArray(wert) ? [...wert] : wert;
|
|
402
|
+
if (key === 'discountPresets') {
|
|
403
|
+
const liste = _vorlagenLesen(wert);
|
|
404
|
+
if (liste !== null)
|
|
405
|
+
out[key] = liste;
|
|
406
|
+
}
|
|
344
407
|
continue;
|
|
345
408
|
}
|
|
346
409
|
const wert = stored[key];
|