@unimaze/billing 0.2.8-rc.0 → 0.2.8
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.
|
@@ -32,6 +32,21 @@ var BillingTaxSummary = function (props) {
|
|
|
32
32
|
};
|
|
33
33
|
})
|
|
34
34
|
: [];
|
|
35
|
+
var hlpArray = dataSource ? dataSource.slice() : [];
|
|
36
|
+
var helper = {};
|
|
37
|
+
var result = hlpArray.reduce(function (r, o) {
|
|
38
|
+
var key = o.taxOverview;
|
|
39
|
+
if (!helper[key]) {
|
|
40
|
+
helper[key] = Object.assign({}, o); // create a copy of o
|
|
41
|
+
r.push(helper[key]);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
helper[key].taxAmount += o.taxAmount;
|
|
45
|
+
helper[key].taxableAmount += o.taxableAmount;
|
|
46
|
+
}
|
|
47
|
+
return r;
|
|
48
|
+
}, []);
|
|
49
|
+
// console.log(result);
|
|
35
50
|
var columns = [
|
|
36
51
|
{
|
|
37
52
|
title: "Skattsyfirlit",
|
|
@@ -48,6 +63,6 @@ var BillingTaxSummary = function (props) {
|
|
|
48
63
|
];
|
|
49
64
|
return (react_1.default.createElement(antd_1.Table, { style: { minHeight: "170px" },
|
|
50
65
|
// showHeader={false}
|
|
51
|
-
columns: columns, dataSource:
|
|
66
|
+
columns: columns, dataSource: result, pagination: false, rowKey: (function (record, index) { return index.toString(); }) }));
|
|
52
67
|
};
|
|
53
68
|
exports.default = react_intl_1.injectIntl(BillingTaxSummary);
|
|
@@ -177,10 +177,10 @@ var BillingLines = /** @class */ (function (_super) {
|
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
title: "",
|
|
180
|
-
render: function (text, record
|
|
180
|
+
render: function (text, record) {
|
|
181
181
|
return React.createElement(React.Fragment, null,
|
|
182
182
|
React.createElement(icons_1.MinusCircleOutlined, { onClick: function () {
|
|
183
|
-
_this.props.handleDelete(
|
|
183
|
+
_this.props.handleDelete(record.key);
|
|
184
184
|
} }));
|
|
185
185
|
}
|
|
186
186
|
}
|
|
@@ -42,8 +42,9 @@ var paymentMethodForConversion_1 = require("../common/components/payment-method/
|
|
|
42
42
|
var CreateInvoice = function (props) {
|
|
43
43
|
// const [submitInvoiceRequest, setSubmitInvoiceRequest] = React.useState<CreateSubmitInvoiceRequest>();
|
|
44
44
|
var form = antd_1.Form.useForm()[0];
|
|
45
|
-
var _a = react_1.useState(
|
|
46
|
-
var _b = react_1.useState(
|
|
45
|
+
var _a = react_1.useState(false), submitting = _a[0], setSubmitting = _a[1];
|
|
46
|
+
var _b = react_1.useState(/*profileOutputToPartyMetadata(props.customers[0])*/ undefined), chosenCustomer = _b[0], setChosenCustomer = _b[1];
|
|
47
|
+
var _c = react_1.useState(1), billingLinesEditableIndex = _c[0], setBillingLinesEditableIndex = _c[1];
|
|
47
48
|
var initialBillingLineData = {
|
|
48
49
|
key: billingLinesEditableIndex,
|
|
49
50
|
itemNo: "Item No.",
|
|
@@ -57,7 +58,7 @@ var CreateInvoice = function (props) {
|
|
|
57
58
|
taxableAmount: 0,
|
|
58
59
|
taxPercentage: null
|
|
59
60
|
};
|
|
60
|
-
var
|
|
61
|
+
var _d = react_1.useState([__assign({}, initialBillingLineData, { key: 0 })]), billingLinesDataSource = _d[0], setBillingLinesDataSource = _d[1];
|
|
61
62
|
// BILLING LINES
|
|
62
63
|
var handleBillingLinesDelete = function (index) {
|
|
63
64
|
var newDataSource = billingLinesDataSource.slice();
|
|
@@ -91,6 +92,7 @@ var CreateInvoice = function (props) {
|
|
|
91
92
|
});
|
|
92
93
|
};
|
|
93
94
|
var handleSubmit = function (values) {
|
|
95
|
+
setSubmitting(true);
|
|
94
96
|
var attachments = [
|
|
95
97
|
values.attachments.file1 && values.attachments.file1,
|
|
96
98
|
values.attachments.file2 && values.attachments.file2,
|
|
@@ -129,16 +131,20 @@ var CreateInvoice = function (props) {
|
|
|
129
131
|
more: attachments.length > 0,
|
|
130
132
|
name: nextFileDescription // nextFile.name,
|
|
131
133
|
};
|
|
134
|
+
setSubmitting(true);
|
|
132
135
|
utils_1.submitDocument(nextFile, createAttachDocument, props.mapiBaseUrl, props.apiKey)
|
|
133
136
|
.then(function (submitDocumentResponse) {
|
|
134
137
|
antd_1.message.success("successfully uploaded attachment " + nextFileDescription);
|
|
138
|
+
setSubmitting(false);
|
|
135
139
|
});
|
|
136
140
|
};
|
|
137
141
|
while (attachments.length > 0) {
|
|
138
142
|
_loop_1();
|
|
139
143
|
}
|
|
144
|
+
setSubmitting(false);
|
|
140
145
|
form.resetFields();
|
|
141
146
|
// Clear the billing line dataSource
|
|
147
|
+
setChosenCustomer(undefined);
|
|
142
148
|
setBillingLinesDataSource([__assign({}, initialBillingLineData, { key: 0 })]);
|
|
143
149
|
setBillingLinesEditableIndex(0);
|
|
144
150
|
})
|
|
@@ -157,36 +163,37 @@ var CreateInvoice = function (props) {
|
|
|
157
163
|
}
|
|
158
164
|
};
|
|
159
165
|
return (react_1.default.createElement(antd_1.ConfigProvider, { locale: setLocale(props.language), componentSize: "small" },
|
|
160
|
-
react_1.default.createElement(antd_1.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
react_1.default.createElement(antd_1.Spin, { spinning: submitting },
|
|
167
|
+
react_1.default.createElement(antd_1.Form, __assign({}, formLayout_1.formItemLayout, { form: form, onFinish: handleSubmit, initialValues: {
|
|
168
|
+
invoice: {
|
|
169
|
+
currencyCode: "ISK",
|
|
170
|
+
supplier: {
|
|
171
|
+
address: {
|
|
172
|
+
countryCode: "IS"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
customer: {
|
|
176
|
+
address: {
|
|
177
|
+
countryCode: "IS"
|
|
178
|
+
}
|
|
171
179
|
}
|
|
172
180
|
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
react_1.default.createElement(
|
|
178
|
-
|
|
179
|
-
react_1.default.createElement(
|
|
180
|
-
|
|
181
|
-
react_1.default.createElement(
|
|
182
|
-
|
|
183
|
-
react_1.default.createElement(
|
|
184
|
-
|
|
185
|
-
react_1.default.createElement(
|
|
186
|
-
|
|
187
|
-
react_1.default.createElement(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit", size: "large" }, "Senda")))))));
|
|
181
|
+
} }),
|
|
182
|
+
react_1.default.createElement(antd_1.Row, { gutter: [16, 16] },
|
|
183
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 } },
|
|
184
|
+
react_1.default.createElement(components_1.Supplier, { billingLinesDataSource: billingLinesDataSource })),
|
|
185
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 } },
|
|
186
|
+
react_1.default.createElement(components_1.Customer, { formInstance: form, customers: props.customers, chosenCustomer: chosenCustomer, setChosenCustomer: setChosenCustomer })),
|
|
187
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 } },
|
|
188
|
+
react_1.default.createElement(components_1.BillingLines, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form, dataSource: billingLinesDataSource, editableIndex: billingLinesEditableIndex, handleAdd: handleBillingLinesAdd, initialBillingLineData: initialBillingLineData, handleDelete: handleBillingLinesDelete, handleSave: handleBillingLinesSave })),
|
|
189
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
190
|
+
react_1.default.createElement(components_1.BaseInformation, { form: form, documentType: "invoice" })),
|
|
191
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
192
|
+
react_1.default.createElement(components_1.PaymentMethod, null)),
|
|
193
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
194
|
+
react_1.default.createElement(components_1.Attachments /*handleAddFile={handleAddFile}*/, null)),
|
|
195
|
+
react_1.default.createElement(antd_1.Row, { style: { width: "100%", padding: "8px" }, justify: "end" },
|
|
196
|
+
react_1.default.createElement(antd_1.Col, null,
|
|
197
|
+
react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit", size: "large" }, "Senda"))))))));
|
|
191
198
|
};
|
|
192
199
|
exports.default = CreateInvoice;
|
|
@@ -17,7 +17,7 @@ interface Props extends InjectedIntlProps {
|
|
|
17
17
|
onlyLabelOnFirstInList?: boolean;
|
|
18
18
|
index?: number;
|
|
19
19
|
}
|
|
20
|
-
declare const _default: React.ComponentClass<Pick<Props, "style" | "initialValue" | "
|
|
20
|
+
declare const _default: React.ComponentClass<Pick<Props, "style" | "initialValue" | "receiverRequirementsKey" | "defaultLabel" | "defaultIsRequired" | "fieldName" | "additionalRules" | "verticalLabels" | "onlyLabelOnFirstInList" | "index">, any> & {
|
|
21
21
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
22
22
|
};
|
|
23
23
|
export default _default;
|