@unimaze/billing 0.21.30 → 0.21.32
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/lib/common/components/billing-lines/SingleBillingLine.js +2 -0
- package/lib/common/components/payment-method/index.js +2 -2
- package/lib/create-invoice/index.js +1 -1
- package/lib/translations/locales/en.json +2 -2
- package/lib/translations/locales/is.json +2 -2
- package/lib/utils/BillingLineUtility.d.ts +1 -0
- package/lib/utils/BillingLineUtility.js +13 -1
- package/lib/utils/LocalStorageUtility.d.ts +1 -0
- package/lib/utils/LocalStorageUtility.js +11 -3
- package/package.json +1 -1
|
@@ -110,8 +110,10 @@ var SingleBillingLine = function (props) {
|
|
|
110
110
|
(0, react_1.useEffect)(function () {
|
|
111
111
|
if (props.outsideVatScope) {
|
|
112
112
|
setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope);
|
|
113
|
+
(0, BillingLineUtility_1.assignTaxCategoryToAllLines)(props.formInstance, enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope);
|
|
113
114
|
}
|
|
114
115
|
else {
|
|
116
|
+
(0, BillingLineUtility_1.assignTaxCategoryToAllLines)(props.formInstance, enums_1.AvailableTaxCategoryTypeEnum.StandardRated);
|
|
115
117
|
setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.StandardRated);
|
|
116
118
|
}
|
|
117
119
|
}, [props.outsideVatScope]);
|
|
@@ -79,11 +79,11 @@ exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
79
79
|
},
|
|
80
80
|
paymentMethod_labels_methods_domesticTransfer: {
|
|
81
81
|
id: "paymentMethod_labels_methods_domesticTransfer",
|
|
82
|
-
defaultMessage: "
|
|
82
|
+
defaultMessage: "Domestic transfer", // Domestic transfer - "Millifærsla innanlands"
|
|
83
83
|
},
|
|
84
84
|
paymentMethod_labels_methods_domesticClaim: {
|
|
85
85
|
id: "paymentMethod_labels_methods_domesticClaim",
|
|
86
|
-
defaultMessage: "
|
|
86
|
+
defaultMessage: "Domestic claim",
|
|
87
87
|
},
|
|
88
88
|
paymentMethod_rules_number: {
|
|
89
89
|
id: "paymentMethod_rules_number",
|
|
@@ -280,7 +280,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
280
280
|
invoice: {
|
|
281
281
|
supplier: __assign({}, (_a = flatFields === null || flatFields === void 0 ? void 0 : flatFields.invoice) === null || _a === void 0 ? void 0 : _a.supplier),
|
|
282
282
|
customer: __assign(__assign({}, chosenCustomer), { locationIdentifier: (_c = (_b = flatFields === null || flatFields === void 0 ? void 0 : flatFields.invoice) === null || _b === void 0 ? void 0 : _b.customer) === null || _c === void 0 ? void 0 : _c.locationIdentifier }),
|
|
283
|
-
paymentMeans: (_d = flatFields === null || flatFields === void 0 ? void 0 : flatFields.invoice) === null || _d === void 0 ? void 0 : _d.paymentMeans,
|
|
283
|
+
paymentMeans: (0, LocalStorageUtility_1.getPaymentMeansObjectForLocalStorage)((_d = flatFields === null || flatFields === void 0 ? void 0 : flatFields.invoice) === null || _d === void 0 ? void 0 : _d.paymentMeans),
|
|
284
284
|
referenceIdentifiers: [{ code: undefined }],
|
|
285
285
|
singleReferenceIdentifier: {
|
|
286
286
|
code: undefined,
|
|
@@ -132,8 +132,8 @@
|
|
|
132
132
|
"paymentMethod_labels_domesticTransfer_paymentReference": "Payment reference",
|
|
133
133
|
"paymentMethod_labels_icelandicClaim_bankNo": "Bank no",
|
|
134
134
|
"paymentMethod_labels_icelandicClaim_claimNo": "Account no",
|
|
135
|
-
"paymentMethod_labels_methods_domesticClaim": "
|
|
136
|
-
"paymentMethod_labels_methods_domesticTransfer": "
|
|
135
|
+
"paymentMethod_labels_methods_domesticClaim": "Domestic claim",
|
|
136
|
+
"paymentMethod_labels_methods_domesticTransfer": "Domestic transfer",
|
|
137
137
|
"paymentMethod_labels_methods_mutuallyAgreed": "Mutually agreed",
|
|
138
138
|
"paymentMethod_labels_methods_undefined": "Undefined",
|
|
139
139
|
"paymentMethod_rules_Length": "{fieldName} must be between {min} and {max}",
|
|
@@ -132,8 +132,8 @@
|
|
|
132
132
|
"paymentMethod_labels_domesticTransfer_paymentReference": "Greiðslutilvísun",
|
|
133
133
|
"paymentMethod_labels_icelandicClaim_bankNo": "Banki",
|
|
134
134
|
"paymentMethod_labels_icelandicClaim_claimNo": "Reikningsnúmer",
|
|
135
|
-
"paymentMethod_labels_methods_domesticClaim": "
|
|
136
|
-
"paymentMethod_labels_methods_domesticTransfer": "Millifærsla",
|
|
135
|
+
"paymentMethod_labels_methods_domesticClaim": "Innlend krafa",
|
|
136
|
+
"paymentMethod_labels_methods_domesticTransfer": "Millifærsla innanlands",
|
|
137
137
|
"paymentMethod_labels_methods_mutuallyAgreed": "Skv. samkomulagi",
|
|
138
138
|
"paymentMethod_labels_methods_undefined": "Óskilgreint",
|
|
139
139
|
"paymentMethod_rules_Length": "{fieldName} verður að vera milli {min} og {max} stafir að lengd",
|
|
@@ -29,4 +29,5 @@ interface TaxDisplay {
|
|
|
29
29
|
export declare const combinedTaxesForLines: (invoiceLines: BillingLineMetadataOverride[]) => TaxDisplay[];
|
|
30
30
|
export declare const getUnitOfMeasureUnitLabel: (unitOfMeasure: any) => string;
|
|
31
31
|
export declare const getDiscountLabel: (discountValue: string, discountType: string, currencyCode: string, discountText: string) => string;
|
|
32
|
+
export declare const assignTaxCategoryToAllLines: (formInstance: FormInstance, taxToAssign: AvailableTaxCategoryTypeEnum) => void;
|
|
32
33
|
export {};
|
|
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.getDiscountLabel = exports.getUnitOfMeasureUnitLabel = exports.combinedTaxesForLines = exports.getFieldNames = exports.getTaxCategoryDisabled = exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
|
|
28
|
+
exports.assignTaxCategoryToAllLines = exports.getDiscountLabel = exports.getUnitOfMeasureUnitLabel = exports.combinedTaxesForLines = exports.getFieldNames = exports.getTaxCategoryDisabled = exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
|
|
29
29
|
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
30
30
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
31
31
|
var react_1 = __importDefault(require("react"));
|
|
@@ -220,3 +220,15 @@ var getDiscountLabel = function (discountValue, discountType, currencyCode, disc
|
|
|
220
220
|
return "".concat(discountValue).concat(discountType === "PERCENTAGE" ? "%" : " ".concat(currencyCode), " ").concat(discountText);
|
|
221
221
|
};
|
|
222
222
|
exports.getDiscountLabel = getDiscountLabel;
|
|
223
|
+
var assignTaxCategoryToAllLines = function (formInstance, taxToAssign) {
|
|
224
|
+
var clonedLines = (0, lodash_1.cloneDeep)(formInstance.getFieldValue(["invoice", "invoiceLines"]));
|
|
225
|
+
clonedLines.forEach(function (line) {
|
|
226
|
+
line.taxCategoryType = taxToAssign;
|
|
227
|
+
});
|
|
228
|
+
formInstance.setFieldsValue({
|
|
229
|
+
invoice: {
|
|
230
|
+
invoiceLines: clonedLines,
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
exports.assignTaxCategoryToAllLines = assignTaxCategoryToAllLines;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const getFormFromLocalStorage: (localStorageFormDataVersion: string) => any;
|
|
2
2
|
export declare const setFormToLocalStorage: (formData: any, localStorageFormDataVersion: string) => void;
|
|
3
|
+
export declare const getPaymentMeansObjectForLocalStorage: (paymentFromForm: any) => any;
|
|
@@ -11,7 +11,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.setFormToLocalStorage = exports.getFormFromLocalStorage = void 0;
|
|
14
|
+
exports.getPaymentMeansObjectForLocalStorage = exports.setFormToLocalStorage = exports.getFormFromLocalStorage = void 0;
|
|
15
|
+
var lodash_1 = require("lodash");
|
|
15
16
|
var getFormFromLocalStorage = function (localStorageFormDataVersion) {
|
|
16
17
|
var rawValuesFromLocalStorage = localStorage.getItem("formData");
|
|
17
18
|
var valuesFromLocalStorageObject = null;
|
|
@@ -23,7 +24,7 @@ var getFormFromLocalStorage = function (localStorageFormDataVersion) {
|
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
26
|
if (valuesFromLocalStorageObject) {
|
|
26
|
-
if ((valuesFromLocalStorageObject === null || valuesFromLocalStorageObject === void 0 ? void 0 : valuesFromLocalStorageObject.
|
|
27
|
+
if ((valuesFromLocalStorageObject === null || valuesFromLocalStorageObject === void 0 ? void 0 : valuesFromLocalStorageObject.version) === localStorageFormDataVersion) {
|
|
27
28
|
return valuesFromLocalStorageObject;
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
@@ -35,7 +36,14 @@ var getFormFromLocalStorage = function (localStorageFormDataVersion) {
|
|
|
35
36
|
};
|
|
36
37
|
exports.getFormFromLocalStorage = getFormFromLocalStorage;
|
|
37
38
|
var setFormToLocalStorage = function (formData, localStorageFormDataVersion) {
|
|
38
|
-
var objectForLocalStorage = __assign(__assign({}, formData), {
|
|
39
|
+
var objectForLocalStorage = __assign(__assign({}, formData), { version: localStorageFormDataVersion });
|
|
39
40
|
localStorage.setItem("formData", JSON.stringify(objectForLocalStorage));
|
|
40
41
|
};
|
|
41
42
|
exports.setFormToLocalStorage = setFormToLocalStorage;
|
|
43
|
+
var getPaymentMeansObjectForLocalStorage = function (paymentFromForm) {
|
|
44
|
+
var _a;
|
|
45
|
+
var clonedPaymentFromForm = (0, lodash_1.cloneDeep)(paymentFromForm);
|
|
46
|
+
(_a = clonedPaymentFromForm === null || clonedPaymentFromForm === void 0 ? void 0 : clonedPaymentFromForm.domesticTransfer) === null || _a === void 0 ? true : delete _a.paymentIdentifier;
|
|
47
|
+
return clonedPaymentFromForm;
|
|
48
|
+
};
|
|
49
|
+
exports.getPaymentMeansObjectForLocalStorage = getPaymentMeansObjectForLocalStorage;
|