@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.es.js CHANGED
@@ -5812,10 +5812,51 @@ function BistpPaymentStatusPanel(_ref3) {
5812
5812
  var modulesManager = useModulesManager();
5813
5813
  var _useTranslations2 = useTranslations(MODULE_NAME, modulesManager),
5814
5814
  formatMessage = _useTranslations2.formatMessage;
5815
+ var _useState = useState({
5816
+ total: 0,
5817
+ pendentes: 0,
5818
+ enviados: 0,
5819
+ confirmados: 0,
5820
+ rejeitados: 0
5821
+ }),
5822
+ _useState2 = _slicedToArray(_useState, 2),
5823
+ summary = _useState2[0],
5824
+ setSummary = _useState2[1];
5825
+ useEffect(function () {
5826
+ if (payrollUuid) {
5827
+ 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 ";
5828
+
5829
+ // Using fetch directly as suggested in the guide to avoid Redux complications for a simple summary
5830
+ fetch('/api/graphql', {
5831
+ method: 'POST',
5832
+ headers: {
5833
+ 'Content-Type': 'application/json',
5834
+ 'Authorization': "Bearer ".concat(localStorage.getItem('token'))
5835
+ },
5836
+ body: JSON.stringify({
5837
+ query: query,
5838
+ variables: {
5839
+ payrollId: payrollUuid
5840
+ }
5841
+ })
5842
+ }).then(function (response) {
5843
+ return response.json();
5844
+ }).then(function (result) {
5845
+ if (result.data) {
5846
+ setSummary({
5847
+ total: result.data.total.totalCount,
5848
+ pendentes: result.data.pendentes.totalCount,
5849
+ enviados: result.data.enviados.totalCount,
5850
+ confirmados: result.data.confirmados.totalCount,
5851
+ rejeitados: result.data.rejeitados.totalCount
5852
+ });
5853
+ }
5854
+ });
5855
+ }
5856
+ }, [payrollUuid]);
5815
5857
  if ((payroll === null || payroll === void 0 ? void 0 : payroll.paymentMethod) !== PAYMENT_METHOD.STRATEGY_BISTP_PAYMENT) return null;
5816
- var summary = (payroll === null || payroll === void 0 ? void 0 : payroll.bistpSummary) || {};
5817
5858
  var total = summary.total || 0;
5818
- var reconciled = summary.reconciled || 0;
5859
+ var reconciled = summary.confirmados || 0;
5819
5860
  var progress = total > 0 ? Math.min(reconciled / total * 100, 100) : 0;
5820
5861
  return /*#__PURE__*/React.createElement(PublishedComponent, {
5821
5862
  pubRef: "policyHolder.TabPanel",
@@ -5836,23 +5877,19 @@ function BistpPaymentStatusPanel(_ref3) {
5836
5877
  }), /*#__PURE__*/React.createElement(BistpMetric, {
5837
5878
  classes: classes,
5838
5879
  label: formatMessage('payroll.bistp.status.reconciled'),
5839
- value: summary.reconciled || 0
5880
+ value: summary.confirmados || 0
5840
5881
  }), /*#__PURE__*/React.createElement(BistpMetric, {
5841
5882
  classes: classes,
5842
5883
  label: formatMessage('payroll.bistp.status.pending'),
5843
- value: summary.pending || 0
5884
+ value: summary.pendentes || 0
5844
5885
  }), /*#__PURE__*/React.createElement(BistpMetric, {
5845
5886
  classes: classes,
5846
5887
  label: formatMessage('payroll.bistp.status.rejected'),
5847
- value: summary.rejected || 0
5848
- }), /*#__PURE__*/React.createElement(BistpMetric, {
5849
- classes: classes,
5850
- label: formatMessage('payroll.bistp.status.sendFailed'),
5851
- value: summary.sendFailed || 0
5888
+ value: summary.rejeitados || 0
5852
5889
  }), /*#__PURE__*/React.createElement(BistpMetric, {
5853
5890
  classes: classes,
5854
- label: formatMessage('payroll.bistp.status.skippedNib'),
5855
- value: summary.skippedNib || 0
5891
+ label: formatMessage('payroll.bistp.status.enviados'),
5892
+ value: summary.enviados || 0
5856
5893
  })), /*#__PURE__*/React.createElement("div", {
5857
5894
  className: classes.progress
5858
5895
  }, /*#__PURE__*/React.createElement(Typography, {