From 7e24a7eee9b2694f31edb258fa01d5fa843517d0 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Thu, 24 Oct 2024 09:55:56 +0200 Subject: [PATCH] - added filter for displaying bando documents; --- src/pages/BandoEdit/index.js | 16 ++++++++++++---- src/pages/BandoView/index.js | 2 +- src/pages/BandoViewBeneficiario/index.js | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/pages/BandoEdit/index.js b/src/pages/BandoEdit/index.js index 7ca869d..68b2620 100644 --- a/src/pages/BandoEdit/index.js +++ b/src/pages/BandoEdit/index.js @@ -78,7 +78,7 @@ const BandoEdit = () => { const validateCallback = (data) => { if (data.status === 'SUCCESS') { - setData({...data, status: data.data.status}); + setData({ ...data, status: data.data.status }); if (bandoMsgs.current) { bandoMsgs.current.show([ { @@ -141,6 +141,10 @@ const BandoEdit = () => { detail: __('Pubblicato!', 'gepafin') }); } + if (data.data.docs) { + data.data.docs = data.data.docs + .filter(o => o.source === 'CALL' && o.type === 'DOCUMENT'); + } setData(data.data); } storeSet.main.unsetAsyncRequest(); @@ -179,7 +183,10 @@ const BandoEdit = () => { ]); } } - + if (data.data.docs) { + data.data.docs = data.data.docs + .filter(o => o.source === 'CALL' && o.type === 'DOCUMENT'); + } setData(data.data); } storeSet.main.unsetAsyncRequest(); @@ -236,7 +243,8 @@ const BandoEdit = () => { } } else { BandoService.getBando(id, getCallback, errGetCallback); - FormsService.getFormsForCall(id, getFormsCallback, () => {}); + FormsService.getFormsForCall(id, getFormsCallback, () => { + }); } }, [id]); @@ -263,7 +271,7 @@ const BandoEdit = () => {
- + {!isEmpty(data) ? <> diff --git a/src/pages/BandoView/index.js b/src/pages/BandoView/index.js index 2132270..1157178 100644 --- a/src/pages/BandoView/index.js +++ b/src/pages/BandoView/index.js @@ -177,7 +177,7 @@ const BandoView = () => {
    {data.docs - .filter(o => o.source === 'CALL') + .filter(o => o.source === 'CALL' && o.type === 'DOCUMENT') .map((o, i) =>
  • {o.name}
  • )} diff --git a/src/pages/BandoViewBeneficiario/index.js b/src/pages/BandoViewBeneficiario/index.js index d539b56..1d6ca0f 100644 --- a/src/pages/BandoViewBeneficiario/index.js +++ b/src/pages/BandoViewBeneficiario/index.js @@ -328,7 +328,7 @@ const BandoViewBeneficiario = () => {
      {data.docs - .filter(o => o.source === 'CALL') + .filter(o => o.source === 'CALL' && o.type === 'DOCUMENT') .map((o, i) =>
    • {o.name}
    • )}