Ja se creen usuaris amb Codis. També funciona l'act_abs
This commit is contained in:
parent
a7b3ba7cb5
commit
2cefdc58aa
@ -330,9 +330,29 @@ export const Codis = () => {
|
|||||||
borderRadius: `.4em`,
|
borderRadius: `.4em`,
|
||||||
padding: `4px`,
|
padding: `4px`,
|
||||||
listStyle: `none`,
|
listStyle: `none`,
|
||||||
backgroundColor: `${'lightgreen' || 'lightcoral'}`
|
backgroundColor: `${'lightgreen' || 'lightcoral'}`,
|
||||||
|
position: `relative`
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
width: `5px`,
|
||||||
|
border: `1px solid #fffa`,
|
||||||
|
position: `absolute`,
|
||||||
|
borderRadius: `50%`,
|
||||||
|
height: `5px`,
|
||||||
|
right: `2px`,
|
||||||
|
top: `2px`,
|
||||||
|
boxShadow: `0 0 14px 5px ${cod.act_abs === "on" ? "lime" : "red"}`,
|
||||||
|
backgroundColor: `${cod.act_abs === "on" ? "lime" : "red"}`
|
||||||
|
}}
|
||||||
|
onClick={ev => {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
Meteor.callAsync('modActivacioAbsolutaCodi', cod);
|
||||||
|
}}
|
||||||
|
></span>
|
||||||
{cod.codi}
|
{cod.codi}
|
||||||
{/* {esEditor && <button onClick={() => {setAmbitSeleccionat({value: cod, label: cod})}}>Edita</button>} */}
|
{/* {esEditor && <button onClick={() => {setAmbitSeleccionat({value: cod, label: cod})}}>Edita</button>} */}
|
||||||
</li>)
|
</li>)
|
||||||
|
|||||||
@ -431,14 +431,22 @@ Meteor.methods({
|
|||||||
|
|
||||||
'creaUsuariAmbCodi': async function (uObj, codi) {
|
'creaUsuariAmbCodi': async function (uObj, codi) {
|
||||||
|
|
||||||
const codiObj = await CodisCollection.find({codi}).fetchAsync();
|
const codiObj = await CodisCollection.findOneAsync({codi});
|
||||||
|
|
||||||
|
|
||||||
const userId = await Accounts.createUserAsync(uObj);
|
const userId = await Accounts.createUserAsync(uObj);
|
||||||
|
|
||||||
const ara = new Date();
|
const ara = new Date();
|
||||||
const dataIni = codiObj.act_cond === "on" ? new Date(codiObj.periode_validesa_ini) : null;
|
let dataIni, dataFi;
|
||||||
const dataFi = codiObj.act_cond === "on" ? new Date(codiObj.periode_validesa_fi) : null;
|
|
||||||
|
console.log("codiObj.periode_validesa_ini: ", await codiObj.periode_validesa_ini);
|
||||||
|
|
||||||
|
if (codiObj.act_cond === "on") {
|
||||||
|
dataIni = new Date(await codiObj.periode_validesa_ini);
|
||||||
|
dataFi = new Date(await codiObj.periode_validesa_fi);
|
||||||
|
}
|
||||||
|
// const dataIni = codiObj.act_cond === "on" ? new Date(codiObj.periode_validesa_ini) : null;
|
||||||
|
// const dataFi = codiObj.act_cond === "on" ? new Date(codiObj.periode_validesa_fi) : null;
|
||||||
|
|
||||||
console.log("codiObj: ", codiObj);
|
console.log("codiObj: ", codiObj);
|
||||||
console.log("ara: ", ara);
|
console.log("ara: ", ara);
|
||||||
@ -462,9 +470,14 @@ Meteor.methods({
|
|||||||
'usaCodiAmbUsuari': async function (userId, codi) {
|
'usaCodiAmbUsuari': async function (userId, codi) {
|
||||||
// const esAdmin = await Roles.userIsInRoleAsync(Meteor.userId(), "admin");
|
// const esAdmin = await Roles.userIsInRoleAsync(Meteor.userId(), "admin");
|
||||||
const codiObj = await CodisCollection.find({codi}).fetchAsync();
|
const codiObj = await CodisCollection.find({codi}).fetchAsync();
|
||||||
|
|
||||||
const ara = new Date();
|
const ara = new Date();
|
||||||
const dataIni = codiObj.act_cond === "on" ? new Date(codiObj.periode_validesa_ini) : null;
|
let dataIni, dataFi;
|
||||||
const dataFi = codiObj.act_cond === "on" ? new Date(codiObj.periode_validesa_fi) : null;
|
|
||||||
|
if (codiObj.act_cond === "on") {
|
||||||
|
dataIni = new Date(codiObj.periode_validesa_ini);
|
||||||
|
dataFi = new Date(codiObj.periode_validesa_fi);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -501,6 +514,19 @@ Meteor.methods({
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'modActivacioAbsolutaCodi': async function (cod) {
|
||||||
|
|
||||||
|
console.log("modActivacioAbsolutaCodi: ", cod);
|
||||||
|
|
||||||
|
return await CodisCollection.updateAsync(
|
||||||
|
{ _id: cod._id },
|
||||||
|
{ $set: {
|
||||||
|
...cod,
|
||||||
|
'act_abs': cod.act_abs === "on" ? null : "on"
|
||||||
|
}}
|
||||||
|
)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
Loading…
Reference in New Issue
Block a user