@stssocialst-stp/fe-payroll 0.3.6 → 0.3.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.
- package/dist/index.es.js +407 -115
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +409 -117
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -23,12 +23,12 @@ import _debounce from 'lodash/debounce';
|
|
|
23
23
|
import Button from '@material-ui/core/Button';
|
|
24
24
|
import _ from 'lodash';
|
|
25
25
|
import _extends from '@babel/runtime/helpers/extends';
|
|
26
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
27
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
28
26
|
import Dialog from '@material-ui/core/Dialog';
|
|
29
27
|
import DialogActions from '@material-ui/core/DialogActions';
|
|
30
28
|
import DialogContent from '@material-ui/core/DialogContent';
|
|
31
29
|
import DialogTitle from '@material-ui/core/DialogTitle';
|
|
30
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
31
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
32
32
|
import Typography$1 from '@material-ui/core/Typography';
|
|
33
33
|
import { useReactToPrint } from 'react-to-print';
|
|
34
34
|
import PrintIcon from '@material-ui/icons/Print';
|
|
@@ -152,6 +152,7 @@ var ACTION_TYPE = {
|
|
|
152
152
|
CLOSE_PAYROLL: 'PAYROLL_MUTATION_CLOSE_PAYROLL',
|
|
153
153
|
REJECT_PAYROLL: 'PAYROLL_MUTATION_REJECT_PAYROLL',
|
|
154
154
|
MAKE_PAYMENT_PAYROLL: 'PAYROLL_MUTATION_MAKE_PAYMENT_PAYROLL',
|
|
155
|
+
UPDATE_PAYROLL_PAYMENT_DATE: 'PAYROLL_MUTATION_UPDATE_PAYROLL_PAYMENT_DATE',
|
|
155
156
|
GET_PAYROLL_PAYMENT_FILES: 'GET_PAYROLL_PAYMENT_FILES',
|
|
156
157
|
BENEFITS_SUMMARY: 'PAYROLL_BENEFITS_SUMMARY',
|
|
157
158
|
GET_BISTP_SUMMARY: 'PAYROLL_BISTP_SUMMARY',
|
|
@@ -168,7 +169,8 @@ var MUTATION_SERVICE = {
|
|
|
168
169
|
DELETE: 'deletePayroll',
|
|
169
170
|
CLOSE: 'closePayroll',
|
|
170
171
|
REJECT: 'rejectPayroll',
|
|
171
|
-
MAKE_PAYMENT: 'makePaymentForPayroll'
|
|
172
|
+
MAKE_PAYMENT: 'makePaymentForPayroll',
|
|
173
|
+
UPDATE_PAYMENT_DATE: 'updatePayrollPaymentDate'
|
|
172
174
|
},
|
|
173
175
|
BENEFIT_CONSUMPTION: {
|
|
174
176
|
DELETE: 'deleteBenefitConsumption'
|
|
@@ -338,7 +340,8 @@ function reducer() {
|
|
|
338
340
|
return _objectSpread$6(_objectSpread$6({}, payroll), {}, {
|
|
339
341
|
id: decodeId(payroll.id),
|
|
340
342
|
dateValidTo: payroll !== null && payroll !== void 0 && payroll.dateValidTo ? payroll === null || payroll === void 0 ? void 0 : payroll.dateValidTo.split('T')[0] : null,
|
|
341
|
-
dateValidFrom: payroll !== null && payroll !== void 0 && payroll.dateValidFrom ? payroll === null || payroll === void 0 ? void 0 : payroll.dateValidFrom.split('T')[0] : null
|
|
343
|
+
dateValidFrom: payroll !== null && payroll !== void 0 && payroll.dateValidFrom ? payroll === null || payroll === void 0 ? void 0 : payroll.dateValidFrom.split('T')[0] : null,
|
|
344
|
+
paymentDate: payroll !== null && payroll !== void 0 && payroll.paymentDate ? payroll === null || payroll === void 0 ? void 0 : payroll.paymentDate.split('T')[0] : null
|
|
342
345
|
});
|
|
343
346
|
})) === null || _parseData4 === void 0 ? void 0 : _parseData4[0],
|
|
344
347
|
errorPayroll: formatGraphQLError(action.payload)
|
|
@@ -553,6 +556,8 @@ function reducer() {
|
|
|
553
556
|
return dispatchMutationResp(state, MUTATION_SERVICE.PAYMENT_POINT.UPDATE, action);
|
|
554
557
|
case SUCCESS(ACTION_TYPE.CREATE_PAYROLL):
|
|
555
558
|
return dispatchMutationResp(state, MUTATION_SERVICE.PAYROLL.CREATE, action);
|
|
559
|
+
case SUCCESS(ACTION_TYPE.UPDATE_PAYROLL_PAYMENT_DATE):
|
|
560
|
+
return dispatchMutationResp(state, MUTATION_SERVICE.PAYROLL.UPDATE_PAYMENT_DATE, action);
|
|
556
561
|
case SUCCESS(ACTION_TYPE.DELETE_PAYROLL):
|
|
557
562
|
return dispatchMutationResp(state, MUTATION_SERVICE.PAYROLL.DELETE, action);
|
|
558
563
|
case SUCCESS(ACTION_TYPE.DELETE_BENEFIT_CONSUMPTION):
|
|
@@ -644,6 +649,14 @@ var messages_en = {
|
|
|
644
649
|
"payroll.payroll.payrollStatusPicker.REJECTED": "REJECTED",
|
|
645
650
|
"payroll.payroll.payrollStatusPicker.RECONCILED": "RECONCILED",
|
|
646
651
|
"payroll.paymentMethod": "Payment Method",
|
|
652
|
+
"payroll.paymentDate": "Payment Date",
|
|
653
|
+
"payroll.paymentDateFrom": "Payment Date From",
|
|
654
|
+
"payroll.paymentDateTo": "Payment Date To",
|
|
655
|
+
"payroll.paymentDate.update": "Update Payment Date",
|
|
656
|
+
"payroll.paymentDate.mutation.updateLabel": "Update payment date {id}",
|
|
657
|
+
"payroll.validation.payroll.payment_date_required": "Payment date is required for BISTP payments.",
|
|
658
|
+
"payroll.validation.payroll.payment_date_in_past": "Payment date cannot be in the past.",
|
|
659
|
+
"payroll.validation.payroll.payment_date_locked": "Payment date can no longer be changed (payroll already sent to BISTP).",
|
|
647
660
|
"payroll.tasks.update.title": "Approve Payroll Tasks",
|
|
648
661
|
"payroll.tasks.reconciliation.title": "Payroll Reconciliation Tasks",
|
|
649
662
|
"payroll.payroll.includedUnpaid": "Included unpaid",
|
|
@@ -758,12 +771,12 @@ var PAYMENT_POINT_PROJECTION = function PAYMENT_POINT_PROJECTION(modulesManager)
|
|
|
758
771
|
return ['id', 'name', 'isDeleted', "location ".concat(modulesManager.getProjection('location.Location.FlatProjection')), "ppm ".concat(modulesManager.getProjection('admin.UserPicker.projection'))];
|
|
759
772
|
};
|
|
760
773
|
var BENEFIT_CONSUMPTION_PROJECTION = function BENEFIT_CONSUMPTION_PROJECTION() {
|
|
761
|
-
return ['id', 'jsonExt', 'code', 'individual {firstName, lastName, nib}', 'benefitAttachment {bill {id, code, terms, amountTotal, datePayed}}', 'receipt', 'photo', 'amount', 'type', 'status', 'dateDue'];
|
|
774
|
+
return ['id', 'jsonExt', 'code', 'individual {firstName, lastName, nib}', 'benefitAttachment {bill {id, code, terms, amountTotal, datePayed}}', 'receipt', 'photo', 'amount', 'type', 'status', 'dateDue', 'paymentDate'];
|
|
762
775
|
};
|
|
763
776
|
var PAYROLL_BENEFIT_CONSUMPTION_PROJECTION = function PAYROLL_BENEFIT_CONSUMPTION_PROJECTION() {
|
|
764
777
|
return ['id',
|
|
765
778
|
// eslint-disable-next-line max-len
|
|
766
|
-
'benefit{id,isDeleted,jsonExt,dateCreated,dateUpdated,dateValidFrom,dateValidTo,id,code,individual {firstName, lastName},benefitAttachment {bill {id, code, terms, datePayed}},receipt,photo,amount,type,status,dateDue}', 'payroll {id, name, status, paymentCycle {code, startDate, endDate}, paymentMethod, benefitPlanNameCode}'];
|
|
779
|
+
'benefit{id,isDeleted,jsonExt,dateCreated,dateUpdated,dateValidFrom,dateValidTo,id,code,individual {firstName, lastName},benefitAttachment {bill {id, code, terms, datePayed}},receipt,photo,amount,type,status,dateDue,paymentDate}', 'payroll {id, name, status, paymentCycle {code, startDate, endDate}, paymentMethod, paymentDate, benefitPlanNameCode}'];
|
|
767
780
|
};
|
|
768
781
|
var BENEFIT_CONSUMPTION_SUMMARY_PROJECTION = function BENEFIT_CONSUMPTION_SUMMARY_PROJECTION() {
|
|
769
782
|
return ['totalAmountReceived', 'totalAmountDue'];
|
|
@@ -775,10 +788,10 @@ var BISTP_SUMMARY_PROJECTION = function BISTP_SUMMARY_PROJECTION() {
|
|
|
775
788
|
return ['bistpSummary { total reconciled rejected pending skippedNib sendFailed }'];
|
|
776
789
|
};
|
|
777
790
|
var PAYROLL_PROJECTION = function PAYROLL_PROJECTION(modulesManager) {
|
|
778
|
-
return ['id', 'name', 'paymentMethod', 'paymentPlan { code, id, name, benefitPlanType }', 'benefitPlanNameCode', "paymentPoint { ".concat(PAYMENT_POINT_PROJECTION(modulesManager).join(' '), " }"), 'paymentCycle { code, startDate, endDate }', 'jsonExt', 'status', 'dateValidFrom', 'dateValidTo', 'isDeleted'].concat(_toConsumableArray(BISTP_SUMMARY_PROJECTION()));
|
|
791
|
+
return ['id', 'name', 'paymentMethod', 'paymentDate', 'paymentPlan { code, id, name, benefitPlanType }', 'benefitPlanNameCode', "paymentPoint { ".concat(PAYMENT_POINT_PROJECTION(modulesManager).join(' '), " }"), 'paymentCycle { code, startDate, endDate }', 'jsonExt', 'status', 'dateValidFrom', 'dateValidTo', 'isDeleted'].concat(_toConsumableArray(BISTP_SUMMARY_PROJECTION()));
|
|
779
792
|
};
|
|
780
793
|
var PAYROLL_SEARCHER_PROJECTION = function PAYROLL_SEARCHER_PROJECTION(modulesManager) {
|
|
781
|
-
return ['id', 'name', 'paymentMethod', 'paymentPlan { code, id, name, benefitPlanType }', 'benefitPlanNameCode', "paymentPoint { ".concat(PAYMENT_POINT_PROJECTION(modulesManager).join(' '), " }"), 'paymentCycle { code, startDate, endDate }', 'jsonExt', 'status', 'dateValidFrom', 'dateValidTo', 'isDeleted'].concat(_toConsumableArray(BISTP_SUMMARY_PROJECTION()));
|
|
794
|
+
return ['id', 'name', 'paymentMethod', 'paymentDate', 'paymentPlan { code, id, name, benefitPlanType }', 'benefitPlanNameCode', "paymentPoint { ".concat(PAYMENT_POINT_PROJECTION(modulesManager).join(' '), " }"), 'paymentCycle { code, startDate, endDate }', 'jsonExt', 'status', 'dateValidFrom', 'dateValidTo', 'isDeleted'].concat(_toConsumableArray(BISTP_SUMMARY_PROJECTION()));
|
|
782
795
|
};
|
|
783
796
|
var CSV_RECONCILIATION_PROJECTION = function CSV_RECONCILIATION_PROJECTION() {
|
|
784
797
|
return ['fileName', 'status', 'error', 'jsonExt'];
|
|
@@ -790,7 +803,7 @@ var formatPaymentPointGQL = function formatPaymentPointGQL(paymentPoint) {
|
|
|
790
803
|
return "\n ".concat(paymentPoint !== null && paymentPoint !== void 0 && paymentPoint.id ? "id: \"".concat(paymentPoint.id, "\"") : '', "\n ").concat(paymentPoint !== null && paymentPoint !== void 0 && paymentPoint.name ? "name: \"".concat(formatGQLString(paymentPoint.name), "\"") : '', "\n ").concat(paymentPoint !== null && paymentPoint !== void 0 && paymentPoint.location ? "locationId: ".concat(decodeId(paymentPoint.location.id)) : '', "\n ").concat(paymentPoint !== null && paymentPoint !== void 0 && paymentPoint.ppm ? "ppmId: \"".concat(decodeId(paymentPoint.ppm.id), "\"") : '', "\n ");
|
|
791
804
|
};
|
|
792
805
|
var formatPayrollGQL = function formatPayrollGQL(payroll) {
|
|
793
|
-
return "\n ".concat(payroll !== null && payroll !== void 0 && payroll.id ? "id: \"".concat(payroll.id, "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.name ? "name: \"".concat(formatGQLString(payroll.name), "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.paymentPoint ? "paymentPointId: \"".concat(decodeId(payroll.paymentPoint.id), "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.paymentPlan ? "paymentPlanId: \"".concat(decodeId(payroll.paymentPlan.id), "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.paymentCycle ? "paymentCycleId: \"".concat(decodeId(payroll.paymentCycle.id), "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.paymentMethod ? "paymentMethod: \"".concat(payroll.paymentMethod, "\"") : '', "\n ", "status: ".concat(PAYROLL_STATUS.PENDING_APPROVAL), "\n ").concat(payroll !== null && payroll !== void 0 && payroll.jsonExt ? "jsonExt: ".concat(JSON.stringify(payroll.jsonExt)) : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.dateValidFrom ? "dateValidFrom: \"".concat(payroll.dateValidFrom, "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.dateValidTo ? "dateValidTo: \"".concat(payroll.dateValidTo, "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.fromFailedInvoicesPayrollId ? "fromFailedInvoicesPayrollId: \"".concat(payroll.fromFailedInvoicesPayrollId, "\"") : '', "\n ");
|
|
806
|
+
return "\n ".concat(payroll !== null && payroll !== void 0 && payroll.id ? "id: \"".concat(payroll.id, "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.name ? "name: \"".concat(formatGQLString(payroll.name), "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.paymentPoint ? "paymentPointId: \"".concat(decodeId(payroll.paymentPoint.id), "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.paymentPlan ? "paymentPlanId: \"".concat(decodeId(payroll.paymentPlan.id), "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.paymentCycle ? "paymentCycleId: \"".concat(decodeId(payroll.paymentCycle.id), "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.paymentMethod ? "paymentMethod: \"".concat(payroll.paymentMethod, "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.paymentDate ? "paymentDate: \"".concat(payroll.paymentDate, "\"") : '', "\n ", "status: ".concat(PAYROLL_STATUS.PENDING_APPROVAL), "\n ").concat(payroll !== null && payroll !== void 0 && payroll.jsonExt ? "jsonExt: ".concat(JSON.stringify(payroll.jsonExt)) : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.dateValidFrom ? "dateValidFrom: \"".concat(payroll.dateValidFrom, "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.dateValidTo ? "dateValidTo: \"".concat(payroll.dateValidTo, "\"") : '', "\n ").concat(payroll !== null && payroll !== void 0 && payroll.fromFailedInvoicesPayrollId ? "fromFailedInvoicesPayrollId: \"".concat(payroll.fromFailedInvoicesPayrollId, "\"") : '', "\n ");
|
|
794
807
|
};
|
|
795
808
|
var PERFORM_MUTATION = function PERFORM_MUTATION(mutationType, mutationInput, ACTION, clientMutationLabel) {
|
|
796
809
|
var mutation = formatMutation(mutationType, mutationInput, clientMutationLabel);
|
|
@@ -892,6 +905,10 @@ function makePaymentForPayroll(payroll, clientMutationLabel) {
|
|
|
892
905
|
var payrollUuids = "ids: [\"".concat(payroll === null || payroll === void 0 ? void 0 : payroll.id, "\"]");
|
|
893
906
|
return PERFORM_MUTATION(MUTATION_SERVICE.PAYROLL.MAKE_PAYMENT, payrollUuids, ACTION_TYPE.MAKE_PAYMENT_PAYROLL, clientMutationLabel);
|
|
894
907
|
}
|
|
908
|
+
function updatePayrollPaymentDate(payroll, paymentDate, clientMutationLabel) {
|
|
909
|
+
var mutationInput = "\n id: \"".concat(payroll === null || payroll === void 0 ? void 0 : payroll.id, "\"\n paymentDate: \"").concat(paymentDate, "\"\n ");
|
|
910
|
+
return PERFORM_MUTATION(MUTATION_SERVICE.PAYROLL.UPDATE_PAYMENT_DATE, mutationInput, ACTION_TYPE.UPDATE_PAYROLL_PAYMENT_DATE, clientMutationLabel);
|
|
911
|
+
}
|
|
895
912
|
function fetchBistpSummary(payrollId) {
|
|
896
913
|
var query = "\n {\n total: benefitConsumptionByPayroll(payrollUuid: \"".concat(payrollId, "\", first: 0) { totalCount }\n pendentes: benefitConsumptionByPayroll(payrollUuid: \"").concat(payrollId, "\", status: ACCEPTED, first: 0) { totalCount }\n enviados: benefitConsumptionByPayroll(payrollUuid: \"").concat(payrollId, "\", status: APPROVE_FOR_PAYMENT, first: 0) { totalCount }\n confirmados: benefitConsumptionByPayroll(payrollUuid: \"").concat(payrollId, "\", status: RECONCILED, first: 0) { totalCount }\n rejeitados: benefitConsumptionByPayroll(payrollUuid: \"").concat(payrollId, "\", status: REJECTED, first: 0) { totalCount }\n }\n ");
|
|
897
914
|
return graphql(query, ACTION_TYPE.GET_BISTP_SUMMARY);
|
|
@@ -1108,7 +1125,7 @@ function PaymentPointPage(_ref) {
|
|
|
1108
1125
|
saveTooltip: formatMessage('tooltip.save')
|
|
1109
1126
|
})));
|
|
1110
1127
|
}
|
|
1111
|
-
var mapDispatchToProps$
|
|
1128
|
+
var mapDispatchToProps$j = function mapDispatchToProps(dispatch) {
|
|
1112
1129
|
return bindActionCreators({
|
|
1113
1130
|
clearPaymentPoint: clearPaymentPoint,
|
|
1114
1131
|
createPaymentPoint: createPaymentPoint,
|
|
@@ -1120,7 +1137,7 @@ var mapDispatchToProps$i = function mapDispatchToProps(dispatch) {
|
|
|
1120
1137
|
journalize: journalize
|
|
1121
1138
|
}, dispatch);
|
|
1122
1139
|
};
|
|
1123
|
-
var mapStateToProps$
|
|
1140
|
+
var mapStateToProps$j = function mapStateToProps(state, props) {
|
|
1124
1141
|
var _state$core$user$i_us, _state$core;
|
|
1125
1142
|
return {
|
|
1126
1143
|
paymentPointUuid: props.match.params.payment_point_uuid,
|
|
@@ -1131,7 +1148,7 @@ var mapStateToProps$i = function mapStateToProps(state, props) {
|
|
|
1131
1148
|
paymentPoint: state.payroll.paymentPoint
|
|
1132
1149
|
};
|
|
1133
1150
|
};
|
|
1134
|
-
var PaymentPointPage$1 = connect(mapStateToProps$
|
|
1151
|
+
var PaymentPointPage$1 = connect(mapStateToProps$j, mapDispatchToProps$j)(PaymentPointPage);
|
|
1135
1152
|
|
|
1136
1153
|
var useStyles$f = makeStyles(function (theme) {
|
|
1137
1154
|
return {
|
|
@@ -1396,7 +1413,7 @@ function PaymentPointSearcher(_ref) {
|
|
|
1396
1413
|
rowLocked: isRowDisabled
|
|
1397
1414
|
});
|
|
1398
1415
|
}
|
|
1399
|
-
var mapStateToProps$
|
|
1416
|
+
var mapStateToProps$i = function mapStateToProps(state) {
|
|
1400
1417
|
return {
|
|
1401
1418
|
fetchingPaymentPoints: state.payroll.fetchingPaymentPoints,
|
|
1402
1419
|
fetchedPaymentPoints: state.payroll.fetchedPaymentPoints,
|
|
@@ -1409,7 +1426,7 @@ var mapStateToProps$h = function mapStateToProps(state) {
|
|
|
1409
1426
|
mutation: state.payroll.mutation
|
|
1410
1427
|
};
|
|
1411
1428
|
};
|
|
1412
|
-
var mapDispatchToProps$
|
|
1429
|
+
var mapDispatchToProps$i = function mapDispatchToProps(dispatch) {
|
|
1413
1430
|
return bindActionCreators({
|
|
1414
1431
|
fetchPaymentPoints: fetchPaymentPoints,
|
|
1415
1432
|
deletePaymentPoint: deletePaymentPoint,
|
|
@@ -1418,7 +1435,7 @@ var mapDispatchToProps$h = function mapDispatchToProps(dispatch) {
|
|
|
1418
1435
|
coreConfirm: coreConfirm
|
|
1419
1436
|
}, dispatch);
|
|
1420
1437
|
};
|
|
1421
|
-
var PaymentPointSearcher$1 = connect(mapStateToProps$
|
|
1438
|
+
var PaymentPointSearcher$1 = connect(mapStateToProps$i, mapDispatchToProps$i)(PaymentPointSearcher);
|
|
1422
1439
|
|
|
1423
1440
|
var useStyles$e = makeStyles(function (theme) {
|
|
1424
1441
|
return {
|
|
@@ -1748,7 +1765,7 @@ function AdvancedFiltersDialog(_ref) {
|
|
|
1748
1765
|
disabled: !object || confirmed || readOnly
|
|
1749
1766
|
}, formatMessage$1(intl, 'payroll', 'payroll.advancedFilters.button.filter')))) : /*#__PURE__*/React.createElement(React.Fragment, null)));
|
|
1750
1767
|
}
|
|
1751
|
-
var mapStateToProps$
|
|
1768
|
+
var mapStateToProps$h = function mapStateToProps(state, props) {
|
|
1752
1769
|
return {
|
|
1753
1770
|
rights: !!state.core && !!state.core.user && !!state.core.user.i_user ? state.core.user.i_user.rights : [],
|
|
1754
1771
|
confirmed: state.core.confirmed,
|
|
@@ -1758,12 +1775,12 @@ var mapStateToProps$g = function mapStateToProps(state, props) {
|
|
|
1758
1775
|
customFilters: state.core.customFilters
|
|
1759
1776
|
};
|
|
1760
1777
|
};
|
|
1761
|
-
var mapDispatchToProps$
|
|
1778
|
+
var mapDispatchToProps$h = function mapDispatchToProps(dispatch) {
|
|
1762
1779
|
return bindActionCreators({
|
|
1763
1780
|
fetchCustomFilter: fetchCustomFilter
|
|
1764
1781
|
}, dispatch);
|
|
1765
1782
|
};
|
|
1766
|
-
var AdvancedFiltersDialog$1 = injectIntl(withTheme(withStyles(styles$3)(connect(mapStateToProps$
|
|
1783
|
+
var AdvancedFiltersDialog$1 = injectIntl(withTheme(withStyles(styles$3)(connect(mapStateToProps$h, mapDispatchToProps$h)(AdvancedFiltersDialog))));
|
|
1767
1784
|
|
|
1768
1785
|
function PayrollStatusPicker(_ref) {
|
|
1769
1786
|
var required = _ref.required,
|
|
@@ -1831,7 +1848,7 @@ function PaymentMethodPicker(_ref) {
|
|
|
1831
1848
|
required: required
|
|
1832
1849
|
});
|
|
1833
1850
|
}
|
|
1834
|
-
var mapStateToProps$
|
|
1851
|
+
var mapStateToProps$g = function mapStateToProps(state) {
|
|
1835
1852
|
return {
|
|
1836
1853
|
rights: !!state.core && !!state.core.user && !!state.core.user.i_user ? state.core.user.i_user.rights : [],
|
|
1837
1854
|
confirmed: state.core.confirmed,
|
|
@@ -1841,12 +1858,99 @@ var mapStateToProps$f = function mapStateToProps(state) {
|
|
|
1841
1858
|
paymentMethods: state.payroll.paymentMethods
|
|
1842
1859
|
};
|
|
1843
1860
|
};
|
|
1844
|
-
var mapDispatchToProps$
|
|
1861
|
+
var mapDispatchToProps$g = function mapDispatchToProps(dispatch) {
|
|
1845
1862
|
return bindActionCreators({
|
|
1846
1863
|
fetchPaymentMethods: fetchPaymentMethods
|
|
1847
1864
|
}, dispatch);
|
|
1848
1865
|
};
|
|
1849
|
-
var PaymentMethodPicker$1 = connect(mapStateToProps$
|
|
1866
|
+
var PaymentMethodPicker$1 = connect(mapStateToProps$g, mapDispatchToProps$g)(PaymentMethodPicker);
|
|
1867
|
+
|
|
1868
|
+
var EDITABLE_STATUSES = [PAYROLL_STATUS.PENDING_APPROVAL, PAYROLL_STATUS.APPROVE_FOR_PAYMENT];
|
|
1869
|
+
function PayrollPaymentDateDialog(_ref) {
|
|
1870
|
+
var payroll = _ref.payroll,
|
|
1871
|
+
updatePayrollPaymentDate = _ref.updatePayrollPaymentDate,
|
|
1872
|
+
fetchPayroll = _ref.fetchPayroll,
|
|
1873
|
+
submittingMutation = _ref.submittingMutation,
|
|
1874
|
+
mutation = _ref.mutation;
|
|
1875
|
+
var modulesManager = useModulesManager();
|
|
1876
|
+
var _useTranslations = useTranslations(MODULE_NAME, modulesManager),
|
|
1877
|
+
formatMessage = _useTranslations.formatMessage,
|
|
1878
|
+
formatMessageWithValues = _useTranslations.formatMessageWithValues;
|
|
1879
|
+
var _useState = useState(false),
|
|
1880
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1881
|
+
isOpen = _useState2[0],
|
|
1882
|
+
setIsOpen = _useState2[1];
|
|
1883
|
+
var _useState3 = useState(null),
|
|
1884
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1885
|
+
paymentDate = _useState4[0],
|
|
1886
|
+
setPaymentDate = _useState4[1];
|
|
1887
|
+
var handleOpen = function handleOpen() {
|
|
1888
|
+
var _payroll$paymentDate;
|
|
1889
|
+
setPaymentDate((_payroll$paymentDate = payroll === null || payroll === void 0 ? void 0 : payroll.paymentDate) !== null && _payroll$paymentDate !== void 0 ? _payroll$paymentDate : null);
|
|
1890
|
+
setIsOpen(true);
|
|
1891
|
+
};
|
|
1892
|
+
var handleClose = function handleClose() {
|
|
1893
|
+
setIsOpen(false);
|
|
1894
|
+
};
|
|
1895
|
+
var handleSave = function handleSave() {
|
|
1896
|
+
if (!paymentDate) return;
|
|
1897
|
+
updatePayrollPaymentDate(payroll, paymentDate, formatMessageWithValues('payroll.paymentDate.mutation.updateLabel', mutationLabel(payroll)));
|
|
1898
|
+
};
|
|
1899
|
+
useEffect(function () {
|
|
1900
|
+
if (!submittingMutation && (mutation === null || mutation === void 0 ? void 0 : mutation.actionType) === ACTION_TYPE.UPDATE_PAYROLL_PAYMENT_DATE && mutation !== null && mutation !== void 0 && mutation.clientMutationId && isOpen) {
|
|
1901
|
+
handleClose();
|
|
1902
|
+
if (payroll !== null && payroll !== void 0 && payroll.id) {
|
|
1903
|
+
fetchPayroll(modulesManager, ["id: \"".concat(payroll.id, "\"")]);
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
}, [submittingMutation]);
|
|
1907
|
+
if (!(payroll !== null && payroll !== void 0 && payroll.id)) return null;
|
|
1908
|
+
if (!EDITABLE_STATUSES.includes(payroll === null || payroll === void 0 ? void 0 : payroll.status)) return null;
|
|
1909
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1910
|
+
onClick: handleOpen,
|
|
1911
|
+
variant: "outlined",
|
|
1912
|
+
color: "primary",
|
|
1913
|
+
style: {
|
|
1914
|
+
marginTop: '16px'
|
|
1915
|
+
}
|
|
1916
|
+
}, formatMessage('payroll.paymentDate.update')), /*#__PURE__*/React.createElement(Dialog, {
|
|
1917
|
+
open: isOpen,
|
|
1918
|
+
onClose: handleClose
|
|
1919
|
+
}, /*#__PURE__*/React.createElement(DialogTitle, null, formatMessage('payroll.paymentDate.update')), /*#__PURE__*/React.createElement(DialogContent, {
|
|
1920
|
+
style: {
|
|
1921
|
+
minWidth: 400
|
|
1922
|
+
}
|
|
1923
|
+
}, /*#__PURE__*/React.createElement(PublishedComponent, {
|
|
1924
|
+
pubRef: "core.DatePicker",
|
|
1925
|
+
module: "payroll",
|
|
1926
|
+
label: "payroll.paymentDate",
|
|
1927
|
+
value: paymentDate,
|
|
1928
|
+
onChange: setPaymentDate,
|
|
1929
|
+
required: true,
|
|
1930
|
+
disablePast: true
|
|
1931
|
+
})), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
1932
|
+
onClick: handleClose,
|
|
1933
|
+
color: "primary"
|
|
1934
|
+
}, formatMessage('payroll.beneficiaries.cancel')), /*#__PURE__*/React.createElement(Button, {
|
|
1935
|
+
onClick: handleSave,
|
|
1936
|
+
color: "primary",
|
|
1937
|
+
variant: "contained",
|
|
1938
|
+
disabled: !paymentDate
|
|
1939
|
+
}, formatMessage('payroll.beneficiaries.confirm')))));
|
|
1940
|
+
}
|
|
1941
|
+
var mapStateToProps$f = function mapStateToProps(state) {
|
|
1942
|
+
return {
|
|
1943
|
+
submittingMutation: state.payroll.submittingMutation,
|
|
1944
|
+
mutation: state.payroll.mutation
|
|
1945
|
+
};
|
|
1946
|
+
};
|
|
1947
|
+
var mapDispatchToProps$f = function mapDispatchToProps(dispatch) {
|
|
1948
|
+
return bindActionCreators({
|
|
1949
|
+
updatePayrollPaymentDate: updatePayrollPaymentDate,
|
|
1950
|
+
fetchPayroll: fetchPayroll
|
|
1951
|
+
}, dispatch);
|
|
1952
|
+
};
|
|
1953
|
+
var PayrollPaymentDateDialog$1 = connect(mapStateToProps$f, mapDispatchToProps$f)(PayrollPaymentDateDialog);
|
|
1850
1954
|
|
|
1851
1955
|
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1852
1956
|
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -2016,6 +2120,28 @@ var PayrollHeadPanel = /*#__PURE__*/function (_FormPanel) {
|
|
|
2016
2120
|
return _this2.updateAttribute('paymentMethod', paymentMethod);
|
|
2017
2121
|
},
|
|
2018
2122
|
label: formatMessage$1(intl, 'payroll', 'paymentMethod')
|
|
2123
|
+
})), /*#__PURE__*/React.createElement(Grid, {
|
|
2124
|
+
item: true,
|
|
2125
|
+
xs: 3,
|
|
2126
|
+
className: classes.item
|
|
2127
|
+
}, /*#__PURE__*/React.createElement(PublishedComponent, {
|
|
2128
|
+
pubRef: "core.DatePicker",
|
|
2129
|
+
module: "payroll",
|
|
2130
|
+
label: "payroll.paymentDate",
|
|
2131
|
+
value: payroll === null || payroll === void 0 ? void 0 : payroll.paymentDate,
|
|
2132
|
+
required: (payroll === null || payroll === void 0 ? void 0 : payroll.paymentMethod) === PAYMENT_METHOD.STRATEGY_BISTP_PAYMENT,
|
|
2133
|
+
readOnly: readOnly,
|
|
2134
|
+
disablePast: !readOnly,
|
|
2135
|
+
onChange: function onChange(paymentDate) {
|
|
2136
|
+
return _this2.updateAttribute('paymentDate', paymentDate);
|
|
2137
|
+
}
|
|
2138
|
+
})), readOnly && /*#__PURE__*/React.createElement(Grid, {
|
|
2139
|
+
item: true,
|
|
2140
|
+
xs: 3,
|
|
2141
|
+
className: classes.item
|
|
2142
|
+
}, /*#__PURE__*/React.createElement(PayrollPaymentDateDialog$1, {
|
|
2143
|
+
payroll: payroll,
|
|
2144
|
+
readOnly: readOnly
|
|
2019
2145
|
}))), /*#__PURE__*/React.createElement(Divider, null), !isPayrollFromFailedInvoices && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, null, /*#__PURE__*/React.createElement("div", {
|
|
2020
2146
|
className: classes.item
|
|
2021
2147
|
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
@@ -3543,7 +3669,7 @@ function PayrollPage(_ref) {
|
|
|
3543
3669
|
};
|
|
3544
3670
|
}, []);
|
|
3545
3671
|
var mandatoryFieldsEmpty = function mandatoryFieldsEmpty() {
|
|
3546
|
-
if (editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.name && editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.paymentPlan && editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.paymentCycle && editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.paymentMethod && !(editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.isDeleted)) return false;
|
|
3672
|
+
if (editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.name && editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.paymentPlan && editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.paymentCycle && editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.paymentMethod && ((editedPayroll === null || editedPayroll === void 0 ? void 0 : editedPayroll.paymentMethod) !== PAYMENT_METHOD.STRATEGY_BISTP_PAYMENT || editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.paymentDate) && !(editedPayroll !== null && editedPayroll !== void 0 && editedPayroll.isDeleted)) return false;
|
|
3547
3673
|
return true;
|
|
3548
3674
|
};
|
|
3549
3675
|
var canSave = function canSave() {
|
|
@@ -3735,6 +3861,38 @@ function PayrollFilter(_ref) {
|
|
|
3735
3861
|
filter: "paymentMethod: \"".concat(value, "\"")
|
|
3736
3862
|
}]);
|
|
3737
3863
|
}
|
|
3864
|
+
})), /*#__PURE__*/React.createElement(Grid, {
|
|
3865
|
+
item: true,
|
|
3866
|
+
xs: 2,
|
|
3867
|
+
className: classes.item
|
|
3868
|
+
}, /*#__PURE__*/React.createElement(PublishedComponent, {
|
|
3869
|
+
pubRef: "core.DatePicker",
|
|
3870
|
+
module: "payroll",
|
|
3871
|
+
label: "payroll.paymentDateFrom",
|
|
3872
|
+
value: filterValue('paymentDate_Gte'),
|
|
3873
|
+
onChange: function onChange(value) {
|
|
3874
|
+
return onChangeFilters([{
|
|
3875
|
+
id: 'paymentDate_Gte',
|
|
3876
|
+
value: value,
|
|
3877
|
+
filter: value ? "paymentDate_Gte: \"".concat(value, "\"") : EMPTY_STRING
|
|
3878
|
+
}]);
|
|
3879
|
+
}
|
|
3880
|
+
})), /*#__PURE__*/React.createElement(Grid, {
|
|
3881
|
+
item: true,
|
|
3882
|
+
xs: 2,
|
|
3883
|
+
className: classes.item
|
|
3884
|
+
}, /*#__PURE__*/React.createElement(PublishedComponent, {
|
|
3885
|
+
pubRef: "core.DatePicker",
|
|
3886
|
+
module: "payroll",
|
|
3887
|
+
label: "payroll.paymentDateTo",
|
|
3888
|
+
value: filterValue('paymentDate_Lte'),
|
|
3889
|
+
onChange: function onChange(value) {
|
|
3890
|
+
return onChangeFilters([{
|
|
3891
|
+
id: 'paymentDate_Lte',
|
|
3892
|
+
value: value,
|
|
3893
|
+
filter: value ? "paymentDate_Lte: \"".concat(value, "\"") : EMPTY_STRING
|
|
3894
|
+
}]);
|
|
3895
|
+
}
|
|
3738
3896
|
})), /*#__PURE__*/React.createElement(ControlledField, {
|
|
3739
3897
|
module: "payroll",
|
|
3740
3898
|
id: "payrollFilter.showHistory",
|
|
@@ -3819,10 +3977,10 @@ function PayrollSearcher(_ref) {
|
|
|
3819
3977
|
prevSubmittingMutationRef.current = submittingMutation;
|
|
3820
3978
|
});
|
|
3821
3979
|
var headers = function headers() {
|
|
3822
|
-
return ['payroll.name', 'payroll.benefitPlan', 'payroll.paymentPoint', 'payroll.status', 'payroll.paymentMethod', 'payroll.bistp.progress', 'emptyLabel'];
|
|
3980
|
+
return ['payroll.name', 'payroll.benefitPlan', 'payroll.paymentPoint', 'payroll.status', 'payroll.paymentMethod', 'payroll.paymentDate', 'payroll.bistp.progress', 'emptyLabel'];
|
|
3823
3981
|
};
|
|
3824
3982
|
var sorts = function sorts() {
|
|
3825
|
-
return [['name', true], ['benefitPlanNameCode', true], ['paymentPoint', true], ['status', true], ['paymentMethod', true]];
|
|
3983
|
+
return [['name', true], ['benefitPlanNameCode', true], ['paymentPoint', true], ['status', true], ['paymentMethod', true], ['paymentDate', true]];
|
|
3826
3984
|
};
|
|
3827
3985
|
var renderBistpProgress = function renderBistpProgress(payroll) {
|
|
3828
3986
|
if (payroll.paymentMethod !== PAYMENT_METHOD.STRATEGY_BISTP_PAYMENT) return null;
|
|
@@ -3884,6 +4042,9 @@ function PayrollSearcher(_ref) {
|
|
|
3884
4042
|
return payroll.status ? "".concat(payroll.status) : '';
|
|
3885
4043
|
}, function (payroll) {
|
|
3886
4044
|
return payroll.paymentMethod ? "".concat(payroll.paymentMethod) : '';
|
|
4045
|
+
}, function (payroll) {
|
|
4046
|
+
var _payroll$paymentDate;
|
|
4047
|
+
return (_payroll$paymentDate = payroll.paymentDate) !== null && _payroll$paymentDate !== void 0 ? _payroll$paymentDate : '—';
|
|
3887
4048
|
}, function (payroll) {
|
|
3888
4049
|
return renderBistpProgress(payroll);
|
|
3889
4050
|
}, function (payroll) {
|
|
@@ -5684,9 +5845,11 @@ function BenefitConsumptionSearcher(_ref) {
|
|
|
5684
5845
|
return isPayrollFromFailedInvoices ? BENEFIT_CONSUMPTION_STATUS.APPROVE_FOR_PAYMENT : benefitConsumption === null || benefitConsumption === void 0 ? void 0 : benefitConsumption.status;
|
|
5685
5846
|
}, function (benefitConsumption) {
|
|
5686
5847
|
return checkBenefitDueDate(benefitConsumption);
|
|
5687
|
-
},
|
|
5688
|
-
|
|
5689
|
-
|
|
5848
|
+
},
|
|
5849
|
+
// paymentDate enviada ao BISTP; fallback para bill.datePayed (offline); "—" se ainda não enviado
|
|
5850
|
+
function (benefitConsumption) {
|
|
5851
|
+
var _benefitConsumption$p, _benefitConsumption$b, _benefitConsumption$b2;
|
|
5852
|
+
return (_benefitConsumption$p = benefitConsumption === null || benefitConsumption === void 0 ? void 0 : benefitConsumption.paymentDate) !== null && _benefitConsumption$p !== void 0 ? _benefitConsumption$p : !benefitConsumption.receipt ? '—' : (_benefitConsumption$b = benefitConsumption === null || benefitConsumption === void 0 || (_benefitConsumption$b2 = benefitConsumption.benefitAttachment) === null || _benefitConsumption$b2 === void 0 || (_benefitConsumption$b2 = _benefitConsumption$b2[0]) === null || _benefitConsumption$b2 === void 0 || (_benefitConsumption$b2 = _benefitConsumption$b2.bill) === null || _benefitConsumption$b2 === void 0 ? void 0 : _benefitConsumption$b2.datePayed) !== null && _benefitConsumption$b !== void 0 ? _benefitConsumption$b : '—';
|
|
5690
5853
|
}, function (benefitConsumption) {
|
|
5691
5854
|
var jsonExt = (benefitConsumption === null || benefitConsumption === void 0 ? void 0 : benefitConsumption.jsonExt) || {};
|
|
5692
5855
|
var hasBistpFields = jsonExt.bistp_skip_reason || jsonExt.bistp_processed || jsonExt.bistp_rejection_reason;
|
|
@@ -5707,7 +5870,7 @@ function BenefitConsumptionSearcher(_ref) {
|
|
|
5707
5870
|
return benefitConsumption.id;
|
|
5708
5871
|
};
|
|
5709
5872
|
var sorts = function sorts() {
|
|
5710
|
-
return [['individual_FirstName', true], ['individual_LastName', true], ['individual_Nib', true], ['photo', true], ['code', true], ['dateDue', true], ['receipt', true], ['amount', true], ['type', true], ['status', true]];
|
|
5873
|
+
return [['individual_FirstName', true], ['individual_LastName', true], ['individual_Nib', true], ['photo', true], ['code', true], ['dateDue', true], ['receipt', true], ['amount', true], ['type', true], ['status', true], ['paymentDate', true]];
|
|
5711
5874
|
};
|
|
5712
5875
|
var defaultFilters = function defaultFilters() {
|
|
5713
5876
|
var filters = {
|
|
@@ -6489,11 +6652,93 @@ function useBeneficiarios() {
|
|
|
6489
6652
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
6490
6653
|
error = _useState6[0],
|
|
6491
6654
|
setError = _useState6[1];
|
|
6492
|
-
function
|
|
6655
|
+
function poll(_x) {
|
|
6656
|
+
return _poll.apply(this, arguments);
|
|
6657
|
+
}
|
|
6658
|
+
function _poll() {
|
|
6659
|
+
_poll = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(clientMutationId) {
|
|
6660
|
+
var INTERVAL_MS, TIMEOUT_MS, started, _result$data, _node$jsonExt$output, _node$jsonExt, resp, result, node;
|
|
6661
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
6662
|
+
while (1) switch (_context.prev = _context.next) {
|
|
6663
|
+
case 0:
|
|
6664
|
+
INTERVAL_MS = 5000;
|
|
6665
|
+
TIMEOUT_MS = 20 * 60 * 1000; // 20 minutos
|
|
6666
|
+
started = Date.now();
|
|
6667
|
+
case 1:
|
|
6668
|
+
if (!(Date.now() - started < TIMEOUT_MS)) {
|
|
6669
|
+
_context.next = 8;
|
|
6670
|
+
break;
|
|
6671
|
+
}
|
|
6672
|
+
_context.next = 2;
|
|
6673
|
+
return new Promise(function (resolve) {
|
|
6674
|
+
return setTimeout(resolve, INTERVAL_MS);
|
|
6675
|
+
});
|
|
6676
|
+
case 2:
|
|
6677
|
+
_context.next = 3;
|
|
6678
|
+
return fetch("".concat(baseApiUrl, "/graphql"), {
|
|
6679
|
+
method: 'POST',
|
|
6680
|
+
headers: buildHeaders(),
|
|
6681
|
+
credentials: 'same-origin',
|
|
6682
|
+
body: JSON.stringify({
|
|
6683
|
+
query: "\n query {\n mutationLogs(clientMutationId: \"".concat(clientMutationId, "\") {\n edges { node { status error jsonExt clientMutationLabel } }\n }\n }\n ")
|
|
6684
|
+
})
|
|
6685
|
+
});
|
|
6686
|
+
case 3:
|
|
6687
|
+
resp = _context.sent;
|
|
6688
|
+
_context.next = 4;
|
|
6689
|
+
return resp.json();
|
|
6690
|
+
case 4:
|
|
6691
|
+
result = _context.sent;
|
|
6692
|
+
node = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 || (_result$data = _result$data.mutationLogs) === null || _result$data === void 0 || (_result$data = _result$data.edges) === null || _result$data === void 0 || (_result$data = _result$data[0]) === null || _result$data === void 0 ? void 0 : _result$data.node;
|
|
6693
|
+
if (node) {
|
|
6694
|
+
_context.next = 5;
|
|
6695
|
+
break;
|
|
6696
|
+
}
|
|
6697
|
+
return _context.abrupt("continue", 1);
|
|
6698
|
+
case 5:
|
|
6699
|
+
// Update UI with label if needed
|
|
6700
|
+
setOutput("A processar: ".concat(node.clientMutationLabel, "..."));
|
|
6701
|
+
if (!(node.status === 2)) {
|
|
6702
|
+
_context.next = 6;
|
|
6703
|
+
break;
|
|
6704
|
+
}
|
|
6705
|
+
return _context.abrupt("return", {
|
|
6706
|
+
success: true,
|
|
6707
|
+
output: (_node$jsonExt$output = (_node$jsonExt = node.jsonExt) === null || _node$jsonExt === void 0 ? void 0 : _node$jsonExt.output) !== null && _node$jsonExt$output !== void 0 ? _node$jsonExt$output : null,
|
|
6708
|
+
error: null
|
|
6709
|
+
});
|
|
6710
|
+
case 6:
|
|
6711
|
+
if (!(node.status === 1)) {
|
|
6712
|
+
_context.next = 7;
|
|
6713
|
+
break;
|
|
6714
|
+
}
|
|
6715
|
+
return _context.abrupt("return", {
|
|
6716
|
+
success: false,
|
|
6717
|
+
output: null,
|
|
6718
|
+
error: node.error
|
|
6719
|
+
});
|
|
6720
|
+
case 7:
|
|
6721
|
+
_context.next = 1;
|
|
6722
|
+
break;
|
|
6723
|
+
case 8:
|
|
6724
|
+
return _context.abrupt("return", {
|
|
6725
|
+
success: false,
|
|
6726
|
+
output: null,
|
|
6727
|
+
error: 'Timeout: operação excedeu 20 minutos'
|
|
6728
|
+
});
|
|
6729
|
+
case 9:
|
|
6730
|
+
case "end":
|
|
6731
|
+
return _context.stop();
|
|
6732
|
+
}
|
|
6733
|
+
}, _callee);
|
|
6734
|
+
}));
|
|
6735
|
+
return _poll.apply(this, arguments);
|
|
6736
|
+
}
|
|
6737
|
+
function request(_x2) {
|
|
6493
6738
|
return _request.apply(this, arguments);
|
|
6494
6739
|
}
|
|
6495
6740
|
function _request() {
|
|
6496
|
-
_request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6741
|
+
_request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(path) {
|
|
6497
6742
|
var _ref,
|
|
6498
6743
|
_ref$multipart,
|
|
6499
6744
|
multipart,
|
|
@@ -6505,15 +6750,15 @@ function useBeneficiarios() {
|
|
|
6505
6750
|
contentType,
|
|
6506
6751
|
_data,
|
|
6507
6752
|
message,
|
|
6508
|
-
|
|
6753
|
+
_args2 = arguments,
|
|
6509
6754
|
_t;
|
|
6510
|
-
return _regeneratorRuntime.wrap(function (
|
|
6511
|
-
while (1) switch (
|
|
6755
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
6756
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
6512
6757
|
case 0:
|
|
6513
|
-
_ref =
|
|
6758
|
+
_ref = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {}, _ref$multipart = _ref.multipart, multipart = _ref$multipart === void 0 ? false : _ref$multipart, _ref$body = _ref.body, body = _ref$body === void 0 ? null : _ref$body;
|
|
6514
6759
|
setLoading(true);
|
|
6515
6760
|
setError(null);
|
|
6516
|
-
|
|
6761
|
+
_context2.prev = 1;
|
|
6517
6762
|
init = {
|
|
6518
6763
|
method: 'POST',
|
|
6519
6764
|
credentials: 'same-origin'
|
|
@@ -6524,54 +6769,50 @@ function useBeneficiarios() {
|
|
|
6524
6769
|
init.headers = buildHeaders();
|
|
6525
6770
|
if (body) init.body = JSON.stringify(body);
|
|
6526
6771
|
}
|
|
6527
|
-
|
|
6772
|
+
_context2.next = 2;
|
|
6528
6773
|
return fetch("".concat(BASE).concat(path), init);
|
|
6529
6774
|
case 2:
|
|
6530
|
-
response =
|
|
6775
|
+
response = _context2.sent;
|
|
6531
6776
|
data = null;
|
|
6532
6777
|
contentType = response.headers.get('content-type') || '';
|
|
6533
6778
|
if (!contentType.includes('application/json')) {
|
|
6534
|
-
|
|
6779
|
+
_context2.next = 4;
|
|
6535
6780
|
break;
|
|
6536
6781
|
}
|
|
6537
|
-
|
|
6782
|
+
_context2.next = 3;
|
|
6538
6783
|
return response.json();
|
|
6539
6784
|
case 3:
|
|
6540
|
-
data =
|
|
6785
|
+
data = _context2.sent;
|
|
6541
6786
|
case 4:
|
|
6542
6787
|
if (response.ok) {
|
|
6543
|
-
|
|
6788
|
+
_context2.next = 5;
|
|
6544
6789
|
break;
|
|
6545
6790
|
}
|
|
6546
6791
|
message = ((_data = data) === null || _data === void 0 ? void 0 : _data.message) || "HTTP ".concat(response.status);
|
|
6547
6792
|
setError(message);
|
|
6548
|
-
return
|
|
6793
|
+
return _context2.abrupt("return", {
|
|
6549
6794
|
ok: false,
|
|
6550
6795
|
message: message,
|
|
6551
6796
|
data: data
|
|
6552
6797
|
});
|
|
6553
6798
|
case 5:
|
|
6554
|
-
return
|
|
6799
|
+
return _context2.abrupt("return", {
|
|
6555
6800
|
ok: true,
|
|
6556
6801
|
data: data
|
|
6557
6802
|
});
|
|
6558
6803
|
case 6:
|
|
6559
|
-
|
|
6560
|
-
_t =
|
|
6804
|
+
_context2.prev = 6;
|
|
6805
|
+
_t = _context2["catch"](1);
|
|
6561
6806
|
setError(_t.message);
|
|
6562
|
-
return
|
|
6807
|
+
return _context2.abrupt("return", {
|
|
6563
6808
|
ok: false,
|
|
6564
6809
|
message: _t.message
|
|
6565
6810
|
});
|
|
6566
6811
|
case 7:
|
|
6567
|
-
_context.prev = 7;
|
|
6568
|
-
setLoading(false);
|
|
6569
|
-
return _context.finish(7);
|
|
6570
|
-
case 8:
|
|
6571
6812
|
case "end":
|
|
6572
|
-
return
|
|
6813
|
+
return _context2.stop();
|
|
6573
6814
|
}
|
|
6574
|
-
},
|
|
6815
|
+
}, _callee2, null, [[1, 6]]);
|
|
6575
6816
|
}));
|
|
6576
6817
|
return _request.apply(this, arguments);
|
|
6577
6818
|
}
|
|
@@ -6579,50 +6820,53 @@ function useBeneficiarios() {
|
|
|
6579
6820
|
return _backup.apply(this, arguments);
|
|
6580
6821
|
}
|
|
6581
6822
|
function _backup() {
|
|
6582
|
-
_backup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6823
|
+
_backup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
6583
6824
|
var payrollId,
|
|
6584
6825
|
_yield$request,
|
|
6585
6826
|
ok,
|
|
6586
6827
|
data,
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
6828
|
+
pollResult,
|
|
6829
|
+
_args3 = arguments;
|
|
6830
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
6831
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
6592
6832
|
case 0:
|
|
6593
|
-
payrollId =
|
|
6594
|
-
|
|
6833
|
+
payrollId = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : null;
|
|
6834
|
+
_context3.next = 1;
|
|
6595
6835
|
return request('/backup/', {
|
|
6596
6836
|
body: payrollId ? {
|
|
6597
6837
|
payroll_id: payrollId
|
|
6598
6838
|
} : {}
|
|
6599
6839
|
});
|
|
6600
6840
|
case 1:
|
|
6601
|
-
_yield$request =
|
|
6841
|
+
_yield$request = _context3.sent;
|
|
6602
6842
|
ok = _yield$request.ok;
|
|
6603
6843
|
data = _yield$request.data;
|
|
6604
|
-
if (ok) {
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
});
|
|
6608
|
-
a = document.createElement('a');
|
|
6609
|
-
a.href = URL.createObjectURL(blob);
|
|
6610
|
-
a.download = "backup_beneficiarios_".concat(new Date().toISOString().slice(0, 19).replace(/:/g, '-'), ".json");
|
|
6611
|
-
document.body.appendChild(a);
|
|
6612
|
-
a.click();
|
|
6613
|
-
document.body.removeChild(a);
|
|
6614
|
-
URL.revokeObjectURL(a.href);
|
|
6615
|
-
setOutput("Backup conclu\xEDdo: ".concat(JSON.stringify(data.counts)));
|
|
6844
|
+
if (!ok) {
|
|
6845
|
+
_context3.next = 3;
|
|
6846
|
+
break;
|
|
6616
6847
|
}
|
|
6617
|
-
|
|
6848
|
+
setOutput('Backup iniciado. A aguardar conclusão...');
|
|
6849
|
+
_context3.next = 2;
|
|
6850
|
+
return poll(data.clientMutationId);
|
|
6851
|
+
case 2:
|
|
6852
|
+
pollResult = _context3.sent;
|
|
6853
|
+
if (pollResult.success) {
|
|
6854
|
+
setOutput("Backup conclu\xEDdo: ".concat(pollResult.output));
|
|
6855
|
+
// Handle download trigger if file info is in jsonExt
|
|
6856
|
+
} else {
|
|
6857
|
+
setError(pollResult.error);
|
|
6858
|
+
}
|
|
6859
|
+
case 3:
|
|
6860
|
+
setLoading(false);
|
|
6861
|
+
return _context3.abrupt("return", {
|
|
6618
6862
|
ok: ok,
|
|
6619
6863
|
data: data
|
|
6620
6864
|
});
|
|
6621
|
-
case
|
|
6865
|
+
case 4:
|
|
6622
6866
|
case "end":
|
|
6623
|
-
return
|
|
6867
|
+
return _context3.stop();
|
|
6624
6868
|
}
|
|
6625
|
-
},
|
|
6869
|
+
}, _callee3);
|
|
6626
6870
|
}));
|
|
6627
6871
|
return _backup.apply(this, arguments);
|
|
6628
6872
|
}
|
|
@@ -6630,7 +6874,7 @@ function useBeneficiarios() {
|
|
|
6630
6874
|
return _limpar.apply(this, arguments);
|
|
6631
6875
|
}
|
|
6632
6876
|
function _limpar() {
|
|
6633
|
-
_limpar = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6877
|
+
_limpar = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
6634
6878
|
var _ref2,
|
|
6635
6879
|
_ref2$dryRun,
|
|
6636
6880
|
dryRun,
|
|
@@ -6639,12 +6883,13 @@ function useBeneficiarios() {
|
|
|
6639
6883
|
_yield$request2,
|
|
6640
6884
|
ok,
|
|
6641
6885
|
data,
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6886
|
+
pollResult,
|
|
6887
|
+
_args4 = arguments;
|
|
6888
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
6889
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
6645
6890
|
case 0:
|
|
6646
|
-
_ref2 =
|
|
6647
|
-
|
|
6891
|
+
_ref2 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref2$dryRun = _ref2.dryRun, dryRun = _ref2$dryRun === void 0 ? true : _ref2$dryRun, _ref2$forceSkipFinanc = _ref2.forceSkipFinancial, forceSkipFinancial = _ref2$forceSkipFinanc === void 0 ? false : _ref2$forceSkipFinanc;
|
|
6892
|
+
_context4.next = 1;
|
|
6648
6893
|
return request('/limpar/', {
|
|
6649
6894
|
body: {
|
|
6650
6895
|
username: 'admin',
|
|
@@ -6653,27 +6898,42 @@ function useBeneficiarios() {
|
|
|
6653
6898
|
}
|
|
6654
6899
|
});
|
|
6655
6900
|
case 1:
|
|
6656
|
-
_yield$request2 =
|
|
6901
|
+
_yield$request2 = _context4.sent;
|
|
6657
6902
|
ok = _yield$request2.ok;
|
|
6658
6903
|
data = _yield$request2.data;
|
|
6659
|
-
if (ok)
|
|
6660
|
-
|
|
6904
|
+
if (!ok) {
|
|
6905
|
+
_context4.next = 3;
|
|
6906
|
+
break;
|
|
6907
|
+
}
|
|
6908
|
+
setOutput('Limpeza iniciada. A aguardar conclusão...');
|
|
6909
|
+
_context4.next = 2;
|
|
6910
|
+
return poll(data.clientMutationId);
|
|
6911
|
+
case 2:
|
|
6912
|
+
pollResult = _context4.sent;
|
|
6913
|
+
if (pollResult.success) {
|
|
6914
|
+
setOutput(pollResult.output);
|
|
6915
|
+
} else {
|
|
6916
|
+
setError(pollResult.error);
|
|
6917
|
+
}
|
|
6918
|
+
case 3:
|
|
6919
|
+
setLoading(false);
|
|
6920
|
+
return _context4.abrupt("return", {
|
|
6661
6921
|
ok: ok,
|
|
6662
6922
|
data: data
|
|
6663
6923
|
});
|
|
6664
|
-
case
|
|
6924
|
+
case 4:
|
|
6665
6925
|
case "end":
|
|
6666
|
-
return
|
|
6926
|
+
return _context4.stop();
|
|
6667
6927
|
}
|
|
6668
|
-
},
|
|
6928
|
+
}, _callee4);
|
|
6669
6929
|
}));
|
|
6670
6930
|
return _limpar.apply(this, arguments);
|
|
6671
6931
|
}
|
|
6672
|
-
function importar(
|
|
6932
|
+
function importar(_x3) {
|
|
6673
6933
|
return _importar.apply(this, arguments);
|
|
6674
6934
|
}
|
|
6675
6935
|
function _importar() {
|
|
6676
|
-
_importar = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
6936
|
+
_importar = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(file) {
|
|
6677
6937
|
var _ref3,
|
|
6678
6938
|
_ref3$dryRun,
|
|
6679
6939
|
dryRun,
|
|
@@ -6685,11 +6945,12 @@ function useBeneficiarios() {
|
|
|
6685
6945
|
_yield$request3,
|
|
6686
6946
|
ok,
|
|
6687
6947
|
data,
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6948
|
+
pollResult,
|
|
6949
|
+
_args5 = arguments;
|
|
6950
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
6951
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
6691
6952
|
case 0:
|
|
6692
|
-
_ref3 =
|
|
6953
|
+
_ref3 = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {}, _ref3$dryRun = _ref3.dryRun, dryRun = _ref3$dryRun === void 0 ? false : _ref3$dryRun, payrollId = _ref3.payrollId, benefitPlanId = _ref3.benefitPlanId, benefitType = _ref3.benefitType, sheet = _ref3.sheet;
|
|
6693
6954
|
fd = new FormData();
|
|
6694
6955
|
fd.append('file', file);
|
|
6695
6956
|
fd.append('username', 'admin');
|
|
@@ -6698,33 +6959,48 @@ function useBeneficiarios() {
|
|
|
6698
6959
|
if (benefitPlanId) fd.append('benefit_plan_id', benefitPlanId);
|
|
6699
6960
|
if (benefitType) fd.append('benefit_type', benefitType);
|
|
6700
6961
|
if (sheet) fd.append('sheet', sheet);
|
|
6701
|
-
|
|
6962
|
+
_context5.next = 1;
|
|
6702
6963
|
return request('/importar/', {
|
|
6703
6964
|
multipart: true,
|
|
6704
6965
|
body: fd
|
|
6705
6966
|
});
|
|
6706
6967
|
case 1:
|
|
6707
|
-
_yield$request3 =
|
|
6968
|
+
_yield$request3 = _context5.sent;
|
|
6708
6969
|
ok = _yield$request3.ok;
|
|
6709
6970
|
data = _yield$request3.data;
|
|
6710
|
-
if (ok)
|
|
6711
|
-
|
|
6971
|
+
if (!ok) {
|
|
6972
|
+
_context5.next = 3;
|
|
6973
|
+
break;
|
|
6974
|
+
}
|
|
6975
|
+
setOutput('Importação iniciada. A aguardar conclusão...');
|
|
6976
|
+
_context5.next = 2;
|
|
6977
|
+
return poll(data.clientMutationId);
|
|
6978
|
+
case 2:
|
|
6979
|
+
pollResult = _context5.sent;
|
|
6980
|
+
if (pollResult.success) {
|
|
6981
|
+
setOutput(pollResult.output);
|
|
6982
|
+
} else {
|
|
6983
|
+
setError(pollResult.error);
|
|
6984
|
+
}
|
|
6985
|
+
case 3:
|
|
6986
|
+
setLoading(false);
|
|
6987
|
+
return _context5.abrupt("return", {
|
|
6712
6988
|
ok: ok,
|
|
6713
6989
|
data: data
|
|
6714
6990
|
});
|
|
6715
|
-
case
|
|
6991
|
+
case 4:
|
|
6716
6992
|
case "end":
|
|
6717
|
-
return
|
|
6993
|
+
return _context5.stop();
|
|
6718
6994
|
}
|
|
6719
|
-
},
|
|
6995
|
+
}, _callee5);
|
|
6720
6996
|
}));
|
|
6721
6997
|
return _importar.apply(this, arguments);
|
|
6722
6998
|
}
|
|
6723
|
-
function restore(
|
|
6999
|
+
function restore(_x4) {
|
|
6724
7000
|
return _restore.apply(this, arguments);
|
|
6725
7001
|
}
|
|
6726
7002
|
function _restore() {
|
|
6727
|
-
_restore = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
7003
|
+
_restore = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(file) {
|
|
6728
7004
|
var _ref4,
|
|
6729
7005
|
_ref4$dryRun,
|
|
6730
7006
|
dryRun,
|
|
@@ -6734,35 +7010,51 @@ function useBeneficiarios() {
|
|
|
6734
7010
|
_yield$request4,
|
|
6735
7011
|
ok,
|
|
6736
7012
|
data,
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
7013
|
+
pollResult,
|
|
7014
|
+
_args6 = arguments;
|
|
7015
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
7016
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
6740
7017
|
case 0:
|
|
6741
|
-
_ref4 =
|
|
7018
|
+
_ref4 = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {}, _ref4$dryRun = _ref4.dryRun, dryRun = _ref4$dryRun === void 0 ? true : _ref4$dryRun, _ref4$skipPhases = _ref4.skipPhases, skipPhases = _ref4$skipPhases === void 0 ? [] : _ref4$skipPhases;
|
|
6742
7019
|
fd = new FormData();
|
|
6743
7020
|
fd.append('file', file);
|
|
6744
7021
|
fd.append('username', 'admin');
|
|
6745
7022
|
fd.append('dry_run', String(dryRun));
|
|
6746
7023
|
if (skipPhases.length) fd.append('skip_phases', skipPhases.join(','));
|
|
6747
|
-
|
|
7024
|
+
_context6.next = 1;
|
|
6748
7025
|
return request('/restore/', {
|
|
6749
7026
|
multipart: true,
|
|
6750
7027
|
body: fd
|
|
6751
7028
|
});
|
|
6752
7029
|
case 1:
|
|
6753
|
-
_yield$request4 =
|
|
7030
|
+
_yield$request4 = _context6.sent;
|
|
6754
7031
|
ok = _yield$request4.ok;
|
|
6755
7032
|
data = _yield$request4.data;
|
|
6756
|
-
if (ok)
|
|
6757
|
-
|
|
7033
|
+
if (!ok) {
|
|
7034
|
+
_context6.next = 3;
|
|
7035
|
+
break;
|
|
7036
|
+
}
|
|
7037
|
+
setOutput('Restore iniciado. A aguardar conclusão...');
|
|
7038
|
+
_context6.next = 2;
|
|
7039
|
+
return poll(data.clientMutationId);
|
|
7040
|
+
case 2:
|
|
7041
|
+
pollResult = _context6.sent;
|
|
7042
|
+
if (pollResult.success) {
|
|
7043
|
+
setOutput(pollResult.output);
|
|
7044
|
+
} else {
|
|
7045
|
+
setError(pollResult.error);
|
|
7046
|
+
}
|
|
7047
|
+
case 3:
|
|
7048
|
+
setLoading(false);
|
|
7049
|
+
return _context6.abrupt("return", {
|
|
6758
7050
|
ok: ok,
|
|
6759
7051
|
data: data
|
|
6760
7052
|
});
|
|
6761
|
-
case
|
|
7053
|
+
case 4:
|
|
6762
7054
|
case "end":
|
|
6763
|
-
return
|
|
7055
|
+
return _context6.stop();
|
|
6764
7056
|
}
|
|
6765
|
-
},
|
|
7057
|
+
}, _callee6);
|
|
6766
7058
|
}));
|
|
6767
7059
|
return _restore.apply(this, arguments);
|
|
6768
7060
|
}
|