update
This commit is contained in:
@@ -1005,7 +1005,17 @@ var PERMS = {
|
||||
"supercafe": "SuperCafé",
|
||||
"avisos": "Avisos",
|
||||
"comedor": "Menú comedor",
|
||||
"comedor:edit": "> Editar"
|
||||
};
|
||||
function checkRole(role) {
|
||||
var roles = SUB_LOGGED_IN_DETAILS.Roles || ""
|
||||
var rolesArr = roles.split(",")
|
||||
if (rolesArr.includes("ADMIN") || rolesArr.includes(role) || AC_BYPASS) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
function SetPages() {
|
||||
document.getElementById("appendApps2").innerHTML = ""
|
||||
Object.keys(PAGES).forEach((key) => {
|
||||
|
||||
@@ -4,6 +4,7 @@ PAGES.avisos = {
|
||||
AccessControl: true,
|
||||
Title: "Avisos",
|
||||
edit: function (mid) {
|
||||
if (!checkRole("avisos:edit")) {setUrlHash("index");return}
|
||||
var nameh1 = safeuuid();
|
||||
var field_fecha = safeuuid();
|
||||
var field_asunto = safeuuid();
|
||||
@@ -168,6 +169,7 @@ PAGES.avisos = {
|
||||
};
|
||||
},
|
||||
index: function () {
|
||||
if (!checkRole("avisos")) {setUrlHash("index");return}
|
||||
const tablebody = safeuuid();
|
||||
var btn_new = safeuuid();
|
||||
container.innerHTML = `
|
||||
@@ -212,8 +214,12 @@ PAGES.avisos = {
|
||||
}
|
||||
}
|
||||
);
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("avisos," + safeuuid(""));
|
||||
};
|
||||
if (!checkRole("avisos:edit")) {
|
||||
document.getElementById(btn_new).style.display = "none"
|
||||
} else {
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("avisos," + safeuuid(""));
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -4,6 +4,7 @@ PAGES.comedor = {
|
||||
AccessControl: true,
|
||||
Title: "Menú comedor",
|
||||
edit: function (mid) {
|
||||
if (!checkRole("comedor:edit")) {setUrlHash("index");return}
|
||||
var nameh1 = safeuuid();
|
||||
var field_fecha = safeuuid();
|
||||
var field_platos = safeuuid();
|
||||
@@ -77,6 +78,7 @@ PAGES.comedor = {
|
||||
};
|
||||
},
|
||||
index: function () {
|
||||
if (!checkRole("comedor")) {setUrlHash("index");return}
|
||||
const tablebody = safeuuid();
|
||||
var btn_new = safeuuid();
|
||||
container.innerHTML = `
|
||||
@@ -109,8 +111,13 @@ PAGES.comedor = {
|
||||
}
|
||||
}
|
||||
);
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("comedor," + safeuuid(""));
|
||||
};
|
||||
|
||||
if (!checkRole("comedor:edit")) {
|
||||
document.getElementById(btn_new).style.display = "none"
|
||||
} else {
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("comedor," + safeuuid(""));
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ PAGES.materiales = {
|
||||
AccessControl: true,
|
||||
Title: "Materiales",
|
||||
edit: function (mid) {
|
||||
if (!checkRole("materiales:edit")) {setUrlHash("index");return}
|
||||
var nameh1 = safeuuid();
|
||||
var field_nombre = safeuuid();
|
||||
var field_cantidad = safeuuid();
|
||||
@@ -109,6 +110,7 @@ PAGES.materiales = {
|
||||
};
|
||||
},
|
||||
index: function () {
|
||||
if (!checkRole("materiales")) {setUrlHash("index");return}
|
||||
var btn_new = safeuuid();
|
||||
container.innerHTML = `
|
||||
<h1>Materiales</h1>
|
||||
@@ -145,9 +147,12 @@ PAGES.materiales = {
|
||||
undefined,
|
||||
true // Enable global search bar
|
||||
);
|
||||
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("materiales," + safeuuid(""));
|
||||
};
|
||||
if (!checkRole("materiales:edit")) {
|
||||
document.getElementById(btn_new).style.display = "none"
|
||||
} else {
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("materiales," + safeuuid(""));
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ PAGES.personas = {
|
||||
AccessControl: true,
|
||||
Title: "Personas",
|
||||
edit: function (mid) {
|
||||
if (!checkRole("personas:edit")) {setUrlHash("index");return}
|
||||
var nameh1 = safeuuid();
|
||||
var permisosdet = safeuuid();
|
||||
var field_nombre = safeuuid();
|
||||
@@ -146,6 +147,7 @@ PAGES.personas = {
|
||||
};
|
||||
},
|
||||
index: function () {
|
||||
if (!checkRole("personas")) {setUrlHash("index");return}
|
||||
var btn_new = safeuuid();
|
||||
container.innerHTML = `
|
||||
<h1>Personas</h1>
|
||||
@@ -188,9 +190,12 @@ PAGES.personas = {
|
||||
undefined,
|
||||
true // Enable global search bar
|
||||
);
|
||||
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("personas," + safeuuid(""));
|
||||
};
|
||||
if (!checkRole("personas:edit")) {
|
||||
document.getElementById(btn_new).style.display = "none"
|
||||
} else {
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("personas," + safeuuid(""));
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ PAGES.supercafe = {
|
||||
AccessControl: true,
|
||||
Title: "SuperCafé",
|
||||
edit: function (mid) {
|
||||
if (!checkRole("supercafe:edit")) {setUrlHash("index");return}
|
||||
var nameh1 = safeuuid();
|
||||
var field_fecha = safeuuid();
|
||||
var field_persona = safeuuid();
|
||||
@@ -138,6 +139,7 @@ PAGES.supercafe = {
|
||||
};
|
||||
},
|
||||
index: function () {
|
||||
if (!checkRole("supercafe")) {setUrlHash("index");return}
|
||||
var tts = false;
|
||||
var sc_nobtn = "";
|
||||
if (urlParams.get("sc_nobtn") == "yes") {
|
||||
@@ -173,11 +175,7 @@ PAGES.supercafe = {
|
||||
<div id="cont2"></div>
|
||||
</details>
|
||||
`;
|
||||
|
||||
//Todas las comandas
|
||||
TS_IndexElement(
|
||||
"supercafe",
|
||||
[
|
||||
var config = [
|
||||
{
|
||||
key: "Persona",
|
||||
type: "persona",
|
||||
@@ -196,7 +194,33 @@ PAGES.supercafe = {
|
||||
default: "",
|
||||
label: "Comanda",
|
||||
},
|
||||
],
|
||||
]
|
||||
if (!checkRole("supercafe:edit")) {
|
||||
config = [
|
||||
{
|
||||
key: "Persona",
|
||||
type: "persona",
|
||||
default: "",
|
||||
label: "Persona",
|
||||
},
|
||||
{
|
||||
key: "Estado",
|
||||
type: "comanda-status",
|
||||
default: "",
|
||||
label: "Estado",
|
||||
},
|
||||
{
|
||||
key: "Comanda",
|
||||
type: "comanda",
|
||||
default: "",
|
||||
label: "Comanda",
|
||||
},
|
||||
]
|
||||
}
|
||||
//Todas las comandas
|
||||
TS_IndexElement(
|
||||
"supercafe",
|
||||
config,
|
||||
gun.get(TABLE).get("supercafe"),
|
||||
document.querySelector("#cont1"),
|
||||
(data, new_tr) => {
|
||||
@@ -245,26 +269,7 @@ PAGES.supercafe = {
|
||||
//Deudas
|
||||
TS_IndexElement(
|
||||
"supercafe",
|
||||
[
|
||||
{
|
||||
key: "Persona",
|
||||
type: "persona",
|
||||
default: "",
|
||||
label: "Persona",
|
||||
},
|
||||
{
|
||||
key: "Estado",
|
||||
type: "comanda-status",
|
||||
default: "",
|
||||
label: "Estado",
|
||||
},
|
||||
{
|
||||
key: "Comanda",
|
||||
type: "comanda",
|
||||
default: "",
|
||||
label: "Comanda",
|
||||
},
|
||||
],
|
||||
config,
|
||||
gun.get(TABLE).get("supercafe"),
|
||||
document.querySelector("#cont2"),
|
||||
(data, new_tr) => {
|
||||
@@ -309,9 +314,12 @@ PAGES.supercafe = {
|
||||
old[key] = data.Estado;
|
||||
}
|
||||
);
|
||||
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("supercafe," + safeuuid(""));
|
||||
};
|
||||
if (!checkRole("supercafe:edit")) {
|
||||
document.getElementById(btn_new).style.display = "none"
|
||||
} else {
|
||||
document.getElementById(btn_new).onclick = () => {
|
||||
setUrlHash("supercafe," + safeuuid(""));
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user