diff --git a/client/main.jsx b/client/main.jsx
index d2e380f..a9f7af3 100644
--- a/client/main.jsx
+++ b/client/main.jsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, {StrictMode} from 'react';
import { createRoot } from 'react-dom/client';
import { Meteor } from 'meteor/meteor';
import { App } from '/imports/ui/App';
@@ -6,5 +6,7 @@ import { App } from '/imports/ui/App';
Meteor.startup(() => {
const container = document.getElementById('react-target');
const root = createRoot(container);
- root.render();
+ root.render(
+
+ );
});
diff --git a/imports/ui/Pobles.jsx b/imports/ui/Pobles.jsx
index e6acc93..bacdebb 100644
--- a/imports/ui/Pobles.jsx
+++ b/imports/ui/Pobles.jsx
@@ -10,7 +10,203 @@ import { Link } from 'react-router-dom';
import { NecessitatsCollection } from '../api/necessitats';
+const QuadreInfo_Poble = ({esEditor, pobleSeleccionat, setPobleSeleccionat}) => {
+
+ const refInAmbitAssignat = useRef();
+ return
+
+ {pobleSeleccionat &&
{pobleSeleccionat._id}
}
+
+
+ ;
+};
+
+const BotoPobleAmbIndicadors = ({pob, pobleSeleccionat, setPobleSeleccionat, esEditor}) => {
+ // let pob = pobleSeleccionat;
+ useSubscribe('necessitats', pob.ambitAssociat);
+ const necessitats = useFind(NecessitatsCollection, [{"poble.ambitAssociat": pob.ambitAssociat}]);
+ const [monitors, setMonitors] = useState(false);
+ const [encarregats, setEncarregats] = useState(false);
+ const [voluntaris, setVoluntaris] = useState(false);
+
+ // let mon, mons, enc, encs, vol, vols;
+
+ (async () => {
+ const mons = await Roles.getUsersInRoleAsync("monitor_de_poble", pob?.ambitAssociat);
+ // console.log("monitors: ", monitors);
+ setMonitors(mons?.fetch().length || false);
+
+ const encs = await Roles.getUsersInRoleAsync("encarregat_de_tasques", pob?.ambitAssociat);
+ // console.log("monitors: ", monitors);
+ setEncarregats(encs?.fetch().length || false);
+
+ const vols = await Roles.getUsersInRoleAsync("voluntari_de_poble", pob?.ambitAssociat);
+ // console.log("monitors: ", monitors);
+ setVoluntaris(vols?.fetch().length || false);
+ })();
+
+ return
+ {// Indicadors de Responsables
+
+ {
+ monitors
+ ? {monitors}
+ : false
+ }
+ { encarregats
+ ? {encarregats}
+ : false
+ }
+ { voluntaris
+ ? {voluntaris}
+ : false
+ }
+
+ }
+
+ {// Indicadors de Necessitats
+
+ {
+ necessitats.length
+ ?
+ {necessitats.length }
+ : false
+ }
+
+ }
+
+ {// Botó de creació de nou poble
+
+ {pob.nomPoble} {esEditor && }
+
+ }
+ ;
+}
export const Pobles = () => {
@@ -36,201 +232,10 @@ export const Pobles = () => {
}, []);
// })();
- const BotoPobleAmbIndicadors = ({pob}) => {
- useSubscribe('necessitats', pob.ambitAssociat);
- const necessitats = useFind(NecessitatsCollection, [{"poble.ambitAssociat": pob.ambitAssociat}]);
- const [monitors, setMonitors] = useState(false);
- const [encarregats, setEncarregats] = useState(false);
- const [voluntaris, setVoluntaris] = useState(false);
-
- // let mon, mons, enc, encs, vol, vols;
-
- (async () => {
- const mons = await Roles.getUsersInRoleAsync("monitor_de_poble", pob?.ambitAssociat);
- // console.log("monitors: ", monitors);
- setMonitors(mons?.fetch().length || false);
-
- const encs = await Roles.getUsersInRoleAsync("encarregat_de_tasques", pob?.ambitAssociat);
- // console.log("monitors: ", monitors);
- setEncarregats(encs?.fetch().length || false);
-
- const vols = await Roles.getUsersInRoleAsync("voluntari_de_poble", pob?.ambitAssociat);
- // console.log("monitors: ", monitors);
- setVoluntaris(vols?.fetch().length || false);
- })();
-
- return
- {// Indicadors de Responsables
-
- {
- monitors
- ? {monitors}
- : false
- }
- { encarregats
- ? {encarregats}
- : false
- }
- { voluntaris
- ? {voluntaris}
- : false
- }
-
- }
-
- {// Indicadors de Necessitats
-
- {
- necessitats.length
- ?
- {necessitats.length }
- : false
- }
-
- }
-
- {// Botó de creació de nou poble
-
- {pob.nomPoble} {esEditor && }
-
- }
- ;
- }
- const QuadreInfo_Poble = () => {
-
- const refInAmbitAssignat = useRef();
-
- return
-
- {pobleSeleccionat &&
{pobleSeleccionat._id}
}
-
-
- ;
- };
+
+
// const Indicador = ({valor, ambit, }) => {
@@ -240,7 +245,7 @@ export const Pobles = () => {
Pobles
- { esEditor && (pobleSeleccionat || creantPoble) && }
+ { esEditor && (pobleSeleccionat || creantPoble) && }
{
pobles
.sort((a,b) => a.nomPoble?.toLowerCase() > b.nomPoble?.toLowerCase())
.map(pob => {
- return
+ return
})
}