@unimaze/billing 0.1.2-rc.9 → 0.2.0-rc.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 (73) hide show
  1. package/lib/common/components/attachments/Attachment.d.ts +6 -5
  2. package/lib/common/components/attachments/Attachment.js +69 -18
  3. package/lib/common/components/attachments/index.d.ts +5 -6
  4. package/lib/common/components/attachments/index.js +18 -6
  5. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +17 -0
  6. package/lib/common/components/base-information/ReferenceIdentifiers.js +54 -0
  7. package/lib/common/components/base-information/index.d.ts +6 -3
  8. package/lib/common/components/base-information/index.js +70 -9
  9. package/lib/common/components/billing-lines/BillingCalculations.d.ts +11 -0
  10. package/lib/common/components/billing-lines/BillingCalculations.js +63 -0
  11. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
  12. package/lib/common/components/billing-lines/BillingTaxSummary.js +53 -0
  13. package/lib/common/components/billing-lines/NewBillingLines.d.ts +10 -0
  14. package/lib/common/components/billing-lines/NewBillingLines.js +77 -0
  15. package/lib/common/components/billing-lines/index.d.ts +7 -15
  16. package/lib/common/components/billing-lines/index.js +173 -62
  17. package/lib/common/components/customer/hardCoddedCustomer.d.ts +7 -0
  18. package/lib/common/components/customer/hardCoddedCustomer.js +25 -0
  19. package/lib/common/components/customer/index.d.ts +5 -6
  20. package/lib/common/components/customer/index.js +101 -12
  21. package/lib/common/components/delivery-location/index.d.ts +5 -2
  22. package/lib/common/components/delivery-location/index.js +57 -8
  23. package/lib/common/components/editable-cell/index.js +7 -9
  24. package/lib/common/components/form-item/index.d.ts +12 -7
  25. package/lib/common/components/form-item/index.js +31 -7
  26. package/lib/common/components/locale-intl/index.d.ts +10 -0
  27. package/lib/common/components/locale-intl/index.js +45 -0
  28. package/lib/common/components/payment-method/index.d.ts +6 -3
  29. package/lib/common/components/payment-method/index.js +107 -15
  30. package/lib/common/components/payment-method/paymentMethodForConversion.d.ts +9 -0
  31. package/lib/common/components/payment-method/paymentMethodForConversion.js +44 -0
  32. package/lib/common/components/supplier/index.d.ts +5 -2
  33. package/lib/common/components/supplier/index.js +99 -25
  34. package/lib/common/consts/formLayout.d.ts +44 -0
  35. package/lib/common/consts/formLayout.js +35 -0
  36. package/lib/common/consts/validationRules.js +0 -7
  37. package/lib/common/types/ReceiverRequirements.d.ts +1 -1
  38. package/lib/common/types/ReceiverRequirements.js +4 -66
  39. package/lib/create-credit-note/index.js +1 -2
  40. package/lib/create-invoice/index.js +104 -40
  41. package/lib/src/common/components/attachments/Attachment.d.ts +6 -5
  42. package/lib/src/common/components/attachments/index.d.ts +5 -6
  43. package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +17 -0
  44. package/lib/src/common/components/base-information/index.d.ts +6 -3
  45. package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +11 -0
  46. package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
  47. package/lib/src/common/components/billing-lines/NewBillingLines.d.ts +10 -0
  48. package/lib/src/common/components/billing-lines/index.d.ts +7 -15
  49. package/lib/src/common/components/customer/index.d.ts +5 -6
  50. package/lib/src/common/components/delivery-location/index.d.ts +5 -2
  51. package/lib/src/common/components/form-item/index.d.ts +12 -7
  52. package/lib/src/common/components/locale-intl/index.d.ts +10 -0
  53. package/lib/src/common/components/payment-method/index.d.ts +6 -3
  54. package/lib/src/common/components/payment-method/paymentMethodForConversion.d.ts +9 -0
  55. package/lib/src/common/components/supplier/index.d.ts +5 -2
  56. package/lib/src/common/consts/formLayout.d.ts +44 -0
  57. package/lib/src/common/types/ReceiverRequirements.d.ts +1 -1
  58. package/lib/src/translations/locales.d.ts +75 -0
  59. package/lib/src/utils/BillingLineUtility.d.ts +10 -0
  60. package/lib/src/utils/ConversionUtility.d.ts +4 -4
  61. package/lib/translations/locales/is.json +71 -0
  62. package/lib/translations/locales.d.ts +75 -0
  63. package/lib/translations/locales.js +10 -0
  64. package/lib/utils/ApiUtility.js +1 -1
  65. package/lib/utils/BillingLineUtility.d.ts +10 -0
  66. package/lib/utils/BillingLineUtility.js +90 -0
  67. package/lib/utils/ConversionUtility.d.ts +4 -4
  68. package/lib/utils/ConversionUtility.js +38 -54
  69. package/lib/utils/RequirementsUtility.js +1 -1
  70. package/package.json +8 -5
  71. package/lib/common/components/billing-lines/BillingLIneFormData.d.ts +0 -6
  72. package/lib/common/components/billing-lines/BillingLIneFormData.js +0 -6
  73. package/lib/src/common/components/billing-lines/BillingLIneFormData.d.ts +0 -6
@@ -1,27 +1,19 @@
1
1
  import * as React from 'react';
2
2
  import '@ant-design/compatible/assets/index.css';
3
3
  import { BillingLineMetadata } from "@unimaze/api-clients/lib/mapi/models";
4
+ import { InjectedIntlProps } from "react-intl";
4
5
  import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
5
6
  import { FormInstance } from "antd/es/form";
6
- import { ColumnType } from 'antd/es/table';
7
- interface EditableColumnProps<T> extends ColumnType<T> {
8
- editable?: boolean;
9
- }
10
- interface Props {
7
+ interface Props extends InjectedIntlProps {
11
8
  formInstance: FormInstance;
12
9
  setBillingLineMetadata: (formInstance: FormInstance, billingLineMetadata: BillingLineMetadata[]) => void;
13
- }
14
- interface States {
15
10
  dataSource: BillingLineMetadataOverride[];
16
- editableIndex: number;
17
- }
18
- declare class BillingLines extends React.Component<Props, States> {
19
- columns: EditableColumnProps<BillingLineMetadataOverride>[];
20
- constructor(props: Props);
21
- renderCurrencyColumn: (text: string) => string;
22
11
  handleDelete: (index: number) => void;
23
12
  handleAdd: () => void;
24
13
  handleSave: (row: BillingLineMetadataOverride, formInstance: FormInstance) => void;
25
- render(): JSX.Element;
14
+ editableIndex: number;
26
15
  }
27
- export default BillingLines;
16
+ declare const BillingLinesIntl: React.ComponentClass<Pick<Props, "formInstance" | "setBillingLineMetadata" | "dataSource" | "handleDelete" | "handleAdd" | "handleSave" | "editableIndex">, any> & {
17
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
18
+ };
19
+ export default BillingLinesIntl;
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
- import { wapi2 } from "@unimaze/api-clients";
3
- interface Props {
4
- customer: wapi2.ProfileOutput;
5
- }
6
- declare const Customer: React.FC<Props>;
7
- export default Customer;
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const CustomerIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default CustomerIntl;
@@ -1,3 +1,6 @@
1
1
  import * as React from 'react';
2
- declare const DeliveryLocation: React.FC;
3
- export default DeliveryLocation;
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const DeliveryLocationIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default DeliveryLocationIntl;
@@ -1,18 +1,23 @@
1
1
  import React from 'react';
2
- import { AvailableFields, ReceiverRequirements } from "../../types/ReceiverRequirements";
3
- import { Rule } from "rc-field-form/lib/interface";
2
+ import { AvailableFields } from "../../types/ReceiverRequirements";
3
+ import { NamePath, Rule } from "rc-field-form/lib/interface";
4
+ import { InjectedIntlProps } from "react-intl";
4
5
  interface StringMap {
5
6
  [key: string]: string;
6
7
  }
7
- interface Props {
8
- receiverRequirements: ReceiverRequirements;
8
+ interface Props extends InjectedIntlProps {
9
9
  receiverRequirementsKey: AvailableFields;
10
10
  defaultLabel: React.ReactNode;
11
11
  defaultIsRequired: boolean;
12
- fieldName: string | string[];
12
+ fieldName: NamePath;
13
13
  additionalRules?: Rule[];
14
14
  style?: React.CSSProperties;
15
15
  initialValue?: StringMap;
16
+ verticalLabels?: boolean;
17
+ onlyLabelOnFirstInList?: boolean;
18
+ index?: number;
16
19
  }
17
- declare const FormItem: React.FC<Props>;
18
- export default FormItem;
20
+ declare const _default: React.ComponentClass<Pick<Props, "style" | "initialValue" | "fieldName" | "index" | "receiverRequirementsKey" | "defaultLabel" | "defaultIsRequired" | "additionalRules" | "verticalLabels" | "onlyLabelOnFirstInList">, any> & {
21
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
22
+ };
23
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import "moment/locale/is";
3
+ import "moment/locale/sr";
4
+ interface IHotSwappingIntlProviderOwnProps {
5
+ initialLocale: string;
6
+ initialMessages: any;
7
+ languageString?: string;
8
+ }
9
+ declare const HotIntlProvider: React.FC<IHotSwappingIntlProviderOwnProps>;
10
+ export default HotIntlProvider;
@@ -1,3 +1,6 @@
1
- /// <reference types="react" />
2
- declare const PaymentMethod: () => JSX.Element;
3
- export default PaymentMethod;
1
+ import React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const _default: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default _default;
@@ -0,0 +1,9 @@
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,3 +1,6 @@
1
1
  import * as React from 'react';
2
- declare const Supplier: React.FC;
3
- export default Supplier;
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const SupplierIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default SupplierIntl;
@@ -0,0 +1,44 @@
1
+ declare const formItemLayout: {
2
+ labelCol: {
3
+ xs: {
4
+ span: number;
5
+ };
6
+ sm: {
7
+ span: number;
8
+ };
9
+ };
10
+ wrapperCol: {
11
+ xs: {
12
+ span: number;
13
+ };
14
+ sm: {
15
+ span: number;
16
+ };
17
+ };
18
+ };
19
+ declare const formItemVerticalLayout: {
20
+ labelCol: {
21
+ span: number;
22
+ };
23
+ wrapperCol: {
24
+ span: number;
25
+ };
26
+ };
27
+ declare const fullWidthInput: {
28
+ wrapperCol: {
29
+ span: number;
30
+ };
31
+ };
32
+ declare const formItemLayoutWithOutLabel: {
33
+ wrapperCol: {
34
+ xs: {
35
+ span: number;
36
+ offset: number;
37
+ };
38
+ sm: {
39
+ span: number;
40
+ offset: number;
41
+ };
42
+ };
43
+ };
44
+ export { formItemLayout, formItemVerticalLayout, fullWidthInput, formItemLayoutWithOutLabel };
@@ -55,7 +55,7 @@ export declare enum AvailableFields {
55
55
  "invoiceLines.quantity" = "invoiceLines.quantity",
56
56
  "invoiceLines.uniteOfMeasure.unit" = "invoiceLines.unitOfMeasure.unit",
57
57
  "invoiceLines.uniteOfMeasure.code" = "invoiceLines.unitOfMeasure.code",
58
- "invoiceLines.priceAmount" = "invoiceLines.priceAmount",
58
+ "invoiceLines.unitPriceAmount" = "invoiceLines.unitPriceAmount",
59
59
  "invoiceLines.taxCategoryType" = "invoiceLines.taxCategoryType",
60
60
  "invoiceLines.taxableAmount" = "invoiceLines.taxableAmount",
61
61
  "invoiceLines.taxAmount" = "invoiceLines.taxAmount",
@@ -0,0 +1,75 @@
1
+ declare const _default: {
2
+ en: {};
3
+ is: {
4
+ "attachment_labels_Reference": string;
5
+ "attachment_labels_Reference_requiredMessage": string;
6
+ "attachment_labels_Description": string;
7
+ "attachment_labels_Description_requiredMessage": string;
8
+ "attachment_labels_File": string;
9
+ "attachment_title": string;
10
+ "baseInformation_title": string;
11
+ "baseInformation_invoiceNo": string;
12
+ "baseInformation_issueDate": string;
13
+ "baseInformation_dueDate": string;
14
+ "baseInformation_orderReference_documentNo": string;
15
+ "baseInformation_notes": string;
16
+ "baseInformation_currencyCode": string;
17
+ "billingCalculations_labels_TaxAmountWithoutVat": string;
18
+ "billingCalculations_labels_TotalVatAmount": string;
19
+ "billingCalculations_labels_TotalAmountWithVat": string;
20
+ "billingTaxSummary_taxOverview": string;
21
+ "billingTaxSummary_taxableAmount": string;
22
+ "billingTaxSummary_taxAmount": string;
23
+ "billingLines_title": string;
24
+ "billingLines_itemNo": string;
25
+ "billingLines_name": string;
26
+ "billingLines_quantity": string;
27
+ "billingLines_unitOfMeasure": string;
28
+ "billingLines_unitPriceAmount": string;
29
+ "billingLines_taxCategoryType": string;
30
+ "billingLines_taxCategoryPercentage": string;
31
+ "billingLines_discount": string;
32
+ "billingLines_lineAmount": string;
33
+ "billingLines_taxAmount": string;
34
+ "billingLines_button_addRow": string;
35
+ "deliveryLocation_title": string;
36
+ "deliveryLocation_partyName": string;
37
+ "deliveryLocation_streetNameAndNumber": string;
38
+ "deliveryLocation_postalZone": string;
39
+ "deliveryLocation_city": string;
40
+ "deliveryLocation_countryCode": string;
41
+ "formItem_required_errorMessage": string;
42
+ "paymentMethod_labels_domesticTransfer_bankNo": string;
43
+ "paymentMethod_labels_domesticTransfer_typeNo": string;
44
+ "paymentMethod_labels_domesticTransfer_accountNo": string;
45
+ "paymentMethod_labels_domesticTransfer_paymentReference": string;
46
+ "paymentMethod_labels_icelandicClaim_bankNo": string;
47
+ "paymentMethod_labels_icelandicClaim_claimNo": string;
48
+ "paymentMethod_labels_methods_undefined": string;
49
+ "paymentMethod_labels_methods_mutuallyAgreed": string;
50
+ "paymentMethod_labels_methods_domesticTransfer": string;
51
+ "paymentMethod_labels_methods_domesticClaim": string;
52
+ "paymentMethod_rulles_number": string;
53
+ "supplier_title": string;
54
+ "supplier_name": string;
55
+ "supplier_identifier": string;
56
+ "supplier_vatNumber": string;
57
+ "supplier_address_streetNameAndNumber": string;
58
+ "supplier_address_zip_postalCode": string;
59
+ "supplier_address_city": string;
60
+ "supplier_address_countryCode": string;
61
+ "supplier_contact_email": string;
62
+ "supplier_contact_name": string;
63
+ "supplier_notValidEmail": string;
64
+ "customer_title": string;
65
+ "customer_name": string;
66
+ "customer_identifier": string;
67
+ "customer_address_streetNameAndNumber": string;
68
+ "customer_address_zip_postalCode": string;
69
+ "customer_address_city": string;
70
+ "customer_address_countryCode": string;
71
+ "customer_contact_email": string;
72
+ "customer_contact_name": string;
73
+ };
74
+ };
75
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
2
+ import { FormInstance } from "antd/es/form";
3
+ import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
4
+ import React from "react";
5
+ export declare const billingLinesFieldsMetadata: (formInstance: FormInstance) => BillingLineMetadata[];
6
+ export declare const calculateTaxableAmount: (discountValue: string | null | undefined, quantity: number | null, unitPriceAmount: number | null) => number;
7
+ export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
8
+ export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum) => number;
9
+ export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum) => string;
10
+ export declare const getCorrectInputNode: (dataIdx: "unitOfMeasure" | "itemNo" | "name" | "description" | "quantity" | "unitPriceAmount" | "taxCategoryType" | "taxableAmount" | "taxAmount" | "taxPercentage" | "discountValue" | "discountReason" | "notes" | "accountingCost" | "billingPeriod" | "buyersItemNo" | "standardItemNo" | "originCountryCode" | "commodityClassification" | "additionalItemProperties" | "referenceIdentifiers" | "orderLineReference" | "key") => React.ReactChild;
@@ -1,6 +1,6 @@
1
- import { InvoiceMetadataInput } from "@unimaze/api-clients/lib/mapi";
1
+ import { BillingLineMetadata, InvoiceMetadataInput } from "@unimaze/api-clients/lib/mapi";
2
2
  import { Store } from "antd/es/form/interface";
3
3
  import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
4
- import { IBillingLinesMetadata } from "../common/components/billing-lines/BillingLIneFormData";
5
- declare const convertToInvoiceMetadataInput: (formValues: Store, billingLines: IBillingLinesMetadata, customer: ProfileOutput) => InvoiceMetadataInput;
6
- export { /*convertToCreditNoteMetadataInput,*/ convertToInvoiceMetadataInput };
4
+ import { PaymentMeansMetadata } from "@unimaze/api-clients/lib/mapi/api";
5
+ declare const convertToInvoiceMetadataInput: (formValues: Store, billingLines: BillingLineMetadata[], paymentMethod: PaymentMeansMetadata, customer?: ProfileOutput | undefined) => InvoiceMetadataInput;
6
+ export { convertToInvoiceMetadataInput };
@@ -0,0 +1,71 @@
1
+ {
2
+ "attachment_labels_Reference": "Reference",
3
+ "attachment_labels_Reference_requiredMessage": "Please input the reference",
4
+ "attachment_labels_Description": "Description",
5
+ "attachment_labels_Description_requiredMessage": "Please input the description",
6
+ "attachment_labels_File": "File",
7
+ "attachment_title": "Attachments",
8
+ "baseInformation_title": "Base Information",
9
+ "baseInformation_invoiceNo": "Invoice No",
10
+ "baseInformation_issueDate": "Issue date",
11
+ "baseInformation_dueDate": "Due date",
12
+ "baseInformation_orderReference_documentNo": "Order no",
13
+ "baseInformation_notes": "Notes",
14
+ "baseInformation_currencyCode": "Currency",
15
+ "billingCalculations_labels_TaxAmountWithoutVat": "Total amount without VAT",
16
+ "billingCalculations_labels_TotalVatAmount": "Total VAT amount",
17
+ "billingCalculations_labels_TotalAmountWithVat": "Total amount with VAT",
18
+ "billingTaxSummary_taxOverview": "Tax overview",
19
+ "billingTaxSummary_taxableAmount": "Taxable amount",
20
+ "billingTaxSummary_taxAmount": "Tax",
21
+ "billingLines_title": "Document lines",
22
+ "billingLines_itemNo": "Item no",
23
+ "billingLines_name": "Name",
24
+ "billingLines_quantity": "Quantity",
25
+ "billingLines_unitOfMeasure": "Unit of measure",
26
+ "billingLines_unitPriceAmount": "Unit price amount",
27
+ "billingLines_taxCategoryType": "Tax category",
28
+ "billingLines_taxCategoryPercentage": "Tax percentage",
29
+ "billingLines_discount": "Discount",
30
+ "billingLines_lineAmount": "Amount",
31
+ "billingLines_taxAmount": "Tax inclusive amount",
32
+ "billingLines_button_addRow": "Add a row",
33
+ "deliveryLocation_title": "Delivery location",
34
+ "deliveryLocation_partyName": "Party name",
35
+ "deliveryLocation_streetNameAndNumber": "Address",
36
+ "deliveryLocation_postalZone": "Postal no",
37
+ "deliveryLocation_city": "Town/City",
38
+ "deliveryLocation_countryCode": "Country code",
39
+ "formItem_required_errorMessage": "This field is required",
40
+ "paymentMethod_labels_domesticTransfer_bankNo": "Bank no",
41
+ "paymentMethod_labels_domesticTransfer_typeNo": "Type no",
42
+ "paymentMethod_labels_domesticTransfer_accountNo": "Account no",
43
+ "paymentMethod_labels_domesticTransfer_paymentReference": "Payment reference",
44
+ "paymentMethod_labels_icelandicClaim_bankNo": "Bank no",
45
+ "paymentMethod_labels_icelandicClaim_claimNo": "Claim no",
46
+ "paymentMethod_labels_methods_undefined": "Undefined",
47
+ "paymentMethod_labels_methods_mutuallyAgreed": "Mutually agreed",
48
+ "paymentMethod_labels_methods_domesticTransfer": "Domestic transfer",
49
+ "paymentMethod_labels_methods_domesticClaim": "Claim (Icelandic)",
50
+ "paymentMethod_rulles_number": "Please use only number characters",
51
+ "supplier_title": "Supplier",
52
+ "supplier_name": "Supplier name",
53
+ "supplier_identifier": "Identifier",
54
+ "supplier_vatNumber": "VAT no",
55
+ "supplier_address_streetNameAndNumber": "Address",
56
+ "supplier_address_zip_postalCode": "Zip/Postal code",
57
+ "supplier_address_city": "City",
58
+ "supplier_address_countryCode": "Country code",
59
+ "supplier_contact_email": "E-Mail",
60
+ "supplier_contact_name": "Contact name",
61
+ "supplier_notValidEmail": "This is not a valid E-Mail",
62
+ "customer_title": "Customer",
63
+ "customer_name": "Customer name",
64
+ "customer_identifier": "Identifier",
65
+ "customer_address_streetNameAndNumber": "Address",
66
+ "customer_address_zip_postalCode": "Zip/Postal code",
67
+ "customer_address_city": "City",
68
+ "customer_address_countryCode": "Country code",
69
+ "customer_contact_email": "E-Mail",
70
+ "customer_contact_name": "Contact name"
71
+ }
@@ -0,0 +1,75 @@
1
+ declare const _default: {
2
+ en: {};
3
+ is: {
4
+ "attachment_labels_Reference": string;
5
+ "attachment_labels_Reference_requiredMessage": string;
6
+ "attachment_labels_Description": string;
7
+ "attachment_labels_Description_requiredMessage": string;
8
+ "attachment_labels_File": string;
9
+ "attachment_title": string;
10
+ "baseInformation_title": string;
11
+ "baseInformation_invoiceNo": string;
12
+ "baseInformation_issueDate": string;
13
+ "baseInformation_dueDate": string;
14
+ "baseInformation_orderReference_documentNo": string;
15
+ "baseInformation_notes": string;
16
+ "baseInformation_currencyCode": string;
17
+ "billingCalculations_labels_TaxAmountWithoutVat": string;
18
+ "billingCalculations_labels_TotalVatAmount": string;
19
+ "billingCalculations_labels_TotalAmountWithVat": string;
20
+ "billingTaxSummary_taxOverview": string;
21
+ "billingTaxSummary_taxableAmount": string;
22
+ "billingTaxSummary_taxAmount": string;
23
+ "billingLines_title": string;
24
+ "billingLines_itemNo": string;
25
+ "billingLines_name": string;
26
+ "billingLines_quantity": string;
27
+ "billingLines_unitOfMeasure": string;
28
+ "billingLines_unitPriceAmount": string;
29
+ "billingLines_taxCategoryType": string;
30
+ "billingLines_taxCategoryPercentage": string;
31
+ "billingLines_discount": string;
32
+ "billingLines_lineAmount": string;
33
+ "billingLines_taxAmount": string;
34
+ "billingLines_button_addRow": string;
35
+ "deliveryLocation_title": string;
36
+ "deliveryLocation_partyName": string;
37
+ "deliveryLocation_streetNameAndNumber": string;
38
+ "deliveryLocation_postalZone": string;
39
+ "deliveryLocation_city": string;
40
+ "deliveryLocation_countryCode": string;
41
+ "formItem_required_errorMessage": string;
42
+ "paymentMethod_labels_domesticTransfer_bankNo": string;
43
+ "paymentMethod_labels_domesticTransfer_typeNo": string;
44
+ "paymentMethod_labels_domesticTransfer_accountNo": string;
45
+ "paymentMethod_labels_domesticTransfer_paymentReference": string;
46
+ "paymentMethod_labels_icelandicClaim_bankNo": string;
47
+ "paymentMethod_labels_icelandicClaim_claimNo": string;
48
+ "paymentMethod_labels_methods_undefined": string;
49
+ "paymentMethod_labels_methods_mutuallyAgreed": string;
50
+ "paymentMethod_labels_methods_domesticTransfer": string;
51
+ "paymentMethod_labels_methods_domesticClaim": string;
52
+ "paymentMethod_rulles_number": string;
53
+ "supplier_title": string;
54
+ "supplier_name": string;
55
+ "supplier_identifier": string;
56
+ "supplier_vatNumber": string;
57
+ "supplier_address_streetNameAndNumber": string;
58
+ "supplier_address_zip_postalCode": string;
59
+ "supplier_address_city": string;
60
+ "supplier_address_countryCode": string;
61
+ "supplier_contact_email": string;
62
+ "supplier_contact_name": string;
63
+ "supplier_notValidEmail": string;
64
+ "customer_title": string;
65
+ "customer_name": string;
66
+ "customer_identifier": string;
67
+ "customer_address_streetNameAndNumber": string;
68
+ "customer_address_zip_postalCode": string;
69
+ "customer_address_city": string;
70
+ "customer_address_countryCode": string;
71
+ "customer_contact_email": string;
72
+ "customer_contact_name": string;
73
+ };
74
+ };
75
+ export default _default;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var is_json_1 = __importDefault(require("./locales/is.json"));
7
+ // English is the default message in each of our source files, so no need for a separate en.json file
8
+ var en = {};
9
+ // If we add more than just spanish, just import the files and export it below: export default { en, es, de }
10
+ exports.default = { en: en, is: is_json_1.default };
@@ -47,7 +47,7 @@ var createOptions = function (apiKey, callName, language) {
47
47
  return __assign({ headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) })) }, (callName && { cancelToken: getCancelToken(callName) }));
48
48
  };
49
49
  var createOptionsData = function (data, apiKey, callName, language) {
50
- return __assign({ headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer apikey-" + window.btoa(apiKey) }), { 'Content-Type': 'application/octet-stream' }) }, (callName && { cancelToken: getCancelToken(callName) }), { data: data });
50
+ return __assign({ headers: __assign({ "Accept-Language": language ? language : "en" }, (apiKey && { Authorization: "Bearer " + window.btoa(apiKey) }), { 'Content-Type': 'application/octet-stream' }) }, (callName && { cancelToken: getCancelToken(callName) }), { data: data });
51
51
  };
52
52
  var getCancelToken = function (callName) {
53
53
  var cancelTokenSource = window[callName];
@@ -0,0 +1,10 @@
1
+ import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
2
+ import { FormInstance } from "antd/es/form";
3
+ import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
4
+ import React from "react";
5
+ export declare const billingLinesFieldsMetadata: (formInstance: FormInstance) => BillingLineMetadata[];
6
+ export declare const calculateTaxableAmount: (discountValue: string | null | undefined, quantity: number | null, unitPriceAmount: number | null) => number;
7
+ export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
8
+ export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum) => number;
9
+ export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum) => string;
10
+ export declare const getCorrectInputNode: (dataIdx: "key" | "name" | "description" | "notes" | "referenceIdentifiers" | "unitOfMeasure" | "itemNo" | "quantity" | "unitPriceAmount" | "taxCategoryType" | "taxableAmount" | "taxAmount" | "taxPercentage" | "discountValue" | "discountReason" | "accountingCost" | "billingPeriod" | "buyersItemNo" | "standardItemNo" | "originCountryCode" | "commodityClassification" | "additionalItemProperties" | "orderLineReference") => React.ReactChild;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var api_1 = require("@unimaze/api-clients/lib/mapi/api");
18
+ var react_1 = __importDefault(require("react"));
19
+ var antd_1 = require("antd");
20
+ var models_1 = require("@unimaze/api-clients/lib/mapi/models");
21
+ exports.billingLinesFieldsMetadata = function (formInstance) {
22
+ var billingLinesMetadata = formInstance.getFieldValue("billingLinesMetadata");
23
+ return billingLinesMetadata.map(function (billingLine) {
24
+ var taxableAmount = exports.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount);
25
+ var taxPercentage = exports.calculateTaxPercentage(billingLine.taxCategoryType);
26
+ var taxAmount = exports.calculateTaxAmount(taxableAmount, taxPercentage);
27
+ var mappedBillingLine = __assign({}, billingLine, { taxableAmount: taxableAmount,
28
+ taxAmount: taxAmount,
29
+ taxPercentage: taxPercentage });
30
+ if (mappedBillingLine.discountValue === "0" || mappedBillingLine.discountValue === "0%") {
31
+ delete mappedBillingLine.discountValue;
32
+ }
33
+ return mappedBillingLine;
34
+ });
35
+ };
36
+ exports.calculateTaxableAmount = function (discountValue, quantity, unitPriceAmount) {
37
+ if (!quantity || !unitPriceAmount) {
38
+ return 0;
39
+ }
40
+ if (discountValue) {
41
+ if (discountValue.endsWith("%")) {
42
+ // (quantity * unitPriceAmount) * ((100 - discountValue) / 100)
43
+ return ((quantity * unitPriceAmount) * ((100 - parseFloat(discountValue)) / 100));
44
+ }
45
+ else {
46
+ // (quantity * unitPriceAmount) - discountValue
47
+ return ((quantity * unitPriceAmount) - parseFloat(discountValue));
48
+ }
49
+ }
50
+ else {
51
+ return (quantity * unitPriceAmount);
52
+ }
53
+ };
54
+ exports.calculateTaxAmount = function (taxableAmount, taxPercentage) {
55
+ // taxableAmount * (taxPercentage / 100)
56
+ return (taxableAmount * (taxPercentage / 100));
57
+ };
58
+ exports.calculateTaxPercentage = function (taxCategoryType) {
59
+ // inferred from the taxCategoryType? what is the mapping? ZeroRated/Exempt = 0, StandardRated = 24, ReducedRate = 11
60
+ switch (taxCategoryType) {
61
+ case api_1.TaxCategoryTypeEnum.StandardRated:
62
+ return 24;
63
+ case api_1.TaxCategoryTypeEnum.ReducedRated:
64
+ return 11;
65
+ case api_1.TaxCategoryTypeEnum.ZeroRated:
66
+ case api_1.TaxCategoryTypeEnum.Exempt:
67
+ return 0;
68
+ }
69
+ };
70
+ exports.generateTaxCategoryLabel = function (taxCategoryType) {
71
+ return exports.calculateTaxPercentage(taxCategoryType) + "% (" + taxCategoryType + ")";
72
+ };
73
+ exports.getCorrectInputNode = function (dataIdx) {
74
+ switch (dataIdx) {
75
+ case "quantity":
76
+ case "unitPriceAmount":
77
+ return react_1.default.createElement(antd_1.InputNumber, { step: 1 });
78
+ case "unitOfMeasure":
79
+ return (react_1.default.createElement(antd_1.Select, null, Object.keys(models_1.UnitOfMeasureMetadataUnitEnum).map(function (unitOfMeasure) {
80
+ if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
81
+ return (react_1.default.createElement(antd_1.Select.Option, { value: unitOfMeasure, title: unitOfMeasure, key: unitOfMeasure }, unitOfMeasure));
82
+ })));
83
+ case "taxCategoryType":
84
+ return (react_1.default.createElement(antd_1.Select, null, Object.keys(models_1.BillingLineMetadataTaxCategoryTypeEnum).map(function (taxCategoryType) {
85
+ return (react_1.default.createElement(antd_1.Select.Option, { value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, taxCategoryType));
86
+ })));
87
+ default:
88
+ return react_1.default.createElement(antd_1.Input, null);
89
+ }
90
+ };
@@ -1,6 +1,6 @@
1
- import { InvoiceMetadataInput } from "@unimaze/api-clients/lib/mapi";
1
+ import { BillingLineMetadata, InvoiceMetadataInput } from "@unimaze/api-clients/lib/mapi";
2
2
  import { Store } from "antd/es/form/interface";
3
3
  import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
4
- import { IBillingLinesMetadata } from "../common/components/billing-lines/BillingLIneFormData";
5
- declare const convertToInvoiceMetadataInput: (formValues: Store, billingLines: IBillingLinesMetadata, customer: ProfileOutput) => InvoiceMetadataInput;
6
- export { /*convertToCreditNoteMetadataInput,*/ convertToInvoiceMetadataInput };
4
+ import { PaymentMeansMetadata } from "@unimaze/api-clients/lib/mapi/api";
5
+ declare const convertToInvoiceMetadataInput: (formValues: Store, billingLines: BillingLineMetadata[], paymentMethod: PaymentMeansMetadata, customer?: ProfileOutput | undefined) => InvoiceMetadataInput;
6
+ export { convertToInvoiceMetadataInput };