@stssocialst-stp/fe-payroll 0.3.0 → 0.3.2

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.js CHANGED
@@ -5856,10 +5856,51 @@ function BistpPaymentStatusPanel(_ref3) {
5856
5856
  var modulesManager = feCore.useModulesManager();
5857
5857
  var _useTranslations2 = feCore.useTranslations(MODULE_NAME, modulesManager),
5858
5858
  formatMessage = _useTranslations2.formatMessage;
5859
+ var _useState = React.useState({
5860
+ total: 0,
5861
+ pendentes: 0,
5862
+ enviados: 0,
5863
+ confirmados: 0,
5864
+ rejeitados: 0
5865
+ }),
5866
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
5867
+ summary = _useState2[0],
5868
+ setSummary = _useState2[1];
5869
+ React.useEffect(function () {
5870
+ if (payrollUuid) {
5871
+ var query = "\n query ResumoPagamentos($payrollId: UUID!) {\n total: benefitConsumptionByPayroll(payrollUuid: $payrollId, first: 0) { totalCount }\n pendentes: benefitConsumptionByPayroll(payrollUuid: $payrollId, status: \"ACCEPTED\", first: 0) { totalCount }\n enviados: benefitConsumptionByPayroll(payrollUuid: $payrollId, status: \"APPROVE_FOR_PAYMENT\", first: 0) { totalCount }\n confirmados: benefitConsumptionByPayroll(payrollUuid: $payrollId, status: \"RECONCILED\", first: 0) { totalCount }\n rejeitados: benefitConsumptionByPayroll(payrollUuid: $payrollId, status: \"REJECTED\", first: 0) { totalCount }\n }\n ";
5872
+
5873
+ // Using fetch directly as suggested in the guide to avoid Redux complications for a simple summary
5874
+ fetch('/api/graphql', {
5875
+ method: 'POST',
5876
+ headers: {
5877
+ 'Content-Type': 'application/json',
5878
+ 'Authorization': "Bearer ".concat(localStorage.getItem('token'))
5879
+ },
5880
+ body: JSON.stringify({
5881
+ query: query,
5882
+ variables: {
5883
+ payrollId: payrollUuid
5884
+ }
5885
+ })
5886
+ }).then(function (response) {
5887
+ return response.json();
5888
+ }).then(function (result) {
5889
+ if (result.data) {
5890
+ setSummary({
5891
+ total: result.data.total.totalCount,
5892
+ pendentes: result.data.pendentes.totalCount,
5893
+ enviados: result.data.enviados.totalCount,
5894
+ confirmados: result.data.confirmados.totalCount,
5895
+ rejeitados: result.data.rejeitados.totalCount
5896
+ });
5897
+ }
5898
+ });
5899
+ }
5900
+ }, [payrollUuid]);
5859
5901
  if ((payroll === null || payroll === void 0 ? void 0 : payroll.paymentMethod) !== PAYMENT_METHOD.STRATEGY_BISTP_PAYMENT) return null;
5860
- var summary = (payroll === null || payroll === void 0 ? void 0 : payroll.bistpSummary) || {};
5861
5902
  var total = summary.total || 0;
5862
- var reconciled = summary.reconciled || 0;
5903
+ var reconciled = summary.confirmados || 0;
5863
5904
  var progress = total > 0 ? Math.min(reconciled / total * 100, 100) : 0;
5864
5905
  return /*#__PURE__*/React__default["default"].createElement(feCore.PublishedComponent, {
5865
5906
  pubRef: "policyHolder.TabPanel",
@@ -5880,23 +5921,19 @@ function BistpPaymentStatusPanel(_ref3) {
5880
5921
  }), /*#__PURE__*/React__default["default"].createElement(BistpMetric, {
5881
5922
  classes: classes,
5882
5923
  label: formatMessage('payroll.bistp.status.reconciled'),
5883
- value: summary.reconciled || 0
5924
+ value: summary.confirmados || 0
5884
5925
  }), /*#__PURE__*/React__default["default"].createElement(BistpMetric, {
5885
5926
  classes: classes,
5886
5927
  label: formatMessage('payroll.bistp.status.pending'),
5887
- value: summary.pending || 0
5928
+ value: summary.pendentes || 0
5888
5929
  }), /*#__PURE__*/React__default["default"].createElement(BistpMetric, {
5889
5930
  classes: classes,
5890
5931
  label: formatMessage('payroll.bistp.status.rejected'),
5891
- value: summary.rejected || 0
5892
- }), /*#__PURE__*/React__default["default"].createElement(BistpMetric, {
5893
- classes: classes,
5894
- label: formatMessage('payroll.bistp.status.sendFailed'),
5895
- value: summary.sendFailed || 0
5932
+ value: summary.rejeitados || 0
5896
5933
  }), /*#__PURE__*/React__default["default"].createElement(BistpMetric, {
5897
5934
  classes: classes,
5898
- label: formatMessage('payroll.bistp.status.skippedNib'),
5899
- value: summary.skippedNib || 0
5935
+ label: formatMessage('payroll.bistp.status.enviados'),
5936
+ value: summary.enviados || 0
5900
5937
  })), /*#__PURE__*/React__default["default"].createElement("div", {
5901
5938
  className: classes.progress
5902
5939
  }, /*#__PURE__*/React__default["default"].createElement(core.Typography, {