added restrictions
This commit is contained in:
Generated
+12
-1
@@ -1324,6 +1324,7 @@
|
||||
"integrity": "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"csstype": "^3.0.2"
|
||||
}
|
||||
@@ -1384,6 +1385,7 @@
|
||||
"integrity": "sha512-BnOroVl1SgrPLywqxyqdJ4l3S2MsKVLDVxZvjI1Eoe8ev2r3kGDo+PcMihNmDE+6/KjkTubSJnmqGZZjQSBq/g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.46.2",
|
||||
"@typescript-eslint/types": "8.46.2",
|
||||
@@ -1923,6 +1925,7 @@
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -2502,7 +2505,8 @@
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/cwise-compiler": {
|
||||
"version": "1.1.3",
|
||||
@@ -2908,6 +2912,7 @@
|
||||
"integrity": "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.8.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
@@ -3081,6 +3086,7 @@
|
||||
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@rtsao/scc": "^1.1.0",
|
||||
"array-includes": "^3.1.9",
|
||||
@@ -5238,6 +5244,7 @@
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz",
|
||||
"integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -5247,6 +5254,7 @@
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz",
|
||||
"integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"scheduler": "^0.26.0"
|
||||
},
|
||||
@@ -5537,6 +5545,7 @@
|
||||
"integrity": "sha512-t+YPtOQHpGW1QWsh1CHQ5cPIr9lbbGZLZnbihP/D/qZj/yuV68m8qarcV17nvkOX81BCrvzAlq2klCQFZghyTg==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"chokidar": "^4.0.0",
|
||||
"immutable": "^5.0.2",
|
||||
@@ -6049,6 +6058,7 @@
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@@ -6238,6 +6248,7 @@
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
||||
@@ -234,6 +234,58 @@ export default function Page() {
|
||||
};
|
||||
|
||||
const handleGuardar = async () => {
|
||||
|
||||
if (!formData.inventario) {
|
||||
toast.error("Inventario no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_marca) {
|
||||
toast.error("marca no encontrada");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_tipo_equipo) {
|
||||
toast.error("Tipo de equipo no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_estado) {
|
||||
toast.error("estado no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_uso) {
|
||||
toast.error("tipo de uso no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_adscripcion) {
|
||||
toast.error("adscripcion no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (formData.id_tipo_equipo == 9) {
|
||||
if (!formData.id_periferico) {
|
||||
toast.error("Periferico no encontrado");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(formData.id_tipo_equipo != 8 && formData.id_tipo_equipo != 7 && formData.id_tipo_equipo != 9){
|
||||
if (!formData.id_sistema_operativo) {
|
||||
toast.error("Sistema operativo no encontrado ");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (formData.id_tipo_equipo != 9) {
|
||||
if (!formData.id_procesador) {
|
||||
toast.error("Procesador no encontrado");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function Editar() {
|
||||
lugar: "",
|
||||
observaciones: "",
|
||||
responsable: "",
|
||||
periferico: "",
|
||||
id_periferico: 0,
|
||||
fechaFactura: "",
|
||||
});
|
||||
|
||||
@@ -228,7 +228,7 @@ export default function Editar() {
|
||||
observaciones: equipo.observaciones || "",
|
||||
id_adscripcion: equipo.adscripcion?.id_adscripcion || 0,
|
||||
lugar: equipo.lugar || "",
|
||||
periferico: equipo.periferico?.periferico || "",
|
||||
id_periferico: equipo.periferico?.id_periferico || 0,
|
||||
fechaFactura: equipo.fechaFactura || "",
|
||||
responsable,
|
||||
});
|
||||
@@ -282,6 +282,59 @@ export default function Editar() {
|
||||
}, [formData.id_tipo_equipo]);
|
||||
|
||||
const handleGuardar = async () => {
|
||||
|
||||
|
||||
if (!formData.inventario) {
|
||||
toast.error("Inventario no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_marca) {
|
||||
toast.error("marca no encontrada");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_tipo_equipo) {
|
||||
toast.error("Tipo de equipo no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_estado) {
|
||||
toast.error("estado no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_uso) {
|
||||
toast.error("tipo de uso no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formData.id_adscripcion) {
|
||||
toast.error("adscripcion no encontrado");
|
||||
return;
|
||||
}
|
||||
|
||||
if (formData.id_tipo_equipo == 9) {
|
||||
if (!formData.id_periferico) {
|
||||
toast.error("Periferico no encontrado");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(formData.id_tipo_equipo != 8 && formData.id_tipo_equipo != 7 && formData.id_tipo_equipo != 9){
|
||||
if (!formData.id_sistema_operativo) {
|
||||
toast.error("Sistema operativo no encontrado ");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (formData.id_tipo_equipo != 9) {
|
||||
if (!formData.id_procesador) {
|
||||
toast.error("Procesador no encontrado");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
|
||||
@@ -562,14 +615,14 @@ export default function Editar() {
|
||||
<div className="formGroup">
|
||||
<label>Tipos de Periféricos</label>
|
||||
<select
|
||||
value={formData.periferico || ""}
|
||||
value={formData.id_periferico || 0}
|
||||
onChange={(e) =>
|
||||
handleInputChange("tipoPeriferico", e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Selecciona periférico</option>
|
||||
{perifericos.map((p) => (
|
||||
<option key={p.id_periferico} value={p.periferico}>
|
||||
<option key={p.id_periferico} value={p.id_periferico}>
|
||||
{p.periferico}
|
||||
</option>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user