diff --git a/zero.Backoffice.UI/app/components/ui-dropdown-button.vue b/zero.Backoffice.UI/app/components/ui-dropdown-button.vue index 037f208f..f9efd12c 100644 --- a/zero.Backoffice.UI/app/components/ui-dropdown-button.vue +++ b/zero.Backoffice.UI/app/components/ui-dropdown-button.vue @@ -1,15 +1,15 @@  diff --git a/zero.Backoffice.UI/app/editor/compile.ts b/zero.Backoffice.UI/app/editor/compile.ts index 7d4d83c5..040de6e4 100644 --- a/zero.Backoffice.UI/app/editor/compile.ts +++ b/zero.Backoffice.UI/app/editor/compile.ts @@ -58,9 +58,9 @@ export interface ZeroCompiledEditorField options: any | null; component: Component; - optional: (model: any) => boolean; - readonly: (model: any) => boolean; - hidden: (model: any) => boolean; + optional: (model: any, parent: any) => boolean; + readonly: (model: any, parent: any) => boolean; + hidden: (model: any, parent: any) => boolean; label: string; hideLabel: boolean; description: string | null; @@ -90,7 +90,7 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi path: field.path, component, - optional(model: any) + optional(model: any, parent: any) { if (typeof field.configuration.optional === 'boolean') { @@ -98,12 +98,12 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi } if (typeof field.configuration.optional === 'function') { - return field.configuration.optional(model); + return field.configuration.optional(model, parent); } return false; }, - readonly(model: any) + readonly(model: any, parent: any) { if (typeof field.configuration.readonly === 'boolean') { @@ -111,12 +111,12 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi } if (typeof field.configuration.readonly === 'function') { - return field.configuration.readonly(model); + return field.configuration.readonly(model, parent); } return false; }, - hidden(model: any) + hidden(model: any, parent: any) { if (typeof field.configuration.hidden === 'boolean') { @@ -124,7 +124,7 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi } if (typeof field.configuration.hidden === 'function') { - return field.configuration.hidden(model); + return field.configuration.hidden(model, parent); } return false; }, diff --git a/zero.Backoffice.UI/app/utils/numbers.ts b/zero.Backoffice.UI/app/utils/numbers.ts index 92f95f22..cac7562b 100644 --- a/zero.Backoffice.UI/app/utils/numbers.ts +++ b/zero.Backoffice.UI/app/utils/numbers.ts @@ -41,4 +41,15 @@ export function toCurrency(value: number, decimals: number = 2, hideSymbol: bool return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, noEncode ? " " : " ") + (hideSymbol === true ? "" : (noEncode ? " €" : " €")); // TODO we have dynamic currencies, not fixed to € -}; \ No newline at end of file +}; + + +/** + * Rounds a number up + * @returns {number} Number + */ +export function roundUp(value: number, decimals: number = 2) +{ + decimals = Math.pow(10, decimals); + return Math.ceil(value * decimals) / decimals; +} \ No newline at end of file diff --git a/zero.Backoffice/Resources/Localization/zero.de-de.json b/zero.Backoffice/Resources/Localization/zero.de-de.json index ca560124..2379aa94 100644 --- a/zero.Backoffice/Resources/Localization/zero.de-de.json +++ b/zero.Backoffice/Resources/Localization/zero.de-de.json @@ -33,6 +33,7 @@ "back": "Zurück", "close": "Schließen", "cancel": "Abbrechen", + "ok": "OK", "confirm": "Bestätigen", "save": "Speichern", "create": "Erstellen", diff --git a/zero.Backoffice/Resources/Localization/zero.en-us.json b/zero.Backoffice/Resources/Localization/zero.en-us.json index debdc4f3..8c8fd9f2 100644 --- a/zero.Backoffice/Resources/Localization/zero.en-us.json +++ b/zero.Backoffice/Resources/Localization/zero.en-us.json @@ -36,6 +36,7 @@ "back": "Go back", "close": "Close", "cancel": "Cancel", + "ok": "OK", "confirm": "Confirm", "save": "Save", "create": "Create",