@unimaze/billing 0.8.3-rc.0 → 0.9.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.
Files changed (61) hide show
  1. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +3 -1
  2. package/lib/common/components/base-information/ReferenceIdentifiers.js +20 -15
  3. package/lib/common/components/base-information/index.d.ts +3 -1
  4. package/lib/common/components/base-information/index.js +11 -8
  5. package/lib/common/components/billing-lines/BillingTaxSummary.js +4 -0
  6. package/lib/common/components/billing-lines/NewBillingLines.d.ts +2 -2
  7. package/lib/common/components/billing-lines/NewBillingLines.js +2 -1
  8. package/lib/common/components/billing-lines/index.d.ts +3 -3
  9. package/lib/common/components/editable-cell/index.d.ts +1 -1
  10. package/lib/common/components/editable-cell/index.js +5 -1
  11. package/lib/common/components/form-item/index.js +3 -2
  12. package/lib/common/components/payment-method/index.d.ts +1 -1
  13. package/lib/common/components/payment-method/index.js +106 -81
  14. package/lib/common/components/supplier/index.js +15 -12
  15. package/lib/common/types/BillingLineMetadataOverride.d.ts +1 -1
  16. package/lib/common/types/CommonProps.d.ts +1 -0
  17. package/lib/create-invoice/IntlLoader.d.ts +2 -0
  18. package/lib/create-invoice/IntlLoader.js +1 -1
  19. package/lib/create-invoice/index.d.ts +3 -1
  20. package/lib/create-invoice/index.js +20 -8
  21. package/lib/translations/locales/is.json +12 -8
  22. package/lib/translations/locales.d.ts +6 -2
  23. package/lib/utils/ApiUtility.d.ts +2 -1
  24. package/lib/utils/ApiUtility.js +3 -3
  25. package/lib/utils/BillingLineUtility.d.ts +1 -1
  26. package/lib/utils/BillingLineUtility.js +3 -3
  27. package/lib/utils/RequirementsUtility.d.ts +1 -0
  28. package/lib/utils/RequirementsUtility.js +14 -0
  29. package/package.json +2 -2
  30. package/lib/example/src/index.d.ts +0 -1
  31. package/lib/src/common/components/attachments/Attachment.d.ts +0 -18
  32. package/lib/src/common/components/attachments/index.d.ts +0 -6
  33. package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +0 -18
  34. package/lib/src/common/components/base-information/index.d.ts +0 -13
  35. package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +0 -11
  36. package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
  37. package/lib/src/common/components/billing-lines/index.d.ts +0 -28
  38. package/lib/src/common/components/component-container/Content.d.ts +0 -7
  39. package/lib/src/common/components/component-container/Header.d.ts +0 -9
  40. package/lib/src/common/components/component-container/index.d.ts +0 -11
  41. package/lib/src/common/components/customer/index.d.ts +0 -18
  42. package/lib/src/common/components/delivery-location/index.d.ts +0 -10
  43. package/lib/src/common/components/editable-cell/index.d.ts +0 -15
  44. package/lib/src/common/components/editable-row/index.d.ts +0 -5
  45. package/lib/src/common/components/form-item/index.d.ts +0 -28
  46. package/lib/src/common/components/index.d.ts +0 -10
  47. package/lib/src/common/components/payment-method/index.d.ts +0 -11
  48. package/lib/src/common/components/payment-method/paymentMethodForConversion.d.ts +0 -9
  49. package/lib/src/common/components/supplier/index.d.ts +0 -12
  50. package/lib/src/common/consts/formLayout.d.ts +0 -74
  51. package/lib/src/common/consts/validationRules.d.ts +0 -6
  52. package/lib/src/common/types/ReceiverRequirements.d.ts +0 -80
  53. package/lib/src/create-invoice/IntlLoader.d.ts +0 -14
  54. package/lib/src/create-invoice/index.d.ts +0 -11
  55. package/lib/src/translations/locales.d.ts +0 -142
  56. package/lib/src/utils/ApiUtility.d.ts +0 -21
  57. package/lib/src/utils/BillingLineUtility.d.ts +0 -10
  58. package/lib/src/utils/ConversionUtility.d.ts +0 -8
  59. package/lib/src/utils/IntlUtility.d.ts +0 -4
  60. package/lib/src/utils/RequirementsUtility.d.ts +0 -6
  61. package/lib/src/utils/index.d.ts +0 -2
@@ -44,6 +44,6 @@ var CreateInvoice = function (props) {
44
44
  react_intl_1.addLocaleData(en_1.default.concat(sr_1.default, is_1.default));
45
45
  return (react_1.default.createElement(antd_1.ConfigProvider, { locale: andLocale, componentSize: "small" },
46
46
  react_1.default.createElement(react_intl_1.IntlProvider, { locale: languageString, defaultLocale: "en", key: languageString, messages: locales_1.default[languageString] },
47
- react_1.default.createElement(index_1.default, { customers: props.customers, language: languageString, mapiBaseUrl: props.mapiBaseUrl, rapiBaseUrl: props.rapiBaseUrl, receiverRequirements: props.receiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, legalIdentifier: props.legalIdentifier, uploadSizeLimit: props.uploadSizeLimit, attachmentTooltipText: props.attachmentTooltipText }))));
47
+ react_1.default.createElement(index_1.default, { customers: props.customers, language: languageString, mapiBaseUrl: props.mapiBaseUrl, rapiBaseUrl: props.rapiBaseUrl, receiverRequirements: props.receiverRequirements, getReceiverRequirements: props.getReceiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, legalIdentifier: props.legalIdentifier, uploadSizeLimit: props.uploadSizeLimit, attachmentTooltipText: props.attachmentTooltipText, referenceIdentifiersHelpText: props.referenceIdentifiersHelpText, referenceIdentifiersLabelText: props.referenceIdentifiersLabelText }))));
48
48
  };
49
49
  exports.default = CreateInvoice;
@@ -4,8 +4,10 @@ import { InjectedIntlProps } from "react-intl";
4
4
  import { CommonProps } from "../common/types/CommonProps";
5
5
  interface Props extends CommonProps, InjectedIntlProps {
6
6
  customers: ProfileOutputWithApiKey[];
7
+ referenceIdentifiersHelpText?: string;
8
+ referenceIdentifiersLabelText?: string;
7
9
  }
8
- declare const _default: React.ComponentClass<Pick<Props, "uploadSizeLimit" | "attachmentTooltipText" | "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "legalIdentifier" | "customers" | "language" | "mapiBaseUrl">, any> & {
10
+ declare const _default: React.ComponentClass<Pick<Props, "uploadSizeLimit" | "attachmentTooltipText" | "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "legalIdentifier" | "referenceIdentifiersLabelText" | "referenceIdentifiersHelpText" | "customers" | "language" | "mapiBaseUrl" | "getReceiverRequirements">, any> & {
9
11
  WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
10
12
  };
11
13
  export default _default;
@@ -22,7 +22,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  var mapi_1 = require("@unimaze/api-clients/lib/mapi");
25
- var models_1 = require("@unimaze/api-clients/lib/mapi/models");
26
25
  var antd_1 = require("antd");
27
26
  var formLayout_1 = require("../common/consts/formLayout");
28
27
  var components_1 = require("../common/components");
@@ -81,17 +80,17 @@ var CreateInvoiceConstructor = function (props) {
81
80
  taxAmount: 0,
82
81
  name: props.intl.formatMessage(billing_lines_1.translationMessages.billingLines_placeholders_newItem),
83
82
  unitOfMeasure: {
84
- value: models_1.UnitOfMeasureMetadataUnitEnum.Piece,
83
+ value: mapi_1.Units.Piece,
85
84
  label: props.intl.formatMessage(editable_cell_1.commonTranslationMessages.unitOfMeasure_labels_Piece)
86
85
  },
87
86
  unitPriceAmount: 0,
88
87
  taxCategoryType: {
89
- value: models_1.BillingLineMetadataTaxCategoryTypeEnum.Exempt,
90
- label: props.intl.formatMessage(editable_cell_1.commonTranslationMessages.taxCategoryType_labels_Exempt) + " (0%)"
88
+ value: mapi_1.TaxCategoryTypeEnum.OutsideTaxScope,
89
+ label: props.intl.formatMessage(editable_cell_1.commonTranslationMessages.taxCategoryType_labels_OutsideTaxScope) + " (0%)"
91
90
  },
92
91
  discountValue: "0",
93
92
  taxableAmount: 0,
94
- taxPercentage: null
93
+ taxPercentage: 0
95
94
  };
96
95
  var _f = react_1.useState([__assign({}, initialBillingLineData, { key: 0 })]), billingLinesDataSource = _f[0], setBillingLinesDataSource = _f[1];
97
96
  // BILLING LINES
@@ -114,8 +113,8 @@ var CreateInvoiceConstructor = function (props) {
114
113
  newData.splice(index, 1, __assign({}, item, row));
115
114
  var billingLineMetadata = newData.map(function (current) {
116
115
  return __assign({}, current, { unitOfMeasure: {
117
- unit: models_1.UnitOfMeasureMetadataUnitEnum[current.unitOfMeasure.value],
118
- }, taxCategoryType: models_1.BillingLineMetadataTaxCategoryTypeEnum[current.taxCategoryType.value] });
116
+ unit: mapi_1.Units[current.unitOfMeasure.value],
117
+ }, taxCategoryType: mapi_1.TaxCategoryTypeEnum[current.taxCategoryType.value] });
119
118
  });
120
119
  setBillingLinesDataSource(newData);
121
120
  handleSetBillingLineMetadata(formInstance, billingLineMetadata);
@@ -235,6 +234,19 @@ var CreateInvoiceConstructor = function (props) {
235
234
  console.log(error.config);
236
235
  });
237
236
  };
237
+ react_1.useEffect(function () {
238
+ getReceiverRequirements();
239
+ }, [chosenCustomer]);
240
+ var getReceiverRequirements = function () {
241
+ if (chosenCustomer) {
242
+ form.resetFields([
243
+ ["invoice", "referenceIdentifiers"],
244
+ ["invoice", "customer", "locationIdentifier"],
245
+ ["invoice", "paymentMeans"]
246
+ ]);
247
+ props.getReceiverRequirements(props.rapiBaseUrl, chosenCustomer.identifier);
248
+ }
249
+ };
238
250
  var defaultCustomer;
239
251
  if (props.customers.length === 1 && !chosenCustomer) {
240
252
  defaultCustomer = props.customers[0];
@@ -276,7 +288,7 @@ var CreateInvoiceConstructor = function (props) {
276
288
  } }),
277
289
  react_1.default.createElement(antd_1.Row, { gutter: [16, 16] },
278
290
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
279
- react_1.default.createElement(components_1.BaseInformation, { receiverRequirements: props.receiverRequirements, form: form, documentType: "invoice", updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl, legalIdentifier: props.legalIdentifier })),
291
+ react_1.default.createElement(components_1.BaseInformation, { receiverRequirements: props.receiverRequirements, form: form, documentType: "invoice", updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl, legalIdentifier: props.legalIdentifier, referenceIdentifiersLabelText: props.referenceIdentifiersLabelText, referenceIdentifiersHelpText: props.referenceIdentifiersHelpText })),
280
292
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
281
293
  react_1.default.createElement(components_1.Supplier, { receiverRequirements: props.receiverRequirements, billingLinesDataSource: billingLinesDataSource })),
282
294
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
@@ -15,8 +15,8 @@
15
15
  "baseInformation_issueDate_title": "Útgáfudagsetning stjórnar á hvaða uppgjörstímabili færslan skráist",
16
16
  "baseInformation_dueDate": "Gjalddagi",
17
17
  "baseInformation_dueDate_title": "Eindagi skal vera sá sami og gjalddagi",
18
- "baseInformation_orderReference_documentNo": "Pöntunarnr.",
19
- "baseInformation_orderReference_documentNo_title": "Tilvísun kaupanda getur t.d. verið starfsmannanúmer, kóti fyrir deild eða hóp, tjónanúmer. Ef kaupandi hefur ekki tilgreint tilvísun, má setja hér inn nafn þess aðila sem pantaði eða óskaði eftir þjónustunni.",
18
+ "baseInformation_buyerReferenceLabel": "Tilvísun kaupanda",
19
+ "baseInformation_buyerReferenceLabel_helpText": "Tilvísun sem kaupandi hefur óskað sé sett á reikning, oft kallað \"þín tilvísun\" (your ref.), Notað í innri flokkun/samþykkt hjá kaupanda. Ef kaupandi hefur ekki tilgreint þetta sérstaklega, þá má setja hér inn nafn þess aðila sem pantaði (umbeðið).",
20
20
  "baseInformation_notes": "Athugasemdir",
21
21
  "baseInformation_currencyCode": "Gjaldmiðill",
22
22
  "baseInformation_costCenter": "COST CENTER??????",
@@ -32,6 +32,7 @@
32
32
  "billingTaxSummary_taxCategoryType_labels_ReducedRated": "Lækkaður skattur",
33
33
  "billingTaxSummary_taxCategoryType_labels_ZeroRated": "Enginn skattur",
34
34
  "billingTaxSummary_taxCategoryType_labels_Exempt": "Undaþeginn skatti",
35
+ "billingTaxSummary_taxCategoryType_labels_OutsideTaxScope": "Utan skattumfangs",
35
36
  "billingLines_title": "Reikningslínur",
36
37
  "billingLines_tooltip_title": "Hér þarf að skilgreina Vörunr, Nafn, Fjölda, Mælieiningu, Verð pr. einingu og upphæð. Virðisauki reiknast sjálfkrafa. Smelltu á \"Bæta við röð\" til þess að bæta við vörulínu",
37
38
  "billingLines_itemNo": "Vörunr.",
@@ -56,13 +57,14 @@
56
57
  "deliveryLocation_countryCode": "Landsnúmer",
57
58
  "formItem_required_errorMessage": "Það þarf að fylla út í þennan reit",
58
59
  "paymentMethod_title": "Greiðsluháttur",
59
- "paymentMethod_labels_domesticTransfer_bankNo": "Bankanúmer",
60
+ "paymentMethod_label": "Reikningsnúmer",
61
+ "paymentMethod_labels_domesticTransfer_bankNo": "Banki",
60
62
  "paymentMethod_labels_domesticTransfer_typeNo": "Týpunúmer",
61
- "paymentMethod_labels_domesticTransfer_accountType": "Tegund reiknings",
63
+ "paymentMethod_labels_domesticTransfer_accountType": "Hb",
62
64
  "paymentMethod_labels_domesticTransfer_accountNo": "Reikningsnúmer",
63
65
  "paymentMethod_labels_domesticTransfer_paymentReference": "Greiðslutilvísun",
64
- "paymentMethod_labels_icelandicClaim_bankNo": "Bankanúmer",
65
- "paymentMethod_labels_icelandicClaim_claimNo": "Kröfunúmer",
66
+ "paymentMethod_labels_icelandicClaim_bankNo": "Banki",
67
+ "paymentMethod_labels_icelandicClaim_claimNo": "Reikningsnúmer",
66
68
  "paymentMethod_labels_methods_undefined": "Óskilgreint",
67
69
  "paymentMethod_labels_methods_mutuallyAgreed": "Skv. samkomulagi",
68
70
  "paymentMethod_labels_methods_domesticTransfer": "Millifærsla",
@@ -73,6 +75,7 @@
73
75
  "supplier_name": "Nafn birgja",
74
76
  "supplier_identifier": "Kennitala",
75
77
  "supplier_vatNumber": "VSK nr.",
78
+ "supplier_vatNumber_mandatory": "Gerð er krafa um VSK númer ef línur í skjali nota aðra skattflokka heldur en 'Utan skattumfangs'",
76
79
  "supplier_address_streetNameAndNumber": "Heimilisfang",
77
80
  "supplier_address_zip_postalCode": "Póstnúmer",
78
81
  "supplier_address_city": "Borg",
@@ -93,8 +96,8 @@
93
96
  "customer_contact_email": "Netfang",
94
97
  "customer_contact_name": "Nafn tengiliðs",
95
98
  "referenceIdentifiers_labels_addButton": "Bætið við tilvísunarnúmeri",
96
- "referenceIdentifiers_labels_referenceIdentifier": "Tilvísunarnúmer",
97
- "referenceIdentifiers_labels_referenceIdentifier_title": "Númer er á við tjónið sem um ræðir (bílnúmer, fasteignanúmer eða kennitala)",
99
+ "referenceIdentifiers_labels_referenceIdentifier": "Viðfang",
100
+ "referenceIdentifiers_labels_referenceIdentifier_title": "Tilvísun í viðfang sem tengt er reikningi, gefið upp af seljanda. Gæti verið áskriftarnúmer, símanúmer, mælistaður, ökutæki, einstaklingur o.fl. eftir því sem við á.",
98
101
  "attachment_labels_uploadFileMsg": "Smelltu eða dragðu inn skrá hér til að hlaða upp",
99
102
  "attachment_labels_descriptionErrorMsg": "Lýsing má ekki samsvara annarri skráalýsing",
100
103
  "baseInformation_currency_ISK": "Íslensk króna (ISK)",
@@ -109,6 +112,7 @@
109
112
  "taxCategoryType_labels_ReducedRated": "Lækkaður skattur",
110
113
  "taxCategoryType_labels_ZeroRated": "Enginn skattur",
111
114
  "taxCategoryType_labels_Exempt": "Undaþeginn skatti",
115
+ "taxCategoryType_labels_OutsideTaxScope": "Utan skattumfangs",
112
116
  "unitOfMeasure_labels_Piece": "Stykki",
113
117
  "unitOfMeasure_labels_Kilogram": "Kílógramm",
114
118
  "unitOfMeasure_labels_Month": "Mánuður",
@@ -17,8 +17,8 @@ declare const _default: {
17
17
  "baseInformation_issueDate_title": string;
18
18
  "baseInformation_dueDate": string;
19
19
  "baseInformation_dueDate_title": string;
20
- "baseInformation_orderReference_documentNo": string;
21
- "baseInformation_orderReference_documentNo_title": string;
20
+ "baseInformation_buyerReferenceLabel": string;
21
+ "baseInformation_buyerReferenceLabel_helpText": string;
22
22
  "baseInformation_notes": string;
23
23
  "baseInformation_currencyCode": string;
24
24
  "baseInformation_costCenter": string;
@@ -34,6 +34,7 @@ declare const _default: {
34
34
  "billingTaxSummary_taxCategoryType_labels_ReducedRated": string;
35
35
  "billingTaxSummary_taxCategoryType_labels_ZeroRated": string;
36
36
  "billingTaxSummary_taxCategoryType_labels_Exempt": string;
37
+ "billingTaxSummary_taxCategoryType_labels_OutsideTaxScope": string;
37
38
  "billingLines_title": string;
38
39
  "billingLines_tooltip_title": string;
39
40
  "billingLines_itemNo": string;
@@ -58,6 +59,7 @@ declare const _default: {
58
59
  "deliveryLocation_countryCode": string;
59
60
  "formItem_required_errorMessage": string;
60
61
  "paymentMethod_title": string;
62
+ "paymentMethod_label": string;
61
63
  "paymentMethod_labels_domesticTransfer_bankNo": string;
62
64
  "paymentMethod_labels_domesticTransfer_typeNo": string;
63
65
  "paymentMethod_labels_domesticTransfer_accountType": string;
@@ -75,6 +77,7 @@ declare const _default: {
75
77
  "supplier_name": string;
76
78
  "supplier_identifier": string;
77
79
  "supplier_vatNumber": string;
80
+ "supplier_vatNumber_mandatory": string;
78
81
  "supplier_address_streetNameAndNumber": string;
79
82
  "supplier_address_zip_postalCode": string;
80
83
  "supplier_address_city": string;
@@ -111,6 +114,7 @@ declare const _default: {
111
114
  "taxCategoryType_labels_ReducedRated": string;
112
115
  "taxCategoryType_labels_ZeroRated": string;
113
116
  "taxCategoryType_labels_Exempt": string;
117
+ "taxCategoryType_labels_OutsideTaxScope": string;
114
118
  "unitOfMeasure_labels_Piece": string;
115
119
  "unitOfMeasure_labels_Kilogram": string;
116
120
  "unitOfMeasure_labels_Month": string;
@@ -1,6 +1,6 @@
1
1
  import { mapi } from "@unimaze/api-clients";
2
2
  import { InvoiceMetadataInput, TransactionProcessingMode } from "@unimaze/api-clients/lib/mapi/api";
3
- import { AxiosPromise } from "axios";
3
+ import { AxiosPromise, CancelToken } from "axios";
4
4
  import { LanguageProp } from "../common/types/CommonProps";
5
5
  interface CreateSubmitInvoice {
6
6
  messageId: string;
@@ -18,4 +18,5 @@ interface AttachDocument {
18
18
  }
19
19
  declare const submitDocument: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey?: string | undefined) => AxiosPromise<mapi.MessageOutput>;
20
20
  declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey?: string | undefined, callName?: string | undefined, language?: LanguageProp) => AxiosPromise<mapi.MessageOutput>;
21
+ export declare const getCancelToken: (callName: string) => CancelToken;
21
22
  export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument };
@@ -45,15 +45,15 @@ var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, apiKey, callName
45
45
  };
46
46
  exports.submitInvoice = submitInvoice;
47
47
  var createOptions = function (apiKey, callName, language) {
48
- return __assign({ headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) })) }, (callName && { cancelToken: getCancelToken(callName) }));
48
+ return __assign({ headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) })) }, (callName && { cancelToken: exports.getCancelToken(callName) }));
49
49
  };
50
50
  var createOptionsData = function (data, apiKey, callName, language) {
51
- var options = __assign({}, (callName && { cancelToken: getCancelToken(callName) }), { data: data, headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) }), { "Content-Type": "application/octet-stream" }) });
51
+ var options = __assign({}, (callName && { cancelToken: exports.getCancelToken(callName) }), { data: data, headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) }), { "Content-Type": "application/octet-stream" }) });
52
52
  // tslint:disable-next-line:no-console
53
53
  console.log(options);
54
54
  return options;
55
55
  };
56
- var getCancelToken = function (callName) {
56
+ exports.getCancelToken = function (callName) {
57
57
  var cancelTokenSource = window[callName];
58
58
  if (cancelTokenSource) {
59
59
  cancelTokenSource.cancel("only one call allowed. Canceling previous call");
@@ -7,4 +7,4 @@ export declare const calculateTaxableAmount: (discountValue: string | null | und
7
7
  export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
8
8
  export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum) => number;
9
9
  export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum, taxCategoryTypeTranslated: string) => string;
10
- export declare const getCorrectInputNode: (dataIdx: "key" | "name" | "description" | "referenceIdentifiers" | "notes" | "accountingCost" | "billingPeriod" | "unitOfMeasure" | "taxCategoryType" | "itemNo" | "quantity" | "unitPriceAmount" | "taxableAmount" | "taxAmount" | "taxPercentage" | "discountValue" | "discountReason" | "buyersItemNo" | "standardItemNo" | "originCountryCode" | "commodityClassification" | "additionalItemProperties" | "orderLineReference") => React.ReactChild;
10
+ export declare const getCorrectInputNode: (dataIdx: "key" | "name" | "description" | "referenceIdentifiers" | "notes" | "accountingCost" | "billingPeriod" | "unitOfMeasure" | "taxCategoryType" | "itemNo" | "quantity" | "unitPriceAmount" | "taxableAmount" | "taxAmount" | "taxPercentage" | "discountValue" | "discountReason" | "chargeValue" | "chargeReason" | "buyersItemNo" | "standardItemNo" | "originCountryCode" | "commodityClassification" | "additionalItemProperties" | "orderLineReference") => React.ReactChild;
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var api_1 = require("@unimaze/api-clients/lib/mapi/api");
18
18
  var react_1 = __importDefault(require("react"));
19
19
  var antd_1 = require("antd");
20
- var models_1 = require("@unimaze/api-clients/lib/mapi/models");
21
20
  exports.billingLinesFieldsMetadata = function (formInstance) {
22
21
  var billingLinesMetadata = formInstance.getFieldValue("billingLinesMetadata");
23
22
  return billingLinesMetadata.map(function (billingLine) {
@@ -64,6 +63,7 @@ exports.calculateTaxPercentage = function (taxCategoryType) {
64
63
  return 11;
65
64
  case api_1.TaxCategoryTypeEnum.ZeroRated:
66
65
  case api_1.TaxCategoryTypeEnum.Exempt:
66
+ case api_1.TaxCategoryTypeEnum.OutsideTaxScope:
67
67
  return 0;
68
68
  }
69
69
  };
@@ -76,12 +76,12 @@ exports.getCorrectInputNode = function (dataIdx) {
76
76
  case "unitPriceAmount":
77
77
  return react_1.default.createElement(antd_1.InputNumber, { step: 1 });
78
78
  case "unitOfMeasure":
79
- return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false }, Object.keys(models_1.UnitOfMeasureMetadataUnitEnum).map(function (unitOfMeasure) {
79
+ return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false }, Object.keys(api_1.Units).map(function (unitOfMeasure) {
80
80
  if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
81
81
  return (react_1.default.createElement(antd_1.Select.Option, { value: unitOfMeasure, title: unitOfMeasure, key: unitOfMeasure }, unitOfMeasure));
82
82
  })));
83
83
  case "taxCategoryType":
84
- return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false }, Object.keys(models_1.BillingLineMetadataTaxCategoryTypeEnum).map(function (taxCategoryType) {
84
+ return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false }, Object.keys(api_1.Units).map(function (taxCategoryType) {
85
85
  return (react_1.default.createElement(antd_1.Select.Option, { value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, taxCategoryType));
86
86
  })));
87
87
  default:
@@ -3,4 +3,5 @@ import { AvailableFields } from "../common/types/ReceiverRequirements";
3
3
  import { FieldDefinition, NewReceiverRequirements } from "../common/types/NewReceiverRequirements";
4
4
  export declare const getFieldRequirements: (receiverRequirements: NewReceiverRequirements, key: AvailableFields) => FieldDefinition | undefined;
5
5
  export declare const getFieldLabelOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabel: React.ReactNode) => React.ReactNode;
6
+ export declare const getFieldLabelTooltipOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabelTooltip: React.ReactNode) => React.ReactNode;
6
7
  export declare const getFieldIsRequired: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean) => boolean;
@@ -30,6 +30,20 @@ exports.getFieldLabelOverride = function (receiverRequirements, key, defaultLabe
30
30
  var fieldRequirement = exports.getFieldRequirements(receiverRequirements, key);
31
31
  return fieldRequirement && fieldRequirement.properties.hasOwnProperty("label") ? fieldRequirement.properties.label : defaultLabel;
32
32
  };
33
+ exports.getFieldLabelTooltipOverride = function (receiverRequirements, key, defaultLabelTooltip) {
34
+ var fieldRequirement = exports.getFieldRequirements(receiverRequirements, key);
35
+ if (fieldRequirement && fieldRequirement.properties.hasOwnProperty("handling")) {
36
+ if (fieldRequirement.properties.handling) {
37
+ var handling = JSON.parse(fieldRequirement.properties.handling);
38
+ return handling.helpText ? handling.helpText : defaultLabelTooltip;
39
+ }
40
+ else
41
+ return defaultLabelTooltip;
42
+ }
43
+ else {
44
+ return defaultLabelTooltip;
45
+ }
46
+ };
33
47
  exports.getFieldIsRequired = function (receiverRequirements, key, defaultIsRequired) {
34
48
  var fieldRequirement = exports.getFieldRequirements(receiverRequirements, key);
35
49
  var fieldCardinality = fieldRequirement && fieldRequirement.properties.hasOwnProperty("cardinality") && fieldRequirement.properties.cardinality;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.8.3-rc.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "dependencies": {
11
11
  "@ant-design/compatible": "latest",
12
12
  "@types/react-google-recaptcha": "^2.1.0",
13
- "@unimaze/api-clients": "2.0.2",
13
+ "@unimaze/api-clients": "3.0.0",
14
14
  "antd-mask-input": "^0.1.13",
15
15
  "react-google-recaptcha": "^2.1.0",
16
16
  "react-hot-loader": "^4.12.20",
@@ -1 +0,0 @@
1
- import "antd/dist/antd.compact.css";
@@ -1,18 +0,0 @@
1
- import * as React from 'react';
2
- import { InjectedIntlProps } from "react-intl";
3
- interface Props extends InjectedIntlProps {
4
- fieldName: "file1" | "file2" | "file3";
5
- }
6
- interface States {
7
- file: any[];
8
- }
9
- declare class Attachment extends React.Component<Props, States> {
10
- constructor(props: Props);
11
- handleRemoveFile: () => void;
12
- normFile: (e: any) => any;
13
- render(): JSX.Element;
14
- }
15
- declare const _default: React.ComponentClass<Pick<Props & React.RefAttributes<Attachment>, "ref" | "key" | "fieldName">, any> & {
16
- WrappedComponent: React.ComponentType<Props & React.RefAttributes<Attachment> & InjectedIntlProps>;
17
- };
18
- export default _default;
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import { InjectedIntlProps } from "react-intl";
3
- declare const AttachmentGroupIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
- WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
- };
6
- export default AttachmentGroupIntl;
@@ -1,18 +0,0 @@
1
- import React from "react";
2
- import { InjectedIntlProps } from "react-intl";
3
- import { StoreValue } from "rc-field-form/lib/interface";
4
- interface FieldData {
5
- name: number;
6
- key: number;
7
- fieldKey: number;
8
- }
9
- export declare const translationMessages: ReactIntl.Messages<"referenceIdentifiers_labels_addButton" | "referenceIdentifiers_labels_referenceIdentifier" | "referenceIdentifiers_labels_referenceIdentifier_title" | "referenceIdentifiers_labels_carNumber" | "referenceIdentifiers_labels_identifier" | "referenceIdentifiers_labels_propertyNumber">;
10
- interface Props extends InjectedIntlProps {
11
- fields: FieldData[];
12
- add: (defaultValue?: StoreValue) => void;
13
- remove: (index: number) => void;
14
- }
15
- declare const _default: React.ComponentClass<Pick<Props, "remove" | "fields" | "add">, any> & {
16
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
17
- };
18
- export default _default;
@@ -1,13 +0,0 @@
1
- import * as React from 'react';
2
- import { FormInstance } from "antd/es/form";
3
- import { InjectedIntlProps } from "react-intl";
4
- import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
5
- interface Props extends InjectedIntlProps {
6
- receiverRequirements: NewReceiverRequirements;
7
- form: FormInstance;
8
- documentType: "creditNote" | "invoice";
9
- }
10
- declare const BaseInformationIntl: React.ComponentClass<Pick<Props, "form" | "receiverRequirements" | "documentType">, any> & {
11
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
12
- };
13
- export default BaseInformationIntl;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
- import { InjectedIntlProps } from "react-intl";
4
- interface Props extends InjectedIntlProps {
5
- billingLinesMetadata: BillingLineMetadataOverride[] | undefined;
6
- currencyCode: string;
7
- }
8
- declare const _default: React.ComponentClass<Pick<Props, "currencyCode" | "billingLinesMetadata">, any> & {
9
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
10
- };
11
- export default _default;
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
- import { InjectedIntlProps } from "react-intl";
4
- interface Props extends InjectedIntlProps {
5
- billingLines: BillingLineMetadataOverride[] | undefined;
6
- }
7
- declare const _default: React.ComponentClass<Pick<Props, "billingLines">, any> & {
8
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
9
- };
10
- export default _default;
@@ -1,28 +0,0 @@
1
- import * as React from 'react';
2
- import { BillingLineMetadata } from "@unimaze/api-clients/lib/mapi/models";
3
- import { InjectedIntlProps } from "react-intl";
4
- import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
5
- import { FormInstance } from "antd/es/form";
6
- export interface TaxCategoryTypeWithPercentageEnum {
7
- value: "StandardRated" | "ReducedRated" | "ZeroRated" | "Exempt";
8
- label: string;
9
- }
10
- export interface UnitOfMeasureLabelInValueEnum {
11
- value: "Piece" | "Kilogram" | "Month" | "Package" | "Year" | "Day" | "Hour" | "Kilometre" | "Metre" | "Litre" | "SquareMetre" | "CubicMetre" | "Tonne" | "KiloWattHour" | "One" | "Rec20" | "Rec21";
12
- label: string;
13
- }
14
- interface Props extends InjectedIntlProps {
15
- formInstance: FormInstance;
16
- setBillingLineMetadata: (formInstance: FormInstance, billingLineMetadata: BillingLineMetadata[]) => void;
17
- dataSource: BillingLineMetadataOverride[];
18
- handleDelete: (index: number) => void;
19
- handleAdd: (billingLineToAdd: BillingLineMetadataOverride) => void;
20
- handleSave: (row: BillingLineMetadataOverride, formInstance: FormInstance) => void;
21
- initialBillingLineData: BillingLineMetadataOverride;
22
- editableIndex: number;
23
- }
24
- export declare const translationMessages: ReactIntl.Messages<"billingLines_title" | "billingLines_tooltip_title" | "billingLines_itemNo" | "billingLines_name" | "billingLines_quantity" | "billingLines_unitOfMeasure" | "billingLines_unitPriceAmount" | "billingLines_taxCategoryType" | "billingLines_taxCategoryType_title" | "billingLines_taxCategoryPercentage" | "billingLines_discount" | "billingLines_lineAmount" | "billingLines_taxAmount" | "billingLines_button_addRow" | "billingLines_placeholders_itemNo" | "billingLines_placeholders_newItem">;
25
- declare const BillingLinesIntl: React.ComponentClass<Pick<Props, "formInstance" | "setBillingLineMetadata" | "dataSource" | "handleDelete" | "handleAdd" | "handleSave" | "initialBillingLineData" | "editableIndex">, any> & {
26
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
27
- };
28
- export default BillingLinesIntl;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { HeightProperty } from "csstype";
3
- interface Props {
4
- height?: HeightProperty<number>;
5
- }
6
- declare const Content: React.FC<Props>;
7
- export default Content;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { IconProps } from "@ant-design/compatible/es/icon";
3
- interface HeaderProps {
4
- iconProps?: IconProps;
5
- title?: string | React.ReactNode;
6
- action?: React.ReactNode;
7
- }
8
- declare const Header: React.FC<HeaderProps>;
9
- export default Header;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { IconProps } from "@ant-design/compatible/es/icon";
3
- interface Props {
4
- iconProps?: IconProps;
5
- title?: string | React.ReactNode;
6
- action?: React.ReactNode;
7
- noPadding?: boolean;
8
- noHeader?: boolean;
9
- }
10
- declare const ComponentContainer: React.FC<Props>;
11
- export default ComponentContainer;
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { InjectedIntlProps } from "react-intl";
3
- import { FormInstance } from "antd/es/form";
4
- import { PartyMetadata } from "@unimaze/api-clients/lib/mapi";
5
- import { ProfileOutputWithApiKey } from "../../types/AppConfiguration";
6
- import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
7
- interface Props extends InjectedIntlProps {
8
- receiverRequirements: NewReceiverRequirements;
9
- customers: ProfileOutputWithApiKey[];
10
- formInstance: FormInstance;
11
- chosenCustomer: PartyMetadata | undefined;
12
- setChosenCustomer: (chosenCustomer: PartyMetadata) => void;
13
- setChosenCustomerApiKey: (chosenCustomerApiKey: string) => void;
14
- }
15
- declare const CustomerIntl: React.ComponentClass<Pick<Props, "customers" | "receiverRequirements" | "chosenCustomer" | "setChosenCustomer" | "setChosenCustomerApiKey" | "formInstance">, any> & {
16
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
17
- };
18
- export default CustomerIntl;
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import { InjectedIntlProps } from "react-intl";
3
- import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
4
- interface Props extends InjectedIntlProps {
5
- receiverRequirements: NewReceiverRequirements;
6
- }
7
- declare const DeliveryLocationIntl: React.ComponentClass<Pick<Props, "receiverRequirements">, any> & {
8
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
9
- };
10
- export default DeliveryLocationIntl;
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
- import { InjectedIntlProps } from "react-intl";
4
- export declare const commonTranslationMessages: ReactIntl.Messages<"taxCategoryType_labels_StandardRated" | "taxCategoryType_labels_ReducedRated" | "taxCategoryType_labels_ZeroRated" | "taxCategoryType_labels_Exempt" | "unitOfMeasure_labels_Piece" | "unitOfMeasure_labels_Kilogram" | "unitOfMeasure_labels_Month" | "unitOfMeasure_labels_Package" | "unitOfMeasure_labels_Year" | "unitOfMeasure_labels_Day" | "unitOfMeasure_labels_Hour" | "unitOfMeasure_labels_Kilometre" | "unitOfMeasure_labels_Metre" | "unitOfMeasure_labels_Litre" | "unitOfMeasure_labels_SquareMetre" | "unitOfMeasure_labels_CubicMetre" | "unitOfMeasure_labels_Tonne" | "unitOfMeasure_labels_KiloWattHour" | "unitOfMeasure_labels_One">;
5
- interface EditableCellProps extends InjectedIntlProps {
6
- record: BillingLineMetadataOverride;
7
- handleSave: (billingLineMetadata: BillingLineMetadataOverride) => void;
8
- dataIndex: keyof Omit<BillingLineMetadataOverride, 'key'>;
9
- editable: boolean;
10
- index: number;
11
- }
12
- declare const EditableCellIntl: React.ComponentClass<Pick<EditableCellProps, "handleSave" | "record" | "dataIndex" | "editable" | "index">, any> & {
13
- WrappedComponent: React.ComponentType<EditableCellProps & InjectedIntlProps>;
14
- };
15
- export default EditableCellIntl;
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- import { FormInstance } from "antd/lib/form";
3
- export declare const EditableContext: React.Context<FormInstance>;
4
- declare const EditableRow: ({ index, ...props }: any) => JSX.Element;
5
- export default EditableRow;
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import { AvailableFields } from "../../types/ReceiverRequirements";
3
- import { NamePath, Rule } from "rc-field-form/lib/interface";
4
- import { InjectedIntlProps } from "react-intl";
5
- import { FormItemProps } from "antd/lib/form/FormItem";
6
- import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
7
- export declare const translationMessages: ReactIntl.Messages<"formItem_required_errorMessage">;
8
- interface StringMap {
9
- [key: string]: string;
10
- }
11
- interface Props extends InjectedIntlProps, FormItemProps {
12
- receiverRequirements: NewReceiverRequirements;
13
- receiverRequirementsKey: AvailableFields;
14
- defaultLabel: React.ReactNode | string;
15
- defaultLabelTooltip?: React.ReactNode;
16
- defaultIsRequired: boolean;
17
- fieldName: NamePath;
18
- additionalRules?: Rule[];
19
- style?: React.CSSProperties;
20
- initialValue?: StringMap;
21
- verticalLabels?: boolean;
22
- onlyLabelOnFirstInList?: boolean;
23
- index?: number;
24
- }
25
- declare const _default: React.ComponentClass<Pick<Props, "label" | "style" | "children" | "receiverRequirements" | "name" | "prefixCls" | "className" | "id" | "onReset" | "validateTrigger" | "required" | "index" | "dependencies" | "getValueFromEvent" | "normalize" | "rules" | "shouldUpdate" | "trigger" | "validateFirst" | "valuePropName" | "getValueProps" | "messageVariables" | "initialValue" | "isListField" | "htmlFor" | "fieldName" | "receiverRequirementsKey" | "defaultLabel" | "defaultLabelTooltip" | "defaultIsRequired" | "additionalRules" | "verticalLabels" | "onlyLabelOnFirstInList" | "noStyle" | "hasFeedback" | "validateStatus" | "fieldKey" | "colon" | "labelAlign" | "labelCol" | "wrapperCol" | "help" | "extra">, any> & {
26
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
27
- };
28
- export default _default;
@@ -1,10 +0,0 @@
1
- export { default as Attachments } from "./attachments";
2
- export { default as BaseInformation } from "./base-information";
3
- export { default as BillingLines } from "./billing-lines";
4
- export { default as ComponentContainer } from "./component-container";
5
- export { default as Customer } from "./customer";
6
- export { default as DeliveryLocation } from "./delivery-location";
7
- export { default as EditableCell } from "./editable-cell";
8
- export { default as EditableRow } from "./editable-row";
9
- export { default as PaymentMethod } from "./payment-method";
10
- export { default as Supplier } from "./supplier";
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { InjectedIntlProps } from "react-intl";
3
- import { FormInstance } from "antd/es/form";
4
- export declare const translationMessages: ReactIntl.Messages<"paymentMethod_title" | "paymentMethod_labels_domesticTransfer_bankNo" | "paymentMethod_labels_domesticTransfer_accountType" | "paymentMethod_labels_domesticTransfer_accountNo" | "paymentMethod_labels_domesticTransfer_paymentReference" | "paymentMethod_labels_icelandicClaim_bankNo" | "paymentMethod_labels_icelandicClaim_claimNo" | "paymentMethod_labels_methods_undefined" | "paymentMethod_labels_methods_mutuallyAgreed" | "paymentMethod_labels_methods_domesticTransfer" | "paymentMethod_labels_methods_domesticClaim" | "paymentMethod_rules_number" | "paymentMethod_rules_Length">;
5
- interface Props extends InjectedIntlProps {
6
- formInstance: FormInstance;
7
- }
8
- declare const _default: React.ComponentClass<Pick<Props, "formInstance">, any> & {
9
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
10
- };
11
- export default _default;
@@ -1,9 +0,0 @@
1
- import { PaymentMeansType } from "@unimaze/api-clients/lib/mapi";
2
- import { TransferMetadata, ClaimMetadata } from '@unimaze/api-clients/lib/mapi/models';
3
- import { Store } from 'antd/es/form/interface';
4
- export interface IPaymentMeans {
5
- type: PaymentMeansType;
6
- domesticTransfer?: TransferMetadata | undefined;
7
- domesticClaim?: ClaimMetadata | undefined;
8
- }
9
- export declare const PaymentMethodFormData: (formData: Store) => IPaymentMeans;
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import { InjectedIntlProps } from "react-intl";
3
- import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
4
- import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
5
- interface Props extends InjectedIntlProps {
6
- receiverRequirements: NewReceiverRequirements;
7
- billingLinesDataSource: BillingLineMetadataOverride[];
8
- }
9
- declare const SupplierIntl: React.ComponentClass<Pick<Props, "receiverRequirements" | "billingLinesDataSource">, any> & {
10
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
11
- };
12
- export default SupplierIntl;