Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f2a459ba8 | |||
| b0759bcf5c | |||
| 2179ee7d1e | |||
| b150ea3210 | |||
| 1ffcb56863 | |||
| afd4060d20 | |||
| 7e1282a283 | |||
| 597ce41a62 | |||
| 3f23c15239 | |||
| 60a6c6416a | |||
| 48805c093e | |||
| dc75a7b1a7 | |||
| 1de6761d03 | |||
| 13cdfce656 | |||
| 797b3f6815 | |||
| 1219ca1e91 | |||
| 7ee30a6f20 | |||
| 179a968e3e | |||
| bae1f99e5c | |||
| 725bc15f63 | |||
| 2dfeea0cb4 | |||
| 811f5e7c0e | |||
| 7833d38b3e | |||
| 08bca7742b | |||
| 48885dd8e7 | |||
| 7b2f33b2b4 | |||
| c400623c25 | |||
| 6c7be89a01 | |||
| a6ef226bec | |||
| c444b9f37a | |||
| deae0cde7c | |||
| c1a9e5d195 | |||
| 9b203020f6 | |||
| 451915e858 | |||
| 188fb18b51 |
@@ -0,0 +1,85 @@
|
|||||||
|
name: Despliegue Automatizado Universal
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
get-context:
|
||||||
|
runs-on: host
|
||||||
|
outputs:
|
||||||
|
node_version: ${{ steps.setup.outputs.version }}
|
||||||
|
target_app: ${{ steps.setup.outputs.app }}
|
||||||
|
steps:
|
||||||
|
- name: Resolver Aplicación desde apps.conf
|
||||||
|
id: setup
|
||||||
|
run: |
|
||||||
|
# 1. Obtener el nombre del repositorio actual en Gitea (ej: front-Censo)
|
||||||
|
REPO_NAME="${{ github.event.repository.name }}"
|
||||||
|
|
||||||
|
# 2. Determinar si buscamos un entorno -dev (develop) o producción (master)
|
||||||
|
if [ "${{ github.ref_name }}" = "develop" ]; then
|
||||||
|
SUFFIX="-dev"
|
||||||
|
else
|
||||||
|
SUFFIX=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Buscando qué sección de apps.conf tiene REPO=$REPO_NAME y termina en '$SUFFIX'..."
|
||||||
|
|
||||||
|
# 3. Buscar en /etc/apps.conf el bloque que contenga REPO=nombre_del_repo
|
||||||
|
TARGET_APP=$(awk -v repo="REPO=$REPO_NAME" -v suf="$SUFFIX" '
|
||||||
|
/^\[/ { gsub(/[\[\]]/, "", $0); current_box=$0; next }
|
||||||
|
$0 == repo {
|
||||||
|
if ((suf == "-dev" && current_box ~ /-dev$/) || (suf == "" && current_box !~ /-dev$/)) {
|
||||||
|
print current_box;
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' /etc/apps.conf)
|
||||||
|
|
||||||
|
if [ -z "$TARGET_APP" ]; then
|
||||||
|
echo "ERROR: No se encontró ninguna sección en /etc/apps.conf para el repositorio $REPO_NAME con el sufijo correcto."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 4. Leer la versión de Node del bloque encontrado
|
||||||
|
VERSION=$(awk -v app="$TARGET_APP" '
|
||||||
|
$0=="["app"]" { found=1; next }
|
||||||
|
/^\[/ && found { exit }
|
||||||
|
found && /^NODE=/ { split($0, a, "="); print a[2]; exit }
|
||||||
|
' /etc/apps.conf)
|
||||||
|
|
||||||
|
MAJOR_VERSION=$(echo "$VERSION" | tr -d '[:space:]' | grep -oE '[0-9]+' | head -n1)
|
||||||
|
|
||||||
|
echo "-> ID de Aplicación encontrado: $TARGET_APP"
|
||||||
|
echo "-> Versión Mayor de Node resuelta: $MAJOR_VERSION"
|
||||||
|
|
||||||
|
echo "app=${TARGET_APP}" >> $GITHUB_OUTPUT
|
||||||
|
echo "version=${MAJOR_VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
build:
|
||||||
|
needs: get-context
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Configurar Node.js dinámicamente
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ needs.get-context.outputs.node_version }}
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run build
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: [get-context, build]
|
||||||
|
runs-on: host
|
||||||
|
steps:
|
||||||
|
- name: Ejecutar Despliegue en Servidor Físico
|
||||||
|
run: |
|
||||||
|
TARGET_APP="${{ needs.get-context.outputs.target_app }}"
|
||||||
|
BRANCH_NAME="${{ github.ref_name }}"
|
||||||
|
|
||||||
|
sudo -u deploy /home/deploy/scripts/deploy-front.sh "$TARGET_APP" "$BRANCH_NAME"
|
||||||
Generated
+137
-58
@@ -12,18 +12,23 @@
|
|||||||
"@zxing/browser": "^0.1.5",
|
"@zxing/browser": "^0.1.5",
|
||||||
"@zxing/library": "^0.21.3",
|
"@zxing/library": "^0.21.3",
|
||||||
"axios": "^1.13.2",
|
"axios": "^1.13.2",
|
||||||
|
"chart.js": "^4.5.1",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
|
"leaflet": "^1.9.4",
|
||||||
|
"leaflet.heat": "^0.2.0",
|
||||||
"next": "^16.0.7",
|
"next": "^16.0.7",
|
||||||
"react": "19.2.0",
|
"react": "19.2.0",
|
||||||
"react-dom": "19.2.0",
|
"react-dom": "19.2.0",
|
||||||
"react-hot-toast": "^2.6.0",
|
"react-hot-toast": "^2.6.0",
|
||||||
|
"react-leaflet": "^5.0.0",
|
||||||
"react-select": "^5.10.2",
|
"react-select": "^5.10.2",
|
||||||
"recharts": "^3.8.0"
|
"recharts": "^3.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3",
|
"@eslint/eslintrc": "^3",
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
|
"@types/leaflet": "^1.9.21",
|
||||||
"@types/node": "^24",
|
"@types/node": "^24",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
@@ -274,21 +279,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/core": {
|
"node_modules/@emnapi/core": {
|
||||||
"version": "1.7.0",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.1.tgz",
|
||||||
"integrity": "sha512-pJdKGq/1iquWYtv1RRSljZklxHCOCAJFJrImO5ZLKPJVJlVUcs8yFwNQlqS0Lo8xT1VAXXTCZocF9n26FWEKsw==",
|
"integrity": "sha512-mukuNALVsoix/w1BJwFzwXBN/dHeejQtuVzcDsfOEsdpCumXb/E9j8w11h5S54tT1xhifGfbbSm/ICrObRb3KA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emnapi/wasi-threads": "1.1.0",
|
"@emnapi/wasi-threads": "1.2.0",
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/runtime": {
|
"node_modules/@emnapi/runtime": {
|
||||||
"version": "1.7.0",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.1.tgz",
|
||||||
"integrity": "sha512-oAYoQnCYaQZKVS53Fq23ceWMRxq5EhQsE0x0RdQ55jT7wagMu5k+fS39v1fiSLrtrLQlXwVINenqhLMtTrV/1Q==",
|
"integrity": "sha512-VYi5+ZVLhpgK4hQ0TAjiQiZ6ol0oe4mBx7mVv7IflsiEp0OWoVsp/+f9Vc1hOhE0TtkORVrI1GvzyreqpgWtkA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -296,9 +301,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/wasi-threads": {
|
"node_modules/@emnapi/wasi-threads": {
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.0.tgz",
|
||||||
"integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==",
|
"integrity": "sha512-N10dEJNSsUx41Z6pZsXU8FjPjpBEplgH24sfkmITrBED1/U2Esum9F3lfLrMjKHHjmi557zQn7kR9R+XWXu5Rg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
@@ -1174,6 +1179,12 @@
|
|||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@kurkle/color": {
|
||||||
|
"version": "0.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz",
|
||||||
|
"integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@napi-rs/wasm-runtime": {
|
"node_modules/@napi-rs/wasm-runtime": {
|
||||||
"version": "0.2.12",
|
"version": "0.2.12",
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz",
|
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz",
|
||||||
@@ -1188,9 +1199,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/env": {
|
"node_modules/@next/env": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/env/-/env-16.2.0.tgz",
|
||||||
"integrity": "sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ==",
|
"integrity": "sha512-OZIbODWWAi0epQRCRjNe1VO45LOFBzgiyqmTLzIqWq6u1wrxKnAyz1HH6tgY/Mc81YzIjRPoYsPAEr4QV4l9TA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@next/eslint-plugin-next": {
|
"node_modules/@next/eslint-plugin-next": {
|
||||||
@@ -1204,9 +1215,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-darwin-arm64": {
|
"node_modules/@next/swc-darwin-arm64": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.2.0.tgz",
|
||||||
"integrity": "sha512-wTzYulosJr/6nFnqGW7FrG3jfUUlEf8UjGA0/pyypJl42ExdVgC6xJgcXQ+V8QFn6niSG2Pb8+MIG1mZr2vczw==",
|
"integrity": "sha512-/JZsqKzKt01IFoiLLAzlNqys7qk2F3JkcUhj50zuRhKDQkZNOz9E5N6wAQWprXdsvjRP4lTFj+/+36NSv5AwhQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1220,9 +1231,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-darwin-x64": {
|
"node_modules/@next/swc-darwin-x64": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.2.0.tgz",
|
||||||
"integrity": "sha512-BLFPYPDO+MNJsiDWbeVzqvYd4NyuRrEYVB5k2N3JfWncuHAy2IVwMAOlVQDFjj+krkWzhY2apvmekMkfQR0CUQ==",
|
"integrity": "sha512-/hV8erWq4SNlVgglUiW5UmQ5Hwy5EW/AbbXlJCn6zkfKxTy/E/U3V8U1Ocm2YCTUoFgQdoMxRyRMOW5jYy4ygg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1236,9 +1247,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-arm64-gnu": {
|
"node_modules/@next/swc-linux-arm64-gnu": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.2.0.tgz",
|
||||||
"integrity": "sha512-OJYkCd5pj/QloBvoEcJ2XiMnlJkRv9idWA/j0ugSuA34gMT6f5b7vOiCQHVRpvStoZUknhl6/UxOXL4OwtdaBw==",
|
"integrity": "sha512-GkjL/Q7MWOwqWR9zoxu1TIHzkOI2l2BHCf7FzeQG87zPgs+6WDh+oC9Sw9ARuuL/FUk6JNCgKRkA6rEQYadUaw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1252,9 +1263,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-arm64-musl": {
|
"node_modules/@next/swc-linux-arm64-musl": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.2.0.tgz",
|
||||||
"integrity": "sha512-S4J2v+8tT3NIO9u2q+S0G5KdvNDjXfAv06OhfOzNDaBn5rw84DGXWndOEB7d5/x852A20sW1M56vhC/tRVbccQ==",
|
"integrity": "sha512-1ffhC6KY5qWLg5miMlKJp3dZbXelEfjuXt1qcp5WzSCQy36CV3y+JT7OC1WSFKizGQCDOcQbfkH/IjZP3cdRNA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1268,9 +1279,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-x64-gnu": {
|
"node_modules/@next/swc-linux-x64-gnu": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.2.0.tgz",
|
||||||
"integrity": "sha512-2eEBDkFlMMNQnkTyPBhQOAyn2qMxyG2eE7GPH2WIDGEpEILcBPI/jdSv4t6xupSP+ot/jkfrCShLAa7+ZUPcJQ==",
|
"integrity": "sha512-FmbDcZQ8yJRq93EJSL6xaE0KK/Rslraf8fj1uViGxg7K4CKBCRYSubILJPEhjSgZurpcPQq12QNOJQ0DRJl6Hg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1284,9 +1295,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-linux-x64-musl": {
|
"node_modules/@next/swc-linux-x64-musl": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.2.0.tgz",
|
||||||
"integrity": "sha512-oicJwRlyOoZXVlxmIMaTq7f8pN9QNbdes0q2FXfRsPhfCi8n8JmOZJm5oo1pwDaFbnnD421rVU409M3evFbIqg==",
|
"integrity": "sha512-HzjIHVkmGAwRbh/vzvoBWWEbb8BBZPxBvVbDQDvzHSf3D8RP/4vjw7MNLDXFF9Q1WEzeQyEj2zdxBtVAHu5Oyw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1300,9 +1311,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-win32-arm64-msvc": {
|
"node_modules/@next/swc-win32-arm64-msvc": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.2.0.tgz",
|
||||||
"integrity": "sha512-gQmm8izDTPgs+DCWH22kcDmuUp7NyiJgEl18bcr8irXA5N2m2O+JQIr6f3ct42GOs9c0h8QF3L5SzIxcYAAXXw==",
|
"integrity": "sha512-UMiFNQf5H7+1ZsZPxEsA064WEuFbRNq/kEXyepbCnSErp4f5iut75dBA8UeerFIG3vDaQNOfCpevnERPp2V+nA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -1316,9 +1327,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@next/swc-win32-x64-msvc": {
|
"node_modules/@next/swc-win32-x64-msvc": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.2.0.tgz",
|
||||||
"integrity": "sha512-NRfO39AIrzBnixKbjuo2YiYhB6o9d8v/ymU9m/Xk8cyVk+k7XylniXkHwjs4s70wedVffc6bQNbufk5v0xEm0A==",
|
"integrity": "sha512-DRrNJKW+/eimrZgdhVN1uvkN1OI4j6Lpefwr44jKQ0YQzztlmOBUUzHuV5GxOMPK3nmodAYElUVCY8ZXo/IWeA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -1675,6 +1686,17 @@
|
|||||||
"url": "https://opencollective.com/parcel"
|
"url": "https://opencollective.com/parcel"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@react-leaflet/core": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-leaflet/core/-/core-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-3EWmekh4Nz+pGcr+xjf0KNyYfC3U2JjnkWsh0zcqaexYqmmB5ZhH37kz41JXGmKzpaMZCnPofBBm64i+YrEvGQ==",
|
||||||
|
"license": "Hippocratic-2.1",
|
||||||
|
"peerDependencies": {
|
||||||
|
"leaflet": "^1.9.0",
|
||||||
|
"react": "^19.0.0",
|
||||||
|
"react-dom": "^19.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@reduxjs/toolkit": {
|
"node_modules/@reduxjs/toolkit": {
|
||||||
"version": "2.11.2",
|
"version": "2.11.2",
|
||||||
"resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.11.2.tgz",
|
"resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.11.2.tgz",
|
||||||
@@ -1820,6 +1842,13 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/geojson": {
|
||||||
|
"version": "7946.0.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz",
|
||||||
|
"integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/js-cookie": {
|
"node_modules/@types/js-cookie": {
|
||||||
"version": "3.0.6",
|
"version": "3.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-3.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-3.0.6.tgz",
|
||||||
@@ -1841,6 +1870,16 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/leaflet": {
|
||||||
|
"version": "1.9.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.21.tgz",
|
||||||
|
"integrity": "sha512-TbAd9DaPGSnzp6QvtYngntMZgcRk+igFELwR2N99XZn7RXUdKgsXMR+28bUO0rPsWp8MIu/f47luLIQuSLYv/w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/geojson": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "24.10.1",
|
"version": "24.10.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz",
|
||||||
@@ -2821,12 +2860,15 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/baseline-browser-mapping": {
|
"node_modules/baseline-browser-mapping": {
|
||||||
"version": "2.9.6",
|
"version": "2.10.9",
|
||||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.6.tgz",
|
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.9.tgz",
|
||||||
"integrity": "sha512-v9BVVpOTLB59C9E7aSnmIF8h7qRsFpx+A2nugVMTszEOMcfjlZMsXRm4LF23I3Z9AJxc8ANpIvzbzONoX9VJlg==",
|
"integrity": "sha512-OZd0e2mU11ClX8+IdXe3r0dbqMEznRiT4TfbhYIbcRPZkqJ7Qwer8ij3GZAmLsRKa+II9V1v5czCkvmHH3XZBg==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"baseline-browser-mapping": "dist/cli.js"
|
"baseline-browser-mapping": "dist/cli.cjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/brace-expansion": {
|
"node_modules/brace-expansion": {
|
||||||
@@ -2982,6 +3024,18 @@
|
|||||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/chart.js": {
|
||||||
|
"version": "4.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.5.1.tgz",
|
||||||
|
"integrity": "sha512-GIjfiT9dbmHRiYi6Nl2yFCq7kkwdkp1W/lp2J99rX0yo9tgJGn3lKQATztIjb5tVtevcBtIdICNWqlq5+E8/Pw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@kurkle/color": "^0.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"pnpm": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/chokidar": {
|
"node_modules/chokidar": {
|
||||||
"version": "4.0.3",
|
"version": "4.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
|
||||||
@@ -4186,9 +4240,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/flatted": {
|
"node_modules/flatted": {
|
||||||
"version": "3.3.3",
|
"version": "3.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",
|
||||||
"integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==",
|
"integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
@@ -5244,6 +5298,17 @@
|
|||||||
"node": ">=0.10"
|
"node": ">=0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/leaflet": {
|
||||||
|
"version": "1.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
|
||||||
|
"integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==",
|
||||||
|
"license": "BSD-2-Clause"
|
||||||
|
},
|
||||||
|
"node_modules/leaflet.heat": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/leaflet.heat/-/leaflet.heat-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-Cd5PbAA/rX3X3XKxfDoUGi9qp78FyhWYurFg3nsfhntcM/MCNK08pRkf4iEenO1KNqwVPKCmkyktjW3UD+h9bQ=="
|
||||||
|
},
|
||||||
"node_modules/levn": {
|
"node_modules/levn": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
|
||||||
@@ -5440,14 +5505,14 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/next": {
|
"node_modules/next": {
|
||||||
"version": "16.1.6",
|
"version": "16.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/next/-/next-16.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/next/-/next-16.2.0.tgz",
|
||||||
"integrity": "sha512-hkyRkcu5x/41KoqnROkfTm2pZVbKxvbZRuNvKXLRXxs3VfyO0WhY50TQS40EuKO9SW3rBj/sF3WbVwDACeMZyw==",
|
"integrity": "sha512-NLBVrJy1pbV1Yn00L5sU4vFyAHt5XuSjzrNyFnxo6Com0M0KrL6hHM5B99dbqXb2bE9pm4Ow3Zl1xp6HVY9edQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next/env": "16.1.6",
|
"@next/env": "16.2.0",
|
||||||
"@swc/helpers": "0.5.15",
|
"@swc/helpers": "0.5.15",
|
||||||
"baseline-browser-mapping": "^2.8.3",
|
"baseline-browser-mapping": "^2.9.19",
|
||||||
"caniuse-lite": "^1.0.30001579",
|
"caniuse-lite": "^1.0.30001579",
|
||||||
"postcss": "8.4.31",
|
"postcss": "8.4.31",
|
||||||
"styled-jsx": "5.1.6"
|
"styled-jsx": "5.1.6"
|
||||||
@@ -5459,15 +5524,15 @@
|
|||||||
"node": ">=20.9.0"
|
"node": ">=20.9.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@next/swc-darwin-arm64": "16.1.6",
|
"@next/swc-darwin-arm64": "16.2.0",
|
||||||
"@next/swc-darwin-x64": "16.1.6",
|
"@next/swc-darwin-x64": "16.2.0",
|
||||||
"@next/swc-linux-arm64-gnu": "16.1.6",
|
"@next/swc-linux-arm64-gnu": "16.2.0",
|
||||||
"@next/swc-linux-arm64-musl": "16.1.6",
|
"@next/swc-linux-arm64-musl": "16.2.0",
|
||||||
"@next/swc-linux-x64-gnu": "16.1.6",
|
"@next/swc-linux-x64-gnu": "16.2.0",
|
||||||
"@next/swc-linux-x64-musl": "16.1.6",
|
"@next/swc-linux-x64-musl": "16.2.0",
|
||||||
"@next/swc-win32-arm64-msvc": "16.1.6",
|
"@next/swc-win32-arm64-msvc": "16.2.0",
|
||||||
"@next/swc-win32-x64-msvc": "16.1.6",
|
"@next/swc-win32-x64-msvc": "16.2.0",
|
||||||
"sharp": "^0.34.4"
|
"sharp": "^0.34.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@opentelemetry/api": "^1.1.0",
|
"@opentelemetry/api": "^1.1.0",
|
||||||
@@ -5920,6 +5985,20 @@
|
|||||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
|
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/react-leaflet": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-leaflet/-/react-leaflet-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-CWbTpr5vcHw5bt9i4zSlPEVQdTVcML390TjeDG0cK59z1ylexpqC6M1PJFjV8jD7CF+ACBFsLIDs6DRMoLEofw==",
|
||||||
|
"license": "Hippocratic-2.1",
|
||||||
|
"dependencies": {
|
||||||
|
"@react-leaflet/core": "^3.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"leaflet": "^1.9.0",
|
||||||
|
"react": "^19.0.0",
|
||||||
|
"react-dom": "^19.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-redux": {
|
"node_modules/react-redux": {
|
||||||
"version": "9.2.0",
|
"version": "9.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
|
||||||
|
|||||||
@@ -13,18 +13,23 @@
|
|||||||
"@zxing/browser": "^0.1.5",
|
"@zxing/browser": "^0.1.5",
|
||||||
"@zxing/library": "^0.21.3",
|
"@zxing/library": "^0.21.3",
|
||||||
"axios": "^1.13.2",
|
"axios": "^1.13.2",
|
||||||
|
"chart.js": "^4.5.1",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
|
"leaflet": "^1.9.4",
|
||||||
|
"leaflet.heat": "^0.2.0",
|
||||||
"next": "^16.0.7",
|
"next": "^16.0.7",
|
||||||
"react": "19.2.0",
|
"react": "19.2.0",
|
||||||
"react-dom": "19.2.0",
|
"react-dom": "19.2.0",
|
||||||
"react-hot-toast": "^2.6.0",
|
"react-hot-toast": "^2.6.0",
|
||||||
|
"react-leaflet": "^5.0.0",
|
||||||
"react-select": "^5.10.2",
|
"react-select": "^5.10.2",
|
||||||
"recharts": "^3.8.0"
|
"recharts": "^3.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3",
|
"@eslint/eslintrc": "^3",
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
|
"@types/leaflet": "^1.9.21",
|
||||||
"@types/node": "^24",
|
"@types/node": "^24",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 378 KiB |
@@ -1,13 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Pregunta7 from "@/components/Equipo_Computo/Pregunta7";
|
|
||||||
import Pregunta1EP from "@/components/Perifericos/Pregunta1EP";
|
import Pregunta1EP from "@/components/Perifericos/Pregunta1EP";
|
||||||
import Pregunta2EP from "@/components/Perifericos/Pregunta2EP";
|
import Pregunta2EP from "@/components/Perifericos/Pregunta2EP";
|
||||||
import Pregunta4EP from "@/components/Perifericos/Pregunta4EP";
|
import Pregunta4EP from "@/components/Perifericos/Pregunta4EP";
|
||||||
import Pregunta5EP from "@/components/Perifericos/Pregunta5EP";
|
import Pregunta5EP from "@/components/Perifericos/Pregunta5EP";
|
||||||
import "../../styles/layout/reporte.scss";
|
import "../../styles/layout/reporte.scss";
|
||||||
import DownloadReporteXLSX from "@/components/Dowload/Reporte";
|
import DownloadReporteXLSX from "@/components/Dowload/Reporte";
|
||||||
|
import Pregunta7 from "@/components/Equipo_Computo/Pregunta7";
|
||||||
|
|
||||||
|
|
||||||
type PreguntaKey = "pregunta1" | "pregunta4" | "pregunta7";
|
type PreguntaKey = "pregunta1" | "pregunta4" | "pregunta7";
|
||||||
|
|
||||||
|
|||||||
@@ -1,53 +1,17 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
|
||||||
import DownloadReporteXLSX from "@/components/Dowload/Reporte";
|
|
||||||
import Reporte from "@/components/reporteGraficas/reporte";
|
import Reporte from "@/components/reporteGraficas/reporte";
|
||||||
|
|
||||||
import "../../styles/layout/reporte.scss";
|
import "../../styles/layout/reporte.scss";
|
||||||
|
|
||||||
type PreguntaKey = "antiguedad";
|
|
||||||
|
|
||||||
const LABELS: Record<PreguntaKey, string> = {
|
|
||||||
antiguedad: "Antigüedad",
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const [activeTab, setActiveTab] = useState<PreguntaKey>("antiguedad");
|
|
||||||
|
|
||||||
const renderPregunta = () => {
|
|
||||||
switch (activeTab) {
|
|
||||||
case "antiguedad":
|
|
||||||
return (
|
|
||||||
<Reporte />
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return (
|
|
||||||
<div className="p-6 text-center text-gray-500">
|
|
||||||
Contenido no disponible aún.
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="scanView_reporte">
|
<div className="scanView_reporte">
|
||||||
<div className="container_reporte">
|
<div className="container_reporte">
|
||||||
<div className="main-content_reporte">
|
<div className="main-content_reporte">
|
||||||
<div className="tabs_reporte">
|
<div className={`data-table_reporte`}><Reporte /></div>
|
||||||
{Object.entries(LABELS).map(([key, label]) => (
|
|
||||||
<button
|
|
||||||
key={key}
|
|
||||||
className={`tab_reporte ${activeTab === key ? "active" : ""}`}
|
|
||||||
onClick={() => setActiveTab(key as PreguntaKey)}
|
|
||||||
aria-selected={activeTab === key}
|
|
||||||
role="tab"
|
|
||||||
>
|
|
||||||
{label}
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
<div className={`data-table_reporte`}>{renderPregunta()}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
|
||||||
|
import "../../styles/layout/reporte.scss";
|
||||||
|
import ReportePerifericos from "@/components/reporte_graficas_perifericos/reporte";
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="scanView_reporte">
|
||||||
|
<div className="container_reporte">
|
||||||
|
<div className="main-content_reporte">
|
||||||
|
<div className={`data-table_reporte`}><ReportePerifericos /></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -24,7 +24,9 @@ export default function RootLayout({
|
|||||||
<body>
|
<body>
|
||||||
<Header />
|
<Header />
|
||||||
<Toaster position="top-left" reverseOrder={false} />
|
<Toaster position="top-left" reverseOrder={false} />
|
||||||
|
<main>
|
||||||
{children}
|
{children}
|
||||||
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export default function Login() {
|
|||||||
if (tipo === 2) {
|
if (tipo === 2) {
|
||||||
router.push("/escaner");
|
router.push("/escaner");
|
||||||
} else if (tipo === 1) {
|
} else if (tipo === 1) {
|
||||||
router.push("/equipoComputo");
|
router.push("/reportesGraficas");
|
||||||
} else {
|
} else {
|
||||||
toast.error("Tipo de usuario no válido");
|
toast.error("Tipo de usuario no válido");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,33 @@ body {
|
|||||||
color: $color-text;
|
color: $color-text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
main::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
|
||||||
|
width: 200%;
|
||||||
|
height: 200%;
|
||||||
|
|
||||||
|
background-image:
|
||||||
|
linear-gradient(#003f7906 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, #003f7906 1px, transparent 1px);
|
||||||
|
|
||||||
|
background-size: 48px 48px;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
|
transform: translate(-50%, -50%) rotate(15deg);
|
||||||
|
transform-origin: center;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
color: #222;
|
color: #222;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-container {
|
.login-container {
|
||||||
|
|||||||
@@ -41,17 +41,17 @@ function BarNavigation() {
|
|||||||
</li> */}
|
</li> */}
|
||||||
<li className="subMenu" onClick={toggleMenu}>
|
<li className="subMenu" onClick={toggleMenu}>
|
||||||
<Link href="/equipoComputo" className="links">
|
<Link href="/equipoComputo" className="links">
|
||||||
<span>Equipo de Computo</span>
|
<span>Equipo de Cómputo</span>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className="subMenu" onClick={toggleMenu}>
|
<li className="subMenu" onClick={toggleMenu}>
|
||||||
<Link href="/perifericos" className="links">
|
<Link href="/perifericos" className="links">
|
||||||
<span>Perifericos</span>
|
<span>Periféricos</span>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className="subMenu" onClick={toggleMenu}>
|
<li className="subMenu" onClick={toggleMenu}>
|
||||||
<Link href="/reportesGraficas" className="links">
|
<Link href="/reportesGraficas" className="links">
|
||||||
<span>Reportes y Graficas</span>
|
<span>Reportes y Gráficas</span>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className="subMenu">
|
<li className="subMenu">
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default function DownloadReporteXLSX() {
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const handleDownload = async () => {
|
const handleDownload = async () => {
|
||||||
setLoading(true); // 🔹 Activa loader
|
setLoading(true);
|
||||||
const token = Cookies.get("token");
|
const token = Cookies.get("token");
|
||||||
const headers = { Authorization: `Bearer ${token}` };
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ export default function DownloadReporteXLSX() {
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
alert("Hubo un problema al descargar el archivo.");
|
alert("Hubo un problema al descargar el archivo.");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false); // 🔹 Reactiva botón y oculta loader
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,10 +45,10 @@ export default function DownloadReporteXLSX() {
|
|||||||
<button
|
<button
|
||||||
className={styles.downloadBtn}
|
className={styles.downloadBtn}
|
||||||
onClick={handleDownload}
|
onClick={handleDownload}
|
||||||
disabled={loading} // 🔹 Botón deshabilitado
|
disabled={loading}
|
||||||
>
|
>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className={styles.loader}></div> // 🔹 Icono de cargando
|
<div className={styles.loader}></div>
|
||||||
) : (
|
) : (
|
||||||
<img src="/excel.svg" alt="Excel" className={styles.iconExcel} width={30} height={30}/>
|
<img src="/excel.svg" alt="Excel" className={styles.iconExcel} width={30} height={30}/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import styles from "./style.module.css";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
import { useState } from "react";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
filtros: any;
|
||||||
|
count?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function DownloadTable({ filtros, count }: Props) {
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
const handleDownload = async () => {
|
||||||
|
if (!filtros) { return }
|
||||||
|
setLoading(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const token = Cookies.get("token");
|
||||||
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
|
|
||||||
|
const endpoint = count
|
||||||
|
? "/equipos/excel/tabla/count"
|
||||||
|
: "/equipos/excel/tabla";
|
||||||
|
|
||||||
|
const response = await axios.post(
|
||||||
|
`${process.env.NEXT_PUBLIC_API_URL}${endpoint}`,
|
||||||
|
filtros,
|
||||||
|
{
|
||||||
|
headers,
|
||||||
|
responseType: "blob",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const url = window.URL.createObjectURL(new Blob([response.data]));
|
||||||
|
console.log(url)
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = url;
|
||||||
|
a.download = "reporte.xlsx";
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
alert("Hubo un problema al descargar el archivo.");
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
className={styles.downloadBtn}
|
||||||
|
onClick={handleDownload}
|
||||||
|
disabled={loading}
|
||||||
|
>
|
||||||
|
{loading ? (
|
||||||
|
<div className={styles.loader}></div>
|
||||||
|
) : (
|
||||||
|
<img
|
||||||
|
src="/excel.svg"
|
||||||
|
alt="Excel"
|
||||||
|
className={styles.iconExcel}
|
||||||
|
width={30}
|
||||||
|
height={30}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
|
||||||
|
import { MapContainer, ImageOverlay, useMap } from "react-leaflet";
|
||||||
|
import L, { LatLngBoundsExpression } from "leaflet";
|
||||||
|
import "leaflet/dist/leaflet.css";
|
||||||
|
import "leaflet.heat";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
|
// Ajustar vista automáticamente
|
||||||
|
function AjustarVista({ bounds }: { bounds: LatLngBoundsExpression }) {
|
||||||
|
const map = useMap();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
map.fitBounds(bounds);
|
||||||
|
}, [map, bounds]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function HeatLayer() {
|
||||||
|
const map = useMap();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
|
||||||
|
// A 4768x3368
|
||||||
|
const edificios = {
|
||||||
|
A1: [[1407, 3054], [1470, 3054], [1470, 3360], [1407, 3360]],
|
||||||
|
A2: [[1570, 3130], [1570, 3190], [1850, 3190], [1850, 3130]],
|
||||||
|
A3: [[1640, 2650], [1705, 2650], [1705, 2950], [1640, 2950]],
|
||||||
|
A4: [[1268, 2765], [1268, 2830], [1540, 2830], [1540, 2765]],
|
||||||
|
A5: [[995, 2405], [1295, 2405], [1295, 2470], [995, 2470]],
|
||||||
|
A6: [[1390, 2385], [1450, 2385], [1450, 2655], [1390, 2655]],
|
||||||
|
A7: [[1234, 2014], [1296, 2014], [1296, 2317], [1234, 2317]],
|
||||||
|
A8: [[1390, 2055], [1700, 2055], [1700, 2118], [1390, 2118]],
|
||||||
|
A9: [[1215, 1825], [1480, 1825], [1480, 1890], [1215, 1890]],
|
||||||
|
A10: [[1570, 1695], [1635, 1695], [1635, 1960], [1570, 1960]],
|
||||||
|
A11: [[1475, 1510], [1780, 1510], [1780, 1570], [1475, 1570]],
|
||||||
|
A12: [[1310, 1395], [1375, 1395], [1375, 1700], [1310, 1700]],
|
||||||
|
A13: [[1780, 810], [1845, 810], [1845, 1020], [1780, 1020]],
|
||||||
|
A14: [[1505, 775], [1713, 775], [1713, 840], [1505, 840]],
|
||||||
|
A15: [[2027, 2580], [2087, 2580], [2087, 2900], [2027, 2900]],
|
||||||
|
AEROGRAFIA: [[1157, 3308], [1254, 3308], [1254, 3369], [1157, 3369]],
|
||||||
|
ALMACEN: [[989, 1523], [1027, 1523], [1027, 1749], [989, 1749]],
|
||||||
|
APOYO_DOC: [[1115, 1222], [1475, 1222], [1475, 1293], [1115, 1293]],
|
||||||
|
BIBLIOTECA: [[1578, 2372], [1578, 2199], [1593, 2213], [1739, 2213],[1835, 2114], [1889, 2168], [1889, 2345], [1860, 2375],[1888, 2407], [1844, 2450], [1830, 2435], [1814, 2451],[1799, 2435], [1772, 2466], [1766, 2460], [1703, 2523],[1686, 2506], [1645, 2505], [1645, 2465], [1630, 2466],[1629, 2402], [1677, 2402], [1677, 2372], [1666, 2360], [1591, 2360]],
|
||||||
|
CEI: [[1570, 990], [1767, 990], [1767, 1155], [1570, 1155]],
|
||||||
|
INVEST: [[1570, 1240], [1727, 1240], [1727, 1400], [1570, 1400]],
|
||||||
|
CEDTEC: [[885, 2900], [1080, 2900], [1080, 3200], [885, 3200]],
|
||||||
|
CEMM: [[2167, 863], [2453, 863], [2453, 1458], [2167, 1458]],
|
||||||
|
CAFETERIA_Y_LIBRERIA: [[2027, 1483], [2158, 1483], [2158, 1600], [2027, 1600]],
|
||||||
|
CTED: [[1802, 1063], [1908, 1128], [1888, 1179], [1772, 1151]],
|
||||||
|
POSGRADO: [[857, 1472], [1004, 1471],[1004, 1327],[1086, 1325],[1086, 1512], [860, 1512]],
|
||||||
|
UNIDAD_SEMINA: [[1145, 2894], [1320, 2894], [1320, 3070], [1145, 3070]],
|
||||||
|
TALLS_Y_LAB: [[1085, 3209], [1292, 3209], [1292, 3307], [1085, 3307]],
|
||||||
|
UNIDAD_DE_TALLERES_MULTIDISC: [[1624, 3244], [1920, 3240], [1954, 3476], [1622, 3477]],
|
||||||
|
USC: [[992, 2656], [1029, 2656], [1029, 2828], [992, 2828]],
|
||||||
|
UIM: [[294, 3224], [901, 3257], [899, 3358], [312, 3386]],
|
||||||
|
GOB: [[950, 2068], [1104, 2068], [1104, 2218], [950, 2218]],
|
||||||
|
SERV_GRALES: [[1024, 882], [1089, 882], [1089, 1138], [1024, 1138]],
|
||||||
|
SM: [[893, 1789], [935, 1789], [935, 1891], [893, 1891]]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const puntos: any[] = [];
|
||||||
|
|
||||||
|
Object.entries(edificios).forEach(([nombre, poligono]) => {
|
||||||
|
for (let i = 0; i < 15; i++) {
|
||||||
|
|
||||||
|
const x = poligono[0][0] + Math.random() * (poligono[1][0] - poligono[0][0]);
|
||||||
|
const y = poligono[0][1] + Math.random() * (poligono[2][1] - poligono[0][1]);
|
||||||
|
|
||||||
|
const intensidad = Math.random();
|
||||||
|
|
||||||
|
puntos.push([x, y, intensidad]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const heat = (L as any).heatLayer(puntos, {
|
||||||
|
radius: 35,
|
||||||
|
blur: 25,
|
||||||
|
maxZoom: 2,
|
||||||
|
gradient: {
|
||||||
|
0.2: "#00f",
|
||||||
|
0.4: "#0ff",
|
||||||
|
0.6: "#0f0",
|
||||||
|
0.8: "#ff0",
|
||||||
|
1.0: "#f00"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
heat.addTo(map);
|
||||||
|
|
||||||
|
|
||||||
|
Object.entries(edificios).forEach(([nombre, coords]: any) => {
|
||||||
|
L.polygon((coords), {
|
||||||
|
color: "#77ee9f00",
|
||||||
|
weight: 2,
|
||||||
|
fillOpacity: 0.25
|
||||||
|
})
|
||||||
|
.bindPopup(`🏢 ${nombre}`)
|
||||||
|
.addTo(map);
|
||||||
|
});
|
||||||
|
|
||||||
|
// DEBUG PRO (CLICK PARA COORDENADAS EXACTAS)
|
||||||
|
map.on("click", function (e) {
|
||||||
|
console.log(" Coordenadas exactas:", e.latlng);
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
map.removeLayer(heat);
|
||||||
|
};
|
||||||
|
|
||||||
|
}, [map]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function MapaCalor() {
|
||||||
|
|
||||||
|
const bounds: LatLngBoundsExpression = [
|
||||||
|
[0, 0],
|
||||||
|
[3368, 4768]
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
|
||||||
|
<div style={{
|
||||||
|
width: "100%",
|
||||||
|
height: "650px",
|
||||||
|
marginTop: "10px",
|
||||||
|
borderRadius: "12px",
|
||||||
|
overflow: "hidden",
|
||||||
|
boxShadow: "0 6px 25px rgba(0,0,0,0.3)"
|
||||||
|
}}>
|
||||||
|
|
||||||
|
<MapContainer
|
||||||
|
crs={L.CRS.Simple}
|
||||||
|
minZoom={-2}
|
||||||
|
style={{ height: "100%", width: "100%" }}
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageOverlay
|
||||||
|
url="/plano.png"
|
||||||
|
bounds={bounds}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<AjustarVista bounds={bounds} />
|
||||||
|
|
||||||
|
<HeatLayer />
|
||||||
|
|
||||||
|
</MapContainer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -25,12 +25,11 @@ const CATEGORIA_MAP: Record<string, { tabla: number }> = {
|
|||||||
"ESCRITORIO PC": { tabla: 0 },
|
"ESCRITORIO PC": { tabla: 0 },
|
||||||
"ESCRITORIO MAC OS": { tabla: 0 },
|
"ESCRITORIO MAC OS": { tabla: 0 },
|
||||||
"ESCRITORIO MAC OS ": { tabla: 0 },
|
"ESCRITORIO MAC OS ": { tabla: 0 },
|
||||||
|
|
||||||
"ESCRITORIO LINUX": { tabla: 0 },
|
"ESCRITORIO LINUX": { tabla: 0 },
|
||||||
|
|
||||||
"PORTÁTILES WINDOWS": { tabla: 2 },
|
"PORTÁTILES WINDOWS": { tabla: 2 },
|
||||||
|
"PORTÁTILES CHROMEBOOK": { tabla: 2 },
|
||||||
"PORTÁTILES MAC OS": { tabla: 2 },
|
"PORTÁTILES MAC OS": { tabla: 2 },
|
||||||
"PORTÁTILES LINUX": { tabla: 2 },
|
|
||||||
|
|
||||||
"TABLETA IPAD OS": { tabla: 1 },
|
"TABLETA IPAD OS": { tabla: 1 },
|
||||||
"TABLETA ANDROID": { tabla: 1 },
|
"TABLETA ANDROID": { tabla: 1 },
|
||||||
@@ -48,7 +47,7 @@ const TITULOS_TABLAS = [
|
|||||||
const SISTEMAS_POR_TABLA: Record<number, readonly string[]> = {
|
const SISTEMAS_POR_TABLA: Record<number, readonly string[]> = {
|
||||||
0: ["Windows", "Linux", "Mac OS"],
|
0: ["Windows", "Linux", "Mac OS"],
|
||||||
1: ["Android", "iPad OS"],
|
1: ["Android", "iPad OS"],
|
||||||
2: ["Windows", "Linux", "Mac OS"],
|
2: ["Windows", "Chrome OS", "Mac OS"],
|
||||||
3: ["Servidor"],
|
3: ["Servidor"],
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -58,7 +57,9 @@ function normalizarSO(soRaw: string): string {
|
|||||||
if (so.includes("WINDOWS")) return "Windows";
|
if (so.includes("WINDOWS")) return "Windows";
|
||||||
if (so.includes("LINUX")) return "Linux";
|
if (so.includes("LINUX")) return "Linux";
|
||||||
if (so.includes("MAC")) return "Mac OS";
|
if (so.includes("MAC")) return "Mac OS";
|
||||||
if (so.includes("CHROME")) return "Chrome OS";
|
if (so.includes("CHROME OS")) return "Chrome OS";
|
||||||
|
if (so.includes("ANDROID")) return "Android";
|
||||||
|
|
||||||
if (so.includes("IOS") || so.includes("IPAD")) return "iPad OS";
|
if (so.includes("IOS") || so.includes("IPAD")) return "iPad OS";
|
||||||
|
|
||||||
if (so.includes("SERVER") || so.includes("UNIX")) return "Servidor";
|
if (so.includes("SERVER") || so.includes("UNIX")) return "Servidor";
|
||||||
@@ -175,9 +176,8 @@ export default function Pregunta1() {
|
|||||||
{valores.map((valor, colIndex) => (
|
{valores.map((valor, colIndex) => (
|
||||||
<td key={colIndex}>
|
<td key={colIndex}>
|
||||||
<div
|
<div
|
||||||
className={`${style["input-contenedor"]} ${
|
className={`${style["input-contenedor"]} ${loading ? "skeleton" : ""
|
||||||
loading ? "skeleton" : ""
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{!loading ? (
|
{!loading ? (
|
||||||
<input type="number" value={valor} readOnly />
|
<input type="number" value={valor} readOnly />
|
||||||
@@ -201,9 +201,8 @@ export default function Pregunta1() {
|
|||||||
{totalesColumnas.map((t, i) => (
|
{totalesColumnas.map((t, i) => (
|
||||||
<td key={i}>
|
<td key={i}>
|
||||||
<div
|
<div
|
||||||
className={`${style["input-contenedor"]} ${
|
className={`${style["input-contenedor"]} ${loading ? "skeleton" : ""
|
||||||
loading ? "skeleton" : ""
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{!loading && t}
|
{!loading && t}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import "./pregunta7.css";
|
import "./pregunta7.css";
|
||||||
import ToggleButton from "../Toggle/ToggleButton";
|
import ToggleButton from "../Toggle/ToggleButton";
|
||||||
|
import dynamic from "next/dynamic";
|
||||||
|
|
||||||
|
const MapaCalor = dynamic(
|
||||||
|
() => import("./MapaCalor"),
|
||||||
|
{ ssr: false }
|
||||||
|
);
|
||||||
|
|
||||||
type AntiguedadItem = {
|
type AntiguedadItem = {
|
||||||
antiguedad: string | null;
|
antiguedad: string | null;
|
||||||
@@ -166,6 +173,9 @@ export default function Pregunta7() {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<MapaCalor />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ export default function Ranking() {
|
|||||||
}, [year, api_url]);
|
}, [year, api_url]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section>
|
<section style={{width:'100%'}}>
|
||||||
<div className="year-selector">
|
<div className="year-selector">
|
||||||
<div>
|
<div>
|
||||||
<label>Año:</label>
|
<label>Año:</label>
|
||||||
|
|||||||
@@ -14,11 +14,6 @@ import {
|
|||||||
} from "recharts";
|
} from "recharts";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
type AdscripcionOption = {
|
|
||||||
id_adscripcion: string
|
|
||||||
adscripcion: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
filtros: any
|
filtros: any
|
||||||
}
|
}
|
||||||
@@ -28,6 +23,16 @@ interface AntiguedadData {
|
|||||||
antiguedad: string
|
antiguedad: string
|
||||||
total: number
|
total: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const colores = [
|
||||||
|
"#818CF8",
|
||||||
|
"#34D399",
|
||||||
|
"#FBBF24",
|
||||||
|
"#F87171",
|
||||||
|
"#67E8F9",
|
||||||
|
"#C084FC"
|
||||||
|
]
|
||||||
|
|
||||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
export default function Antiguedad({ filtros }: Props) {
|
export default function Antiguedad({ filtros }: Props) {
|
||||||
@@ -54,24 +59,48 @@ export default function Antiguedad({ filtros }: Props) {
|
|||||||
|
|
||||||
}, [filtros])
|
}, [filtros])
|
||||||
|
|
||||||
|
const tieneAdscripciones = data.some(d => d.adscripcion)
|
||||||
|
|
||||||
|
let dataTransformada = data
|
||||||
|
let adscripciones: string[] = []
|
||||||
|
|
||||||
|
if (tieneAdscripciones) {
|
||||||
|
|
||||||
|
adscripciones = [...new Set(data.map(d => d.adscripcion))]
|
||||||
|
|
||||||
|
dataTransformada = Object.values(
|
||||||
|
data.reduce((acc: any, item: any) => {
|
||||||
|
|
||||||
|
if (!acc[item.antiguedad]) {
|
||||||
|
acc[item.antiguedad] = { antiguedad: item.antiguedad }
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[item.antiguedad][item.adscripcion] = Number(item.total)
|
||||||
|
|
||||||
|
return acc
|
||||||
|
|
||||||
|
}, {})
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
minWidth: "570px",
|
minWidth: "570px",
|
||||||
background: "white",
|
background: "white",
|
||||||
borderRadius: "10px",
|
borderRadius: "10px",
|
||||||
margin: "5px auto",
|
|
||||||
padding: "1rem",
|
padding: "1rem",
|
||||||
maxWidth: "100%"
|
maxWidth: "100%"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
||||||
<h1 style={{ margin: "0" }}>Antigüedad</h1>
|
<h1 style={{ margin: "0" }}>Antigüedad por equipo</h1>
|
||||||
|
|
||||||
<ResponsiveContainer width="100%" aspect={2.5}>
|
<ResponsiveContainer width="100%" aspect={2.5}>
|
||||||
|
|
||||||
<BarChart
|
<BarChart
|
||||||
data={data}
|
data={dataTransformada}
|
||||||
margin={{ top: 20 }}
|
margin={{ top: 20 }}
|
||||||
>
|
>
|
||||||
<CartesianGrid strokeDasharray="3 3" />
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
@@ -79,9 +108,28 @@ export default function Antiguedad({ filtros }: Props) {
|
|||||||
<XAxis dataKey="antiguedad" fontSize={12} />
|
<XAxis dataKey="antiguedad" fontSize={12} />
|
||||||
|
|
||||||
<YAxis />
|
<YAxis />
|
||||||
<Tooltip />
|
<Tooltip
|
||||||
<Legend />
|
formatter={(value) => [`${value}`]}
|
||||||
<Bar dataKey="total" fill="#095bd6" />
|
/>
|
||||||
|
<Legend wrapperStyle={{ fontSize: 12 }}/>
|
||||||
|
{tieneAdscripciones ? (
|
||||||
|
|
||||||
|
adscripciones.map((ads, i) => (
|
||||||
|
<Bar
|
||||||
|
key={ads}
|
||||||
|
dataKey={ads}
|
||||||
|
fill={colores[i % colores.length]}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<Bar
|
||||||
|
dataKey="total"
|
||||||
|
fill="#095bd6"
|
||||||
|
/>
|
||||||
|
|
||||||
|
)}
|
||||||
|
|
||||||
</BarChart>
|
</BarChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useEffect, useRef } from "react";
|
||||||
|
import { Chart } from "chart.js/auto";
|
||||||
|
import axios from "axios";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
tipo: "ALUMNO" | "PROFESOR" | "ADMINISTRATIVO";
|
||||||
|
filtros: any
|
||||||
|
}
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
|
export default function Polar({ tipo, filtros }: Props) {
|
||||||
|
const canvasRef = useRef<HTMLCanvasElement | null>(null);
|
||||||
|
const chartRef = useRef<Chart | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!canvasRef.current) return;
|
||||||
|
|
||||||
|
const fetchData = async () => {
|
||||||
|
const token = Cookies.get("token");
|
||||||
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await axios.post(
|
||||||
|
`${api_url}/equipos/graficaPolar/${tipo}`, filtros, { headers }
|
||||||
|
);
|
||||||
|
|
||||||
|
const apiData = res.data;
|
||||||
|
|
||||||
|
// Orden fijo
|
||||||
|
const labels = [
|
||||||
|
"Menor a 2 años",
|
||||||
|
"Entre 2 y 3 años",
|
||||||
|
"Entre 4 y 5 años",
|
||||||
|
"Mayor a 6 años",
|
||||||
|
];
|
||||||
|
|
||||||
|
// Mapear datos
|
||||||
|
const data = labels.map((label) => {
|
||||||
|
const found = apiData.find(
|
||||||
|
(item: any) => item.antiguedad === label
|
||||||
|
);
|
||||||
|
return found ? Number(found.total) : 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Destruir gráfica previa (importante en React)
|
||||||
|
if (chartRef.current) {
|
||||||
|
chartRef.current.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crear gráfica
|
||||||
|
chartRef.current = new Chart(canvasRef.current!, {
|
||||||
|
type: "polarArea",
|
||||||
|
data: {
|
||||||
|
labels,
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
data,
|
||||||
|
borderWidth: 1,
|
||||||
|
backgroundColor: [
|
||||||
|
"rgb(75, 192, 192)",
|
||||||
|
"rgb(255, 206, 86)",
|
||||||
|
"rgb(235, 157, 54)",
|
||||||
|
"rgb(255, 99, 132)",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error al obtener datos:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchData();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (chartRef.current) {
|
||||||
|
chartRef.current.destroy();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, [filtros]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{tipo === 'PROFESOR' ?<h4>PROFESOR Y TECNICO</h4>:
|
||||||
|
<h4>{tipo}</h4>
|
||||||
|
}
|
||||||
|
<canvas ref={canvasRef} height={200} width={350}></canvas>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -3,16 +3,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
type AdscripcionOption = {
|
|
||||||
id_adscripcion: string
|
|
||||||
adscripcion: string
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProcesadorOption = {
|
|
||||||
id_procesador: string
|
|
||||||
procesador: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
filtros: any
|
filtros: any
|
||||||
@@ -24,23 +15,62 @@ interface procesador {
|
|||||||
total: number;
|
total: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const colores = [
|
||||||
|
"#818CF8",
|
||||||
|
"#34D399",
|
||||||
|
"#FBBF24",
|
||||||
|
"#F87171",
|
||||||
|
"#67E8F9",
|
||||||
|
"#C084FC"
|
||||||
|
]
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
export default function Procesador({ filtros }: Props) {
|
export default function Procesador({ filtros }: Props) {
|
||||||
const [data, setData] = useState<procesador[]>([])
|
const [data, setData] = useState<procesador[]>([])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const token = Cookies.get("token");
|
||||||
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
|
|
||||||
const getAntiguedad = async () => {
|
const getAntiguedad = async () => {
|
||||||
const response = await axios.post("http://localhost:3001/equipos/grafica/procesador",filtros)
|
const response = await axios.post(`${api_url}/equipos/grafica/procesador`, filtros, { headers }
|
||||||
|
)
|
||||||
|
|
||||||
setData(response.data)
|
setData(response.data)
|
||||||
}
|
}
|
||||||
getAntiguedad()
|
getAntiguedad()
|
||||||
}, [filtros])
|
}, [filtros])
|
||||||
|
|
||||||
|
const tieneAdscripciones = data.some(d => d.adscripcion)
|
||||||
|
|
||||||
|
let dataTransformada = data
|
||||||
|
let adscripciones: string[] = []
|
||||||
|
|
||||||
|
if (tieneAdscripciones) {
|
||||||
|
|
||||||
|
adscripciones = [...new Set(data.map(d => d.adscripcion))]
|
||||||
|
|
||||||
|
dataTransformada = Object.values(
|
||||||
|
data.reduce((acc: any, item: any) => {
|
||||||
|
|
||||||
|
if (!acc[item.procesador]) {
|
||||||
|
acc[item.procesador] = { procesador: item.procesador }
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[item.procesador][item.adscripcion] = Number(item.total)
|
||||||
|
|
||||||
|
return acc
|
||||||
|
|
||||||
|
}, {})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: "100%", background: "white", borderRadius: "10px", margin: "5px auto", padding: "1rem" }}>
|
<div style={{ width: "100%", background: "white", borderRadius: "10px", margin: "5px auto", padding: "1rem" }}>
|
||||||
<h1 style={{ margin: "0" }}>Procesador</h1>
|
<h1 style={{ margin: "0" }}>Procesador por equipo</h1>
|
||||||
<ResponsiveContainer width="100%" aspect={3.5} minHeight={270}>
|
<ResponsiveContainer width="100%" aspect={3.5}>
|
||||||
<BarChart data={data}
|
<BarChart data={dataTransformada}
|
||||||
width={500}
|
width={500}
|
||||||
height={300}
|
height={300}
|
||||||
margin={{
|
margin={{
|
||||||
@@ -51,10 +81,28 @@ export default function Procesador({ filtros }: Props) {
|
|||||||
<CartesianGrid strokeDasharray="3 3" />
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
<XAxis dataKey="procesador" fontSize={12} angle={40} textAnchor="start" hide />
|
<XAxis dataKey="procesador" fontSize={12} angle={40} textAnchor="start" hide />
|
||||||
<YAxis />
|
<YAxis />
|
||||||
<Tooltip />
|
<Tooltip
|
||||||
<Legend />
|
formatter={(value) => [`${value}`]}
|
||||||
<Bar dataKey="total" fill="#095bd6" />
|
/>
|
||||||
|
<Legend wrapperStyle={{ fontSize: 12 }}/>
|
||||||
|
{tieneAdscripciones ? (
|
||||||
|
|
||||||
|
adscripciones.map((ads, i) => (
|
||||||
|
<Bar
|
||||||
|
key={ads}
|
||||||
|
dataKey={ads}
|
||||||
|
fill={colores[i % colores.length]}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<Bar
|
||||||
|
dataKey="total"
|
||||||
|
fill="#095bd6"
|
||||||
|
/>
|
||||||
|
|
||||||
|
)}
|
||||||
</BarChart>
|
</BarChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,16 +3,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
type AdscripcionOption = {
|
|
||||||
id_adscripcion: string
|
|
||||||
adscripcion: string
|
|
||||||
}
|
|
||||||
|
|
||||||
type UsoOption = {
|
|
||||||
id_sistema_operativo: string
|
|
||||||
sistema_operativo: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
filtros: any
|
filtros: any
|
||||||
@@ -24,23 +15,61 @@ interface so {
|
|||||||
total: number;
|
total: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const colores = [
|
||||||
|
"#818CF8",
|
||||||
|
"#34D399",
|
||||||
|
"#FBBF24",
|
||||||
|
"#F87171",
|
||||||
|
"#67E8F9",
|
||||||
|
"#C084FC"
|
||||||
|
]
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
export default function SistemaOperativo({ filtros }: Props) {
|
export default function SistemaOperativo({ filtros }: Props) {
|
||||||
const [data, setData] = useState<so[]>([])
|
const [data, setData] = useState<so[]>([])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const token = Cookies.get("token");
|
||||||
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
const getAntiguedad = async () => {
|
const getAntiguedad = async () => {
|
||||||
const response = await axios.post("http://localhost:3001/equipos/grafica/so",filtros)
|
const response = await axios.post(`${api_url}/equipos/grafica/so`, filtros, { headers }
|
||||||
|
)
|
||||||
|
|
||||||
setData(response.data)
|
setData(response.data)
|
||||||
}
|
}
|
||||||
getAntiguedad()
|
getAntiguedad()
|
||||||
}, [filtros])
|
}, [filtros])
|
||||||
|
|
||||||
|
const tieneAdscripciones = data.some(d => d.adscripcion)
|
||||||
|
|
||||||
|
let dataTransformada = data
|
||||||
|
let adscripciones: string[] = []
|
||||||
|
|
||||||
|
if (tieneAdscripciones) {
|
||||||
|
|
||||||
|
adscripciones = [...new Set(data.map(d => d.adscripcion))]
|
||||||
|
|
||||||
|
dataTransformada = Object.values(
|
||||||
|
data.reduce((acc: any, item: any) => {
|
||||||
|
|
||||||
|
if (!acc[item.so]) {
|
||||||
|
acc[item.so] = { so: item.so }
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[item.so][item.adscripcion] = Number(item.total)
|
||||||
|
|
||||||
|
return acc
|
||||||
|
|
||||||
|
}, {})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: "100%", background: "white", borderRadius: "10px", margin: "5px auto", padding: "1rem" }}>
|
<div style={{ width: "100%", background: "white", borderRadius: "10px", margin: "5px auto", padding: "1rem" }}>
|
||||||
<h1 style={{ margin: "0" }}>SistemaOperativo</h1>
|
<h1 style={{ margin: "0" }}>SistemaOperativo por equipo</h1>
|
||||||
<ResponsiveContainer width="100%" aspect={3.5}>
|
<ResponsiveContainer width="100%" aspect={3.5}>
|
||||||
<BarChart data={data}
|
<BarChart data={dataTransformada}
|
||||||
width={500}
|
width={500}
|
||||||
height={300}
|
height={300}
|
||||||
margin={{
|
margin={{
|
||||||
@@ -50,10 +79,28 @@ export default function SistemaOperativo({ filtros }: Props) {
|
|||||||
<CartesianGrid strokeDasharray="3 3" />
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
<XAxis dataKey="so" fontSize={12} angle={30} textAnchor="start" hide />
|
<XAxis dataKey="so" fontSize={12} angle={30} textAnchor="start" hide />
|
||||||
<YAxis />
|
<YAxis />
|
||||||
<Tooltip />
|
<Tooltip
|
||||||
<Legend />
|
formatter={(value) => [`${value}`]}
|
||||||
<Bar dataKey="total" fill="#095bd6" />
|
/>
|
||||||
|
<Legend wrapperStyle={{ fontSize: 12 }}/>
|
||||||
|
{tieneAdscripciones ? (
|
||||||
|
|
||||||
|
adscripciones.map((ads, i) => (
|
||||||
|
<Bar
|
||||||
|
key={ads}
|
||||||
|
dataKey={ads}
|
||||||
|
fill={colores[i % colores.length]}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<Bar
|
||||||
|
dataKey="total"
|
||||||
|
fill="#095bd6"
|
||||||
|
/>
|
||||||
|
|
||||||
|
)}
|
||||||
</BarChart>
|
</BarChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,16 +3,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
type AdscripcionOption = {
|
|
||||||
id_adscripcion: string
|
|
||||||
adscripcion: string
|
|
||||||
}
|
|
||||||
|
|
||||||
type UsoOption = {
|
|
||||||
id_uso: string
|
|
||||||
tipo_uso: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
filtros: any
|
filtros: any
|
||||||
@@ -24,13 +15,28 @@ interface UsoData {
|
|||||||
total: number
|
total: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const colores = [
|
||||||
|
"#818CF8",
|
||||||
|
"#34D399",
|
||||||
|
"#FBBF24",
|
||||||
|
"#F87171",
|
||||||
|
"#67E8F9",
|
||||||
|
"#C084FC"
|
||||||
|
]
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
export default function Uso({ filtros }: Props) {
|
export default function Uso({ filtros }: Props) {
|
||||||
const [data, setData] = useState<UsoData[]>([])
|
const [data, setData] = useState<UsoData[]>([])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const token = Cookies.get("token");
|
||||||
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
|
|
||||||
const getUso = async () => {
|
const getUso = async () => {
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
"http://localhost:3001/equipos/grafica/uso",filtros
|
`${api_url}/equipos/grafica/uso`, filtros,
|
||||||
|
{ headers }
|
||||||
)
|
)
|
||||||
setData(response.data)
|
setData(response.data)
|
||||||
}
|
}
|
||||||
@@ -38,11 +44,35 @@ export default function Uso({ filtros }: Props) {
|
|||||||
|
|
||||||
}, [filtros])
|
}, [filtros])
|
||||||
|
|
||||||
|
const tieneAdscripciones = data.some(d => d.adscripcion)
|
||||||
|
|
||||||
|
let dataTransformada = data
|
||||||
|
let adscripciones: string[] = []
|
||||||
|
|
||||||
|
if (tieneAdscripciones) {
|
||||||
|
|
||||||
|
adscripciones = [...new Set(data.map(d => d.adscripcion))]
|
||||||
|
|
||||||
|
dataTransformada = Object.values(
|
||||||
|
data.reduce((acc: any, item: any) => {
|
||||||
|
|
||||||
|
if (!acc[item.uso]) {
|
||||||
|
acc[item.uso] = { uso: item.uso }
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[item.uso][item.adscripcion] = Number(item.total)
|
||||||
|
|
||||||
|
return acc
|
||||||
|
|
||||||
|
}, {})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ minWidth: "570px", background: "white", borderRadius: "10px", margin: "5px auto", padding: "1rem" }}>
|
<div style={{ minWidth: "570px", background: "white", borderRadius: "10px", padding: "1rem" }}>
|
||||||
<h1 style={{ margin: "0" }}>Uso</h1>
|
<h1 style={{ margin: "0" }}>Uso por equipo</h1>
|
||||||
<ResponsiveContainer width="100%" aspect={2.5} minHeight={220}>
|
<ResponsiveContainer width="100%" aspect={2.5} minHeight={220}>
|
||||||
<BarChart data={data}
|
<BarChart data={dataTransformada}
|
||||||
width={500}
|
width={500}
|
||||||
height={300}
|
height={300}
|
||||||
margin={{
|
margin={{
|
||||||
@@ -52,12 +82,31 @@ export default function Uso({ filtros }: Props) {
|
|||||||
<CartesianGrid strokeDasharray="3 3" />
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
<XAxis dataKey="uso" fontSize={12} />
|
<XAxis dataKey="uso" fontSize={12} />
|
||||||
<YAxis />
|
<YAxis />
|
||||||
<Tooltip />
|
<Tooltip
|
||||||
<Legend />
|
formatter={(value) => [`${value}`]}
|
||||||
<Bar dataKey="total" fill="#095bd6" />
|
/>
|
||||||
|
<Legend wrapperStyle={{ fontSize: 12 }}/>
|
||||||
|
{tieneAdscripciones ? (
|
||||||
|
|
||||||
|
adscripciones.map((ads, i) => (
|
||||||
|
<Bar
|
||||||
|
key={ads}
|
||||||
|
dataKey={ads}
|
||||||
|
fill={colores[i % colores.length]}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<Bar
|
||||||
|
dataKey="total"
|
||||||
|
fill="#095bd6"
|
||||||
|
/>
|
||||||
|
|
||||||
|
)}
|
||||||
</BarChart>
|
</BarChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
//IO
|
||||||
@@ -42,51 +42,81 @@
|
|||||||
.chip {
|
.chip {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #f1f3f5;
|
background: linear-gradient(135deg, #2563eb, #7c3aed);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
text-align: start;
|
text-align: start;
|
||||||
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.remove {
|
.remove {
|
||||||
border: none;
|
border: none;
|
||||||
background: none;
|
background: rgba(255,255,255,0.2);
|
||||||
margin-left: 6px;
|
margin-left: 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: #777;
|
color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 12px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.remove:hover {
|
.remove:hover {
|
||||||
color: #c0392b;
|
background: rgba(255,255,255,0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
padding: 8px 14px;
|
padding: 12px 20px;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 6px;
|
border-radius: 10px;
|
||||||
background: #2563eb;
|
background: linear-gradient(135deg, #2563eb, #4f46e5);
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 13px;
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: all 0.25s ease;
|
||||||
|
box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.button:hover {
|
.button:hover {
|
||||||
background: #1d4ed8;
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.graficas {
|
.graficas {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graficas > div {
|
||||||
|
background: white;
|
||||||
|
border-radius: 16px !important;
|
||||||
|
padding: 15px !important;
|
||||||
|
box-shadow: 0 10px 25px rgba(0,0,0,0.08);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graficas > div:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 15px 35px rgba(0,0,0,0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
.filtro {
|
.filtro {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: start;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.containerSelection {
|
.containerSelection {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 200px
|
width: 200px
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import styles from './TableAntiguedad.module.css'
|
||||||
|
import axios from 'axios'
|
||||||
|
import DownloadTable from '@/components/Dowload/tabla'
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
filtros: any
|
||||||
|
count: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
|
export default function TableAntiguedad({ filtros, count }: Props) {
|
||||||
|
|
||||||
|
const [data, setData] = useState<any[]>([])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!filtros) { return }
|
||||||
|
|
||||||
|
const getUso = async () => {
|
||||||
|
const token = Cookies.get("token");
|
||||||
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
|
|
||||||
|
const endpoint = count
|
||||||
|
? `${api_url}/equipos/tabla/count`
|
||||||
|
: `${api_url}/equipos/tabla`
|
||||||
|
|
||||||
|
const response = await axios.post(endpoint, filtros,{headers})
|
||||||
|
setData(response.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
getUso()
|
||||||
|
}, [filtros, count])
|
||||||
|
|
||||||
|
const columnas = data.length > 0 ? Object.keys(data[0]) : []
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.container}>
|
||||||
|
{count ? <DownloadTable filtros={filtros} count={true} /> : <DownloadTable filtros={filtros} count={false} />}
|
||||||
|
<table className={styles.table}>
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
{columnas.map((col) => (
|
||||||
|
<th key={col}>{formatearTitulo(col)}</th>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{data.length === 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={columnas.length} className={styles.empty}>
|
||||||
|
No hay datos
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
data.map((item, index) => (
|
||||||
|
<tr key={index}>
|
||||||
|
{columnas.map((col) => (
|
||||||
|
<td key={col}>
|
||||||
|
{item[col] ?? '-'}
|
||||||
|
</td>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatearTitulo(col: string) {
|
||||||
|
const nombres: any = {
|
||||||
|
inventario: 'No. Inventario',
|
||||||
|
adscripcion: 'Adscripción',
|
||||||
|
antiguedad: 'Antigüedad',
|
||||||
|
procesador: 'Procesador',
|
||||||
|
sistema_operativo: 'Sistema Operativo',
|
||||||
|
uso: 'Uso'
|
||||||
|
}
|
||||||
|
|
||||||
|
return nombres[col] || col
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 14px;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table thead {
|
||||||
|
background: linear-gradient(135deg, #a5a5a5, #878787);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table th {
|
||||||
|
padding: 12px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table td {
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table tbody tr:hover {
|
||||||
|
background-color: #f5f8ff;
|
||||||
|
transition: 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #095bd6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
@@ -11,6 +11,8 @@ import SistemaOperativo from "./Graficas/SistemaOperativo"
|
|||||||
import Uso from "./Graficas/Uso"
|
import Uso from "./Graficas/Uso"
|
||||||
|
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
|
import TableAntiguedad from "./Tablas/Antiguedad"
|
||||||
|
import Polar from "./Graficas/Polar"
|
||||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
type AdscripcionOption = {
|
type AdscripcionOption = {
|
||||||
@@ -48,35 +50,51 @@ export default function Reporte() {
|
|||||||
const [sistemasOperativos, setSistemasOperativos] = useState<SoOption[]>([])
|
const [sistemasOperativos, setSistemasOperativos] = useState<SoOption[]>([])
|
||||||
const [soSeleccionado, setSoSeleccionado] = useState<SoOption[]>([])
|
const [soSeleccionado, setSoSeleccionado] = useState<SoOption[]>([])
|
||||||
|
|
||||||
const [usos, setUsos] = useState<UsoOption[]>([])
|
const [usos, setUsos] = useState<UsoOption[]>([{ id_uso: "0", tipo_uso: "Todos" }])
|
||||||
const [usoSeleccionado, setUsoSeleccionado] = useState<UsoOption[]>([])
|
const [usoSeleccionado, setUsoSeleccionado] = useState<UsoOption[]>([])
|
||||||
|
|
||||||
const [antiguedad, setAntiguedad] = useState<AntiguedadOption[]>([{ antiguedad: "Menor a 2 años" }, { antiguedad: "Entre 2 y 3 años" }, { antiguedad: "Entre 4 y 5 años" }, { antiguedad: "Mayor a 6 años" }])
|
const [antiguedad, setAntiguedad] = useState<AntiguedadOption[]>([{ antiguedad: "Todos" }, { antiguedad: "Menor a 2 años" }, { antiguedad: "Entre 2 y 3 años" }, { antiguedad: "Entre 4 y 5 años" }, { antiguedad: "Mayor a 6 años" }])
|
||||||
const [antiguedadSeleccionada, setAntiguedadSeleccionada] = useState<AntiguedadOption[]>([])
|
const [antiguedadSeleccionada, setAntiguedadSeleccionada] = useState<AntiguedadOption[]>([])
|
||||||
|
|
||||||
const [filtros, setFiltros] = useState<any>(null)
|
const [filtros, setFiltros] = useState<any>(null)
|
||||||
|
const [filtrosTable, setFiltrosTable] = useState<any>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
const cargarDatos = async () => {
|
const cargarDatos = async () => {
|
||||||
const token = Cookies.get("token");
|
const token = Cookies.get("token");
|
||||||
const headers = { Authorization: `Bearer ${token}` };
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
const [
|
const [
|
||||||
adscripcionRes,
|
adscripcionRes,
|
||||||
procesadorRes,
|
procesadorRes,
|
||||||
usoRes,
|
usoRes,
|
||||||
soRes,
|
soRes,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
axios.get(`${api_url}/equipos/adscripciones`,{ headers }),
|
axios.get(`${api_url}/equipos/adscripciones`, { headers }),
|
||||||
axios.get(`${api_url}/equipos/procesador-tipo-equipos`,{ headers }),
|
axios.get(`${api_url}/equipos/procesador-tipo-equipos`, { headers }),
|
||||||
axios.get(`${api_url}/equipos/usos`,{ headers }),
|
axios.get(`${api_url}/equipos/usos`, { headers }),
|
||||||
axios.get(`${api_url}/equipos/sistemas-operativos`,{ headers }),
|
axios.get(`${api_url}/equipos/sistemas-operativos`, { headers }),
|
||||||
])
|
])
|
||||||
|
|
||||||
setAdscripciones(adscripcionRes.data)
|
setAdscripciones([
|
||||||
setProcesadores(procesadorRes.data)
|
{ id_adscripcion: "0", adscripcion: "Todos" },
|
||||||
setUsos(usoRes.data)
|
...adscripcionRes.data
|
||||||
setSistemasOperativos(soRes.data)
|
])
|
||||||
|
|
||||||
|
setProcesadores([
|
||||||
|
{ id_procesador: "0", procesador: "Todos" },
|
||||||
|
...procesadorRes.data
|
||||||
|
])
|
||||||
|
|
||||||
|
setUsos([
|
||||||
|
{ id_uso: "0", tipo_uso: "Todos" },
|
||||||
|
...usoRes.data
|
||||||
|
])
|
||||||
|
|
||||||
|
setSistemasOperativos([
|
||||||
|
{ id_sistema_operativo: "0", sistema_operativo: "Todos" },
|
||||||
|
...soRes.data
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
cargarDatos()
|
cargarDatos()
|
||||||
@@ -105,7 +123,12 @@ export default function Reporte() {
|
|||||||
|
|
||||||
const generarReporte = () => {
|
const generarReporte = () => {
|
||||||
|
|
||||||
const filtros = {
|
const limpiar = (arr: string[]) => {
|
||||||
|
if (arr.includes("0")) return []
|
||||||
|
return arr
|
||||||
|
}
|
||||||
|
|
||||||
|
const filtrosTable = {
|
||||||
adscripciones: adscripcionesSeleccionadas.map(a => String(a.id_adscripcion)),
|
adscripciones: adscripcionesSeleccionadas.map(a => String(a.id_adscripcion)),
|
||||||
procesadores: procesadorSeleccionado.map(p => String(p.id_procesador)),
|
procesadores: procesadorSeleccionado.map(p => String(p.id_procesador)),
|
||||||
sistemas: soSeleccionado.map(s => String(s.id_sistema_operativo)),
|
sistemas: soSeleccionado.map(s => String(s.id_sistema_operativo)),
|
||||||
@@ -113,7 +136,16 @@ export default function Reporte() {
|
|||||||
antiguedad: antiguedadSeleccionada.map(u => String(u.antiguedad))
|
antiguedad: antiguedadSeleccionada.map(u => String(u.antiguedad))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const filtros = {
|
||||||
|
adscripciones: limpiar(adscripcionesSeleccionadas.map(a => String(a.id_adscripcion))),
|
||||||
|
procesadores: limpiar(procesadorSeleccionado.map(p => String(p.id_procesador))),
|
||||||
|
sistemas: limpiar(soSeleccionado.map(s => String(s.id_sistema_operativo))),
|
||||||
|
usos: limpiar(usoSeleccionado.map(u => String(u.id_uso))),
|
||||||
|
antiguedad: limpiar(antiguedadSeleccionada.map(a => String(a.antiguedad)))
|
||||||
|
}
|
||||||
|
|
||||||
setFiltros(filtros)
|
setFiltros(filtros)
|
||||||
|
setFiltrosTable(filtrosTable)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +161,7 @@ export default function Reporte() {
|
|||||||
<label className={styles.adscripcion}>Adscripción</label>
|
<label className={styles.adscripcion}>Adscripción</label>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
instanceId="adscripcion"
|
||||||
options={adscripciones}
|
options={adscripciones}
|
||||||
getOptionLabel={(o) => o.adscripcion}
|
getOptionLabel={(o) => o.adscripcion}
|
||||||
getOptionValue={(o) => o.id_adscripcion}
|
getOptionValue={(o) => o.id_adscripcion}
|
||||||
@@ -166,6 +199,7 @@ export default function Reporte() {
|
|||||||
<label className={styles.adscripcion}>Procesador</label>
|
<label className={styles.adscripcion}>Procesador</label>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
instanceId="procesadores"
|
||||||
options={procesadores}
|
options={procesadores}
|
||||||
getOptionLabel={(o) => o.procesador}
|
getOptionLabel={(o) => o.procesador}
|
||||||
getOptionValue={(o) => o.id_procesador}
|
getOptionValue={(o) => o.id_procesador}
|
||||||
@@ -206,6 +240,7 @@ export default function Reporte() {
|
|||||||
<label className={styles.adscripcion}>Sistema Operativo</label>
|
<label className={styles.adscripcion}>Sistema Operativo</label>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
instanceId="sistemasOperativos"
|
||||||
options={sistemasOperativos}
|
options={sistemasOperativos}
|
||||||
getOptionLabel={(o) => o.sistema_operativo}
|
getOptionLabel={(o) => o.sistema_operativo}
|
||||||
getOptionValue={(o) => o.id_sistema_operativo}
|
getOptionValue={(o) => o.id_sistema_operativo}
|
||||||
@@ -247,6 +282,7 @@ export default function Reporte() {
|
|||||||
<label className={styles.adscripcion}>Uso</label>
|
<label className={styles.adscripcion}>Uso</label>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
instanceId="usos"
|
||||||
options={usos}
|
options={usos}
|
||||||
getOptionLabel={(o) => o.tipo_uso}
|
getOptionLabel={(o) => o.tipo_uso}
|
||||||
getOptionValue={(o) => o.id_uso}
|
getOptionValue={(o) => o.id_uso}
|
||||||
@@ -286,6 +322,7 @@ export default function Reporte() {
|
|||||||
<label className={styles.adscripcion}>Antiguedad</label>
|
<label className={styles.adscripcion}>Antiguedad</label>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
instanceId="antiguedad"
|
||||||
options={antiguedad}
|
options={antiguedad}
|
||||||
getOptionLabel={(o) => o.antiguedad}
|
getOptionLabel={(o) => o.antiguedad}
|
||||||
getOptionValue={(o) => o.antiguedad}
|
getOptionValue={(o) => o.antiguedad}
|
||||||
@@ -342,6 +379,10 @@ export default function Reporte() {
|
|||||||
filtros={filtros}
|
filtros={filtros}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Polar tipo="ALUMNO" filtros={filtros} />
|
||||||
|
<Polar tipo="PROFESOR" filtros={filtros} />
|
||||||
|
<Polar tipo="ADMINISTRATIVO" filtros={filtros} />
|
||||||
|
|
||||||
<Procesador
|
<Procesador
|
||||||
filtros={filtros}
|
filtros={filtros}
|
||||||
/>
|
/>
|
||||||
@@ -350,6 +391,9 @@ export default function Reporte() {
|
|||||||
filtros={filtros}
|
filtros={filtros}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<TableAntiguedad filtros={filtros} count={true} />
|
||||||
|
<TableAntiguedad filtros={filtrosTable} count={false} />
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import axios from "axios";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import {
|
||||||
|
Bar,
|
||||||
|
BarChart,
|
||||||
|
CartesianGrid,
|
||||||
|
Legend,
|
||||||
|
ResponsiveContainer,
|
||||||
|
Tooltip,
|
||||||
|
XAxis,
|
||||||
|
YAxis
|
||||||
|
} from "recharts";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
filtros: any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AntiguedadData {
|
||||||
|
adscripcion: string
|
||||||
|
antiguedad: string
|
||||||
|
total: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const colores = [
|
||||||
|
"#818CF8",
|
||||||
|
"#34D399",
|
||||||
|
"#FBBF24",
|
||||||
|
"#F87171",
|
||||||
|
"#67E8F9",
|
||||||
|
"#C084FC"
|
||||||
|
]
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
|
export default function Antiguedad({ filtros }: Props) {
|
||||||
|
|
||||||
|
const [data, setData] = useState<AntiguedadData[]>([])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const token = Cookies.get("token");
|
||||||
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
|
|
||||||
|
const getAntiguedad = async () => {
|
||||||
|
|
||||||
|
const response = await axios.post(
|
||||||
|
`${api_url}/equipos/graficaPerifericos/antiguedad`,
|
||||||
|
filtros,
|
||||||
|
{ headers }
|
||||||
|
)
|
||||||
|
|
||||||
|
setData(response.data)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getAntiguedad()
|
||||||
|
|
||||||
|
}, [filtros])
|
||||||
|
|
||||||
|
const tieneAdscripciones = data.some(d => d.adscripcion)
|
||||||
|
|
||||||
|
let dataTransformada = data
|
||||||
|
let adscripciones: string[] = []
|
||||||
|
|
||||||
|
if (tieneAdscripciones) {
|
||||||
|
|
||||||
|
adscripciones = [...new Set(data.map(d => d.adscripcion))]
|
||||||
|
|
||||||
|
dataTransformada = Object.values(
|
||||||
|
data.reduce((acc: any, item: any) => {
|
||||||
|
|
||||||
|
if (!acc[item.antiguedad]) {
|
||||||
|
acc[item.antiguedad] = { antiguedad: item.antiguedad }
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[item.antiguedad][item.adscripcion] = Number(item.total)
|
||||||
|
|
||||||
|
return acc
|
||||||
|
|
||||||
|
}, {})
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
minWidth: "570px",
|
||||||
|
background: "white",
|
||||||
|
borderRadius: "10px",
|
||||||
|
padding: "1rem",
|
||||||
|
maxWidth: "100%"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
|
||||||
|
<h1 style={{ margin: "0" }}>Antigüedad por periferico</h1>
|
||||||
|
|
||||||
|
<ResponsiveContainer width="100%" aspect={2.5}>
|
||||||
|
|
||||||
|
<BarChart
|
||||||
|
data={dataTransformada}
|
||||||
|
margin={{ top: 20 }}
|
||||||
|
>
|
||||||
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
|
|
||||||
|
<XAxis dataKey="antiguedad" fontSize={12} />
|
||||||
|
|
||||||
|
<YAxis />
|
||||||
|
<Tooltip
|
||||||
|
formatter={(value) => [`${value}`]}
|
||||||
|
/>
|
||||||
|
<Legend />
|
||||||
|
{tieneAdscripciones ? (
|
||||||
|
|
||||||
|
adscripciones.map((ads, i) => (
|
||||||
|
<Bar
|
||||||
|
key={ads}
|
||||||
|
dataKey={ads}
|
||||||
|
fill={colores[i % colores.length]}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<Bar
|
||||||
|
dataKey="total"
|
||||||
|
fill="#095bd6"
|
||||||
|
/>
|
||||||
|
|
||||||
|
)}
|
||||||
|
|
||||||
|
</BarChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import axios from "axios";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
filtros: any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface procesador {
|
||||||
|
adscripcion: string
|
||||||
|
procesador: string;
|
||||||
|
total: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const colores = [
|
||||||
|
"#818CF8",
|
||||||
|
"#34D399",
|
||||||
|
"#FBBF24",
|
||||||
|
"#F87171",
|
||||||
|
"#67E8F9",
|
||||||
|
"#C084FC"
|
||||||
|
]
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
|
export default function Procesador({ filtros }: Props) {
|
||||||
|
const [data, setData] = useState<procesador[]>([])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const getAntiguedad = async () => {
|
||||||
|
const response = await axios.post(`${api_url}/equipos/graficaPerifericos/procesador`, filtros)
|
||||||
|
|
||||||
|
setData(response.data)
|
||||||
|
}
|
||||||
|
getAntiguedad()
|
||||||
|
}, [filtros])
|
||||||
|
|
||||||
|
const tieneAdscripciones = data.some(d => d.adscripcion)
|
||||||
|
|
||||||
|
let dataTransformada = data
|
||||||
|
let adscripciones: string[] = []
|
||||||
|
|
||||||
|
if (tieneAdscripciones) {
|
||||||
|
|
||||||
|
adscripciones = [...new Set(data.map(d => d.adscripcion))]
|
||||||
|
|
||||||
|
dataTransformada = Object.values(
|
||||||
|
data.reduce((acc: any, item: any) => {
|
||||||
|
|
||||||
|
if (!acc[item.procesador]) {
|
||||||
|
acc[item.procesador] = { procesador: item.procesador }
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[item.procesador][item.adscripcion] = Number(item.total)
|
||||||
|
|
||||||
|
return acc
|
||||||
|
|
||||||
|
}, {})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ width: "100%", background: "white", borderRadius: "10px", margin: "5px auto", padding: "1rem" }}>
|
||||||
|
<h1 style={{ margin: "0" }}>Procesador por equipo</h1>
|
||||||
|
<ResponsiveContainer width="100%" aspect={3.5}>
|
||||||
|
<BarChart data={dataTransformada}
|
||||||
|
width={500}
|
||||||
|
height={300}
|
||||||
|
margin={{
|
||||||
|
top: 20,
|
||||||
|
bottom: 20,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
|
<XAxis dataKey="procesador" fontSize={12} angle={40} textAnchor="start" hide />
|
||||||
|
<YAxis />
|
||||||
|
<Tooltip
|
||||||
|
formatter={(value) => [`${value}`]}
|
||||||
|
/>
|
||||||
|
<Legend />
|
||||||
|
{tieneAdscripciones ? (
|
||||||
|
|
||||||
|
adscripciones.map((ads, i) => (
|
||||||
|
<Bar
|
||||||
|
key={ads}
|
||||||
|
dataKey={ads}
|
||||||
|
fill={colores[i % colores.length]}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<Bar
|
||||||
|
dataKey="total"
|
||||||
|
fill="#095bd6"
|
||||||
|
/>
|
||||||
|
|
||||||
|
)}
|
||||||
|
</BarChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import axios from "axios";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
filtros: any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface so {
|
||||||
|
adscripcion: string
|
||||||
|
so: string;
|
||||||
|
total: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const colores = [
|
||||||
|
"#818CF8",
|
||||||
|
"#34D399",
|
||||||
|
"#FBBF24",
|
||||||
|
"#F87171",
|
||||||
|
"#67E8F9",
|
||||||
|
"#C084FC"
|
||||||
|
]
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
|
export default function SistemaOperativo({ filtros }: Props) {
|
||||||
|
const [data, setData] = useState<so[]>([])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const getAntiguedad = async () => {
|
||||||
|
const response = await axios.post(`${api_url}/equipos/graficaPerifericos/so`, filtros)
|
||||||
|
|
||||||
|
setData(response.data)
|
||||||
|
}
|
||||||
|
getAntiguedad()
|
||||||
|
}, [filtros])
|
||||||
|
|
||||||
|
const tieneAdscripciones = data.some(d => d.adscripcion)
|
||||||
|
|
||||||
|
let dataTransformada = data
|
||||||
|
let adscripciones: string[] = []
|
||||||
|
|
||||||
|
if (tieneAdscripciones) {
|
||||||
|
|
||||||
|
adscripciones = [...new Set(data.map(d => d.adscripcion))]
|
||||||
|
|
||||||
|
dataTransformada = Object.values(
|
||||||
|
data.reduce((acc: any, item: any) => {
|
||||||
|
|
||||||
|
if (!acc[item.so]) {
|
||||||
|
acc[item.so] = { so: item.so }
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[item.so][item.adscripcion] = Number(item.total)
|
||||||
|
|
||||||
|
return acc
|
||||||
|
|
||||||
|
}, {})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ width: "100%", background: "white", borderRadius: "10px", margin: "5px auto", padding: "1rem" }}>
|
||||||
|
<h1 style={{ margin: "0" }}>SistemaOperativo por equipo</h1>
|
||||||
|
<ResponsiveContainer width="100%" aspect={3.5}>
|
||||||
|
<BarChart data={dataTransformada}
|
||||||
|
width={500}
|
||||||
|
height={300}
|
||||||
|
margin={{
|
||||||
|
top: 20,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
|
<XAxis dataKey="so" fontSize={12} angle={30} textAnchor="start" hide />
|
||||||
|
<YAxis />
|
||||||
|
<Tooltip
|
||||||
|
formatter={(value) => [`${value}`]}
|
||||||
|
/>
|
||||||
|
<Legend />
|
||||||
|
{tieneAdscripciones ? (
|
||||||
|
|
||||||
|
adscripciones.map((ads, i) => (
|
||||||
|
<Bar
|
||||||
|
key={ads}
|
||||||
|
dataKey={ads}
|
||||||
|
fill={colores[i % colores.length]}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<Bar
|
||||||
|
dataKey="total"
|
||||||
|
fill="#095bd6"
|
||||||
|
/>
|
||||||
|
|
||||||
|
)}
|
||||||
|
</BarChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import axios from "axios";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
filtros: any
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UsoData {
|
||||||
|
uso: string
|
||||||
|
adscripcion: string
|
||||||
|
total: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const colores = [
|
||||||
|
"#818CF8",
|
||||||
|
"#34D399",
|
||||||
|
"#FBBF24",
|
||||||
|
"#F87171",
|
||||||
|
"#67E8F9",
|
||||||
|
"#C084FC"
|
||||||
|
]
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
|
export default function Uso({ filtros }: Props) {
|
||||||
|
const [data, setData] = useState<UsoData[]>([])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const getUso = async () => {
|
||||||
|
const response = await axios.post(
|
||||||
|
`${api_url}/equipos/graficaPerifericos/uso`, filtros
|
||||||
|
)
|
||||||
|
setData(response.data)
|
||||||
|
}
|
||||||
|
getUso()
|
||||||
|
|
||||||
|
}, [filtros])
|
||||||
|
|
||||||
|
const tieneAdscripciones = data.some(d => d.adscripcion)
|
||||||
|
|
||||||
|
let dataTransformada = data
|
||||||
|
let adscripciones: string[] = []
|
||||||
|
|
||||||
|
if (tieneAdscripciones) {
|
||||||
|
|
||||||
|
adscripciones = [...new Set(data.map(d => d.adscripcion))]
|
||||||
|
|
||||||
|
dataTransformada = Object.values(
|
||||||
|
data.reduce((acc: any, item: any) => {
|
||||||
|
|
||||||
|
if (!acc[item.uso]) {
|
||||||
|
acc[item.uso] = { uso: item.uso }
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[item.uso][item.adscripcion] = Number(item.total)
|
||||||
|
|
||||||
|
return acc
|
||||||
|
|
||||||
|
}, {})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ minWidth: "570px", background: "white", borderRadius: "10px", padding: "1rem" }}>
|
||||||
|
<h1 style={{ margin: "0" }}>Uso por periferico</h1>
|
||||||
|
<ResponsiveContainer width="100%" aspect={2.5} minHeight={220}>
|
||||||
|
<BarChart data={dataTransformada}
|
||||||
|
width={500}
|
||||||
|
height={300}
|
||||||
|
margin={{
|
||||||
|
top: 20,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
|
<XAxis dataKey="uso" fontSize={12} />
|
||||||
|
<YAxis />
|
||||||
|
<Tooltip
|
||||||
|
formatter={(value) => [`${value}`]}
|
||||||
|
/>
|
||||||
|
<Legend />
|
||||||
|
{tieneAdscripciones ? (
|
||||||
|
|
||||||
|
adscripciones.map((ads, i) => (
|
||||||
|
<Bar
|
||||||
|
key={ads}
|
||||||
|
dataKey={ads}
|
||||||
|
fill={colores[i % colores.length]}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
|
||||||
|
) : (
|
||||||
|
|
||||||
|
<Bar
|
||||||
|
dataKey="total"
|
||||||
|
fill="#095bd6"
|
||||||
|
/>
|
||||||
|
|
||||||
|
)}
|
||||||
|
</BarChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
//IO
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 20px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 18px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listaContainer {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lista {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: linear-gradient(135deg, #2563eb, #7c3aed);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
font-size: 13px;
|
||||||
|
text-align: start;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove {
|
||||||
|
border: none;
|
||||||
|
background: rgba(255,255,255,0.2);
|
||||||
|
margin-left: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 12px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove:hover {
|
||||||
|
background: rgba(255,255,255,0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 12px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: linear-gradient(135deg, #2563eb, #4f46e5);
|
||||||
|
color: white;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.25s ease;
|
||||||
|
box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
|
||||||
|
}
|
||||||
|
.graficas {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graficas > div {
|
||||||
|
background: white;
|
||||||
|
border-radius: 16px !important;
|
||||||
|
padding: 15px !important;
|
||||||
|
box-shadow: 0 10px 25px rgba(0,0,0,0.08);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graficas > div:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 15px 35px rgba(0,0,0,0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.filtro {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: start;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.containerSelection {
|
||||||
|
width: 100%;
|
||||||
|
width: 200px
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import styles from './TableAntiguedad.module.css'
|
||||||
|
import axios from 'axios'
|
||||||
|
import DownloadTable from '@/components/Dowload/tabla'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
filtros: any
|
||||||
|
count: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
|
export default function TableAntiguedad({ filtros, count }: Props) {
|
||||||
|
|
||||||
|
const [data, setData] = useState<any[]>([])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const getUso = async () => {
|
||||||
|
const endpoint = count
|
||||||
|
? `${api_url}/equipos/tabla/count`
|
||||||
|
: `${api_url}/equipos/tabla`
|
||||||
|
|
||||||
|
const response = await axios.post(endpoint, filtros)
|
||||||
|
setData(response.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
getUso()
|
||||||
|
}, [filtros, count])
|
||||||
|
|
||||||
|
const columnas = data.length > 0 ? Object.keys(data[0]) : []
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.container}>
|
||||||
|
{count ? <DownloadTable filtros={filtros} count={true} /> : <DownloadTable filtros={filtros} count={false} />}
|
||||||
|
<table className={styles.table}>
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
{columnas.map((col) => (
|
||||||
|
<th key={col}>{formatearTitulo(col)}</th>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{data.length === 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td colSpan={columnas.length} className={styles.empty}>
|
||||||
|
No hay datos
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
data.map((item, index) => (
|
||||||
|
<tr key={index}>
|
||||||
|
{columnas.map((col) => (
|
||||||
|
<td key={col}>
|
||||||
|
{item[col] ?? '-'}
|
||||||
|
</td>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatearTitulo(col: string) {
|
||||||
|
const nombres: any = {
|
||||||
|
inventario: 'No. Inventario',
|
||||||
|
adscripcion: 'Adscripción',
|
||||||
|
antiguedad: 'Antigüedad',
|
||||||
|
procesador: 'Procesador',
|
||||||
|
sistema_operativo: 'Sistema Operativo',
|
||||||
|
uso: 'Uso'
|
||||||
|
}
|
||||||
|
|
||||||
|
return nombres[col] || col
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 14px;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table thead {
|
||||||
|
background: linear-gradient(135deg, #a5a5a5, #878787);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table th {
|
||||||
|
padding: 12px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table td {
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table tbody tr:hover {
|
||||||
|
background-color: #f5f8ff;
|
||||||
|
transition: 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #095bd6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
@@ -0,0 +1,393 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import Select from "react-select"
|
||||||
|
import { useEffect, useState } from "react"
|
||||||
|
import styles from "./Reporte.module.css"
|
||||||
|
import axios from "axios"
|
||||||
|
|
||||||
|
import Antiguedad from "./Graficas/Antiguedad"
|
||||||
|
import Procesador from "./Graficas/Procesador"
|
||||||
|
import SistemaOperativo from "./Graficas/SistemaOperativo"
|
||||||
|
import Uso from "./Graficas/Uso"
|
||||||
|
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
import TableAntiguedad from "./Tablas/Antiguedad"
|
||||||
|
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||||
|
|
||||||
|
type AdscripcionOption = {
|
||||||
|
id_adscripcion: string
|
||||||
|
adscripcion: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type UsoOption = {
|
||||||
|
id_uso: string
|
||||||
|
tipo_uso: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SoOption = {
|
||||||
|
id_sistema_operativo: string
|
||||||
|
sistema_operativo: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProcesadorOption = {
|
||||||
|
id_procesador: string
|
||||||
|
procesador: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type AntiguedadOption = {
|
||||||
|
antiguedad: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ReportePerifericos() {
|
||||||
|
|
||||||
|
const [adscripciones, setAdscripciones] = useState<AdscripcionOption[]>([])
|
||||||
|
const [adscripcionesSeleccionadas, setAdscripcionesSeleccionadas] = useState<AdscripcionOption[]>([])
|
||||||
|
|
||||||
|
const [procesadores, setProcesadores] = useState<ProcesadorOption[]>([])
|
||||||
|
const [procesadorSeleccionado, setProcesadorSeleccionado] = useState<ProcesadorOption[]>([])
|
||||||
|
|
||||||
|
const [sistemasOperativos, setSistemasOperativos] = useState<SoOption[]>([])
|
||||||
|
const [soSeleccionado, setSoSeleccionado] = useState<SoOption[]>([])
|
||||||
|
|
||||||
|
const [usos, setUsos] = useState<UsoOption[]>([{ id_uso: "0", tipo_uso: "Todos" }])
|
||||||
|
const [usoSeleccionado, setUsoSeleccionado] = useState<UsoOption[]>([])
|
||||||
|
|
||||||
|
const [antiguedad, setAntiguedad] = useState<AntiguedadOption[]>([{ antiguedad: "Todos" }, { antiguedad: "Menor a 2 años" }, { antiguedad: "Entre 2 y 3 años" }, { antiguedad: "Entre 4 y 5 años" }, { antiguedad: "Mayor a 6 años" }])
|
||||||
|
const [antiguedadSeleccionada, setAntiguedadSeleccionada] = useState<AntiguedadOption[]>([])
|
||||||
|
|
||||||
|
const [filtros, setFiltros] = useState<any>(null)
|
||||||
|
const [filtrosTable, setFiltrosTable] = useState<any>(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
|
||||||
|
const cargarDatos = async () => {
|
||||||
|
const token = Cookies.get("token");
|
||||||
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
|
const [
|
||||||
|
adscripcionRes,
|
||||||
|
procesadorRes,
|
||||||
|
usoRes,
|
||||||
|
soRes,
|
||||||
|
] = await Promise.all([
|
||||||
|
axios.get(`${api_url}/equipos/adscripciones`, { headers }),
|
||||||
|
axios.get(`${api_url}/equipos/procesador-tipo-equipos`, { headers }),
|
||||||
|
axios.get(`${api_url}/equipos/usos`, { headers }),
|
||||||
|
axios.get(`${api_url}/equipos/sistemas-operativos`, { headers }),
|
||||||
|
])
|
||||||
|
|
||||||
|
setAdscripciones([
|
||||||
|
{ id_adscripcion: "0", adscripcion: "Todos" },
|
||||||
|
...adscripcionRes.data
|
||||||
|
])
|
||||||
|
|
||||||
|
setProcesadores([
|
||||||
|
{ id_procesador: "0", procesador: "Todos" },
|
||||||
|
...procesadorRes.data
|
||||||
|
])
|
||||||
|
|
||||||
|
setUsos([
|
||||||
|
{ id_uso: "0", tipo_uso: "Todos" },
|
||||||
|
...usoRes.data
|
||||||
|
])
|
||||||
|
|
||||||
|
setSistemasOperativos([
|
||||||
|
{ id_sistema_operativo: "0", sistema_operativo: "Todos" },
|
||||||
|
...soRes.data
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
cargarDatos()
|
||||||
|
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
function agregar<T>(option: T | null, lista: T[], setLista: (v: T[]) => void, key: keyof T) {
|
||||||
|
|
||||||
|
if (!option) return
|
||||||
|
|
||||||
|
const existe = lista.some((item) => item[key] === option[key])
|
||||||
|
|
||||||
|
if (!existe) {
|
||||||
|
setLista([...lista, option])
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function eliminar<T>(id: string, lista: T[], setLista: (v: T[]) => void, key: keyof T) {
|
||||||
|
|
||||||
|
setLista(
|
||||||
|
lista.filter((item) => item[key] !== id)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const generarReporte = () => {
|
||||||
|
|
||||||
|
const limpiar = (arr: string[]) => {
|
||||||
|
if (arr.includes("0")) return []
|
||||||
|
return arr
|
||||||
|
}
|
||||||
|
|
||||||
|
const filtrosTable = {
|
||||||
|
adscripciones: adscripcionesSeleccionadas.map(a => String(a.id_adscripcion)),
|
||||||
|
procesadores: procesadorSeleccionado.map(p => String(p.id_procesador)),
|
||||||
|
sistemas: soSeleccionado.map(s => String(s.id_sistema_operativo)),
|
||||||
|
usos: usoSeleccionado.map(u => String(u.id_uso)),
|
||||||
|
antiguedad: antiguedadSeleccionada.map(u => String(u.antiguedad))
|
||||||
|
}
|
||||||
|
|
||||||
|
const filtros = {
|
||||||
|
adscripciones: limpiar(adscripcionesSeleccionadas.map(a => String(a.id_adscripcion))),
|
||||||
|
procesadores: limpiar(procesadorSeleccionado.map(p => String(p.id_procesador))),
|
||||||
|
sistemas: limpiar(soSeleccionado.map(s => String(s.id_sistema_operativo))),
|
||||||
|
usos: limpiar(usoSeleccionado.map(u => String(u.id_uso))),
|
||||||
|
antiguedad: limpiar(antiguedadSeleccionada.map(a => String(a.antiguedad)))
|
||||||
|
}
|
||||||
|
|
||||||
|
setFiltros(filtros)
|
||||||
|
setFiltrosTable(filtrosTable)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className={styles.container}>
|
||||||
|
|
||||||
|
<section className={styles.filtro}>
|
||||||
|
|
||||||
|
{/* ADSCRIPCION */}
|
||||||
|
|
||||||
|
<div className={styles.containerSelection}>
|
||||||
|
<label className={styles.adscripcion}>Adscripción</label>
|
||||||
|
|
||||||
|
<Select
|
||||||
|
options={adscripciones}
|
||||||
|
getOptionLabel={(o) => o.adscripcion}
|
||||||
|
getOptionValue={(o) => o.id_adscripcion}
|
||||||
|
onChange={(o) => agregar(o, adscripcionesSeleccionadas, setAdscripcionesSeleccionadas, "id_adscripcion")}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className={styles.lista}>
|
||||||
|
|
||||||
|
{adscripcionesSeleccionadas.map((a) => (
|
||||||
|
|
||||||
|
<div key={a.id_adscripcion} className={styles.chip}>
|
||||||
|
|
||||||
|
<span>{a.adscripcion}</span>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className={styles.remove}
|
||||||
|
onClick={() => eliminar(a.id_adscripcion, adscripcionesSeleccionadas, setAdscripcionesSeleccionadas, "id_adscripcion")}
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
))}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{/* PROCESADOR */}
|
||||||
|
|
||||||
|
<div className={styles.containerSelection}>
|
||||||
|
|
||||||
|
<label className={styles.adscripcion}>Procesador</label>
|
||||||
|
|
||||||
|
<Select
|
||||||
|
options={procesadores}
|
||||||
|
getOptionLabel={(o) => o.procesador}
|
||||||
|
getOptionValue={(o) => o.id_procesador}
|
||||||
|
onChange={(o) =>
|
||||||
|
agregar(o, procesadorSeleccionado, setProcesadorSeleccionado, "id_procesador")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className={styles.lista}>
|
||||||
|
|
||||||
|
{procesadorSeleccionado.map((p) => (
|
||||||
|
|
||||||
|
<div key={p.id_procesador} className={styles.chip}>
|
||||||
|
|
||||||
|
<span>{p.procesador}</span>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className={styles.remove}
|
||||||
|
onClick={() =>
|
||||||
|
eliminar(p.id_procesador, procesadorSeleccionado, setProcesadorSeleccionado, "id_procesador")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
))}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* SISTEMA OPERATIVO */}
|
||||||
|
|
||||||
|
<div className={styles.containerSelection}>
|
||||||
|
|
||||||
|
<label className={styles.adscripcion}>Sistema Operativo</label>
|
||||||
|
|
||||||
|
<Select
|
||||||
|
options={sistemasOperativos}
|
||||||
|
getOptionLabel={(o) => o.sistema_operativo}
|
||||||
|
getOptionValue={(o) => o.id_sistema_operativo}
|
||||||
|
onChange={(o) =>
|
||||||
|
agregar(o, soSeleccionado, setSoSeleccionado, "id_sistema_operativo")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className={styles.lista}>
|
||||||
|
|
||||||
|
{soSeleccionado.map((s) => (
|
||||||
|
|
||||||
|
<div key={s.id_sistema_operativo} className={styles.chip}>
|
||||||
|
|
||||||
|
<span>{s.sistema_operativo}</span>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className={styles.remove}
|
||||||
|
onClick={() =>
|
||||||
|
eliminar(s.id_sistema_operativo, soSeleccionado, setSoSeleccionado, "id_sistema_operativo")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
))}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{/* USO */}
|
||||||
|
|
||||||
|
<div className={styles.containerSelection}>
|
||||||
|
|
||||||
|
<label className={styles.adscripcion}>Uso</label>
|
||||||
|
|
||||||
|
<Select
|
||||||
|
options={usos}
|
||||||
|
getOptionLabel={(o) => o.tipo_uso}
|
||||||
|
getOptionValue={(o) => o.id_uso}
|
||||||
|
onChange={(o) =>
|
||||||
|
agregar(o, usoSeleccionado, setUsoSeleccionado, "id_uso")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className={styles.lista}>
|
||||||
|
|
||||||
|
{usoSeleccionado.map((u) => (
|
||||||
|
|
||||||
|
<div key={u.id_uso} className={styles.chip}>
|
||||||
|
|
||||||
|
<span>{u.tipo_uso}</span>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className={styles.remove}
|
||||||
|
onClick={() =>
|
||||||
|
eliminar(u.id_uso, usoSeleccionado, setUsoSeleccionado, "id_uso")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
))}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div className={styles.containerSelection}>
|
||||||
|
|
||||||
|
<label className={styles.adscripcion}>Antiguedad</label>
|
||||||
|
|
||||||
|
<Select
|
||||||
|
options={antiguedad}
|
||||||
|
getOptionLabel={(o) => o.antiguedad}
|
||||||
|
getOptionValue={(o) => o.antiguedad}
|
||||||
|
onChange={(o) =>
|
||||||
|
agregar(o, antiguedadSeleccionada, setAntiguedadSeleccionada, "antiguedad")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className={styles.lista}>
|
||||||
|
|
||||||
|
{antiguedadSeleccionada.map((p) => (
|
||||||
|
|
||||||
|
<div key={p.antiguedad} className={styles.chip}>
|
||||||
|
|
||||||
|
<span>{p.antiguedad}</span>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className={styles.remove}
|
||||||
|
onClick={() =>
|
||||||
|
eliminar(p.antiguedad, antiguedadSeleccionada, setAntiguedadSeleccionada, "antiguedad")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
))}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className={styles.button}
|
||||||
|
onClick={generarReporte}
|
||||||
|
>
|
||||||
|
Buscar
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<section className={styles.graficas}>
|
||||||
|
|
||||||
|
<Antiguedad
|
||||||
|
filtros={filtros}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Uso
|
||||||
|
filtros={filtros}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* <Procesador
|
||||||
|
filtros={filtros}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SistemaOperativo
|
||||||
|
filtros={filtros}
|
||||||
|
/> */}
|
||||||
|
|
||||||
|
{/* <TableAntiguedad filtros={filtros} count={true} />
|
||||||
|
<TableAntiguedad filtros={filtrosTable} count={false} /> */}
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
+2
-2
@@ -3,8 +3,8 @@ import type { NextRequest } from "next/server";
|
|||||||
import { jwtDecode } from "jwt-decode";
|
import { jwtDecode } from "jwt-decode";
|
||||||
|
|
||||||
const permisos: Record<number, string[]> = {
|
const permisos: Record<number, string[]> = {
|
||||||
1: ["/crearCuenta", "/equipoComputo", "/perifericos","/escaner", "/agregarEquipo", "/editar","/historial","/ranking","/cambiarPass","/reportesGraficas"],
|
1: ["/crearCuenta", "/equipoComputo", "/perifericos", "/escaner", "/hotmap", "/agregarEquipo", "/editar", "/historial", "/ranking", "/cambiarPass", "/reportesGraficas"],
|
||||||
2: ["/escaner", "/agregarEquipo", "/editar","/historial","/ranking","/cambiarPass"],
|
2: ["/escaner", "/agregarEquipo", "/editar", "/historial", "/ranking", "/cambiarPass"],
|
||||||
};
|
};
|
||||||
|
|
||||||
export function proxy(request: NextRequest) {
|
export function proxy(request: NextRequest) {
|
||||||
|
|||||||
Reference in New Issue
Block a user