comentario: sistema de Armamento Inventario y personal

This commit is contained in:
Cap. Miguel Arcangel Ollarves Mayorquin 2026-06-02 15:59:29 -04:00
commit 26047910d7
29216 changed files with 6103232 additions and 0 deletions

16
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
// Use IntelliSense para saber los atributos posibles.
// Mantenga el puntero para ver las descripciones de los existentes atributos.
// Para más información, visite: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Depurador de Python: Archivo actual con argumentos",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": "${command:pickArgs}"
}
]
}

18
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"editor.quickSuggestions": {
"comments": "on"
},
"auto-close-tag.disableOnLanguage": [
],
"editor.accessibilityPageSize": 10,
"editor.fontSize": 18,
"files.autoSave": "afterDelay",
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.defaultFormatter": "batisteo.vscode-django",
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"CodeGPT.apiKey": "Groq",
}

158
README.md Normal file
View File

@ -0,0 +1,158 @@
# 🚩 SAEJB - Sistema de Gestión Militar
```
____ ___ _____ _____ ____
/ ___| / _ \| ____|/ _ \___ \
| | | | | | _| | | | |__) |
| |___ | |_| | |___| |_| / __/
\____| \___/|_____\___/_____|
Sistema SAEJB - Inventario, Armamento y Personal
```
Pequeña guía del proyecto y cómo ponerlo en marcha.
## Descripción
SAEJB es una aplicación Django diseñada para gestionar brigadas, batallones, personal, armas, municiones e inventario asociado. Incluye módulos para digitalización de documentos, abastecimiento y control de reparaciones/equipos.
## Stack tecnológico
- Backend: Python 3.x, Django 5.0
- Base de datos: MySQL (configurada en `sistema/settings.py`) y drivers `mysqlclient`/`PyMySQL` disponibles
- Frontend: plantillas Django + AdminLTE (`django-adminlte3`), SweetAlert2 (via `package.json`)
- Bibliotecas relevantes (extraídas de `requirements.txt`): Pillow, reportlab, wkhtmltopdf, xhtml2pdf, openpyxl, PyPDF
## Modelos de datos (resumen)
Los modelos principales se encuentran en `seajb/models.py`. Resumen de las entidades y campos clave:
- Brigada
- code (unique), nombreB, ubicacionB, comandante, telefono, correo, fecha
- Batallones
- nombreB, ubicacionB, comandante, telefono, correo, fecha, primero (FK -> Brigada)
- Armas
- categoria, tipoA, modeloA, calibreA, serialA, serialAG, fechaAG, opAM, cantidadA, cantidadC, ac (accesorios), armaS, calibreS, serialS, cantidadS, segundo (FK -> Batallones)
- Municiones
- tipoM, serialAG, fechaAG, cantidadM, lote, tercero (FK -> Batallones)
- Personas (personal)
- code (unique), categoria, grado, promocion, anio, unidad, datos (nombres), cedula, armaA, cargadores, municiones, serialA, serialAG, fechaAG, direccion, telefono, correo, img
- ArmasDePersonas
- armas, modelo, serial, serialag, fechag, cargadores, municiones, persona (FK -> Personas)
- BrigadaDigital / UnidadDigital
- tablas para digitalización de documentos con campos de nombre, descripción, imagen y relaciones
- Producto, Abastecimiento, ProductoAbastecimiento
- inventario de productos con códigos únicos, cantidad, precio y movimientos entre puntos de abastecimiento
- Cemanblin, Cemantar, Cemansac
- registros de reparaciones/equipos con código único, unidad, equipo, fechas y firmas
Para ver todos los campos y validaciones revisa `seajb/models.py`.
## Requisitos previos
- Python 3.10+ (compatible con Django 5)
- MySQL (o ajustar a Postgres si se prefiere)
- pip
- Node/npm si se van a gestionar dependencias frontend (opcional)
Dependencias del proyecto en `requirements.txt`.
## Uso del sistema (resumen)
1. Crear y activar un entorno virtual:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
2. Instalar dependencias:
pip install -r requirements.txt
3. Configurar la base de datos en `sistema/settings.py` (USER, PASSWORD, HOST, NAME)
4. Migraciones y usuario admin:
python manage.py migrate
python manage.py createsuperuser
5. Ejecutar servidor en desarrollo:
python manage.py runserver
6. Acceder a la administración: `http://127.0.0.1:8000/admin`
Nota: si usa imágenes, asegúrese de que `MEDIA_ROOT` está accesible y `MEDIA_URL` configurado (ya está en `sistema/settings.py`).
## Módulos del sistema
- Gestión de Brigadas y Batallones (`Brigada`, `Batallones`)
- Gestión de Armas y Municiones (`Armas`, `Municiones`)
- Gestión de Personal y sus armas (`Personas`, `ArmasDePersonas`)
- Inventario y abastecimiento (`Producto`, `Abastecimiento`, `ProductoAbastecimiento`)
- Digitalización de documentos (`BrigadaDigital`, `UnidadDigital`)
- Control de reparaciones/equipos (`Cemanblin`, `Cemantar`, `Cemansac`)
- Reportes/PDFs: `reportlab`, `wkhtmltopdf`, `xhtml2pdf`
## Seguridad
- Actualmente `DEBUG = True` y `ALLOWED_HOSTS = ['*']` en `sistema/settings.py`. Cambiar antes de producción.
- Mantener `SECRET_KEY` fuera del repositorio (usar variables de entorno o vault).
- Habilitar HTTPS en despliegue y configurar cabeceras de seguridad (HSTS, X-Frame-Options ya activado por middleware).
- Revisar control de acceso en vistas y usar permisos de Django para recursos sensibles.
- Asegurarse de la protección CSRF (Django la incluye por defecto) y de la correcta gestión de archivos subidos.
## Instalación y configuración detallada
1. Clonar el repositorio y situarse en la carpeta raíz (donde está `manage.py`).
2. Crear entorno virtual y activarlo (Windows PowerShell):
python -m venv .venv
.\\.venv\\Scripts\\Activate.ps1
3. Instalar dependencias:
pip install -r requirements.txt
4. Configurar base de datos en `sistema/settings.py` o preferiblemente usar variables de entorno:
DATABASES['default']['NAME'] = 'saejb'
DATABASES['default']['USER'] = '<tu_usuario>'
DATABASES['default']['PASSWORD'] = '<tu_password>'
DATABASES['default']['HOST'] = 'localhost'
5. Migrar y crear superusuario:
python manage.py migrate
python manage.py createsuperuser
6. Correr el servidor:
python manage.py runserver
## Posibles mejoras
- Externalizar secretos: usar `django-environ` o variables de entorno.
- Soporte para despliegue con Docker y docker-compose.
- Mejorar validaciones y pruebas unitarias (actualmente no hay tests visibles).
- Añadir API REST con Django REST Framework para integración móvil/externa.
- Soporte multi-usuario con roles más finos y logs de auditoría para cambios críticos.
- Implementar sistema de backups y rotación de logs para la base de datos.
---
Si quieres, puedo:
- Añadir un Dockerfile y docker-compose para desarrollo.
- Generar un archivo de configuración de entorno (.env) y adaptar `settings.py` para leerlo.
- Crear plantillas de despliegue (systemd, nginx + gunicorn).
Fin del README.

21
exit Normal file
View File

@ -0,0 +1,21 @@
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/etc/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
core.editor="C:\Users\MAOM\AppData\Local\Programs\Microsoft VS Code\bin\code" --wait
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true

22
manage.py Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sistema.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

BIN
media/imagenes/freddy.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
media/imagenes/goku.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

21
package-lock.json generated Normal file
View File

@ -0,0 +1,21 @@
{
"name": "sistema",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"sweetalert2": "^11.10.4"
}
},
"node_modules/sweetalert2": {
"version": "11.10.4",
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.10.4.tgz",
"integrity": "sha512-MOVRuEW/yQsyzgkaiHqAJcYKxW3vhtE5o3Skp6vZdyJejCOWo4FOicbjRfvqHAXTyTMuwDHA+0lYbO6BiHl1Gw==",
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/limonte"
}
}
}
}

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"sweetalert2": "^11.10.4"
}
}

BIN
requirements.txt Normal file

Binary file not shown.

View File

@ -0,0 +1,21 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="row">
<div class="form-group col-md-12">
<label for="nombre" class="form-label">{{formulario.nombre.label}}</label>
<input type="text" class="form-control" name="nombre" id="nombre" placeholder="Nombre del Punto">
</div>
<!-- <div class="form-group col-md-12">
<label for="descripcion" class="form-label">{{formulario.descripcion.label}}</label>
<textarea class="form-control" name="descripcion" id="descripcion" cols="30" rows="10"></textarea>
</div> -->
<div>
<div class="modal-footer">
<input type="submit" class="btn btn-primary float-left" value="Guardar">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
</div>
</form>

View File

@ -0,0 +1,111 @@
{% extends "base.html" %}
{% block titulo %} Abastecimiento {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Abastecimiento</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Información</a></li>
<li class="breadcrumb-item active">Abastecimiento</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"></h3>
<a href="#" class="btn btn-success float-left" data-toggle="modal" data-target="#modalAbas"><i class="fas fa-plus-square"></i>
Nuevo
</a>
</div>
</div>
<div class="card-body">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th></th>
<th>NOMBRE DEL PUNTO</th>
<th>ACCIONES</th>
</tr>
</thead>
<tbody>
{% for datos in abasto %}
<tr>
<td>{{datos.id}} </td>
<td>{{datos.nombre}} </td>
<td>
<a href="{% url 'info' datos.id %}" class="btn btn-success "><i class="fas fa-solid fa-eye"></i></a>
<a href="#" class="btn btn-info"><i class="fas fa-solid fa-marker"></i></a>
<a href="#" class="btn btn-danger" data-id="{{ datos.id }}"><i class="fas fa-solid fa-trash"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="modal fade" id="modalAbas" tabindex="1" aria-labelledby="tituloAbasdModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="tituloCantidadModal">Formulario Registro</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include "abastecimiento/abas_formulario.html" %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(document).ready(function() {
$(".btn-danger").click(function() {
let id = $(this).data('id');
Swal.fire({
title: '¿Estás seguro?',
text: "Si usted acepta ¡No podrás revertir esto! Eliminaras todos los registro subcrito de este Punto de Abastecimiento",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, bórralo!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/abastecimiento/eliminar_abas/' + id,
method: 'GET',
success: function(response) {
if (response.status === 'success') {
Swal.fire('¡Registro eliminado!', '', 'success');
} else {
location.reload();
}
}
});
}
});
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,65 @@
{% extends "base.html" %}
{% block titulo %} ABASTECIMIENTO {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel del Punto de Abastecimiento</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Información</a></li>
<li class="breadcrumb-item active">Producto</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"></h3>
<h3 class="card-title m-0">Llegada del Producto enviado del Servicio de Armamento</h3>
<h3 class="card-title m-0"></h3>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th>F-ENTRADA</th>
<th>NOMBRE DEL PRODUCTO</th>
<th>SERIALES</th>
<th>CANTIDAD</th>
<th>PRECIO</th>
<th>TOTAL</th>
</tr>
</thead>
<tbody>
{% for datos in producto %}
<tr>
<td>{{datos.fecha_salida|date:'d-m-Y'}}</td>
<td>{{datos.movimiento}}</td>
<td>{{datos.serial}}</td>
<td>{{datos.cantidad}}</td>
<td>{{datos.precio}}</td>
<td>{{datos.total}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,174 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="row">
<div class="form-group col-md-6">
<label for="segundo">Unidad:</label>
<select class="form-control" id="segundo" name="segundo">
<option value="{{batallon.id}}">{{batallon.id}} - {{batallon.nombreB}}</option>
</select>
{% for error in formulario_armas.errors.segundo %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-6">
<label for="categoria">Categoria:</label>
<select class="form-control" name="categoria" id="categoria">
<option value="{{formulario_armas.categoria.value|default_if_none:''}}"> Actual : {{formulario_armas.categoria.value|default_if_none:''}}</option>
<option value="Blindado">Blindado</option>
<option value="Artilleria">Artilleria</option>
<option value="Portatiles">Portatiles</option>
<option value="Armas Colectivas">Armas Colectiva</option>
<option value="Armas Organica">Armas Organica</option>
<option value="Otras">Otras</option>
</select>
{% for error in formulario_armas.errors.categoria %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-4">
<label for="tipoA" class="form-label"> {{formulario_armas.tipoA.label}} </label>
<input type="text" class="form-control" name="tipoA" id="tipoA"
value="{{ formulario_armas.tipoA.value|default_if_none:'' }}" placeholder="Blindado, Artilleria, Otros" />
{% for error in formulario_armas.errors.tipoA %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-4">
<label for="modeloA" class="form-label">{{formulario_armas.modeloA.label}}</label>
<input type="text" class="form-control" name="modeloA" id="modeloA"
value="{{ formulario_armas.modeloA.value|default_if_none:'' }}" placeholder="Arma, Blindado, Artilleria Otros" />
{% for error in formulario_armas.errors.modeloA %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-4">
<label for="calibreA" class="form-label">{{formulario_armas.calibreA.label}}</label>
<input type="text" class="form-control" name="calibreA" id="calibreA"
value="{{ formulario_armas.calibreA.value|default_if_none:'' }}" placeholder="Arma, Blindado, Artilleria" />
{% for error in formulario_armas.errors.calibreA %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="serialA" class="form-label">{{formulario_armas.serialA.label}}</label>
<textarea class="form-control" name="serialA" id="serialA" rows="5"
placeholder="Coloque los seriales necesarios">{{formulario_armas.serialA.value|default_if_none:'' }}</textarea>
{% for error in formulario_armas.errors.serialA %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-4">
<label for="serialAG" class="form-label">{{formulario_armas.serialAG.label}}</label>
<input type="text" class="form-control" name="serialAG" id="serialAG"
value="{{formulario_armas.serialAG.value|default_if_none:'' }}" placeholder=" Blindado, Artilleria , Otros" />
{% for error in formulario_armas.errors.serialAG %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-2">
<label for="fechaAG" class="form-label">{{formulario_armas.fechaAG.label}}</label>
<input type="date" class="form-control" name="fechaAG" id="fechaAG"
value="{{formulario_armas.fechaAG.value|default_if_none:'' }}" placeholder="Fecha de Asignación" />
{% for error in formulario_armas.errors.fechaAG %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-2">
<label for="opAM">{{formulario_armas.opAM.label}}</label>
<select class="form-control" name="opAM" id="opAM">
<option value="{{formulario_armas.opAM.value|default_if_none:''}}">SELECCION: {{formulario_armas.opAM.value|default_if_none:''}}</option>
<option value="Operativa">Operativa</option>
<option value="Inoperativa">Inoperativa</option>
<option value="Inutilizada">Inutilizada</option>
<option value="Reparacion">Reparacion</option>
</select>
{% for error in formulario_armas.errors.opAM %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-2">
<label for="cantidadA" class="form-label">{{formulario_armas.cantidadA.label}}</label>
<input type="number" class="form-control" name="cantidadA" id="cantidadA"
value="{{formulario_armas.cantidadA.value|default_if_none:'' }}" placeholder="500" />
{% for error in formulario_armas.errors.cantidadA %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-2">
<label for="cantidadC" class="form-label">{{formulario_armas.cantidadC.label}}</label>
<input type="number" class="form-control" name="cantidadC" id="cantidadC"
value="{{formulario_armas.cantidadC.value|default_if_none:'' }}" placeholder="500" />
{% for error in formulario_armas.errors.cantidadC %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="ac" class="form-label">{{formulario_armas.ac.label}}</label>
<textarea class="form-control" name="ac" id="ac" cols="30" rows="5"
placeholder="Coloque los Accesorios necesarios">{{formulario_armas.ac.value|default_if_none:''}}</textarea>
{% for error in formulario_armas.errors.ac %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="armaS">Armas Segundaria</label>
<select class="form-control" name="armaS" id="armaS">
<option value="">-----Seleccionar-----</option>
<option value="Si">Si</option>
<option value="No">No</option>
</select>
{% for error in formulario_armas.errors.armaS %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
</div>
<div id="prueba1" style="display: none;">
<div class="form-group">
<label for="calibreS" class="form-label">Tipo,Modelo,Calibre</label>
<textarea class="form-control" name="calibreS" id="calibreS" cols="30" rows="5"
placeholder="Blindado, Artilleria, Otros">{{formulario_armas.calibreS.value|default_if_none:''}}</textarea>
{% for error in formulario_armas.errors.calibreS %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="serialS" class="form-label">Serial de Arma Segundaria</label>
<textarea class="form-control" name="serialS" id="serialS" cols="30" rows="5"
placeholder="Blindado, Artilleria, Otros">{{formulario_armas.serialS.value|default_if_none:''}}</textarea>
{% for error in formulario_armas.errors.serialS %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="cantidadS" class="form-label">Cantidad Segundaria</label>
<input type="number" class="form-control" name="cantidadS" id="cantidadS" placeholder="500" />
{% for error in formulario_armas.errors.cantidadS %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button type="button" id="cerrarBoton" class="btn btn-secondary" data-dismiss="modal">CERRAR</button>
<input type="submit" class="btn btn-primary float-left" value="GUARDAR">
</div>
</form>

408
seajb/Templates/base.html Normal file
View File

@ -0,0 +1,408 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block titulo %} {% endblock %}</title>
<!-- imagen Favicon -->
<link rel="icon" href="/static/imagenes/dos.ico" type="image/x-icon">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome Icons -->
<link rel="stylesheet" href="/static/plugins/fontawesome-free/css/all.min.css">
<!-- Tempusdominus Bootstrap 4 -->
<link rel="stylesheet" href="/static/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
<!-- daterange picker -->
<link rel="stylesheet" href="/static/plugins/daterangepicker/daterangepicker.css">
<!-- Bootstrap Color Picker -->
<link rel="stylesheet" href="/static/plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
<!-- iCheck for checkboxes and radio inputs -->
<link rel="stylesheet" href="/static/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
<!-- Select2 -->
<link rel="stylesheet" href="/static/plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="/static/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<!-- Bootstrap4 Duallistbox -->
<link rel="stylesheet" href="/static/plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css">
<!-- BS Stepper -->
<link rel="stylesheet" href="/static/plugins/bs-stepper/css/bs-stepper.min.css">
<!-- dropzonejs -->
<link rel="stylesheet" href="/static/plugins/dropzone/min/dropzone.min.css">
<!-- InputMask -->
<script src="/static/plugins/moment/moment.min.js"></script>
<script src="/static/plugins/inputmask/jquery.inputmask.min.js"></script>
<!-- DataTables -->
<link rel="stylesheet" href="/static/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="/static/plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
<link rel="stylesheet" href="/static/plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
<!-- SweetAlert2 -->
<link rel="stylesheet" href="/static/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css">
<!-- overlayScrollbars -->
<link rel="stylesheet" href="/static/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
<!-- IonIcons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="/static/dist/css/adminlte.min.css">
{% block css %}
<style>
.table-hover-blue thead th:hover {
background-color: #007bff;
}
table {
overflow-x: auto;
}
table td{
word-wrap: break-word;
max-width: 100px;
padding: 15px;
}
table{
text-align: center;
}
.text-truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.custom-textarea {
margin: 0;
padding: 0;
}
</style>
{% endblock%}
</head>
<body class="hold-transition sidebar-mini layout-fixed layout-navbar-fixed layout-footer-fixed">
<div class="wrapper">
{% block proloander %}{% endblock %}
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<!-- Left navbar links -->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
</li>
<li class="nav-item d-none d-sm-inline-block">
<a href="{% url 'servicio' %}" class="nav-link">Inicio</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<!-- Dropdown Menu -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-solid fa-user-tie"></i> {{user.username}}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Configuración</a>
{% if request.user.is_authenticated %}
<a class="dropdown-item" href="{% url 'exit' %}"><i class="fas fa-solid fa-power-off"></i> Salida</a>
{% else %}
<a class="dropdown-item" href="{% url 'login' %}">Entrar</a>
{% endif %}
</div>
</li>
</ul>
</nav>
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<a href="#" class="brand-link">
<img src="/static/dist/img/logo.jpeg" alt="SAEJB" class="brand-image img-circle elevation-3"
style="opacity: .8">
<span class="brand-text font-weight-light float-left"><b>SAEJB</b></span>
</a>
<div class="sidebar">
<nav class="mt-2">
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
<li class="nav-item">
{% if perms.seajb.view_personas %}
<a href="#" class="nav-link">
<i class="nav-icon fas fa-user-edit"></i>
<p>Personal <i class="fas fa-angle-left right"></i><span class="badge badge-info right">1</span></p>
</a>
{% endif %}
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="{% url 'personas' %}" class="nav-link"><i class="nav-icon fa fa-circle fa-xs"
style="font-size: 0.5rem;"></i>
<p>Asignación</p>
</a>
</li>
</ul>
</li>
<!-- <li class="nav-item">
{% if perms.seajb.view_brigada %}
<a href="{% url 'servicio' %}" class="nav-link"><i class="nav-icon fas fa-campground"></i>
<p>Brigadas</p>
</a>
{% endif %}
</li> -->
<li class="nav-item">
{% if perms.seajb.view_producto %}
<a href="#" class="nav-link">
<i class="nav-icon fas fa-solid fa-clipboard-list"></i>
<p>Inventario<i class="fas fa-angle-left right"></i><span class="badge badge-info right">2</span></p>
</a>
{% endif %}
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="{% url 'inventario' %}" class="nav-link"><i class="fa fa-circle nav-icon"
style="font-size: 0.5rem;"></i>
<p>Productos</p>
</a>
<!-- <a href="#" class="nav-link"><i class="fa fa-circle nav-icon" style="font-size: 0.5rem;"></i>
<p>Historial</p>
</a> -->
</li>
</ul>
</li>
<li class="nav-item">
{% if perms.seajb.view_abastecimiento %}
<a href="{% url 'abastecimiento' %}" class="nav-link"><i class="nav-icon fas fa-poo-storm "></i>
<p>Abastecimiento</p>
</a>
{% endif %}
</li>
<li class="nav-item">
{% if perms.seajb.view_cemantar %}
<a href="#" class="nav-link">
<i class="nav-icon fa fa-wrench" aria-hidden="true"></i>
<p>Centros<i class="fas fa-angle-left right"></i><span class="badge badge-info right">3</span></p>
</a>
{% endif %}
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="{% url 'cemantar'%}" class="nav-link"><i class="fa fa-circle nav-icon" style="font-size: 0.5rem;"></i>
<p>Cemantar</p>
</a>
<a href="{% url 'cemansac'%}" class="nav-link"><i class="fa fa-circle nav-icon" style="font-size: 0.5rem;"></i>
<p>Cemansac</p>
</a>
<a href="{% url 'cemanblin'%}" class="nav-link"><i class="fa fa-circle nav-icon" style="font-size: 0.5rem;"></i>
<p>Cemanblin</p>
</a>
</li>
</ul>
</li>
<li class="nav-item">
{% if perms.seajb.view_brigadadigital %}
<a href="{% url 'digital' %}" class="nav-link"><i class="nav-icon fas fa-solid fa-image"></i>
<p>Digitalización</p>
</a>
{% endif %}
</li>
<li class="nav-item">
{% if perms.seajb.view_user %}
<a href="#" class="nav-link">
<i class="nav-icon fas fa-solid fa-user" aria-hidden="true"></i>
<p>Usuarios<i class="fas fa-angle-left right"></i><span class="badge badge-info right">2</span></p>
</a>
{% endif %}
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="{% url 'usuarios'%}" class="nav-link"><i class="fa fa-circle nav-icon" style="font-size: 0.5rem;"></i>
<p>Tabla de Usuario</p>
</a>
<!-- <a href="#" class="nav-link"><i class="fa fa-circle nav-icon" style="font-size: 0.5rem;"></i>
<p>Historial</p>
</a> -->
</li>
</ul>
</li>
</ul>
</nav>
</div>
</aside>
<div class="content-wrapper">
{% block seccion %} {% endblock %}
<div class="content">
<div class="container-fluid">
{% block contenido %} {% endblock %}
</div>
</div>
</div>
<footer class="main-footer">
<strong>&copy; 2024 <a href="#">Dirección de Tecnologia de la Información y Comunicaciones</a></strong>
<div class="float-right d-none d-sm-inline-block">
<b>Version</b> 0.0.1
</div>
</footer>
</div>
<!-- jQuery -->
<script src="/static/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="/static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- SweetAlert2 -->
<script src="/static/plugins/sweetalert2/sweetalert2.min.js"></script>
<!-- Select2 -->
<script src="/static/plugins/select2/js/select2.full.min.js"></script>
<!-- Bootstrap4 Duallistbox -->
<script src="/static/plugins/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.min.js"></script>
<!-- date-range-picker -->
<script src="/static/plugins/daterangepicker/daterangepicker.js"></script>
<!-- bootstrap color picker -->
<script src="/static/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="/static/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- InputMask -->
<script src="/static/plugins/moment/moment.min.js"></script>
<script src="/static/plugins/inputmask/jquery.inputmask.min.js"></script>
<!-- Bootstrap Switch -->
<script src="/static/plugins/bootstrap-switch/js/bootstrap-switch.min.js"></script>
<!-- BS-Stepper -->
<script src="/static/plugins/bs-stepper/js/bs-stepper.min.js"></script>
<!-- dropzonejs -->
<script src="/static/plugins/dropzone/min/dropzone.min.js"></script>
<!-- DataTables & Plugins -->
<script src="/static/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="/static/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="/static/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="/static/plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="/static/plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="/static/plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="/static/plugins/jszip/jszip.min.js"></script>
<script src="/static/plugins/pdfmake/pdfmake.min.js"></script>
<script src="/static/plugins/pdfmake/vfs_fonts.js"></script>
<script src="/static/plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="/static/plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="/static/plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
<!-- overlayScrollbars -->
<script src="/static/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="/static/dist/js/adminlte.min.js"></script>
{% block js %} {% endblock %}
<!-- <script>
$("#cerrarBoton").click(function () {
history.back();
});
</script> -->
<script>
$(document).ready(function () {
$('input[type=date]').val('');
});
</script>
<script>
$(function () {
$("#example1").DataTable({
"responsive": false, "lengthChange": true, "autoWidth": true,
// "buttons": ["excel", "pdf"],
language: {
"pageLength": "",
"decimal": "",
"emptyTable": "No hay datos",
"info": "Mostrando _START_ a _END_ de _TOTAL_ Registros",
"infoEmpty": "Mostrando 0 a 0 de 0 Registros",
"infoFiltered": "(Filtro de _MAX_ total Registros)",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "Mostrar _MENU_ Registros",
"loadingRecords": "Cargando...",
"processing": "Procesando...",
"search": "Buscar:",
"zeroRecords": "No se encontraron coincidencias",
"paginate": {
"first": "Primero",
"last": "Ultimo",
"next": "Próximo",
"previous": "Anterior",
},
"aria": {
"sortAscending": ": Activar orden de columna ascendente",
"sortDescending": ": Activar orden de columna desendente",
}
}
}).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
$('#example2').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true,
"responsive": false,
language: {
"pageLength": "",
"decimal": "",
"emptyTable": "No hay datos",
"info": "Mostrando _START_ a _END_ de _TOTAL_ Registros",
"infoEmpty": "Mostrando 0 a 0 de 0 Registros",
"infoFiltered": "(Filtro de _MAX_ total Registros)",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "Mostrar _MENU_ Registros",
"loadingRecords": "Cargando...",
"processing": "Procesando...",
"search": "Buscar:",
"zeroRecords": "No se encontraron coincidencias",
"paginate": {
"first": "Primero",
"last": "Ultimo",
"next": "Próximo",
"previous": "Anterior",
},
"aria": {
"sortAscending": ": Activar orden de columna ascendente",
"sortDescending": ": Activar orden de columna desendente",
}
}
}).buttons().container().appendTo('#example2_wrapper .col-md-6:eq(0)');
});
</script>
{% if messages %}
{% for message in messages %}
<script>
const Toast = Swal.mixin({
toast: true,
position: "top-end",
showConfirmButton: false,
timer: 3000,
timerProgressBar: true,
didOpen: (toast) => {
toast.onmouseenter = Swal.stopTimer;
toast.onmouseleave = Swal.resumeTimer;
}
});
Toast.fire({
icon: "{{ message.tags }}",
title: "{{ message }}"
});
</script>
{% endfor %}
{% endif %}
</body>
</html>

View File

@ -0,0 +1,61 @@
{% extends "base.html" %}
{% block titulo %} Editar Armamento {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Edición de Armamento</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Formulario</a></li>
<li class="breadcrumb-item active">Edición</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="row justify-content-center">
<div class="card card-dark card-outline w-50">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title">Formulario de Edición del Armamento</h3>
</div>
</div>
<div class="card-body">
{% include 'armas/armas_f.html' %}
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$("#cerrarBoton").click(function () {
history.back();
});
</script>
<script>
$(document).ready(function () {
$("#armaS").change(function () {
var valorSeleccionado = $(this).val();
if (valorSeleccionado == "No") {
$("#prueba1").hide();
$("#prueba2").show();
} else {
$("#prueba1").show();
$("#prueba2").hide();
}
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,47 @@
{% extends "base.html" %}
{% block titulo %} Editar Brigada {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Edición</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Formulario</a></li>
<li class="breadcrumb-item active">Edición</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="row justify-content-center">
<div class="card card-dark card-outline w-25">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title">Formulario de Edición de la Unidad de la Brigada</h3>
</div>
</div>
<div class="card-body">
{% include 'batallon/batallon_f.html' %}
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$("#cerrarBoton").click(function () {
history.back();
});
</script>
{% endblock %}

View File

@ -0,0 +1,66 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="form-group">
<label for="primero">Brigada</label>
<select class="form-control" id="primero" name="primero">
<option value="{{primero.id}}">{{primero.id}} - {{primero.nombreB}} </option>
</select>
{% for error in formulario.errors.primero %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="nombreB" class="form-label">Unidad</label>
<input type="text" class="form-control" name="nombreB" id="nombreB"
value="{{ formulario.nombreB.value|default_if_none:'' }}" placeholder="Unidad">
{% for error in formulario.errors.nombreB %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="ubicacionB" class="form-label"> {{formulario.ubicacionB.label}} </label>
<input type="text" class="form-control" name="ubicacionB" id="ubicacionB"
value="{{ formulario.ubicacionB.value|default_if_none:'' }}" placeholder="ubicacion">
{% for error in formulario.errors.ubicacionB %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="comandante" class="form-label">{{formulario.comandante.label}}</label>
<input type="text" class="form-control" name="comandante" id="comandante"
value="{{ formulario.comandante.value|default_if_none:'' }}" placeholder="Comandante">
{% for error in formulario.errors.comandante %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="telefono" class="form-label">{{formulario.telefono.label}} </label>
<input type="tel" class="form-control" name="telefono" id="telefono"
value="{{ formulario.telefono.value|default_if_none:'' }}" placeholder="Telefono">
{% for error in formulario.errors.telefono %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="correo" class="form-label">{{formulario.correo.label}}</label>
<input type="email" class="form-control" name="correo" id="correo"
value="{{ formulario.correo.value|default_if_none:'' }}" placeholder="Correo Electronico">
{% for error in formulario.errors.correo %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="modal-footer">
<button type="button" id="cerrarBoton" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
<input type="submit" class="btn btn-primary float-left" value="GUARDAR">
</div>
</form>

View File

@ -0,0 +1,45 @@
{% extends "base.html" %}
{% block titulo %} Editar Munición {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Edición de Munición</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Formulario</a></li>
<li class="breadcrumb-item active">Edición</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="row justify-content-center">
<div class="card card-dark card-outline w-25">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0">Formulario de Edición de la Munición</h3>
</div>
</div>
<div class="card-body">
{% include 'municion/municion_f.html' %}
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$("#cerrarBoton").click(function () {
history.back();
});
</script>
{% endblock %}

View File

@ -0,0 +1,270 @@
{% extends "base.html" %}
{% block titulo %} Armas y Municiones{% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Unidades</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Información</a></li>
<li class="breadcrumb-item active">Armamento</li>
<li class="breadcrumb-item active">Municiones</li>
<li class="breadcrumb-item active">Explosivos</li>
<li class="breadcrumb-item active">Accesorio</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header ">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0">
<a href="{% url 'pdf_tres' batallon.id %}" class="btn btn-danger"><i class="fas fa-file-pdf"></i> PDF</a>
</h3>
<h4>Armamento</h4>
<a href="" class="btn btn-success float-left" data-toggle="modal"
data-target="#modalArmas"><i class="fas fa-plus-square"></i> Nuevo</a>
</div>
</div>
<div class="card-body table-responsive ">
<table id="tablaArmas" class="table table-bordered table-striped table-hover-blue ">
<thead class="table-dark">
<tr>
<th class="text-center">F-R</th>
<th class="text-center">C-ARMA</th>
<th class="text-center">A-AG</th>
<th class="text-center">M-A</th>
<th class="text-center">C-A</th>
<th class="text-center">S-A</th>
<th class="text-center">S-AG</th>
<th class="text-center">F-AG</th>
<th class="text-center">OP A</th>
<th class="text-center">C-A</th>
<th class="text-center">C-C</th>
<th class="text-center">A-S</th>
<th class="text-center">AC</th>
</tr>
</thead>
<tbody>
{% for datos in servicio %}
<tr>
<td>{{datos.fecha|date:"dmy"}}</td>
<td>{{datos.categoria}}</td>
<td>{{datos.tipoA}}</td>
<td>{{datos.modeloA}}</td>
<td>{{datos.calibreA}}</td>
<td class="text-truncate">{{datos.serialA}}</td>
<td>{{datos.serialAG}}</td>
<td>{{datos.fechaAG|date:"dmy"}}</td>
<td>{{datos.opAM}}</td>
<td>{{datos.cantidadA}}</td>
<td>{{datos.cantidadC}}</td>
<td>{{datos.armaS}}</td>
<td>
<a href="{% url 'pdf_cinco' datos.id %}" class="btn btn-danger btn-sm"><i class="fas fa-file-pdf"></i></a> |
<a href="{% url 'edit_armas' datos.id %}" class="btn btn-info btn-sm"><i class="fas fa-solid fa-marker"></i></a> |
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0">
<a href="{% url 'pdf_cuatro' batallon.id %}" class="btn btn-danger"><i class="fas fa-file-pdf"></i> PDF</a>
</h3>
<h4>Municiones y Explosivos</h4>
<a href="#" class="btn btn-success float-left" data-toggle="modal"
data-target="#modalMunicion"><i class="fas fa-plus-square"></i> Nuevo</a>
</div>
</div>
<div class="card-body table-responsive">
<table id="tablaMunicion" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th class="text-center">F-R</th>
<th class="text-center">DESCRIPCIÓN</th>
<th class="text-center">L-N°</th>
<th class="text-center">S-AG</th>
<th class="text-center">F-AG</th>
<th class="text-center">C-M</th>
<th class="text-center">AC</th>
</tr>
</thead>
<tbody>
{% for datos in municiones %}
<tr>
<td>{{datos.fecha|date:"dmy"}} </td>
<td>{{datos.tipoM}} </td>
<td>{{datos.lote}} </td>
<td>{{datos.serialAG}} </td>
<td>{{datos.fechaAG|date:"d/m/y"}} </td>
<td>{{datos.cantidadM}} </td>
<td>
<a href="{% url 'pdf_sexto' datos.id %}" class="btn btn-danger btn-sm"><i class="fas fa-file-pdf"></i></a> |
<a href="{% url 'edit_municion' datos.id %}" class="btn btn-info btn-sm"><i class="fas fa-solid fa-marker"></i></a> |
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="modal fade" id="modalArmas" tabindex="-1" aria-labelledby="tituloArmasModal" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="tituloArmasModal">Formulario de las Armas</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include "armas/armas_f.html" %}
</div>
</div>
</div>
</div>
<div class="modal fade" id="modalMunicion" tabindex="-1" aria-labelledby="tituloMunicionModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="tituloMunicionModal">Formulario de Munición</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include "municion/municion_f.html" %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(function () {
$("#tablaArmas").DataTable({
"responsive": false,
"lengthChange": true,
"autoWidth": true,
"pageLength":5,
"ordering":false,
'info':true,
columnDefs: [
{
targets: 0,
render: function (data, type, row) {
return '<span class="text-truncate">' + data + '</span>';
}
}
],
language: {
"pageLength": "",
"decimal": "",
"emptyTable": "No hay datos",
"info": "Mostrando _START_ a _END_ de _TOTAL_ Registros",
"infoEmpty": "Mostrando 0 a 0 de 0 Registros",
"infoFiltered": "(Filtro de _MAX_ total Registros)",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "Mostrar _MENU_ Registros",
"loadingRecords": "Cargando...",
"processing": "Procesando...",
"search": "Buscar:",
"zeroRecords": "No se encontraron coincidencias",
"paginate": {
"first": "Primero",
"last": "Ultimo",
"next": "Próximo",
"previous": "Anterior",
},
"aria": {
"sortAscending": ": Activar orden de columna ascendente",
"sortDescending": ": Activar orden de columna desendente",
}
}
}).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
$('#tablaMunicion').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true,
"responsive": false,
"pageLength": 5,
"decimal": 5,
language: {
"pageLength": "",
"decimal": "",
"emptyTable": "No hay datos",
"info": "Mostrando _START_ a _END_ de _TOTAL_ Registros",
"infoEmpty": "Mostrando 0 a 0 de 0 Registros",
"infoFiltered": "(Filtro de _MAX_ total Registros)",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "Mostrar _MENU_ Registros",
"loadingRecords": "Cargando...",
"processing": "Procesando...",
"search": "Buscar:",
"zeroRecords": "No se encontraron coincidencias",
"paginate": {
"first": "Primero",
"last": "Ultimo",
"next": "Próximo",
"previous": "Anterior",
},
"aria": {
"sortAscending": ": Activar orden de columna ascendente",
"sortDescending": ": Activar orden de columna desendente",
}
}
}).buttons().container().appendTo('#example2_wrapper .col-md-6:eq(0)');
});
</script>
<script>
$(document).ready(function () {
$("#armaS").change(function () {
var valorSeleccionado = $(this).val();
if (valorSeleccionado == "No") {
$("#prueba1").hide();
$("#prueba2").show();
} else {
$("#prueba1").show();
$("#prueba2").hide();
}
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,58 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="form-group">
<label for="unidad">{{formulario_cemanblin.unidad.label}}</label>
<input type="text" class="form-control" name="unidad" id="unidad" placeholder="Nombre de Unidad"/>
{% for error in formulario_cemanblin.unidad.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="equipo">{{formulario_cemanblin.equipo.label}}</label>
<textarea class="form-control" name="equipo" id="equipo" cols="30" rows="5"></textarea>
{% for error in formulario_cemanblin.equipo.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="fechaE">{{formulario_cemanblin.fechaE.label}}</label>
<input type="date" class="form-control" name="fechaE" id="fechaE" placeholder="Fecha de Entrega"/>
{% for error in formulario_cemanblin.fechaE.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="reparado">{{formulario_cemanblin.reparado.label}}</label>
<select class="form-control" name="reparado" id="reparado">
<option value="Reparado">Reparado</option>
<option value="Reparando">Reparando</option>
</select>
</div>
<div class="form-group">
<label for="seriales">{{formulario_cemanblin.seriales.label}}</label>
<textarea class="form-control" name="seriales" id="seriales" cols="30" rows="5"></textarea>
</div>
<div class="form-group">
<label for="descripcion">{{formulario_cemanblin.descripcion.label}}</label>
<textarea class="form-control" name="descripcion" id="descripcion" cols="30" rows="5"></textarea>
</div>
<div class="form-group">
<label for="personauna">{{formulario_cemanblin.personauna.label}}</label>
<input type="text" class="form-control" name="personauna" id="personauna" placeholder="Persona que Entrega el equipo"/>
<input type="text" class="form-control" name="personados" id="personados" placeholder="Persona que Recibe el equipo" />
<input type="text" class="form-control" name="personatres" id="personatres" placeholder="Persona que Realiza la Orden" />
</div>
<div class="modal-footer">
<button type="button" id="cerrarBoton" class="btn btn-secondary" data-dismiss="modal">CERRAR</button>
<input type="submit" class="btn btn-dark float-left" value="GUARDAR">
</div>
</form>

View File

@ -0,0 +1,134 @@
{% extends "base.html" %}
{% block titulo %} Cemanblin {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control de Cemanblin</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Centros</a></li>
<li class="breadcrumb-item active">Cemanblin</li>
<li class="breadcrumb-item active">Cemantar</li>
<li class="breadcrumb-item active">Cemansac</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"></h3>
{% if perms.seajb.add_cemablin %}
<a href="#" class="btn btn-success float-left" data-toggle="modal" data-target="#modalCemanblin"><i
class="fas fa-plus-square"></i> Nuevo</a>
{% endif %}
</div>
</div>
<div class="card-body table-responsive">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th class="text-center">N° ORDEN</th>
<th class="text-center">UNIDAD</th>
<th class="text-center">EQUIPO</th>
<th class="text-center">F-RECEPCIÓN</th>
<th class="text-center">CONDICION</th>
<th class="text-center">SERIALES</th>
<th class="text-center">DESCRIPCIÓN</th>
<th class="text-center">ACCIONES</th>
</tr>
</thead>
<tbody>
{% for cemanblin in cemanblin %}
<tr>
<td>{{cemanblin.code}}</td>
<td>{{cemanblin.unidad}}</td>
<td>{{cemanblin.equipo}}</td>
<td>{{cemanblin.fechaR}}</td>
<td>{{cemanblin.reparado}}</td>
<td>{{cemanblin.seriales}}</td>
<td>{{cemanblin.descripcion}}</td>
<td>
{% if perms.seajb.change_cemanblin %}
<a href="#" class="btn btn-info btn-sm"><i class="fas fa-solid fa-marker"></i></a> |
{% endif %}
{% if perms.seajb.view_cemanblin %}
<a href="#" class="btn btn-dark btn-sm"><i class="fas fa-file-pdf"></i></a> |
{% endif %}
{% if perms.seajb.delete_cemanblin %}
<a href="#" class="btn btn-danger btn-sm" data-id="#"><i class="fas fa-solid fa-trash"></i></a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modalCemanblin" tabindex="-1" aria-labelledby="modalTituloCemanblin" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark bg-outline">
<h5 class="modal-title" id="modalTituloCemanblin">FORMULARIO DE CEMANBLIN</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include 'centros/cemanblin_f.html' %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(document).ready(function () {
$(".btn-danger").click(function () {
let id = $(this).data('id');
Swal.fire({
title: '¿Estás seguro?',
text: "Si usted acepta ¡No podrás revertir esto! Eliminaras todos los registro Cemanblin",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, bórralo!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/eliminar/' + id,
method: 'GET',
success: function (response) {
if (response.status === 'success') {
Swal.fire('¡Registro eliminado!', '', 'success');
} else {
location.reload();
}
}
});
}
});
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,57 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="form-group">
<label for="unidad">{{formulario_cemansac.unidad.label}}</label>
<input type="text" class="form-control" name="unidad" id="unidad" placeholder="Nombre de Unidad" />
{% for error in formulario_cemansac.unidad.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="equipo">{{formulario_cemansac.equipo.label}}</label>
<textarea class="form-control" name="equipo" id="equipo" rows="5" placeholder="Descripción del Equipo"></textarea>
{% for error in formulario_cemansac.equipo.errors %}<span class="error-message">{{ error }}</span>{% endfor %}
</div>
<div class="form-group">
<label for="fechaE">{{formulario_cemansac.fechaE.label}}</label>
<input type="date" class="form-control" name="fechaE" id="fechaE" placeholder="Fecha de Entrega" />
{% for error in formulario_cemansac.fechaE.errors %}<span class="error-message">{{ error }}</span>{% endfor %}
</div>
<div class="form-group">
<label for="reparado">{{formulario_cemansac.reparado.label}}</label>
<select class="form-control" name="reparado" id="reparado">
<option value="Reparado">Reparado</option>
<option value="Reparando">Reparando</option>
</select>
{% for error in formulario_cemansac.reparado.errors %}<span class="error-message">{{ error }}</span>{% endfor %}
</div>
<div class="form-group">
<label for="seriales">{{formulario_cemansac.seriales.label}}</label>
<textarea class="form-control" name="seriales" id="seriales" rows="5" placeholder="Describe aqui......"></textarea>
{% for error in formulario_cemansac.seriales.errors %}<span class="error-message">{{ error }}</span>{% endfor %}
</div>
<div class="form-group">
<label for="descripcion">{{formulario_cemansac.descripcion.label}}</label>
<textarea class="form-control" name="descripcion" id="descripcion" rows="5" placeholder="Describe aqui......"></textarea>
{% for error in formulario_cemansac.descripcion.errors %}<span class="error-message">{{ error }}</span>{% endfor %}
</div>
<div class="form-group">
<label for="personauna">{{formulario_cemansac.personauna.label}}</label>
<input type="text" class="form-control" name="personauna" id="personauna" placeholder="Persona que Entrega el equipo" />
<input type="text" class="form-control" name="personados" id="personados" placeholder="Persona que Recibe el equipo" />
<input type="text" class="form-control" name="personatres" id="personatres" placeholder="Persona que Realiza la Orden" />
</div>
<div class="modal-footer">
<button type="button" id="cerrarBoton" class="btn btn-secondary" data-dismiss="modal">CERRAR</button>
<input type="submit" class="btn btn-dark float-left" value="GUARDAR">
</div>
</form>

View File

@ -0,0 +1,137 @@
{% extends "base.html" %}
{% block titulo %} Cemansac {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Centros</a></li>
<li class="breadcrumb-item active">Cemansac</li>
<li class="breadcrumb-item active">Cemanblin</li>
<li class="breadcrumb-item active">Cemantar</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"></h3>
{% if perms.seajb.add_cemansac %}
<a href="#" class="btn btn-success float-left" data-toggle="modal" data-target="#modalCemansac"><i
class="fas fa-plus-square"></i> Nuevo</a>
{% endif %}
</div>
</div>
<div class="card-body table-responsive">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th class="text-center">N° ORDEN</th>
<th class="text-center">CODE</th>
<th class="text-center">UNIDAD</th>
<th class="text-center">EQUIPO</th>
<th class="text-center">F-RECEPCIÓN</th>
<th class="text-center">F-ENTREGA</th>
<th class="text-center">CONDICIÓN</th>
<th class="text-center">SERIALES</th>
<th class="text-center">DESCRIPCIÓN</th>
<th class="text-center">ACCIONES</th>
</tr>
</thead>
<tbody>
{% for cemansac in cemansac %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{cemansac.code}}</td>
<td>{{cemansac.unidad}}</td>
<td>{{cemansac.equipo}}</td>
<td>{{cemansac.fechaR|date:"d/m/Y"}}</td>
<td>{{cemansac.fechaE|date:"d/m/Y"}}</td>
<td>{{cemansac.reparado}}</td>
<td>{{cemansac.seriales}}</td>
<td>{{cemansac.descripcion}}</td>
<td>
{% if perms.saejb.view_cemansac %}
<a href="#" class="btn btn-info btn-sm"><i class="fas fa-solid fa-marker"></i></a> |
{% endif %}
{% if perms.saejb.change_cemansac%}
<a href="#" class="btn btn-dark btn-sm"><i class="fas fa-file-pdf"></i></a> |
{% endif %}
{% if perms.saejb.delete.cemansac %}
<a href="#" class="btn btn-danger btn-sm" data-id="#"><i class="fas fa-solid fa-trash"></i></a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modalCemansac" tabindex="-1" aria-labelledby="modalTituloCemansac" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="modalTituloCemansac">FORMULARIO DE CEMANSAC</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include 'centros/cemansac_f.html' %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(document).ready(function () {
$(".btn-danger").click(function () {
let id = $(this).data('id');
Swal.fire({
title: '¿Estás seguro?',
text: "Si usted acepta ¡No podrás revertir esto! Eliminaras todos los registro de la Brigada, Unidades y Armas",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, bórralo!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/eliminar/' + id,
method: 'GET',
success: function (response) {
if (response.status === 'success') {
Swal.fire('¡Registro eliminado!', '', 'success');
} else {
location.reload();
}
}
});
}
});
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,61 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="form-group">
<label for="unidad">{{formulario_cemantar.unidad.label}}</label>
<input type="text" class="form-control" name="unidad" id="unidad" placeholder="Nombre de Unidad" />
{% for error in formulario_cemantar.unidad.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="equipo">{{formulario_cemantar.equipo.label}}</label>
<textarea class="form-control" name="equipo" id="equipo" cols="30" rows="5"></textarea>
{% for error in formulario_cemantar.equipo.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="fechaE">{{formulario_cemantar.fechaE.label}}</label>
<input type="date" class="form-control" name="fechaE" id="fechaE" placeholder="Fecha de Entrega" />
{% for error in formulario_cemantar.fechaE.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="reparado">{{formulario_cemantar.reparado.label}}</label>
<select class="form-control" name="reparado" id="reparado">
<option value="Reparado">Reparado</option>
<option value="Reparando">Reparando</option>
</select>
</div>
<div class="form-group">
<label for="seriales">{{formulario_cemantar.seriales.label}}</label>
<textarea class="form-control" name="seriales" id="seriales" cols="30" rows="5"></textarea>
</div>
<div class="form-group">
<label for="descripcion">{{formulario_cemantar.descripcion.label}}</label>
<textarea class="form-control" name="descripcion" id="descripcion" cols="30" rows="5"></textarea>
</div>
<div class="form-group">
<label for="personauna">{{formulario_cemantar.personauna.label}}</label>
<input type="text" class="form-control" name="personauna" id="personauna"
placeholder="Persona que Entrega el equipo" />
<input type="text" class="form-control" name="personados" id="personados"
placeholder="Persona que Recibe el equipo" />
<input type="text" class="form-control" name="personatres" id="personatres"
placeholder="Persona que Realiza la Orden" />
</div>
<div class="modal-footer">
<button type="button" id="cerrarBoton" class="btn btn-secondary" data-dismiss="modal">CERRAR</button>
<input type="submit" class="btn btn-dark float-left" value="GUARDAR">
</div>
</form>

View File

@ -0,0 +1,137 @@
{% extends "base.html" %}
{% block titulo %} Cemantar {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Centros</a></li>
<li class="breadcrumb-item active">Cemantar</li>
<li class="breadcrumb-item active">Cemanblin</li>
<li class="breadcrumb-item active">Cemansac</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"></h3>
{% if perms.seajb.add_cemantar %}
<a href="#" class="btn btn-success float-left" data-toggle="modal" data-target="#modalCemantar"><i
class="fas fa-plus-square"></i> Nuevo</a>
{% endif %}
</div>
</div>
<div class="card-body table-responsive">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th class="text-center">N° ORDEN</th>
<th class="text-center">CODE</th>
<th class="text-center">UNIDAD</th>
<th class="text-center">EQUIPO</th>
<th class="text-center">F-RECEPCIÓN</th>
<th class="text-center">F-ENTREGA</th>
<th class="text-center">CONDICIÓN</th>
<th class="text-center">SERIALES</th>
<th class="text-center">DESCRIPCIÓN</th>
<th class="text-center">ACCIONES</th>
</tr>
</thead>
<tbody>
{% for cemantar in cemantar %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{cemantar.code}}</td>
<td>{{cemantar.unidad}}</td>
<td>{{cemantar.equipo}}</td>
<td>{{cemantar.fechaR|date:"d/m/Y"}}</td>
<td>{{cemantar.fechaE|date:"d/m/Y"}}</td>
<td>{{cemantar.reparado}}</td>
<td>{{cemantar.seriales}}</td>
<td>{{cemantar.descripcion}}</td>
<td>
{% if perms.seajb.change_cemantar %}
<a href="#" class="btn btn-info btn-sm"><i class="fas fa-solid fa-marker"></i></a> |
{% endif %}
{% if perms.seajb.view_cemantar %}
<a href="#" class="btn btn-dark btn-sm"><i class="fas fa-file-pdf"></i></a> |
{% endif %}
{% if perms.seajb.delete_cemantar %}
<a href="#" class="btn btn-danger btn-sm" data-id="#"><i class="fas fa-solid fa-trash"></i></a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modalCemantar" tabindex="-1" aria-labelledby="modalTituloCemantar" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="modalTituloCemantar">FORMULARIO DE CEMANTAR</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include 'centros/cemantar_f.html' %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(document).ready(function () {
$(".btn-danger").click(function () {
let id = $(this).data('id');
Swal.fire({
title: '¿Estás seguro?',
text: "Si usted acepta ¡No podrás revertir esto! Eliminaras todos los registro de Cemantar",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, bórralo!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/eliminar/' + id,
method: 'GET',
success: function (response) {
if (response.status === 'success') {
Swal.fire('¡Registro eliminado!', '', 'success');
} else {
location.reload();
}
}
});
}
});
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,37 @@
{% extends 'base.html' %}
{% block titulo %}{{titulo}}{{" Edición digital"| escape}}{% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Edición Datos de las Unidad de Digitalización</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Editar</a></li>
<li class="breadcrumb-item">Edición de Nombre de Unidad</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido%}
<div class="row justify-content-center">
<div class="card card-dark card-outline w-50">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0">Editar Nombre de la Brigada Digitalizados</h3>
</div>
</div>
<div class="card-body">
{% include 'digital/digital_formulario.html' %}
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,17 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="form-group">
<label for="nombre" class="form-label">{{formularios.nombre.label}} </label>
<input type="text" class="form-control" name="nombre" id="nombre" value="{{ formularios.nombre.value|default_if_none:'' }}" placeholder="Nombre">
{% for error in formularios.errors.nombre %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="modal-footer">
<button type="button" id="cerrarBoton" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
<input type="submit" class="btn btn-dark float-left" value="Registrar">
</div>
</form>

View File

@ -0,0 +1,91 @@
{% extends 'base.html' %}
{% block titulo %} Digitalización {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control Datos Digitalizados</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Información</a></li>
<li class="breadcrumb-item">Digital Escaneo por Brigadas y Unidades</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"></h3>
{% if perms.seajb.add_digital %}
<a href="#" class="btn btn-success float-left" data-toggle="modal" data-target="#modalDigital"><i class="fas fa-plus-square"></i> Nuevo</a>
{% endif %}
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th></th>
<th>ENTRADA</th>
<th>NOMBRE DE BRIGADA</th>
<th>ACCIONES</th>
</tr>
</thead>
<tbody>
{% for dital in digitales %}
<tr>
<td scope="row">{{dital.id}}</td>
<td>{{dital.fecha_entrada}}</td>
<td>{{dital.nombre}}</td>
<td>
{% if perms.seajb.view_digital %}
<a href="{% url 'infodig' dital.id %}" class="btn btn-success"><i class="nav-icon fas fa-eye"></i></a> |
{% endif %}
{% if perms.seajb.change_digital %}
<a href="{% url 'digital_edit' dital.id %}" class="btn btn-info"><i class="fas fa-solid fa-marker"></i></a> |
{% endif %}
{% if perms.seajb.delete_digital %}
<a href="{% url 'suprimir' dital.id %}" class="btn btn-danger"><i class="fas fa-solid fa-trash"></i></a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modalDigital" tabindex="-1" aria-labelledby="modalTituloDigital" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="modalTituloDigital">Formulario Digital</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include 'digital/digital_formulario.html' %}
</div>
</div>
</div>
</div>
{% endblock%}

View File

@ -0,0 +1,79 @@
{% extends 'base.html' %}
{% block titulo %} Principal {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Tabla</a></li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title"></h3>
<a href="#" class="btn btn-success float-left" data-toggle="modal" data-target="#modalDigital"><i class="fas fa-plus-square"></i> Nuevo</a>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th></th>
<th>ENTRADA</th>
<th>NOMBRE DE UNIDAD</th>
<th>DESCRIPCIÓN</th>
<th>ESCANEADO</th>
<th>ACCIONES</th>
</tr>
</thead>
<tbody>
{% for digital in digito %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{digital.fecha_entrada|date:"d/m/Y"}}</td>
<td>{{digital.nombreU}}</td>
<td>{{digital.descripcion}}</td>
<td><a href="{{digital.img.url}}" target="_blank">Descargar</a></td>
<td>
<a href="{% url 'edit_info' digital.id %}" class="btn btn-info"><i class="fas fa-solid fa-marker"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modalDigital" tabindex="-1" aria-labelledby="modalTituloDigital" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="modalTituloDigital">Formulario Digital</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include 'digital/unidad_digital_form.html' %}
</div>
</div>
</div>
</div>
{% endblock%}

View File

@ -0,0 +1,36 @@
{% extends 'base.html' %}
{% block titulo %} Edición de Escaneo{% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Edición Datos de las Unidad de Digitalización</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Editar</a></li>
<li class="breadcrumb-item">Edición de Nombre de Unidad</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido%}
<div class="row justify-content-center">
<div class="card card-dark card-outline w-50">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0">Editar Digitalización</h3>
</div>
</div>
<div class="card-body">
{% include 'digital/unidad_digital_form.html' %}
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,51 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="row">
<div class="form-group col-md-12">
<label for="digital">Brigada A Digitalizar</label>
<select class="form-control" id="digital" name="digital">
{% for digital in digital %}
<option value="{{digital.id}}">{{digital.id}} - {{digital.nombre}} </option>
{% endfor %}
</select>
{% for error in formulario.errors.digital %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="nombreU" class="form-label">{{formulario.nombreU.label}} </label>
<input type="text" class="form-control" name="nombreU" id="nombreU" value="{{ formularios.nombreU.value|default_if_none:'' }}" placeholder="Nombre">
{% for error in formulario.errors.nombreU %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="descripcion" class="form-label">{{formulario.descripcion.label}} </label>
<textarea class="form-control" name="descripcion" id="descripcion" rows="3"
placeholder="Describe el Material">{{ formularios.descripcion.value|default_if_none:'' }}</textarea>
{% for error in formulario.errors.descripcion %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="img" class="form-label">{{formulario.img.label}} </label>
<input type="file" name="img" id="img">
{% for error in formulario.errors.img %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<img src="{{digitales.img.url}}" alt="Imagen actual" width="100px" height="100px">
</div>
<div class="modal-footer">
<button type="button" id="cerrarBoton" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
<input type="submit" class="btn btn-primary float-left" value="Registrar">
</div>
</form>

View File

@ -0,0 +1,39 @@
{% extends 'base.html' %}
{% block titulo %} Editar Inventario {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control de Edición</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Información</a></li>
<li class="breadcrumb-item active">Edición</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="row justify-content-center">
<div class="card card-dark card-outline w-25">
<div class="card-header">
<h3 class="card-title m-0">Formulario de Edición del Inventario</h3>
</div>
<div class="card-body">
{% include 'inventario/inventario_formulario.html' %}
</div>
</div>
</div>
{% endblock%}

View File

@ -0,0 +1,35 @@
{% extends 'base.html' %}
{% block titulo %} Envio de Paquetes {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control de Envios</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Información</a></li>
<li class="breadcrumb-item active">Envios</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="row justify-content-center">
<div class="card card-dark card-outline w-25">
<div class="card-header">
<h3 class="card-title m-0">Formulario de Envio</h3>
</div>
<div class="card-body">
{% include 'inventario/inventario_f_envio.html' %}
</div>
</div>
</div>
{% endblock%}

View File

@ -0,0 +1,35 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="row">
<div class="form-group col-md-12">
<label for="producto">Producto a Enviar</label>
<select class="form-control" name="producto" id="producto">
<option value="0">Seleccione</option>
{% for producto in producto %}
<option value="{{producto.id}}">{{producto.nombre}}</option>
{% endfor %}
</select>
</div>
<div class="form-group col-md-12">
<label for="serial" class="form-label">Seriales:</label>
<textarea class="form-control" name="serial" id="serial" cols="30" rows="5"></textarea>
</div>
<div class="form-group col-md-12">
<label for="abastecimiento">Punto a Recibir</label>
<select class="form-control" name="abastecimiento" id="abastecimiento">
<option value="0">Seleccione</option>
{% for prutos in punto %}
<option value="{{prutos.id}}">{{prutos.nombre}}</option>
{% endfor %}
</select>
</div>
<div class="form-group col-md-12">
<label for="cantidad" class="form-label">Cantidad:</label>
<input type="number" class="form-control" name="cantidad" id="cantidad" placeholder="">
</div>
<div>
<input type="submit" class="btn btn-dark float-left" value="Enviar">
</form>

View File

@ -0,0 +1,60 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="row">
<div class="form-group col-md-12">
<label for="nombre" class="form-label">{{formulario.nombre.label}}</label>
<input type="text" class="form-control" name="nombre" id="nombre" value="{{formulario.nombre.value|default_if_none:'' }}" placeholder="Producto">
{% for error in formulario.nombre.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="serial" class="form-label">{{formulario.serial.label}} :</label>
<textarea class="form-control" name="serial" id="serial" cols="30" rows="5"
placeholder="Describe los seriales">{{ formulario.serial.value|default_if_none:'' }}</textarea>
{% for error in formulario.serial.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="modelo" class="form-label">{{formulario.modelo.label}} :</label>
<input type="text" class="form-control" name="modelo" id="modelo" value="{{ formulario.modelo.value|default_if_none:'' }}" placeholder="Modelo">
{% for error in formulario.modelo.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="descripcion" class="form-label">{{formulario.descripcion.label}} :</label>
<textarea class="form-control" name="descripcion" id="descripcion" rows="3" placeholder="Describe el Producto">{{ formulario.descripcion.value|default_if_none:''}}</textarea>
{% for error in formulario.descripcion.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="cantidad" class="form-label">{{formulario.cantidad.label}} :</label>
<input type="number" class="form-control" name="cantidad" id="cantidad" value="{{formulario.cantidad.value|default_if_none:'' }}" placeholder="500">
{% for error in formulario.cantidad.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="precio" class="form-label">{{formulario.precio.label}}:</label>
<input type="number" class="form-control" name="precio" id="precio" value="{{formularios.precio.value|default:''}}" placeholder="Precio" step="0.01">
{% for error in formulario.precio.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button type="button" id="cerrarBoton" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
<input type="submit" class="btn btn-primary float-left" value="Registrar">
</div>
</form>

View File

@ -0,0 +1,150 @@
{% extends 'base.html' %}
{% block titulo %} Inventario {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control del Inventario</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{% url 'inventario' %}">Inventario</a></li>
<li class="breadcrumb-item">Producto</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
{% if perms.seajb.add_producto %}
<h3 class="card-title m-0"><a href="{% url 'envio' %}" class="btn btn-warning"><i
class="fas fa-hand-holding-usd fs-1"></i> ENVIO</a></h3>
{% endif %}
{% if perms.seajb.view_producto %}
<a href="{% url 'pdf_ocho' %}" class="btn btn-danger" target="_blank"><i class="fas fa-file-pdf fs-1"></i> PDF</a>
{% endif %}
{% if perms.seajb.add_producto %}
<a href="#" class="btn btn-success float-letf" data-toggle="modal" data-target="#modalInventario"><i
class="fas fa-plus-square fs-1"></i> Nuevo</a>
{% endif %}
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th></th>
<th>CODIGO</th>
<th>FECHA</th>
<th>SERIAL</th>
<th>PRODUCTO</th>
<th>MODELO</th>
<th>DESCRIPCIÓN</th>
<th>CANTIDAD</th>
<th>PRECIO</th>
<th>TOTAL</th>
<th>ACCIONES</th>
</tr>
</thead>
<tbody>
{% for inventario in inventario %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{inventario.code}}</td>
<td>{{inventario.fecha_entrada|date:'d/m/Y'}}</td>
<td class="text-truncate">{{inventario.serial}}</td>
<td>{{inventario.nombre}}</td>
<td>{{inventario.modelo}}</td>
<td>{{inventario.descripcion}}</td>
<td>{{inventario.cantidad}}</td>
<td>{{inventario.precio}}</td>
<td>{{inventario.total}}</td>
<td>
{% if perms.seajb.view_producto %}
<a href="{% url 'pdf_sextimo' inventario.id %}" class="btn btn-danger btn-sm"><i class="fas fa-file-pdf fs-1"></i></a> |
{% endif %}
{% if perms.seajb.change_producto %}
<a href="{% url 'edit_in' inventario.id %}" class="btn btn-info btn-sm"><i class="fas fa-solid fa-marker"></i></a> |
{% endif %}
{% if perms.seajb.delete_producto %}
<a href="#" class="btn btn-dark btn-sm" data-id="{{inventario.id}}"><i class="fas fa-solid fa-trash"></i></a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modalInventario" tabindex="-1" aria-labelledby="modalTituloInventario" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark">
<h5 class="modal-title m-0" id="modalTituloInventario">Registrar el Producto</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include 'inventario/inventario_formulario.html' %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(document).ready(function () {
$(".btn-dark").click(function () {
let id = $(this).data('id');
Swal.fire({
title: '¿Estás seguro?',
text: "Si usted acepta ¡No podrás revertir esto! Eliminaras todos los registro del Producto",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, bórralo!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/delete/' + id,
method: 'GET',
success: function (response) {
if (response.status === 'success') {
Swal.fire('¡Registro eliminado!', '', 'success');
} else {
location.reload();
}
}
});
}
});
});
});
</script>
<script>
document.getElementById('precio').addEventListener('change', function (e) {
e.currentTarget.value = parseFloat(e.currentTarget.value).toFixed(2);
});
</script>
{% endblock %}

View File

@ -0,0 +1,57 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="form-group">
<label for="tercero">Unidad</label>
<select class="form-control" id="tercero" name="tercero">
<option value="{{batallon.id}}">{{batallon.id}} - {{batallon.nombreB}} </option>
</select>
{% for error in formulario_municion.errors.tercero %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="tipoM" class="form-label">{{formulario_municion.tipoM.label}} </label>
<input type="text" class="form-control" name="tipoM" id="tipoM" value="{{ formulario_municion.tipoM.value|default_if_none:'' }}" placeholder="Munición, Explosivos, otros ">
{% for error in formulario_municion.errors.tipoM %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="lote" class="form-label">{{formulario_municion.lote.label}}</label>
<input type="text" class="form-control" name="lote" id="lote" value="{{ formulario_municion.lote.value|default_if_none:'' }}" placeholder="Lote N°">
{% for error in formulario_municion.errors.lote %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="serialAG" class="form-label">{{formulario_municion.serialAG.label}}</label>
<input type="text" class="form-control" name="serialAG" id="serialAG" value="{{ formulario_municion.serialAG.value|default_if_none:'' }}" placeholder="Serial de Asignación">
{% for error in formulario_municion.errors.serialAG %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="fechaAG">{{formulario_municion.fechaAG.label}}:</label>
<input type="date" class="form-control" name="fechaAG" id="fechaAG"/>
</div>
<div class="form-group">
<label for="cantidadM" class="form-label">Cantidad</label>
<input type="number" class="form-control" name="cantidadM" id="cantidadM" value="{{formulario_municion.cantidadM.value|default_if_none:'' }}" placeholder="500">
{% for error in formulario_municion.errors.cantidadM %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="modal-footer">
<button type="button" id="cerrarBoton" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
<input type="submit" class="btn btn-primary float-left" value="Registrar">
</div>
</form>

View File

@ -0,0 +1,159 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ORDEN DE ARMAMAMENTO</title>
<style>
table {
overflow-x: auto;
border-collapse: collapse;
table-layout: fixed;
width: 50%;
}
table th,
td {
padding: 5px;
max-width: 400px;
word-wrap: break-word;
white-space: inherit;
}
table p {
text-align: center;
font-size: 10px;
font-weight: bold;
margin-bottom: 0px;
margin-top: 0px;
}
.bodertabla{
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan="5" style="padding: 10px; text-align:center;"><img src="{{img_uno}}" alt="icon" width="60"
height="80"></td>
<td colspan="8">
<p style="margin-top: 0px;">REPÚPLICA BOLIVARIANA DE VENEZUELA</p>
<p style="margin-top: 0px;">MINISTERIO DEL PODER POPULAR PARA LA DEFENSA</p>
<p style="margin-top: 0px;">EJÉRCITO BOLIVARIANO</p>
<p style="margin-top: 0px;">SERVICIO DE ARMAMENTO</p>
</td>
<td colspan="5" style="padding: 20px;"><img src="{{img_dos}}" width="70"></td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="4" style="text-align: left;">Codigo-D : {{codigo.code}}</td>
<td colspan="5" style="text-align: center;">Serial-AG: {{armas.serialAG}}</td>
<td colspan="4" style="text-align: center;" >Fecha-AG : {{armas.fechaAG|date:"d/m/Y"}} </td>
<td colspan="4" style="text-align: right;">{{fecha}}</td>
</tr>
</tbody>
</table>
<table class="bodertabla">
<thead>
{% for unidad in person %}
<tr>
<th colspan="15" style="padding: 10px; border: 1px solid black">
ORDEN DEL SERVICIO DE ARMAMENTO PARA {{unidad.nombreB}} QUE PERTECE A LA {{codigo.nombreB}}
</th>
</tr>
{% endfor %}
</thead>
<thead>
<tr>
<th colspan="3">CATEGORIA</th>
<th colspan="3">T-ARMAS</th>
<th colspan="3">MODELO-A</th>
<th colspan="3">CALIBRE-A</th>
<th colspan="3">CONDICION</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3" style="width: auto; text-align: center;">{{armas.categoria}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{armas.tipoA}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{armas.modeloA}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{armas.calibreA}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{armas.opAM}}</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="3" style="width: auto;">CANTIDAD-A</th>
<th colspan="3" style="width: auto;">CANTIDAD-C</th>
<th colspan="3" style="width: auto;">ARMAS-S</th>
<th colspan="3" style="width: auto;">T-ARMAS-S</th>
<th colspan="3" style="width: auto;">CANTIDAD-S</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3" style="width: auto; text-align: center;">{{armas.cantidadA}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{armas.cantidadC}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{armas.armaS}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{armas.calibreS}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{armas.cantidadS}}</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="15" style="padding: 10px;">SERIALES DEL ARMAMENTO</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="15">{{armas.serialA}}</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="15" style="padding: 10px;">SERIALES DEL ARMAMENTO SEGUNDARIO</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="15">{{armas.serialS}}</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="15" style="padding: 10px;" style="width: auto;">ACCESORIOS</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="15">{{armas.ac}}</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="5" style="height: 150px;"></td>
<td colspan="5"></td>
<td colspan="5"></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="5" style="padding: 10px;">FIRMA1</th>
<th colspan="5" style="padding: 10px;">FIRMA2</th>
<th colspan="5" style="padding: 10px;">FIRMA3</th>
</tr>
</thead>
</table>
</body>
</html>

View File

@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lista General de Armas</title>
<style>
table {
overflow-x: auto;
border-collapse: collapse;
table-layout: fixed;
width: 50%;
}
table th,
td {
padding: 5px;
max-width: 400px;
word-wrap: break-word;
white-space: inherit;
}
table p {
text-align: center;
font-size: 10px;
font-weight: bold;
margin-bottom: 0px;
margin-top: 0px;
}
.bodertabla {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan="5" style="padding: 10px; text-align:center;"><img src="{{img_uno}}" alt="icon" width="60"
height="80"></td>
<td colspan="8">
<p style="margin-top: 0px;">REPÚPLICA BOLIVARIANA DE VENEZUELA</p>
<p style="margin-top: 0px;">MINISTERIO DEL PODER POPULAR PARA LA DEFENSA</p>
<p style="margin-top: 0px;">EJÉRCITO BOLIVARIANO</p>
<p style="margin-top: 0px;">SERVICIO DE ARMAMENTO</p>
</td>
<td colspan="5" style="padding: 20px;"><img src="{{img_dos}}" width="70"></td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="12" style="text-align: left;">Codigo-D : {{brigada.code}}</td>
<td colspan="5" style="text-align: right;">{{fecha}}</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th colspan="15" style="padding: 10px;">
LISTA DE MUNICIONES ASIGNADAS A LA {{batallones.nombreB}}
</th>
</tr>
</thead>
</table>
<table class="bodertabla">
<thead>
<tr>
<th colspan="4">TIPO MUNICIÓN</th>
<th colspan="3">SERIAL-AG</th>
<th colspan="3">FECHA-AG</th>
<th colspan="2">CANTIDAD-M</th>
<th colspan="3">LOTE</th>
</tr>
</thead>
<tbody>
{% for municion in municion %}
<tr>
<td colspan="4">{{municion.tipoM}}</td>
<td colspan="3">{{municion.serialAG}}</td>
<td colspan="3">{{municion.fechaAG|date:'d/m/Y'}}</td>
<td colspan="2">{{municion.cantidadM}}</td>
<td colspan="3">{{municion.lote}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,174 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>INFORMACIÓN DE PERSONAS CON ARMAS ASIGNADAS</title>
<style>
table {
overflow-x: auto;
border-collapse: collapse;
table-layout: fixed;
width: 50%;
}
table th,
td {
padding: 5px;
max-width: 400px;
word-wrap: break-word;
white-space: inherit;
}
table p {
text-align: center;
font-size: 10px;
font-weight: bold;
margin-bottom: 0px;
margin-top: 0px;
}
.bodertabla {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan="5" style="padding: 10px; text-align:center;"><img src="{{img_uno}}" alt="icon" width="60"
height="80"></td>
<td colspan="8">
<p style="margin-top: 0px;">REPÚPLICA BOLIVARIANA DE VENEZUELA</p>
<p style="margin-top: 0px;">MINISTERIO DEL PODER POPULAR PARA LA DEFENSA</p>
<p style="margin-top: 0px;">EJÉRCITO BOLIVARIANO</p>
<p style="margin-top: 0px;">SERVICIO DE ARMAMENTO</p>
</td>
<td colspan="5" style="padding: 20px;"><img src="{{img_dos}}" width="70"></td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="4" style="text-align: left;">Codigo-D : {{person.code}}</td>
<td colspan="5" style="text-align: center;">Serial-AG: {{person.serialAG}}</td>
<td colspan="4" style="text-align: center;">Fecha-AG : {{person.fechaAG|date:"d/m/Y"}} </td>
<td colspan="4" style="text-align: right;">{{fecha}}</td>
</tr>
</tbody>
</table>
<table class="bodertabla">
<thead>
<tr>
<th colspan="15" style="padding: 10px; border: 1px solid black">
PERFIL DE LA PERSONA CON ARMAMENTO ASIGNADO
</th>
</tr>
</thead>
<thead>
<tr>
<th colspan="3">GRADO</th>
<th colspan="3">CATEGORIA</th>
<th colspan="3">NOMBRES Y APELLIDOS</th>
<th colspan="3">CEDULA</th>
<th colspan="3">AÑO</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3" style="width: auto; text-align: center;">{{person.grado}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.categoria}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.datos}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.cedula}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.anio}}</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="3" style="width: auto;">PROMOCIÓN</th>
<th colspan="3" style="width: auto;">UNIDAD</th>
<th colspan="3" style="width: auto;">DIRECCIÓN</th>
<th colspan="3" style="width: auto;">TELEFONO</th>
<th colspan="3" style="width: auto;">CORREO</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3" style="width: auto; text-align: center;">{{person.promocion}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.unidad}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.direccion}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.telefono}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.correo}}</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="6" style="width: auto;">ARMA ASIGNADAS</th>
<th colspan="3" style="width: auto;">SERIAL</th>
<th colspan="3" style="width: auto;">CARGADORES</th>
<th colspan="3" style="width: auto;">MUNICIONES</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="6" style="width: auto; text-align: center;">{{person.armaA}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.serialA}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.cargadores}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.municiones}}</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="15" style="padding: 10px;">OTRO ARMAMENTO</th>
</tr>
</thead>
<thead>
<tr>
<th colspan="3" style="width: auto;">ARMA ASIGNADAS</th>
<th colspan="3" style="width: auto;">MODELO</th>
<th colspan="3" style="width: auto;">SERIAL</th>
<th colspan="3" style="width: auto;">CARGADORES</th>
<th colspan="3" style="width: auto;">MUNICIONES</th>
</tr>
</thead>
<tbody>
{% for person in armas %}
<tr>
<td colspan="3" style="width: auto; text-align: center;">{{person.armas}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.modelo}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.serial}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.cargadores}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{person.municiones}}</td>
</tr>
{% endfor %}
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="5" style="height: 150px;"></td>
<td colspan="5"></td>
<td colspan="5"></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="5" style="padding: 10px;">FIRMA1</th>
<th colspan="5" style="padding: 10px;">FIRMA2</th>
<th colspan="5" style="padding: 10px;">FIRMA3</th>
</tr>
</thead>
</table>
</body>
</html>

View File

@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inventario de SEAJB</title>
<style>
table {
overflow-x: auto;
border-collapse: collapse;
table-layout: fixed;
width: 50%;
}
table th,
td {
padding: 5px;
max-width: 400px;
word-wrap: break-word;
white-space: inherit;
}
table p {
text-align: center;
font-size: 10px;
font-weight: bold;
margin-bottom: 0px;
margin-top: 0px;
}
.bodertabla {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan="5" style="padding: 10px; text-align:center;"><img src="{{img_uno}}" alt="icon" width="60"
height="80"></td>
<td colspan="8">
<p style="margin-top: 0px;">REPÚPLICA BOLIVARIANA DE VENEZUELA</p>
<p style="margin-top: 0px;">MINISTERIO DEL PODER POPULAR PARA LA DEFENSA</p>
<p style="margin-top: 0px;">EJÉRCITO BOLIVARIANO</p>
<p style="margin-top: 0px;">SERVICIO DE ARMAMENTO</p>
</td>
<td colspan="5" style="padding: 20px;"><img src="{{img_dos}}" width="70"></td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="4" style="text-align: left;"></td>
<td colspan="5" style="text-align: center;"></td>
<td colspan="4" style="text-align: center;"></td>
<td colspan="4" style="text-align: right;">{{fecha}}</td>
</tr>
</tbody>
</table>
<table class="bodertabla">
<thead>
<tr>
<th colspan="25" style="padding: 10px; border: 1px solid black">
LISTA DE LOS PRODUCTO REGISTRADOS EN EL INVENTARIO SAEJB
</th>
</tr>
</thead>
<thead>
<tr>
<th colspan="1"></th>
<th colspan="3">CODIGO</th>
<th colspan="6">PRODUCTO</th>
<th colspan="6">MODELO</th>
<th colspan="3">CANTIDAD</th>
<th colspan="3">PRECIO</th>
<th colspan="3">TOTAL</th>
</tr>
</thead>
<tbody>
{% for producto in producto %}
<tr>
<td colspan="1" style="width: auto; text-align: center;">{{forloop.counter}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{producto.code}}</td>
<td colspan="6" style="width: auto; text-align: center;">{{producto.nombre}}</td>
<td colspan="6" style="width: auto; text-align: center;">{{producto.modelo}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{producto.cantidad}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{producto.precio}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{producto.total}}</td>
</tr>
{% endfor %}
</table>
<table>
<tbody>
<tr>
<td colspan="5" style="height: 150px;"></td>
<td colspan="5"></td>
<td colspan="5"></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="5" style="padding: 10px;">FIRMA1</th>
<th colspan="5" style="padding: 10px;">FIRMA2</th>
<th colspan="5" style="padding: 10px;">FIRMA3</th>
</tr>
</thead>
</table>
</body>
</html>

View File

@ -0,0 +1,129 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inventario de SEAJB</title>
<style>
table {
overflow-x: auto;
border-collapse: collapse;
table-layout: fixed;
width: 50%;
}
table th,
td {
padding: 5px;
max-width: 400px;
word-wrap: break-word;
white-space: inherit;
}
table p {
text-align: center;
font-size: 10px;
font-weight: bold;
margin-bottom: 0px;
margin-top: 0px;
}
.bodertabla {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan="5" style="padding: 10px; text-align:center;"><img src="{{img_uno}}" alt="icon" width="60"
height="80"></td>
<td colspan="8">
<p style="margin-top: 0px;">REPÚPLICA BOLIVARIANA DE VENEZUELA</p>
<p style="margin-top: 0px;">MINISTERIO DEL PODER POPULAR PARA LA DEFENSA</p>
<p style="margin-top: 0px;">EJÉRCITO BOLIVARIANO</p>
<p style="margin-top: 0px;">SERVICIO DE ARMAMENTO</p>
</td>
<td colspan="5" style="padding: 20px;"><img src="{{img_dos}}" width="70"></td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="4" style="text-align: left;">Codigo-D : {{producto.code}}</td>
<td colspan="5" style="text-align: center;"></td>
<td colspan="4" style="text-align: center;"></td>
<td colspan="4" style="text-align: right;">{{fecha}}</td>
</tr>
</tbody>
</table>
<table class="bodertabla">
<thead>
<tr>
<th colspan="15" style="padding: 10px; border: 1px solid black">
PRODUCTO REGISTRADO EN EL INVENTARIO
</th>
</tr>
</thead>
<thead>
<tr>
<th colspan="3">PRODUCTO</th>
<th colspan="3">MODELO</th>
<th colspan="3">CANTIDAD</th>
<th colspan="3">PRECIO</th>
<th colspan="3">TOTAL</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3" style="width: auto; text-align: center;">{{producto.nombre}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{producto.modelo}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{producto.cantidad}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{producto.precio}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{producto.total}}</td>
</tr>
</tr>
<thead>
<tr>
<th colspan="15" style="padding: 10px;">SERIAL DEL PRODUCTO</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="15">{{producto.serial}}</td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="15" style="padding: 10px;" style="width: auto;">DESCRIPCIÓN</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="15">{{producto.descripcion}}</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td colspan="5" style="height: 150px;"></td>
<td colspan="5"></td>
<td colspan="5"></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="5" style="padding: 10px;">FIRMA1</th>
<th colspan="5" style="padding: 10px;">FIRMA2</th>
<th colspan="5" style="padding: 10px;">FIRMA3</th>
</tr>
</thead>
</table>
</body>
</html>

View File

@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Orden de Munición Explosivos</title>
<style>
@page {
size: letter portrait;
margin: 1cm;
}
table {
overflow-x: auto;
border-collapse: collapse;
table-layout: fixed;
width: 50%;
}
table th,
td {
padding: 5px;
max-width: 400px;
word-wrap: break-word;
white-space: inherit;
}
table p {
text-align: center;
font-size: 10px;
font-weight: bold;
margin-bottom: 0px;
margin-top: 0px;
}
.bodertabla {
border: 1px solid black;
}
</style>
</head>
<body>
<table id="header_content">
<tbody>
<tr>
<td colspan="5" style="padding: 10px; text-align:center;"><img src="{{img_uno}}" alt="icon" width="60"
height="80" style="opacity: 0.5;"></td>
<td colspan="8">
<p style="margin-top: 0px;">REPÚPLICA BOLIVARIANA DE VENEZUELA</p>
<p style="margin-top: 0px;">MINISTERIO DEL PODER POPULAR PARA LA DEFENSA</p>
<p style="margin-top: 0px;">EJÉRCITO BOLIVARIANO</p>
<p style="margin-top: 0px;">SERVICIO DE ARMAMENTO</p>
</td>
<td colspan="5" style="padding: 20px;"><img src="{{img_dos}}" width="70"></td>
</tr>
</tbody>
<tbody style="margin-top: 30px;">
<tr>
<td colspan="4" style="text-align: left;">Codigo-D : {{brigada.code}}</td>
<td colspan="5" style="text-align: center;">Serial-AG: {{municiones.serialAG}}</td>
<td colspan="4" style="text-align: center;">Fecha-AG : {{municiones.fechaAG|date:"d/m/Y"}} </td>
<td colspan="4" style="text-align: right;">{{fecha}}</td>
</tr>
</tbody>
</table>
<table class="bodertabla" style="margin-top: 40px;">
<thead>
{% for batallones in batallones %}
<tr>
<th colspan="15" style="padding: 10px; border: 1px solid black">
ORDEN PARA {{batallones.nombreB}} QUE PERTECE A LA {{brigada.nombreB}}
</th>
</tr>
{% endfor %}
</thead>
<thead>
<tr>
<th colspan="3">TIPO DE MUNICION O EXPLOSIVO</th>
<th colspan="3">SERIAL AG</th>
<th colspan="3">FECHA-AG</th>
<th colspan="3">CANTIDAD-ME</th>
<th colspan="3">LOTE</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3" style="width: auto; text-align: center;">{{municiones.tipoM}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{municiones.serialAG}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{municiones.fechaAG|date:"d/m/Y"}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{municiones.cantidadM}}</td>
<td colspan="3" style="width: auto; text-align: center;">{{municiones.lote}}</td>
</tr>
</tbody>
</table>
<table id="footer_content">
<tbody>
<tr>
<td colspan="5" style="height: 100px;"></td>
<td colspan="5"></td>
<td colspan="5"></td>
</tr>
</tbody>
<thead>
<tr>
<th colspan="5" style="padding: 10px;">FIRMA1</th>
<th colspan="5" style="padding: 10px;">FIRMA2</th>
<th colspan="5" style="padding: 10px;">FIRMA3</th>
</tr>
</thead>
</table>
</body>
</html>

View File

@ -0,0 +1,100 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lista General de Armas</title>
<style>
table {
overflow-x: auto;
border-collapse: collapse;
table-layout: fixed;
width: 50%;
}
table th,
td {
padding: 5px;
max-width: 400px;
word-wrap: break-word;
white-space: inherit;
}
table p {
text-align: center;
font-size: 10px;
font-weight: bold;
margin-bottom: 0px;
margin-top: 0px;
}
.bodertabla {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan="5" style="padding: 10px; text-align:center;"><img src="{{img_uno}}" alt="icon" width="60"
height="80"></td>
<td colspan="8">
<p style="margin-top: 0px;">REPÚPLICA BOLIVARIANA DE VENEZUELA</p>
<p style="margin-top: 0px;">MINISTERIO DEL PODER POPULAR PARA LA DEFENSA</p>
<p style="margin-top: 0px;">EJÉRCITO BOLIVARIANO</p>
<p style="margin-top: 0px;">SERVICIO DE ARMAMENTO</p>
</td>
<td colspan="5" style="padding: 20px;"><img src="{{img_dos}}" width="70"></td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="12" style="text-align: left;">Codigo-D : {{brigada.code}}</td>
<td colspan="5" style="text-align: right;">{{fecha}}</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th colspan="15" style="padding: 10px;">
LISTA DE LAS ARMAS ASIGNADAS A LA {{batallones.nombreB}}
</th>
</tr>
</thead>
</table>
<table class="bodertabla">
<thead>
<tr>
<th colspan="3">CATEGORIA</th>
<th colspan="3">T-ARMA</th>
<th colspan="4">MODELO-A</th>
<th colspan="3">CALIBRE-A</th>
<th colspan="3">CANTIDAD</th>
<th colspan="3">CONDICION</th>
<th colspan="3">ARMAS-S</th>
</tr>
</thead>
<tbody>
{% for armas in armas %}
<tr>
<td colspan="3">{{armas.categoria}}</td>
<td colspan="3">{{armas.tipoA}}</td>
<td colspan="4">{{armas.modeloA}}</td>
<td colspan="3">{{armas.calibreA}}</td>
<td colspan="3">{{armas.cantidadA}}</td>
<td colspan="3">{{armas.opAM}}</td>
<td colspan="3">{{armas.armaS}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lista General del Personal con Armas Asignadas</title>
<style>
table {
overflow-x: auto;
border-collapse: collapse;
table-layout: fixed;
width: 50%;
}
table th,
td {
padding: 5px;
max-width: 400px;
word-wrap: break-word;
white-space: inherit;
}
table p {
text-align: center;
font-size: 10px;
font-weight: bold;
margin-bottom: 0px;
margin-top: 0px;
}
.bodertabla {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan="5" style="padding: 10px; text-align:center;"><img src="{{img_uno}}" alt="icon" width="60"
height="80"></td>
<td colspan="8">
<p style="margin-top: 0px;">REPÚPLICA BOLIVARIANA DE VENEZUELA</p>
<p style="margin-top: 0px;">MINISTERIO DEL PODER POPULAR PARA LA DEFENSA</p>
<p style="margin-top: 0px;">EJÉRCITO BOLIVARIANO</p>
<p style="margin-top: 0px;">SERVICIO DE ARMAMENTO</p>
</td>
<td colspan="5" style="padding: 20px;"><img src="{{img_dos}}" width="70"></td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="12" style="text-align: left;"></td>
<td colspan="5" style="text-align: right;">{{fecha}}</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th colspan="15" style="padding: 10px;">
LISTA DEL PERSONAL QUE TIENE ARMAS ASIGNADAS
</th>
</tr>
</thead>
</table>
<table class="bodertabla">
<thead>
<tr>
<th colspan="3">GRADO</th>
<th colspan="3">CATEGORIA</th>
<th colspan="4">NOMBRES Y APELIIDOS</th>
<th colspan="3">AÑO</th>
</tr>
</thead>
<tbody>
{% for prueba in prueba %}
<tr>
<td colspan="3">{{prueba.grado}}</td>
<td colspan="3">{{prueba.categoria}}</td>
<td colspan="4">{{prueba.datos}}</td>
<td colspan="3">{{prueba.anio}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,84 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="form-row">
<div class="form-group col-md-12">
<label for="persona">Persona</label>
<select class="form-control" name="persona" id="persona">
<option value="{{person.id}}">{{person.id}} - {{person.datos}} - {{person.cedula}}</option>
</select>
{% for error in formulario.errors.persona %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="armas" class="form-label">{{formulario.armas.label}}</label>
<input type="text" class="form-control" name="armas" id="armas"
value="{{ formulario.armas.value|default_if_none:'' }}" placeholder="Armas">
{% for error in formulario.errors.armas %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="modelo" class="form-label">{{formulario.modelo.label}}</label>
<input type="text" class="form-control" name="modelo" id="modelo" value="{{ formulario.modelo.value|default_if_none:'' }}"
placeholder="modelo">
{% for error in formulario.errors.modelo %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="serial" class="form-label">{{formulario.serial.label}}</label>
<input type="text" class="form-control" name="serial" id="serial"
value="{{ formulario.serial.value|default_if_none:'' }}" placeholder="serial">
{% for error in formulario.errors.serial %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="serialag" class="form-label">{{formulario.serialag.label}} </label>
<input type="text" class="form-control" name="serialag" id="serialag"
value="{{ formulario.serialag.value|default_if_none:'' }}" placeholder="serialag">
{% for error in formulario.errors.serialag %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="fechag" class="form-label">{{formulario.fechag.label}}</label>
<input type="date" class="form-control" name="fechag" id="fechag"
value="{{ formulario.fechag.value|default_if_none:'' }}" placeholder="fechag">
{% for error in formulario.errors.fechag %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="cargadores" class="form-label">{{formulario.cargadores.label}}</label>
<input type="text" class="form-control" name="cargadores" id="cargadores"
value="{{ formulario.cargadores.value|default_if_none:'' }}" placeholder="cargadores">
{% for error in formulario.errors.cargadores %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="municiones" class="form-label">{{formulario.municiones.label}}</label>
<input type="text" class="form-control" name="municiones" id="municiones"
value="{{ formulario.municiones.value|default_if_none:'' }}" placeholder="municiones">
{% for error in formulario.errors.municiones %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
<input type="submit" class="btn btn-primary float-left" value="Registrar">
</div>
</form>

View File

@ -0,0 +1,203 @@
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="row">
<div class="form-group col-md-5">
<label for="categoria">Categoria</label>
<select class="form-control" name="categoria" id="categoria" aria-label="Seleccionar Categoria">
<option value="{{ formulario.categoria.value|default_if_none:'' }}">Actual : {{ formulario.categoria.value|default_if_none:'' }}</option>
<option value="Comando">Oficial de Comando</option>
<option value="Tecnico">Oficial Tecnico</option>
<option value="Tropa">Oficial de Tropa</option>
<option value="Asimilado">Oficial Asimilado</option>
<option value="Tropa Profesional">Tropa Profesional</option>
<option value="Funcionario">Funcionario</option>
<option value="Escolta">Escolta</option>
<option value="Caso Especial">Caso Especial</option>
</select>
{% for error in formulario.errors.categoria %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-5">
<label for="grado">Grado</label>
<select class="form-control" name="grado" id="grado" aria-label="Seleccionar Grado">
<option value="{{ formulario.grado.value|default_if_none:'' }}">Actual : {{ formulario.grado.value|default_if_none:'' }}</option>
<optgroup label="Oficiales">
<option value="GJ">General en Jefe</option>
<option value="MG">Mayor General</option>
<option value="GD">General de División</option>
<option value="GB">General de Brigada</option>
<option value="Cnel.">Coronel</option>
<option value="Tcnel.">Teniente Coronel</option>
<option value="May.">Mayor</option>
<option value="Cap.">Capitán</option>
<option value="Pte.">Primer Teniente</option>
<option value="Tte.">Teniente</option>
</optgroup>
<optgroup label="Tropa">
<option value="SS">Sargento Supervisor</option>
<option value="SA">Sargento Ayudante</option>
<option value="SM1">Sargento Mayor de Primera</option>
<option value="SM2">Sargento Mayor de Segunda</option>
<option value="SM3">Sargento Mayor de Tercera</option>
<option value="S1">Sargento Primero</option>
<option value="S2">Sargento Segundo</option>
</optgroup>
<option value="CIVIL">Civil</option>
</select>
{% for error in formulario.errors.grado %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-2">
<label for="anio" class="form-label">{{formulario.anio.label}}</label>
<select class="form-control" name="anio" id="anio" aria-label="Seleccionar Grado">
<option value="{{ formulario.anio.value|default_if_none:'' }}">Actual : {{ formulario.anio.value|default_if_none:'' }}
</option>
</select>
{% for error in formulario.errors.anio %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-3">
<label for="promocion" class="form-label">{{formulario.promocion.label}}</label>
<textarea class="form-control custom-textarea" name="promocion" id="promocion" rows="2" placeholder="Describe aquí...">{{formulario.promocion.value|default_if_none:''}}
</textarea>
{% for error in formulario.errors.promocion %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-3">
<label for="unidad" class="form-label">{{formulario.unidad.label}}</label>
<textarea class="form-control custom-textarea" name="unidad" id="unidad" rows="2" placeholder="Describe aquí...">{{formulario.unidad.value|default_if_none:''}}
</textarea>
{% for error in formulario.errors.unidad %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-6">
<label for="datos" class="form-label">{{formulario.datos.label}} </label>
<input type="text" class="form-control" name="datos" id="datos"
value="{{ formulario.datos.value|default_if_none:'' }}" placeholder="Nombres y Apellidos">
{% for error in formulario.errors.datos %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-3">
<label for="cedula" class="form-label">{{formulario.cedula.label}}</label>
<input type="text" class="form-control" name="cedula" id="cedula"
value="{{ formulario.cedula.value|default_if_none:'' }}" placeholder="Cedula">
{% for error in formulario.errors.cedula %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-3">
<label for="armaA" class="form-label">{{formulario.armaA.label}}</label>
<textarea class="form-control custom-textarea" name="armaA" id="armaA" rows="2" placeholder="Describe aquí...">{{formulario.armaA.value|default_if_none:''}}
</textarea>
{% for error in formulario.errors.armaA %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-3">
<label for="serialA" class="form-label">{{formulario.serialA.label}}</label>
<input type="text" class="form-control" name="serialA" id="serialA"
value="{{ formulario.serialA.value|default_if_none:'' }}" placeholder="Serial del Arma">
{% for error in formulario.errors.serialA %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-3">
<label for="serialAG" class="form-label">{{formulario.serialAG.label}}</label>
<input type="text" class="form-control" name="serialAG" id="serialAG"
value="{{ formulario.serialAG.value|default_if_none:'' }}" placeholder="Serial de Asignación">
{% for error in formulario.errors.serialAG %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-2">
<label for="fechaAG">Fecha de Asignación</label>
<input type="date" name="fechaAG" id="fechaAG" class="form-control"/>
{% for error in formulario.errors.fechaAG %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-2">
<label for="cargadores" class="form-label">{{formulario.cargadores.label}}</label>
<input type="number" class="form-control" name="cargadores" id="cargadores"
value="{{ formulario.cargadores.value|default_if_none:'' }}" placeholder="500">
{% for error in formulario.errors.cargadores %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-2">
<label for="municiones" class="form-label">{{formulario.municiones.label}}</label>
<input type="number" class="form-control" name="municiones" id="municiones"
value="{{ formulario.municiones.value|default_if_none:'' }}" placeholder="500">
{% for error in formulario.errors.municiones %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-2">
<label for="telefono" class="form-label">{{formulario.telefono.label}}:</label>
<input type="tel" class="form-control" name="telefono" id="telefono"
value="{{ formulario.telefono.value|default_if_none:'' }}" placeholder="Telefono">
{% for error in formulario.errors.telefono %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-4">
<label for="correo" class="form-label">{{formulario.correo.label}}:</label>
<input type="email" class="form-control" name="correo" id="correo"
value="{{ formulario.correo.value|default_if_none:'' }}" placeholder="user@example.com">
{% for error in formulario.errors.correo %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="direccion" class="form-label">{{formulario.direccion.label}}:</label>
<textarea class="form-control custom-textarea" name="direccion" id="direccion" rows="2" placeholder="Describe aquí...">{{formulario.direccion.value|default_if_none:''}}
</textarea>
{% for error in formulario.errors.direccion %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="img" class="form-label">{{formulario.img.label}}:</label>
<input type="file" name="img" id="img" value="{{formulario.img.value|default_if_none:'' }}" >
<img src="{{personas.img.url}}" alt="" width="20px">
{% for error in formulario.errors.img %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
<input type="submit" class="btn btn-dark float-left" value="GUARDAR">
</div>
</form>

View File

@ -0,0 +1,145 @@
{% extends "base.html" %}
{% block titulo %} Personal {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Personal</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Lista</a></li>
<li class="breadcrumb-item active">PDF</li>
<li class="breadcrumb-item active">Personas</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<form action="{% url 'pdf_uno' %}" method="get">
<div class="row">
<div class="col-12">
<div class="input-group">
<select class="form-control" name="year" id="year">
</select>
<div class="input-group-append ">
<button type="submit" class="btn btn-danger" target="_blank"><i class="fas fa-file-pdf"></i></button>
</div>
</div>
</div>
</div>
</form>
<div class="form-group col-md-2 text-right">
{% if perms.seajb.add_personas %}
<a href="#" class="btn btn-success" data-toggle="modal" data-target="#exampleModal"><i class="fas fa-plus-square"></i>
Nuevo</a>
{% endif %}
</div>
</div>
</div>
<div class="card-body">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th></th>
<th>FECHA</th>
<th>CODIGO</th>
<th>GRADO</th>
<th>CATEGORIA</th>
<th>NOMBRES Y APELLIDOS</th>
<th>CEDULA</th>
<th>AÑO</th>
<th>ACCIONES</th>
</tr>
</thead>
<tbody>
{% for datos in personas %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{datos.fecha|date:"d/m/Y"}}</td>
<td>{{datos.code}}</td>
<td>{{datos.grado}}</td>
<td>{{datos.categoria}}</td>
<td>{{datos.datos}} </td>
<td>{{datos.cedula}} </td>
<td>{{datos.anio}} </td>
<td>
{% if perms.seajb.view_personas %}
<a href="{% url 'informacion' datos.id %}" class="btn btn-success btn-sm"><i class="fas fa-solid fa-eye"></i></a> |
{% endif %}
{% if perms.seajb.change_personas %}
<a href="{% url 'personas_editar' datos.id %}" class="btn btn-info btn-sm"><i class="fas fa-solid fa-marker"></i></a> |
{% endif %}
{% if perms.seajb.view_personas %}
<a href="{{datos.img.url}}" class="btn btn-warning btn-sm" target="_blank"><i class="fas fa-download"></i></a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="exampleModalLabel">Formulario de Personas</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include "personas/persona_formulario.html" %}
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
function ComboAno() {
var d = new Date();
var n = d.getFullYear();
var select = document.getElementById("year");
for (var i = n; i >= 1980; i--) {
var opc = document.createElement("option");
opc.text = i;
opc.value = i;
select.add(opc);
}
}
window.onload = ComboAno;
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var yearSelect = document.getElementById('anio');
var currentYear = new Date().getFullYear();
for (var year = 1970; year <= currentYear; year++) {
var option = document.createElement('option');
option.value = year;
option.text = year;
yearSelect.appendChild(option);
}
});
</script>
{% endblock%}

View File

@ -0,0 +1,154 @@
{% extends "base.html" %}
{% block titulo %} Resumen de la Unidad {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Información</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{% url 'personas' %}">Lista</a></li>
<li class="breadcrumb-item active">Información</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="row justify-content-center">
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0">
<a href="{% url 'pdf_dos' person.id %}" class="btn btn-danger" target="_blank"><i class="fas fa-file-pdf"></i></a>
</h3>
<a href="#" type="button" class="btn btn-success float-right" data-toggle="modal" data-target="#modalNuevo"><i class="fas fa-plus-square"></i></a>
</div>
</div>
<div class="card-body table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>CREACIÓN</th>
<th>CODIGO</th>
<th>GRADO</th>
<th>CATEGORIA</th>
<th>PROMOCIÓN</th>
<th>AÑO</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{person.fecha|date:"d/m/Y"}}</td>
<td>{{person.code}}</td>
<td>{{person.grado}} </td>
<td>{{person.categoria}} </td>
<td>{{person.promocion}} </td>
<td>{{person.anio}} </td>
</tr>
</tbody>
<thead>
<tr>
<th>NOMBRES Y APELLIDOS</th>
<th>CEDULA</th>
<th>CORREO</th>
<th>TELEFONO</th>
<th>DIRECCIÓN</th>
<th>UNIDAD</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{person.datos}}</td>
<td>{{person.cedula}}</td>
<td>{{person.correo}}</td>
<td>{{person.telefono}}</td>
<td>{{person.direccion}}</td>
<td>{{person.unidad}}</td>
</tr>
</tbody>
<thead>
<tr>
<th>TIPO DE ARMA</th>
<th>SERIAL DEL ARMA</th>
<th>SERIAL DE ASIGNACIÓN</th>
<th>FECHA DE ASIGNACIÓN</th>
<th>CARGADORES</th>
<th>CARGA BASICA</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{person.armaA}}</td>
<td>{{person.serialA}}</td>
<td>{{person.serialAG}}</td>
<td>{{person.fechaAG}}</td>
<td>{{person.cargadores}}</td>
<td>{{person.municiones}}</td>
</tr>
</tbody>
</table>
<!-- la tabla de armas asignadas -->
<div class=" card-body table-responsive">
<table id="example1" class="table table-striped">
<thead>
<tr>
<th>ARMA</th>
<th>MODELO</th>
<th>SERIAL</th>
<th>SERIAL ASIGNACIÓN</th>
<th>FECHA DE ASIGNACIÓN</th>
<th>CARGADORES</th>
<th>CARGA BASICA</th>
</tr>
</thead>
<tbody>
{% for persona in armas %}
<tr>
<td>{{persona.armas}} </td>
<td>{{persona.modelo}} </td>
<td>{{persona.serial}} </td>
<td>{{persona.serialag}} </td>
<td>{{persona.fechag}} </td>
<td>{{persona.cargadores}} </td>
<td>{{persona.municiones}} </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modalNuevo" tabindex="-1" aria-labelledby="modalNuevoTitulo" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="modalNuevoTitulo">Agregar Nueva Armas</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include "personas/persona_f_nuevo.html" %}
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,42 @@
{% extends "base.html" %}
{% block titulo %} Editar Persona {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Edición de Formulario</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{% url 'personas' %}">Personas</a></li>
<li class="breadcrumb-item active">Editar</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="row justify-content-center">
<div class="card card-dark card-outline w-50">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0">Editar el registro del {{personas.grado}} {{personas.categoria}}, {{personas.datos}}</h3>
</div>
</div>
<div class="card-body">
{% include 'personas/persona_formulario.html' %}
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SAEJB | Inicio de Sesión</title>
<!-- imagen Favicon -->
<link rel="icon" href="/static/imagenes/dos.ico" type="image/x-icon">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<link rel="stylesheet" href="/static/plugins/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="/static/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
<link rel="stylesheet" href="/static/dist/css/adminlte.min.css">
</head>
<body class="hold-transition login-page">
<div class="login-box">
<div class="card card-outline card-primary">
<div class="card-header text-center">
<a class="h1"><b>SAEJB</b> <img src="/static/imagenes/dos.png" alt="logo" height="50" width="50"></a>
</div>
<div class="card-body">
{% for message in messages %}
<div class="alert alert-{{ message.tags }}">
{{ message }}
</div>
{% endfor %}
<p class="login-box-msg">Coloca tu Usuario para Iniciar tu Sesión</p>
{% if form.errors %}
<p>Su nombre de usuario y contraseña no coinciden. Inténtalo de nuevo.</p>
{% endif %}
{% if user.is_authenticated %}
<p>Su cuenta no tiene acceso a esta página. Para continuar, inicie sesión con una cuenta que tenga acceso.</p>
{% endif %}
<form action="#" method="post">
{% csrf_token %}
<div class="input-group mb-3">
<input type="text" class="form-control" name="username" id="username_id" placeholder="Usuario">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-solid fa-user"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" name="password" id="" placeholder="Contraseña">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="row">
{% if not request.user.is_superuser %}
<div class="col-3">
<!-- <a href="{% url 'registro' %}" class="btn btn-dark btn-block">Registrarse</a> -->
</div>
{% endif %}
<div class="col-6">
<button type="submit" class="btn btn-primary btn-block">Iniciar Sesión</button>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/static/dist/js/adminlte.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SAEJB | Inicio de Sesión</title>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<link rel="stylesheet" href="/static/plugins/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="/static/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
<link rel="stylesheet" href="/static/dist/css/adminlte.min.css">
</head>
<body class="hold-transition login-page">
<div class="login-box">
<div class="card card-outline card-primary">
<div class="card-header text-center">
<a href="#" class="h1"><b>REGISTRO</b></a>
</div>
<div class="card-body">
<form action="#" method="post">
{% csrf_token %}
<div class="form-group">
<label for="username">{{form.username.label}}</label>
<input type="text" class="form-control" name="username" id="username" placeholder="Nombre de Usuario">
</div>
<div class="form-group">
<label for="email">{{form.email.label}}</label>
<input type="email" class="form-control" name="email" id="email" placeholder="Correo Electronico">
</div>
<div class="form-group">
<label for="password">Contraseña</label>
<input type="password" class="form-control" name="password" id="password" placeholder="Contraseña">
</div>
<div class="form-group">
<label for="password_confirmation">Confirmar Contraseña</label>
<input type="password" class="form-control" name="password_confirmation" id="password_confirmation" placeholder="Confirmar Contraseña">
</div>
<div class="row">
<div class="col-4">
<div class="icheck-primary d-inline">
<input type="checkbox" id="checkboxPrimary1" name="is_active">
<label for="checkboxPrimary1">{{form.is_active.label}}</label>
</div>
</div>
<div class="col-4">
<div class="icheck-primary d-inline">
<input type="checkbox" id="checkboxPrimary2" name="is_staff">
<label for="checkboxPrimary2">Staff</label>
</div>
</div>
<div class="col-3">
<div class="icheck-primary d-inline">
<input type="checkbox" id="checkboxPrimary3" name="is_superuser">
<label for="checkboxPrimary3">Super</label>
</div>
</div>
</div>
<div class="modal-footer">
<div class="row">
<div class="col-md-2">
<input type="submit" class="btn btn-primary" value="Resgistrarse">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/static/dist/js/adminlte.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block titulo %} Editar Brigada {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Edición de Brigada</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Formulario</a></li>
<li class="breadcrumb-item active">Edición</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="row justify-content-center">
<div class="card card-primary w-25">
<div class="card-header border-0">
<div class="d-flex justify-content-between">
<h3 class="card-title">Editar Formulario de la Brigada</h3>
</div>
</div>
<div class="card-body">
{% include 'servicio/form.html' %}
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,54 @@
<form action="" id="formulario" enctype="multipart/form-data" method="post">
{% csrf_token %}
<div class="row">
<div class="form-group col-md-12">
<label for="nombreB" class="form-label">Brigada</label>
<input type="text" class="form-control" name="nombreB" id="nombreB" value="{{ formulario.nombreB.value|default_if_none:'' }}" placeholder="Brigada">
{% for error in formulario.nombreB.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="ubicacionB" class="form-label"> {{formulario.ubicacionB.label}} </label>
<input type="text" class="form-control" name="ubicacionB" id="ubicacionB" value="{{ formulario.ubicacionB.value|default_if_none:'' }}" placeholder="ubicacion" >
{% for error in formulario.ubicacionB.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="comandante" class="form-label">{{formulario.comandante.label}}</label>
<input type="text" class="form-control" name="comandante" id="comandante" value="{{ formulario.comandante.value|default_if_none:'' }}" placeholder="Comandante">
{% for error in formulario.errors.comandante %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="telefono" class="form-label">{{formulario.telefono.label}} </label>
<input type="text" class="form-control" name="telefono" id="telefono" value="{{ formulario.telefono.value|default_if_none:'' }}" placeholder="Telefono" >
{% for error in formulario.errors.telefono %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group col-md-12">
<label for="correo" class="form-label">{{formulario.correo.label}}</label>
<input type="text" class="form-control" name="correo" id="correo" value="{{ formulario.correo.value|default_if_none:'' }}" placeholder="Correo Electronico">
{% for error in formulario.errors.correo %}
<span class="error">{{ error }}</span>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<input type="submit" class="btn btn-dark float-left" value="Guardar">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
</div>
</form>

View File

@ -0,0 +1,156 @@
{% extends "base.html" %}
{% block titulo %} Panel Principal {% endblock %}
{% block css %}
<style>
.table-hover-blue thead th:hover {
background-color: #007bff; /* Color azul de Bootstrap */
}
</style>
{% endblock%}
{% block proloander %}
<div class="preloader flex-column justify-content-center align-items-center">
<img class="animation__wobble" src="/static/imagenes/dos.png" alt="Logo" height="200" width="200">
</div>
{% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="card-body">
<div class="callout callout-danger">
<h5>Bienvenido <b>{{request.user.username}}</b></h5>
<p>Hola como estas, <span style="font-size: 20px;"> <b>{{request.user.first_name}}
{{request.user.last_name}}</b> </span> hoy es <b>{% now "d M Y" %}</b> estas registrado el <b>Sistema de
Control y Registro del Servicio de Armamento del Ejército Bolivariano</b>, estamos tratando de Innovar y
Automatizar, para asi facilitar el trabajo al Usuario de poder llevar un control correcto de todo sus datos.
</p>
</div>
</div>
<!-- /.card-body -->
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"></h3>
{% if perms.seajb.add_brigada %}
<a href="#" class="btn btn-success float-left" data-toggle="modal" data-target="#modalBrigada"><i class="fas fa-plus-square"></i> Nuevo</a>
{% endif %}
</div>
</div>
<div class="card-body table-responsive">
<table id="example1" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th class="text-center"></th>
<th class="text-center">FECHA</th>
<th class="text-center">SERIAL</th>
<th class="text-center">BRIGADAS</th>
<th class="text-center">COMANDANTES</th>
<th class="text-center">TELEFONOS</th>
<th class="text-center">CORREO</th>
<th class="text-center">UBICACIÓN</th>
<th class="text-center">ACCIONES</th>
</tr>
</thead>
<tbody>
{% for tabla in servicios %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{tabla.fecha|date:"d/m/Y"}}</td>
<td>{{tabla.code}}</td>
<td>{{tabla.nombreB}}</td>
<td>{{tabla.comandante}}</td>
<td>{{tabla.telefono}}</td>
<td>{{tabla.correo}}</td>
<td>{{tabla.ubicacionB}}</td>
<td>
{% if perms.seajb.view_brigada %}
<a href="{% url 'resumen' tabla.id %}" class="btn btn-success btn-sm"><i class="nav-icon fas fa-eye"></i></a> |
{% endif %}
{% if perms.seajb.change_brigada %}
<a href="{% url 'editar' tabla.id %}" class="btn btn-info btn-sm"><i class="fas fa-solid fa-marker"></i></a> |
{% endif %}
{% if perms.seajb.delete_brigada %}
<a href="#" class="btn btn-danger btn-sm" data-id="{{ tabla.id }}" ><i class="fas fa-solid fa-trash"></i></a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modalBrigada" tabindex="-1" aria-labelledby="modalTituloBrigada" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="modalTituloBrigada">Formulario de la Brigada</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include 'servicio/form.html' %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(document).ready(function() {
$(".btn-danger").click(function() {
let id = $(this).data('id');
Swal.fire({
title: '¿Estás seguro?',
text: "Si usted acepta ¡No podrás revertir esto! Eliminaras todos los registro de la Brigada, Unidades y Armas",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, bórralo!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/eliminar/' + id,
method: 'GET',
success: function(response) {
if (response.status === 'success') {
Swal.fire('¡Registro eliminado!', '', 'success');
} else {
location.reload();
}
}
});
}
});
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,27 @@
{% extends "base.html" %}
{% block titulo %} Principal {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Principal</a></li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
{% endblock %}

View File

@ -0,0 +1,95 @@
{% extends "base.html" %}
{% block titulo %} Principal {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Brigadas</h5>
</div><!-- /.col -->
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{% url 'servicio' %}">Lista</a></li>
<li class="breadcrumb-item active">Brigada</li>
<li class="breadcrumb-item active">Unidades</li>
<li class="breadcrumb-item active">Armamento</li>
<li class="breadcrumb-item active">Municiones</li>
</ol>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"></h3>
<p>{{primero.nombreB}} - {{primero.code}}</p>
{% if perms.seajb.add_batallones %}
<a href="#" class="btn btn-success float-left" data-toggle="modal" data-target="#exampleModal"><i
class="fas fa-plus-square"></i> Nuevo</a>
{% endif %}
</div>
</div>
<div class="card-body">
<table id="example2" class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th class="text-center">FECHA-R</th>
<th class="text-center">UNIDAD DE LA BRIGADA</th>
<th class="text-center">COMANDANTE DE LA UNIDAD</th>
<th class="text-center">TELEFONO</th>
<th class="text-center">CORREO</th>
<th class="text-center">UBICACIÓN</th>
<th class="text-center">ACCIONES</th>
</tr>
</thead>
<tbody>
{% for datos in servicios %}
<tr>
<td>{{datos.fecha|date:"dmY"}}</td>
<td>{{datos.nombreB}} </td>
<td>{{datos.comandante}} </td>
<td>{{datos.telefono}} </td>
<td>{{datos.correo}} </td>
<td>{{datos.ubicacionB}} </td>
<td>
{% if perms.seajb.view_batallones %}
<a href="{%url 'infor' datos.id %}" class="btn btn-success btn-sm"><i class="fas fa-solid fa-eye"></i></a> |
{% endif %}
{% if perms.seajb.change_batallones %}
<a href="{% url 'batallon_edit' datos.id %}" class="btn btn-info btn-sm"><i
class="fas fa-solid fa-marker"></i></a> |
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="exampleModalLabel">Formulario de la Unidad de la Brigada</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include 'batallon/batallon_f.html' %}
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,35 @@
{% extends 'base.html' %}
{% block titulo %}{{titulo}}{{" Cambiar Contraseña "|escape}}{% endblock %}
{% block contenido %}
<form action="" method="post">
{% csrf_token %}
<div class="form-group">
<label for="password">Contraseña</label>
<input type="password" class="form-control" name="password" id="password" placeholder="Contraseña">
{% for error in formulario.errors.password %}
<span class="error-messege">{{error}}</span>
{% endfor %}
</div>
<div class="form-group">
<label class="required" for="id_password1"> Contraseña(Confirmación)</label>
<input type="password" autocomplete="new-password" class="form-control" name="password1" id="id_password1"
placeholder="Confirmación">
{% for error in formulario_cambio.non_field_errors %}
{% if "Las contraseñas no coinciden" in error %}
<span class="error-message">{{ error }}</span>
{% endif %}
{% endfor %}
</div>
<div class="modal-footer">
<input type="submit" class="btn bg-gradient-dark btn-flat float-left" value="Guardar">
<a type="button" id="cerrarBoton" href="#" class="btn btn-secondary" data-dismiss="modal">Cerrar</a>
</div>
</form>
{% endblock %}

View File

@ -0,0 +1,58 @@
<form action="" method="post">
{% csrf_token %}
<div class="form-group col-md-5">
<label for="username">{{form.username.label}}</label>
<input type="text" class="form-control" name="username" id="username"
value="{{ form.username.value|default_if_none:'' }}">
</div>
<div class="form-group col-md-5">
<label for="first_name">{{form.first_name.label}}s</label>
<input type="text" class="form-control" name="first_name" id="first_name"
value="{{ form.first_name.value|default_if_none:'' }}">
</div>
<div class="form-group col-md-5">
<label for="last_name">{{form.last_name.label}}</label>
<input type="text" class="form-control" name="last_name" id="last_name"
value="{{ form.last_name.value|default_if_none:'' }}">
</div>
<div class="form-group col-md-5">
<label for="email">{{form.email.label}}</label>
<input type="email" class="form-control" name="email" id="email" value="{{ form.email.value|default_if_none:'' }}">
</div>
<div class="icheck-primary d-inline">
<input type="checkbox" id="checkboxPrimary1" name="is_active" {% if form.instance.is_active %}checked{% endif %}>
<label for="checkboxPrimary1"> Activo</label>
<p>Indica si el usuario debe ser tratado como activo. Desmarque esta opción en lugar de eliminar la cuenta.</p>
</div>
<div class="icheck-primary d-inline">
<input type="checkbox" id="checkboxPrimary2" name="is_staff" {% if form.instance.is_staff %}checked{% endif %}>
<label for="checkboxPrimary2"> Es Staff</label>
<p>Indica si el usuario puede entrar en este sitio de administración.</p>
</div>
<div class="icheck-primary d-inline">
<input type="checkbox" id="checkboxPrimary3" name="is_superuser" {% if form.instance.is_superuser %}checked{% endif %}>
<label for="checkboxPrimary3">Estado de superusuario</label>
<p>Indica que este usuario tiene todos los permisos sin asignárselos explícitamente.</p>
</div>
<select class="duallistbox form-control" multiple="multiple" name="user_permissions" id="id_user_permissions" size="30">
{% for permission in permissions %}
<option value="{{ permission.id }}" {% if permission.id in assigned_permissions_ids %}selected{% endif %}>
{{ permission.id }} - {{ permission.name }} / {{ permission.codename }}</option>
{% endfor %}
</select>
<div class="modal-footer">
<input type="submit" class="btn bg-gradient-dark btn-flat float-left" value="Guardar">
<a type="button" id="cerrarBoton" href="#" class="btn btn-secondary" data-dismiss="modal">Cerrar</a>
</div>
</form>

View File

@ -0,0 +1,73 @@
{% extends 'base.html' %}
{% block titulo %} Usuarios y Permisos {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control de Usuarios</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Usuarios</a></li>
<li class="breadcrumb-item active">Permisos</li>
<li class="breadcrumb-item active">Grupos</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="row justify-content-center">
<div class="card card-default w-80">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"> Usuarios {{info_user.username}} </h3>
<a href="{%url 'cambio_password' info_user.id %}" class="btn btn-success float-left"><i
class="fas fa-plus-square"></i> Nueva Contraseña</a>
</div>
<div class="card-body">
{% include 'usuarios/formulario_user.html' %}
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(document).ready(function () {
$('.duallistbox').bootstrapDualListbox({
filterTextClear: 'Todos',
moveAll: false,
nonSelectedListLabel: 'Permisos sin asignar',
selectedListLabel: 'Permisos asignados',
});
// Reinicializar el DualListBox después de cargar la página
$('.duallistbox').bootstrapDualListbox('refresh');
});
</script>
<script>
document.getElementById('togglePassword').addEventListener('click', function (e) {
var passwordInput = document.getElementById('password');
if (passwordInput.type === "password") {
passwordInput.type = "text";
e.target.innerHTML = '<i class="fa fa-eye-slash"></i>';
} else {
passwordInput.type = "password";
e.target.innerHTML = '<i class="fa fa-eye"></i>';
}
});
</script>
{% endblock %}

View File

@ -0,0 +1,54 @@
<form action="" method="post">
{% csrf_token %}
<div class="form-group">
<label for="username"> Nombre de Usuario</label>
<input type="text" class="form-control" name="username" id="username" placeholder="Nombre de Usuario">
{% for error in form.username.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="first_name"> Nombres</label>
<input type="text" class="form-control" name="first_name" id="first_name" placeholder="Nombres">
{% for error in form.first_name.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="last_name">Apellidos</label>
<input type="text" class="form-control" name="last_name" id="last_name" placeholder="Apellidos">
{% for error in form.last_name.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label for="password"> Contraseña</label>
<input type="password" class="form-control" name="password" id="password" placeholder="Contraseña">
{% for error in form.password.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</div>
<div class="form-group">
<label class="required" for="id_password1"> Contraseña(Confirmación)</label>
<input type="password" autocomplete="new-password" class="form-control" name="password1" id="id_password1" placeholder="Confirmación">
{% for error in form.non_field_errors %}
{% if "Las contraseñas no coinciden" in error %}
<span class="error-message">{{ error }}</span>
{% endif %}
{% endfor %}
</div>
<div class="modal-footer">
<input type="submit" class="btn bg-gradient-dark btn-flat float-left" value="Guardar">
<a type="button" href="#" class="btn btn-secondary" data-dismiss="modal">Cerrar</a>
</div>
</form>

View File

@ -0,0 +1,96 @@
{% extends 'base.html' %}
{% block titulo %} Usuarios y Permisos {% endblock %}
{% block seccion %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h5 class="m-0">Panel de Control de Usuarios</h5>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Usuarios</a></li>
<li class="breadcrumb-item active">Permisos</li>
<li class="breadcrumb-item active">Grupos</li>
</ol>
</div>
</div>
</div>
</div>
{% endblock %}
{% block contenido %}
<div class="card card-dark card-outline">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3 class="card-title m-0"> Usuarios</h3>
<a href="#" class="btn btn-success float-left" data-toggle="modal" data-target="#modalUsuario"><i
class="fas fa-plus-square"></i> Nuevo</a>
</div>
</div>
<div class="card-body">
<div class="table-responsive-lg">
<table class="table table-bordered table-striped table-hover-blue">
<thead class="table-dark">
<tr>
<th scope="col"></th>
<th scope="col">Fecha de Acceso</th>
<th scope="col">Nombre Usuario</th>
<th scope="col">Nombres</th>
<th scope="col">Apellidos</th>
<th scope="col">Correo Electronico</th>
<th scope="col">Condición</th>
<th scope="col">Ultimo Acceso</th>
<th scope="col">Acciones</th>
</tr>
</thead>
<tbody>
{% for usuarios in usuarios %}
<tr class="">
<td>{{forloop.counter}}</td>
<td>{{usuarios.date_joined|date:"d/m/Y"}}</td>
<td>{{usuarios.username}}</td>
<td>{{usuarios.first_name}}</td>
<td>{{usuarios.last_name}}</td>
<td>{{usuarios.email}}</td>
<td><input type="checkbox" name="is_staff" id="is_staff" {% if usuarios.is_staff %}checked{% endif %} data-bootstrap-switch data-off-color="danger" data-on-color="success"></td>
<td>{{usuarios.last_login|date:"d/m/Y"}}</td>
<td>
<a href="{% url 'info_user' usuarios.id %}" class="btn btn-success btn-sm"><i class="nav-icon fas fa-eye"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modalUsuario" tabindex="-1" aria-labelledby="modalTituloUsuario" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-dark ">
<h5 class="modal-title" id="modalTituloUsuario">Registrar Usuario</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% include 'usuarios/registro_formulario.html' %}
</div>
</div>
</div>
</div>
{% endblock %}

2
seajb/__init__.py Normal file
View File

@ -0,0 +1,2 @@
import pymysql
pymysql.install_as_MySQLdb()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

4
seajb/admin.py Normal file
View File

@ -0,0 +1,4 @@
from django.contrib import admin
# Register your models here.

6
seajb/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class SeajbConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'seajb'

229
seajb/forms.py Normal file
View File

@ -0,0 +1,229 @@
from django import forms
from django.forms import DateInput
from django.contrib.auth.models import User, Permission
from django.contrib.auth.forms import UserChangeForm
from .models import Brigada, Batallones, Armas, Municiones, Personas,BrigadaDigital, UnidadDigital, Abastecimiento , Producto, ProductoAbastecimiento, ArmasDePersonas, Cemanblin, Cemantar, Cemansac
class BrigadaForm(forms.ModelForm):
nombreB = forms.CharField(min_length=3, max_length=50, required=True)
class Meta:
model = Brigada
fields = ['nombreB', 'ubicacionB', 'comandante', 'telefono', 'correo']
class BatallonForm(forms.ModelForm):
nombreB = forms.CharField(min_length=3, max_length=50)
class Meta:
model = Batallones
fields = ['nombreB',
'ubicacionB',
'comandante',
'telefono',
'correo',
'primero' ]
class ArmaForm(forms.ModelForm):
calibreS = forms.CharField(required=False)
cantidadS = forms.IntegerField(required=False)
serialS = forms.CharField(required=False)
class Meta:
model = Armas
fields = ['categoria',
'tipoA',
'modeloA',
'calibreA',
'serialA',
'serialAG',
'fechaAG',
'opAM',
'cantidadA',
'cantidadC',
'segundo',
'armaS',
'calibreS',
'cantidadS',
'serialS',
'ac']
class MunicionForm(forms.ModelForm):
class Meta:
model = Municiones
fields = ['tipoM',
'serialAG',
'fechaAG',
'cantidadM',
'lote',
'tercero']
class PersonaForm(forms.ModelForm):
fechaAG = forms.DateField(widget=forms.DateInput(format='%Y-%m-%d'))
class Meta:
model = Personas
fields = ['categoria',
'grado',
'promocion',
'anio',
'unidad',
'datos',
'cedula',
'armaA',
'cargadores',
'municiones',
'serialA',
'serialAG',
'fechaAG',
'direccion',
'telefono',
'correo', 'img']
def __init__(self, *args, **kwargs):
super(PersonaForm, self).__init__(*args, **kwargs)
if self.instance and self.instance.pk:
self.fields['fechaAG'].widget.attrs['value'] = self.instance.fechaAG.strftime('%Y-%m-%d')
class ArmasDePersonasForm(forms.ModelForm):
class Meta:
model = ArmasDePersonas
fields = ['armas' , 'modelo', 'serial', 'serialag', 'fechag', 'cargadores', 'cargadores', 'municiones' , 'persona']
class BrigadaDigitalForm(forms.ModelForm):
class Meta:
model= BrigadaDigital
fields = ['nombre']
class UnidadDigitalForm(forms.ModelForm):
class Meta:
model= UnidadDigital
fields =['nombreU','descripcion','img', 'digital']
class EnviarProductoForm(forms.ModelForm):
class Meta:
model = ProductoAbastecimiento
fields = ['producto', 'abastecimiento', 'cantidad', 'serial']
class ProductoForm(forms.ModelForm):
class Meta:
model = Producto
fields = ['nombre', 'cantidad', 'descripcion', 'serial', 'modelo' , 'precio']
class AbastecimientoForm(forms.ModelForm):
class Meta:
model = Abastecimiento
fields = ['nombre']
class CemanblinForm(forms.ModelForm):
class Meta:
model = Cemanblin
fields = ['fechaE',
'reparado',
'seriales',
'descripcion',
'personauna',
'personados',
'personatres',
'equipo',
'unidad']
class CemantarForm(forms.ModelForm):
class Meta:
model = Cemantar
fields = ['fechaE',
'reparado',
'seriales',
'descripcion',
'personauna',
'personados',
'personatres',
'equipo',
'unidad']
class CemansacForm(forms.ModelForm):
class Meta:
model = Cemansac
fields = ['fechaE',
'reparado',
'seriales',
'descripcion',
'personauna',
'personados',
'personatres',
'equipo',
'unidad']
class EditUserForm(forms.ModelForm):
class Meta:
model = User
fields = ['username', 'email', 'first_name', 'last_name', 'is_active', 'is_staff', 'is_superuser' ,'user_permissions' ]
exclude = ('user_permissions',)
class RegisterForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
password1 = forms.CharField(widget=forms.PasswordInput)
first_name = forms.CharField(max_length=100, label='Nombre')
last_name= forms.CharField(max_length=100,label="Apellido")
class Meta:
model = User
fields = ['username','first_name', 'last_name', 'password', 'password1']
def clean(self):
cleaned_data = super().clean()
password = cleaned_data.get("password")
password1 = cleaned_data.get("password1")
if password and password1 and password != password1:
raise forms.ValidationError("Las contraseñas no coinciden")
class CambioForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
password1 = forms.CharField(widget=forms.PasswordInput)
class Meta:
model = User
fields = ['password', 'password1']
def clean(self):
cleaned_data = super().clean()
password = cleaned_data.get("password")
password1 = cleaned_data.get("password1")
if password and password1 and password != password1:
raise forms.ValidationError("Las contraseñas no coinciden")
class RegistroForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
password_confirmation = forms.CharField(widget=forms.PasswordInput)
is_active = forms.BooleanField(required=False, initial=True)
is_superuser = forms.BooleanField(required=False, initial=True)
is_staff = forms.BooleanField(required=False, initial=True)
class Meta:
model = User
fields = ['username', 'email','is_active', 'is_staff', 'is_superuser' ,'password', 'password_confirmation']
def clean(self):
cleaned_data = super().clean()
password = cleaned_data.get("password")
password_confirmation = cleaned_data.get("password_confirmation")
if password and password_confirmation and password != password_confirmation:
raise forms.ValidationError("Las contraseñas no coinciden")
def clean_checkbox(self):
is_active = self.cleaned_data.get('checkbox')
# Convert 'on' to True, and any other value to False
return is_active == 'on'

View File

@ -0,0 +1,235 @@
# Generated by Django 5.0.3 on 2024-05-27 18:44
import django.core.validators
import django.db.models.deletion
import seajb.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Abastecimiento',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nombre', models.CharField(max_length=255, verbose_name='Punto de Abastecimiento')),
],
),
migrations.CreateModel(
name='Batallones',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nombreB', models.CharField(max_length=100, verbose_name='Unidad')),
('ubicacionB', models.CharField(max_length=100, verbose_name='Ubicacion')),
('comandante', models.CharField(max_length=100, verbose_name='Comandante')),
('telefono', models.CharField(max_length=100, verbose_name='Telefono')),
('correo', models.CharField(max_length=100, verbose_name='Correo Electronico')),
('fecha', models.DateField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='Brigada',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(max_length=100, unique=True)),
('nombreB', models.CharField(max_length=100, verbose_name='Brigada')),
('ubicacionB', models.CharField(max_length=100, verbose_name='Ubicacion')),
('comandante', models.CharField(max_length=100, verbose_name='Comandante')),
('telefono', models.CharField(max_length=100, verbose_name='Telefono')),
('correo', models.CharField(max_length=100, verbose_name='Correo Electronico')),
('fecha', models.DateField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='BrigadaDigital',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nombre', models.CharField(max_length=200, verbose_name='Nombre')),
('fecha_entrada', models.DateField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='Cemanblin',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(max_length=200, unique=True)),
('unidad', models.CharField(max_length=300, verbose_name='Nombre de la Unidad')),
('equipo', models.TextField(null=True, verbose_name='Equipo')),
('fechaR', models.DateField(auto_now_add=True)),
('fechaE', models.DateField(verbose_name='Fecha de Entrega')),
('reparado', models.BooleanField(default=False)),
('seriales', models.TextField(blank=True, null=True)),
('descripcion', models.TextField(blank=True, null=True)),
('personauna', models.CharField(max_length=300, verbose_name='Personas a Firmar')),
('personados', models.CharField(max_length=300)),
('personatres', models.CharField(max_length=300)),
],
),
migrations.CreateModel(
name='Cemansac',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(max_length=200, unique=True)),
('unidad', models.CharField(max_length=300, verbose_name='Nombre de la Unidad')),
('equipo', models.TextField(null=True, verbose_name='Equipo')),
('fechaR', models.DateField(auto_now_add=True)),
('fechaE', models.DateField(verbose_name='Fecha de Entrega')),
('reparado', models.BooleanField(default=False)),
('seriales', models.TextField(blank=True, null=True)),
('descripcion', models.TextField(blank=True, null=True)),
('personauna', models.CharField(max_length=300, verbose_name='Personas a Firmar')),
('personados', models.CharField(max_length=300)),
('personatres', models.CharField(max_length=300)),
],
),
migrations.CreateModel(
name='Cemantar',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(max_length=200, unique=True)),
('unidad', models.CharField(max_length=300, verbose_name='Nombre de la Unidad')),
('equipo', models.TextField(null=True, verbose_name='Equipo')),
('fechaR', models.DateField(auto_now_add=True)),
('fechaE', models.DateField(verbose_name='Fecha de Entrega')),
('reparado', models.BooleanField(default=False)),
('seriales', models.TextField(blank=True, null=True)),
('descripcion', models.TextField(blank=True, null=True)),
('personauna', models.CharField(max_length=300, verbose_name='Personas a Firmar')),
('personados', models.CharField(max_length=300)),
('personatres', models.CharField(max_length=300)),
],
),
migrations.CreateModel(
name='Personas',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(max_length=300, unique=True)),
('categoria', models.CharField(max_length=300, verbose_name='Categoria:')),
('grado', models.CharField(max_length=100, verbose_name='Grado:')),
('promocion', models.TextField(null=True, verbose_name='Promoción:')),
('anio', models.IntegerField(validators=[seajb.models.validate_year], verbose_name='Año:')),
('unidad', models.TextField(null=True, verbose_name='Unidad:')),
('datos', models.CharField(max_length=300, verbose_name='Nombres y Apellidos:')),
('cedula', models.CharField(max_length=100, verbose_name='Cedula')),
('armaA', models.TextField(null=True, verbose_name='Arma de Asignada:')),
('cargadores', models.IntegerField(validators=[django.core.validators.MinValueValidator(1)], verbose_name='Cargadores:')),
('municiones', models.IntegerField(validators=[django.core.validators.MinValueValidator(1)], verbose_name='Carga Basica:')),
('serialA', models.CharField(max_length=100, verbose_name='Serial del Arma')),
('serialAG', models.CharField(max_length=100, verbose_name='Serial de Asignacion')),
('fechaAG', models.DateField(null=True, verbose_name='Fecha de Asignacion')),
('direccion', models.TextField(null=True, verbose_name='Dirección')),
('telefono', models.CharField(max_length=100, verbose_name='Telefono')),
('correo', models.CharField(max_length=100, verbose_name='Correo Electronico')),
('img', models.ImageField(blank=True, default='/imagenes/nohay.jpg', null=True, upload_to='imagenes/', verbose_name='Imagen')),
('fecha', models.DateField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='Producto',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(max_length=200, unique=True)),
('nombre', models.CharField(max_length=300, verbose_name='Producto:')),
('serial', models.TextField(null=True, verbose_name='Serial')),
('modelo', models.CharField(max_length=500, verbose_name='Modelo')),
('descripcion', models.TextField(null=True, verbose_name='Descripción')),
('fecha_entrada', models.DateField(auto_now_add=True)),
('cantidad', models.IntegerField(default=0)),
('precio', models.DecimalField(decimal_places=2, default=0.0, max_digits=6)),
],
),
migrations.CreateModel(
name='Armas',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('categoria', models.CharField(max_length=300, verbose_name='Categoria:')),
('tipoA', models.CharField(max_length=300, verbose_name='Tipo de Armas:')),
('modeloA', models.CharField(max_length=300, verbose_name='Modelo de la Armas:')),
('calibreA', models.CharField(max_length=300, verbose_name='Calibre de la Armas:')),
('serialA', models.CharField(max_length=8000, verbose_name='Serial de la Armas:')),
('serialAG', models.CharField(max_length=300, verbose_name='Serial del Asignación:')),
('fechaAG', models.DateField(verbose_name='Fecha de Asignación:')),
('opAM', models.CharField(max_length=300, verbose_name='Condiciones:')),
('cantidadA', models.IntegerField(verbose_name='Armas:')),
('cantidadC', models.IntegerField(verbose_name='Cargadores:')),
('ac', models.TextField(null=True, verbose_name='Accesorio:')),
('armaS', models.CharField(max_length=300, verbose_name='Arma Segundaria:')),
('calibreS', models.TextField(default=None, null=True, verbose_name='Tipo,Modelo,Calibre:')),
('serialS', models.TextField(blank=True, default=None, null=True, verbose_name='Serial Segundario:')),
('cantidadS', models.IntegerField(blank=True, default=None, null=True, verbose_name='Cantidad Segundario:')),
('fecha', models.DateField(auto_now_add=True)),
('segundo', models.ForeignKey(blank=True, default=None, on_delete=django.db.models.deletion.CASCADE, to='seajb.batallones')),
],
options={
'verbose_name_plural': 'Armas',
'ordering': ['categoria'],
},
),
migrations.AddField(
model_name='batallones',
name='primero',
field=models.ForeignKey(blank=True, default=None, on_delete=django.db.models.deletion.CASCADE, to='seajb.brigada'),
),
migrations.CreateModel(
name='Municiones',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tipoM', models.CharField(max_length=100, verbose_name='Carga Basica')),
('serialAG', models.CharField(max_length=100, verbose_name='Serial Asignado')),
('fechaAG', models.DateField(verbose_name='Fecha de Asignación')),
('cantidadM', models.CharField(max_length=100, verbose_name='Cantidad')),
('lote', models.CharField(max_length=100, verbose_name='Lote N°')),
('fecha', models.DateField(auto_now_add=True)),
('tercero', models.ForeignKey(blank=True, default=None, on_delete=django.db.models.deletion.CASCADE, to='seajb.batallones')),
],
),
migrations.CreateModel(
name='ArmasDePersonas',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('armas', models.CharField(max_length=200, verbose_name='Armas Nuevas')),
('modelo', models.CharField(max_length=200, verbose_name='Modelo')),
('serial', models.CharField(max_length=200, verbose_name='Serial')),
('serialag', models.CharField(max_length=200, verbose_name='Serial de Asignación')),
('fechag', models.CharField(max_length=200, verbose_name='Fecha')),
('cargadores', models.CharField(max_length=200, verbose_name='Cargadores')),
('municiones', models.CharField(max_length=200, verbose_name='Munciones')),
('persona', models.ForeignKey(blank=True, default=None, on_delete=django.db.models.deletion.CASCADE, to='seajb.personas')),
],
),
migrations.CreateModel(
name='ProductoAbastecimiento',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('movimiento', models.CharField(max_length=200)),
('serial', models.TextField(null=True, verbose_name='serial')),
('fecha_salida', models.DateField(auto_now_add=True)),
('cantidad', models.IntegerField(default=0)),
('precio', models.DecimalField(decimal_places=2, max_digits=6)),
('abastecimiento', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seajb.abastecimiento')),
('producto', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seajb.producto')),
],
),
migrations.AddField(
model_name='abastecimiento',
name='productos',
field=models.ManyToManyField(through='seajb.ProductoAbastecimiento', to='seajb.producto'),
),
migrations.CreateModel(
name='UnidadDigital',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nombreU', models.CharField(max_length=100, verbose_name='Unidad')),
('descripcion', models.TextField(null=True, verbose_name='Descripcion')),
('img', models.ImageField(null=True, upload_to='imagenes/', verbose_name='Imagen')),
('fecha_entrada', models.DateField(auto_now_add=True)),
('digital', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seajb.brigadadigital')),
],
),
]

View File

Binary file not shown.

316
seajb/models.py Normal file
View File

@ -0,0 +1,316 @@
from django.db import models
from django.utils import timezone
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
import random
# aqui va las tablas de Brigadas, Batallones y Unidades, Armas de las base de datos del saejb
class Brigada(models.Model):
code = models.CharField(max_length=100, unique=True)
nombreB = models.CharField(max_length=100, verbose_name='Brigada')
ubicacionB = models.CharField(max_length=100, verbose_name='Ubicacion')
comandante = models.CharField(max_length=100, verbose_name='Comandante')
telefono = models.CharField(max_length=100, verbose_name='Telefono')
correo = models.CharField(max_length=100, verbose_name='Correo Electronico')
fecha = models.DateField(auto_now_add=True)
def save(self, *args, **kwargs):
if not self.code:
self.code = self.generate_unique_code()
super().save(*args, **kwargs)
@staticmethod
def generate_unique_code():
prefix = 'SAEJB'
suffix = ''.join(str(random.randint(0, 9)) for _ in range(6))
return f'{prefix}{suffix}'
def __str__(self):
fila ="Brigada:" + self.nombreB + "_" + "Ubicación:" + self.ubicacionB + "_" + "Comandante:" + self.comandante + "_" + "Telefono:" + self.telefono + "_" + "Correo Electronico:" + self.correo
return fila
class Batallones(models.Model):
nombreB = models.CharField(max_length=100, verbose_name='Unidad')
ubicacionB = models.CharField(max_length=100, verbose_name='Ubicacion')
comandante = models.CharField(max_length=100, verbose_name='Comandante')
telefono = models.CharField(max_length=100, verbose_name='Telefono')
correo = models.CharField(max_length=100, verbose_name='Correo Electronico')
fecha = models.DateField(auto_now_add=True)
primero = models.ForeignKey(Brigada, on_delete=models.CASCADE, blank=True, default=None)
def __str__(self):
return self.nombreB, self.ubicacionB, self.comandante, self.telefono, self.correo, self.primero
class Armas(models.Model):
categoria = models.CharField(max_length=300, verbose_name='Categoria:')
tipoA = models.CharField(max_length=300, verbose_name='Tipo de Armas:')
modeloA = models.CharField(max_length=300, verbose_name='Modelo de la Armas:')
calibreA = models.CharField(max_length=300, verbose_name='Calibre de la Armas:')
serialA = models.CharField(max_length=8000, verbose_name='Serial de la Armas:')
serialAG = models.CharField(max_length=300, verbose_name='Serial del Asignación:')
fechaAG = models.DateField(verbose_name='Fecha de Asignación:')
opAM = models.CharField(max_length=300, verbose_name='Condiciones:')
cantidadA = models.IntegerField(verbose_name='Armas:')
cantidadC = models.IntegerField(verbose_name='Cargadores:')
ac = models.TextField(verbose_name="Accesorio:",null=True)
armaS = models.CharField(max_length=300, verbose_name='Arma Segundaria:')
calibreS = models.TextField(verbose_name='Tipo,Modelo,Calibre:', null=True, default=None)
serialS = models.TextField(verbose_name='Serial Segundario:', null=True, blank=True, default=None)
cantidadS = models.IntegerField(verbose_name='Cantidad Segundario:', null=True, blank=True, default=None)
fecha = models.DateField(auto_now_add=True)
segundo = models.ForeignKey(Batallones, on_delete=models.CASCADE, blank=True, default=None)
class Meta:
verbose_name_plural = "Armas"
ordering = ['categoria']
def __str__(self):
return f"{self.categoria} - {self.tipoA} - {self.modeloA} - {self.calibreA}- {self.serialA} - {self.serialAG}- {self.opAM} - {self.cantidadA}- {self.cantidadC} - {self.armaS} - {self.calibreS} - {self.serialS} - {self.cantidadS}- {self.ac}"
class Municiones(models.Model):
tipoM = models.CharField(max_length=100, verbose_name='Carga Basica')
serialAG = models.CharField(max_length=100, verbose_name='Serial Asignado')
fechaAG = models.DateField(verbose_name='Fecha de Asignación')
cantidadM = models.CharField(max_length=100, verbose_name='Cantidad')
lote = models.CharField(max_length=100, verbose_name='Lote N°')
fecha = models.DateField(auto_now_add=True)
tercero = models.ForeignKey(Batallones, on_delete=models.CASCADE, blank=True, default=None)
def __str__(self):
return self.tipoM, self.serialAG, self.fechaAG, self.cantidadM, self.lote, self.tercero
# aqui va las tablas de Personal con Armamento de las base de datos del saejb
def validate_year(value):
if value < 1 or value > 9999:
raise ValidationError("El año debe estar entre 1 y 9999.")
class Personas(models.Model):
code = models.CharField(max_length=300, unique=True)
categoria= models.CharField(max_length=300, verbose_name='Categoria:')
grado = models.CharField(max_length=100, verbose_name='Grado:')
promocion = models.TextField(null=True, verbose_name='Promoción:')
anio = models.IntegerField(validators=[validate_year], verbose_name="Año:")
unidad = models.TextField(null=True, verbose_name='Unidad:')
datos = models.CharField(max_length=300, verbose_name='Nombres y Apellidos:')
cedula = models.CharField(max_length=100, verbose_name='Cedula')
armaA = models.TextField(null=True, verbose_name='Arma de Asignada:')
cargadores = models.IntegerField(validators=[MinValueValidator(1)], verbose_name="Cargadores:")
municiones = models.IntegerField(validators=[MinValueValidator(1)], verbose_name="Carga Basica:")
serialA = models.CharField(max_length=100, verbose_name='Serial del Arma')
serialAG = models.CharField(max_length=100, verbose_name='Serial de Asignacion')
fechaAG = models.DateField(null=True, verbose_name='Fecha de Asignacion')
direccion = models.TextField(null=True, verbose_name='Dirección')
telefono = models.CharField(max_length=100, verbose_name='Telefono')
correo = models.CharField(max_length=100, verbose_name='Correo Electronico')
img = models.ImageField(upload_to='imagenes/',verbose_name="Imagen", null=True, blank=True, default='/imagenes/nohay.jpg')
fecha = models.DateField(auto_now_add=True)
def save(self, *args, **kwargs):
if not self.code:
self.code = self.generar_unico_codigo()
super().save(*args, **kwargs)
@staticmethod
def generar_unico_codigo():
prefix = 'SAPRS'
suffix = ''.join(str(random.randint(0, 9)) for _ in range(6))
return f'{prefix}{suffix}'
def delete(self, using=None, keep_parents=False):
self.img.storage.delete(self.img.name)
super().delete()
def __str__(self):
return (self.categoria,
self.grado,
self.promocion,
self.anio,
self.unidad,
self.datos,
self.cedula,
self.armaA,
self.cargadores,
self.municiones,
self.serialA,
self.serialAG,
self.fechaAG,
self.direccion,
self.telefono,
self.correo)
class ArmasDePersonas(models.Model):
armas = models.CharField(max_length=200, verbose_name="Armas Nuevas")
modelo = models.CharField(max_length=200, verbose_name="Modelo")
serial = models.CharField(max_length=200, verbose_name="Serial")
serialag = models.CharField(max_length=200, verbose_name="Serial de Asignación")
fechag = models.CharField(max_length=200, verbose_name="Fecha")
cargadores = models.CharField(max_length=200, verbose_name="Cargadores")
municiones = models.CharField(max_length=200, verbose_name="Munciones")
persona = models.ForeignKey(Personas, on_delete=models.CASCADE, blank=True, default=None)
def __str__(self):
return self.armas, self.modelo,self.serial,self.serialag,self.fechag,self.cargadores,self.municiones
# aqui digitalizacion de documentos antiguos saejb
class BrigadaDigital(models.Model):
nombre = models.CharField(max_length=200, verbose_name="Nombre")
fecha_entrada = models.DateField(auto_now_add=True)
def __str__(self):
return self.nombre
class UnidadDigital(models.Model):
nombreU = models.CharField(max_length=100 , verbose_name="Unidad")
descripcion = models.TextField(verbose_name="Descripcion",null=True)
img = models.ImageField(upload_to='imagenes/',verbose_name="Imagen", null=True)
fecha_entrada = models.DateField(auto_now_add=True)
digital = models.ForeignKey(BrigadaDigital, on_delete=models.CASCADE)
def __str__(self):
return self.nombreU, self.descripcion
def delete(self, using=None, keep_parents=False):
self.img.storage.delete(self.img.name)
super().delete()
# INVENTARIO saejb
class Producto(models.Model):
code = models.CharField(max_length=200, unique=True)
nombre = models.CharField(max_length=300, verbose_name="Producto:")
serial = models.TextField(null=True, verbose_name='Serial')
modelo = models.CharField(max_length=500, verbose_name='Modelo')
descripcion = models.TextField(verbose_name="Descripción", null=True)
fecha_entrada = models.DateField(auto_now_add=True)
cantidad = models.IntegerField(default=0)
precio = models.DecimalField(max_digits=6, decimal_places=2, default=0.0)
def save(self, *args, **kwargs):
if not self.code:
self.code = self.generar_unico_producto()
super().save(*args, **kwargs)
@staticmethod
def generar_unico_producto():
prefix = 'SAPRO'
suffix = ''.join(str(random.randint(0, 9)) for _ in range(6))
return f'{prefix}{suffix}'
def __str__(self):
return self.nombre, self.cantidad, self.descripcion, self.serial, self.modelo
def total(self):
return self.cantidad * self.precio
class Abastecimiento(models.Model):
nombre = models.CharField(max_length=255, verbose_name='Punto de Abastecimiento')
productos = models.ManyToManyField(Producto, through='ProductoAbastecimiento')
def __str__(self):
return self.nombre
class ProductoAbastecimiento(models.Model):
movimiento = models.CharField(max_length=200)
serial = models.TextField(verbose_name="serial", null=True)
producto = models.ForeignKey(Producto, on_delete=models.CASCADE)
abastecimiento = models.ForeignKey(Abastecimiento, on_delete=models.CASCADE)
fecha_salida = models.DateField(auto_now_add=True)
cantidad = models.IntegerField(default=0)
precio = models.DecimalField(max_digits=6, decimal_places=2)
def __str__(self):
return f'{self.producto.nombre} - {self.producto.precio} - {self.producto.serial}'
def total(self):
return self.cantidad * self.precio
class Cemanblin(models.Model):
code = models.CharField(max_length=200, unique=True)
unidad = models.CharField(max_length=300, verbose_name='Nombre de la Unidad')
equipo = models.TextField(verbose_name='Equipo', null=True)
fechaR = models.DateField(auto_now_add=True)
fechaE = models.DateField(verbose_name='Fecha de Entrega')
reparado = models.BooleanField(default=False)
seriales = models.TextField(null=True, blank=True)
descripcion = models.TextField(blank=True, null=True)
personauna = models.CharField(max_length=300, verbose_name='Personas a Firmar')
personados = models.CharField(max_length=300)
personatres = models.CharField(max_length=300)
def save(self, *args, **kwargs):
if not self.code:
self.code = self.generate_unique_code()
super().save(*args, **kwargs)
@staticmethod
def generate_unique_code():
prefix = 'CBLIN'
while True:
suffix = ''.join(str(random.randint(0, 9)) for _ in range(6))
code = f'{prefix}{suffix}'
if not Cemanblin.objects.filter(code=code).exists():
return code
def __str__(self):
return f"{self.unidad}, {self.fechaE}, {self.reparado}, {self.seriales}, {self.descripcion}, {self.personauna}, {self.personados}, {self.personatres}, {self.equipo}"
class Cemantar(models.Model):
code = models.CharField(max_length=200, unique=True)
unidad = models.CharField(max_length=300, verbose_name='Nombre de la Unidad')
equipo = models.TextField(verbose_name='Equipo', null=True)
fechaR = models.DateField(auto_now_add=True)
fechaE = models.DateField(verbose_name='Fecha de Entrega')
reparado = models.BooleanField(default=False)
seriales = models.TextField(null=True, blank=True)
descripcion = models.TextField(blank=True, null=True)
personauna = models.CharField(max_length=300, verbose_name='Personas a Firmar')
personados = models.CharField(max_length=300)
personatres = models.CharField(max_length=300)
def save(self, *args, **kwargs):
if not self.code:
self.code = self.generate_unique_code()
super().save(*args, **kwargs)
@staticmethod
def generate_unique_code():
prefix = 'CMANT'
while True:
suffix = ''.join(str(random.randint(0, 9)) for _ in range(6))
code = f'{prefix}{suffix}'
if not Cemanblin.objects.filter(code=code).exists():
return code
def __str__(self):
return f"{self.unidad}, {self.fechaE}, {self.reparado}, {self.seriales}, {self.descripcion}, {self.personauna}, {self.personados}, {self.personatres}, {self.equipo}"
class Cemansac(models.Model):
code = models.CharField(max_length=200, unique=True)
unidad = models.CharField(max_length=300, verbose_name='Nombre de la Unidad')
equipo = models.TextField(verbose_name='Equipo', null=True)
fechaR = models.DateField(auto_now_add=True)
fechaE = models.DateField(verbose_name='Fecha de Entrega')
reparado = models.BooleanField(default=False)
seriales = models.TextField(null=True, blank=True)
descripcion = models.TextField(blank=True, null=True)
personauna = models.CharField(max_length=300, verbose_name='Personas a Firmar')
personados = models.CharField(max_length=300)
personatres = models.CharField(max_length=300)
def save(self, *args, **kwargs):
if not self.code:
self.code = self.generate_unique_code()
super().save(*args, **kwargs)
@staticmethod
def generate_unique_code():
prefix = 'CMASC'
while True:
suffix = ''.join(str(random.randint(0, 9)) for _ in range(6))
code = f'{prefix}{suffix}'
if not Cemanblin.objects.filter(code=code).exists():
return code
def __str__(self):
return f"{self.unidad}, {self.fechaE}, {self.reparado}, {self.seriales}, {self.descripcion}, {self.personauna}, {self.personados}, {self.personatres}, {self.equipo}"

3
seajb/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

69
seajb/urls.py Normal file
View File

@ -0,0 +1,69 @@
from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
#vista principal de las brigadas, eliminar, editar y ver unidades
path("", views.servicio, name="servicio"),
path("servicio/editar/<int:brigada_id>", views.editar, name="editar"),
path("eliminar/<int:id>", views.eliminar, name="eliminar"),
path("servicio/resumen/<int:resumen_id>", views.resumen, name="resumen"),
#aqui la ruta de los batallones o unidades que tienen armas y municiones
path("batallon/info/<int:unidad_id>", views.info, name="infor"),
path("batallon/batallon_edit/<int:unidad_id>", views.batallon_edit, name="batallon_edit"),
path("batallon/batallon_armas_edit/<int:arma_id>", views.armas_edit, name="edit_armas"),
path("batallon/batallon_municion_edit/<int:municion_id>", views.municion_edit, name="edit_municion"),
# aqui son las rutas de las vistas de personas
path("personas/persona_index", views.persona_index, name="personas"),
path("personas/persona_informacion/<int:persona_id>", views.persona_informacion, name="informacion"),
path("persona/personas_editar/<int:personas_id>", views.personas_editar, name="personas_editar"),
# todos los documento generados
path("pdf/pdf_uno", views.pdf_uno, name="pdf_uno"),
path("pdf/pdf_dos/<int:pdf_id>", views.pdf_dos, name="pdf_dos"),
path("pdf/pdf_tres/<int:pdf_id>", views.pdf_tres, name="pdf_tres"),
path("pdf/pdf_cuatro/<int:pdf_id>", views.pdf_cuatro, name="pdf_cuatro"),
path("pdf/pdf_cinco/<int:pdf_id>", views.pdf_cinco, name="pdf_cinco"),
path("pdf/pdf_sexto/<int:id>", views.pdf_sexto, name="pdf_sexto"),
path("pdf/sextimo/<int:id>", views.pdf_sextimo, name="pdf_sextimo"),
path("pdf/ocho", views.pdf_ocho, name="pdf_ocho"),
#inventario
path("inventario/inventario_index", views.inventario_index, name="inventario"),
path("inventario/inventario_enviar", views.inventario_enviar, name="envio"),
path("inventario/inventario_edit/<int:in_id>", views.inventario_edit, name="edit_in"),
path("delete/<int:id>", views.delete, name="delete"),
path("abastecimiento/abas_index", views.abastecimiento, name="abastecimiento"),
path("abastecimiento/abas_info/<int:punto_id>", views.abas_info, name="info"),
# rutas de digitalización
path('digital/digital_index', views.digital_index, name='digital'),
path('digital/digital_edit/<int:digital_id>', views.digital_edit, name='digital_edit'),
path("suprimir/<int:id>", views.suprimir, name="suprimir"),
path('digital/digital_info/<int:digital_id>', views.digital_info, name='infodig'),
path('digital/digital_info_edit/<int:digital_id>', views.edit_info, name='edit_info'),
# rutas de los centros
path('centros/cemantar_index', views.cemantar, name='cemantar'),
path('centros/cemansac_index', views.cemansac, name='cemansac'),
path('centros/cemanblin_index', views.cemanblin, name='cemanblin'),
#rutas de usuario
#path('usuarios/permisos',views.permisos,name ='permisos'),
path('usuarios/tabla_user',views.usuarios,name ='usuarios'),
path('usuarios/info_user/<int:user_id>',views.info_user,name ='info_user'),
path('usuarios/cambio_password/<int:id>',views.cambio_password,name ='cambio_password'),
path('registration/registro',views.registro, name ='registro'),
#login
path('logout/', views.exit, name='exit'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

3
seajb/validators.py Normal file
View File

@ -0,0 +1,3 @@
from django.forms import ValidationError

833
seajb/views.py Normal file
View File

@ -0,0 +1,833 @@
import io, sweetify, os ,logging, tempfile
from django.contrib.auth.decorators import login_required
from io import BytesIO
from django.db.models import Q
from django.utils import timezone
from datetime import datetime
from django.conf import settings
from django.template.loader import get_template
from django.contrib.staticfiles import finders
from xhtml2pdf import pisa
from django.core.paginator import Paginator
from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from django.template.loader import render_to_string
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect, FileResponse, HttpRequest
from .models import Brigada, Batallones, Armas, Municiones, Personas, BrigadaDigital, UnidadDigital, Abastecimiento, Producto,ProductoAbastecimiento, ArmasDePersonas, Cemanblin, Cemantar, Cemansac
from .forms import BrigadaForm, BatallonForm, ArmaForm, MunicionForm, PersonaForm, BrigadaDigitalForm, UnidadDigitalForm, EnviarProductoForm, ProductoForm, AbastecimientoForm, ArmasDePersonasForm, CemanblinForm, CemantarForm, CemansacForm
# tabla principal editar , eliminar y crear brigadas
@login_required
def servicio(request):
servicio = Brigada.objects.all()
if request.method == 'POST':
formularios = BrigadaForm(request.POST or None)
if formularios.is_valid():
formularios.save()
messages.success(request, 'El Registro de la Brigada se efectuo con Exito')
return redirect('servicio')
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
else:
formularios = BrigadaForm()
context = {'servicios':servicio , 'formulario': formularios}
return render(request, 'servicio/index.html', context)
@login_required
def editar(request,brigada_id):
elemento = Brigada.objects.get(id=brigada_id)
if request.method == 'POST':
form = BrigadaForm(request.POST or None , instance=elemento)
if form.is_valid():
form.save()
messages.success(request, 'Se edito la Brigada con Exito')
return redirect('servicio')
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
form = BrigadaForm(instance=elemento)
context = {'formulario': form}
return render(request, 'servicio/editar.html', context)
@login_required
def eliminar(request, id):
try:
registro = Brigada.objects.get(id=id)
registro.delete()
messages.success(request, "Registro eliminado correctamente.")
except Brigada.DoesNotExist:
messages.error(request, 'Algo Salio Mal')
return redirect('servicio')
# cada brigada tiene unidades que a su vez tienen armamento y municiones pueden ver y editar
# aqui con este codigo muestra el resumen completo de la brigada y puede crear unidades de esas brigada de acuerdo a su id agregado
@login_required
def resumen(request, resumen_id):
try:
primero = Brigada.objects.get(id=resumen_id)
except Brigada.DoesNotExist:
messages.error(request, "La Brigada no existe")
return redirect('servicio')
servicio = Batallones.objects.filter(primero=primero)
if request.method == 'POST':
formularios = BatallonForm(request.POST)
if formularios.is_valid():
nueva_compania = formularios.save()
messages.success(request, "Se registró la Unidad correctamente")
return redirect('resumen', resumen_id=nueva_compania.primero.id)
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
else:
formularios = BatallonForm()
context = {'servicios': servicio,'primero': primero,'formulario': formularios,}
return render(request, 'servicio/resumen.html', context)
@login_required
def batallon_edit(request, unidad_id):
elemento = Batallones.objects.get(id=unidad_id)
primero = Brigada.objects.get(id=elemento.primero.id)
if request.method == 'POST':
formularios = BatallonForm(request.POST, instance=elemento)
if formularios.is_valid():
nueva_compania = formularios.save()
messages.success(request, 'Se edito la Unidad con Exito')
return redirect('resumen', resumen_id=nueva_compania.primero.id)
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
formularios = BatallonForm(instance=elemento)
context = {'formulario': formularios, 'primero': primero}
return render(request, 'batallon/batallon_edit.html', context)
# este codigo puede usted ver la informacion completa de las unidades y registrar armas y municiones
# tambien ver la tabla completa de las armas y municiones registradas que dependen de esa unidad que a su vez depende de una brigada
@login_required
def info(request, unidad_id):
try:
batallon = Batallones.objects.get(id=unidad_id)
except ObjectDoesNotExist:
messages.error(request, "Batallón no encontrado")
return redirect('servicio')
servicio = Armas.objects.filter(segundo=batallon)
municiones = Municiones.objects.filter(tercero=batallon)
if request.method == 'POST':
formulario_armas = ArmaForm(request.POST)
formulario_municion = MunicionForm(request.POST)
if formulario_armas.is_valid():
nueva_compania = formulario_armas.save()
messages.success(request, "Se registró el Arma correctamente")
return redirect('infor', unidad_id=nueva_compania.segundo.id)
if formulario_municion.is_valid():
nueva_compania = formulario_municion.save()
messages.success(request, "Se registró la Munición correctamente")
return redirect('infor', unidad_id=nueva_compania.tercero.id)
messages.error(request, 'Faltaron campos por rellenar en los Formularios')
else:
formulario_armas = ArmaForm()
formulario_municion = MunicionForm()
context = {
'batallon': batallon,
'servicio': servicio,
'municiones': municiones,
'formulario_armas': formulario_armas,
'formulario_municion': formulario_municion,
}
return render(request, 'batallon/info.html', context)
@login_required
def armas_edit(request, arma_id):
elemento = Armas.objects.get(id=arma_id)
segundo = Batallones.objects.get(id=elemento.segundo.id)
if request.method == 'POST':
formulario_armas = ArmaForm(request.POST, instance=elemento)
if formulario_armas.is_valid():
nueva_comapania = formulario_armas.save()
messages.success(request, 'Se edito el Formulario de Armamento con Exito')
return redirect('infor', unidad_id=nueva_comapania.segundo.id)
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
else:
formulario_armas = ArmaForm(instance=elemento)
context = {'formulario_armas': formulario_armas, 'batallon': segundo}
return render(request,'batallon/batallon_armas_edit.html', context)
@login_required
def municion_edit(request, municion_id):
elemento = Municiones.objects.get(id=municion_id)
tercero = Batallones.objects.get(id=elemento.tercero.id)
if request.method == 'POST':
formulario_municion = MunicionForm(request.POST, instance=elemento)
if formulario_municion.is_valid():
nueva_comapania = formulario_municion.save()
messages.success(request, 'Se edito el Formulario de Munición con Exito')
return redirect('infor', unidad_id=nueva_comapania.tercero.id)
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
else:
formulario_municion = MunicionForm(instance=elemento)
context = {'formulario_municion':formulario_municion, 'batallon':tercero}
return render(request, 'batallon/batallon_municion_edit.html',context)
# tabla principal, crear, editar y eliminar personas
@login_required
def persona_index(request):
personas = Personas.objects.all()
if request.method == 'POST':
formularios = PersonaForm(request.POST or None, request.FILES or None)
if formularios.is_valid():
formularios.save()
if 'img' in request.FILES:
formularios.instance.img = request.FILES['img']
messages.success(request, "Se registro la Persona correctamente")
return redirect('personas')
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
else:
formularios = PersonaForm()
context = {'personas':personas, 'formulario': formularios}
return render(request, 'personas/persona_index.html', context)
@login_required
def personas_editar(request,personas_id):
personas = Personas.objects.get(id=personas_id)
if request.method == 'POST':
formularios = PersonaForm(request.POST or None, request.FILES or None, instance=personas)
if formularios.is_valid():
formularios.save()
messages.success(request, "Se editó la Persona correctamente")
return redirect('personas')
else:
messages.error(request, 'Que paso algo esta Mal, revisa')
else:
formularios = PersonaForm(instance=personas)
context = {'formulario':formularios, 'personas':personas}
return render(request, 'personas/personas_editar.html', context)
@login_required
def persona_informacion(request, persona_id):
person = Personas.objects.get(pk=persona_id)
armas = ArmasDePersonas.objects.filter(persona=person)
if request.method == 'POST':
formularios = ArmasDePersonasForm(request.POST)
if formularios.is_valid():
formularios.save()
messages.success(request, "Se registró nuevo armamento asignado correctamente")
return redirect('informacion', persona_id=person.id)
else:
messages.error(request, 'Revisa el Formulario algo salio mal')
else:
formularios = ArmasDePersonasForm()
context = {'person': person, 'armas': armas, 'formulario': formularios}
return render(request, 'personas/persona_informacion.html', context)
# digitalización
@login_required
def digital_index(request):
digitales = BrigadaDigital.objects.all()
if request.method == 'POST':
formularios = BrigadaDigitalForm(request.POST or None)
if formularios.is_valid():
formularios.save()
messages.success(request, "Se Registro Correctamente")
return redirect('digital')
else:
messages.error(request, 'Revisa el Formulario algo salio mal')
else:
formularios = BrigadaDigitalForm()
context = {'digitales': digitales, 'formularios': formularios}
return render(request, 'digital/digital_index.html', context)
#editar cada opcion de la lista de digitalizaciones
@login_required
def digital_edit(request, digital_id):
digital = BrigadaDigital.objects.get(pk=digital_id)
if request.method == 'POST':
formularios = BrigadaDigitalForm(request.POST, instance=digital)
if formularios.is_valid():
formularios.save()
messages.info(request, "Los Datos se actualizaron Correctamente")
return redirect('digital')
else:
messages.error(request, 'No se pudo Actualizar los Datos')
else:
formularios = BrigadaDigitalForm(instance=digital)
context = {"digital": digital , 'formularios':formularios}
return render(request,'digital/digital_edit.html',context)
def suprimir(request, id):
try:
digital = BrigadaDigital.objects.get(id=id)
digital.delete()
messages.success(request, "Se Elimino Correctamente")
return redirect('digital')
except:
messages.error(request, "No se pudo Eliminar")
return redirect('digital')
@login_required
def digital_info(request, digital_id):
digital = BrigadaDigital.objects.filter(id=digital_id)
digitales = UnidadDigital.objects.filter(digital=digital_id)
if request.method == 'POST':
formularios = UnidadDigitalForm(request.POST, request.FILES)
if formularios.is_valid():
nuevo = formularios.save()
id = nuevo.digital.id
messages.success(request, "Se Registro Correctamente")
return redirect('infodig', digital_id=id)
else:
messages.error(request, 'Revisa el Formulario algo salio mal')
else:
formularios = UnidadDigitalForm()
context = {'digital': digital, 'digito': digitales, 'formulario': formularios}
return render(request, 'digital/digital_info.html', context)
@login_required
def edit_info(request, digital_id):
try:
digital = BrigadaDigital.objects.filter(id=digital_id)
except BrigadaDigital.DoesNotExist:
messages.error(request, 'BrigadaDigital no existe')
return redirect('digital')
digitales = UnidadDigital.objects.get(id=digital_id)
if request.method == 'POST':
formularios = UnidadDigitalForm(request.POST, request.FILES, instance=digitales)
if formularios.is_valid():
formularios.save()
messages.info(request, "Los Datos se actualizaron Correctamente")
return redirect('infodig', digital_id=digitales.id)
else:
messages.error(request, 'No se pudo Actualizar los Datos')
else:
formularios = UnidadDigitalForm(instance=digitales)
context = {"digital": digital , 'digitales':digitales , 'formularios':formularios}
return render(request,'digital/digital_info_edit.html',context)
#INVENTARIO
@login_required
def inventario_index(request):
inventario = Producto.objects.all()
if request.method == 'POST':
formularios = ProductoForm(request.POST)
if formularios.is_valid():
formularios.save()
messages.success(request, "Se registro el inventario correctamente")
return redirect('inventario')
else:
messages.error(request, 'Revisa el Formulario algo salio mal')
else:
formularios = ProductoForm()
context = {'inventario':inventario, 'formulario':formularios}
return render(request, 'inventario/inventario_index.html', context)
@login_required
def inventario_edit(request, in_id):
inventario = Producto.objects.get(id=in_id)
if request.method == 'POST':
formularios = ProductoForm(request.POST or None , instance=inventario)
if formularios.is_valid():
formularios.save()
messages.success(request, 'Se edito el Inventario con Exito')
return redirect('inventario')
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
else:
formularios = ProductoForm(instance=inventario)
context = {'formulario': formularios}
return render(request, 'inventario/inventario_edit.html', context)
@login_required
def delete(request, id):
try:
registro = Producto.objects.get(id=id)
registro.delete()
messages.success(request, "Registro eliminado correctamente.")
except Producto.DoesNotExist:
messages.error(request, 'Algo Salio Mal', timer=8000)
return redirect('inventario')
@login_required
def inventario_enviar(request):
producto = Producto.objects.all()
punto = Abastecimiento.objects.all()
if request.method == 'POST':
formularios = EnviarProductoForm(request.POST)
if formularios.is_valid():
producto_obj = formularios.cleaned_data['producto']
abastecimiento = formularios.cleaned_data['abastecimiento']
cantidad = formularios.cleaned_data['cantidad']
serial = formularios.cleaned_data['serial']
if producto_obj.cantidad >= cantidad:
producto_obj.cantidad -= cantidad
producto_obj.save()
ProductoAbastecimiento.objects.create(
producto=producto_obj,
abastecimiento=abastecimiento,
cantidad=cantidad,
serial=serial,
precio=producto_obj.precio,
movimiento=producto_obj.nombre)
messages.success(request, 'Se envió el paquete correctamente para el punto de abastecimiento')
return redirect('inventario')
else:
messages.error(request, 'No hay suficientes unidades')
return redirect('inventario')
else:
formularios = EnviarProductoForm()
context = {'formulario': formularios, 'producto': producto, 'punto': punto}
return render(request, 'inventario/inventario_enviar.html', context)
@login_required
def abastecimiento(request):
abasto = Abastecimiento.objects.all()
if request.method == 'POST':
formularios = AbastecimientoForm(request.POST)
if formularios.is_valid():
formularios.save()
messages.success(request, "Se registró el abastecimiento correctamente")
return redirect('abastecimiento')
else:
messages.error(request, 'Revisa el Formulario algo salio mal')
else:
formularios = AbastecimientoForm()
context = {'abasto': abasto, 'formulario': formularios}
return render(request, 'abastecimiento/abas_index.html', context)
@login_required
def abas_info(request, punto_id):
try:
abastecimiento = Abastecimiento.objects.get(id=punto_id)
except Abastecimiento.DoesNotExist:
return render(request, 'abastecimiento')
producto = ProductoAbastecimiento.objects.filter(abastecimiento=abastecimiento)
context = {'producto': producto}
return render(request, 'abastecimiento/abas_info.html', context)
# PDF IMPRIMIR REPORTES TODOS LOS PDf del MODULO DE PERSONAS, Y BRIGADAS,UNIDADES, MUNICIONES Y ARMAS
@login_required
def pdf_uno(request):
try:
year = request.GET.get('year', None)
fecha = datetime.now().date()
img_uno = settings.STATIC_ROOT + '/imagenes/imagen.png'
img_dos = settings.STATIC_ROOT + '/imagenes/dos.png'
prueba = Personas.objects.filter(anio=year)
template = get_template('pdf/pdf_uno.html')
context = {
'prueba': prueba,
'year':year,
'fecha':fecha,
'img_uno':img_uno,
'img_dos':img_dos
}
html = template.render(context)
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename="report.pdf"'
pisa_status = pisa.CreatePDF(html, dest=response)
if pisa_status.err:
messages.error(request, 'Error al generar el PDF', extra_tags='alert-danger')
return redirect('personas')
return response
except:
return redirect('personas')
@login_required
def pdf_dos(request, pdf_id):
try:
person = Personas.objects.get(pk=pdf_id)
armas = ArmasDePersonas.objects.filter(persona=person)
fecha = datetime.now().date()
img_uno = settings.STATIC_ROOT + '/imagenes/imagen.png'
img_dos = settings.STATIC_ROOT + '/imagenes/dos.png'
template = get_template('pdf/pdf_dos.html')
context = {'person': person,
'armas': armas,
'fecha':fecha,
'img_uno':img_uno,
'img_dos':img_dos
}
html = template.render(context)
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = f'attachment; filename="reporte.pdf"'
pisa_status = pisa.CreatePDF(html, dest=response)
if pisa_status.err:
messages.error(request, 'Error al generar el PDF', extra_tags='alert-danger')
return redirect('servicio')
return response
except Personas.DoesNotExist:
messages.error(request, 'Persona no encontrada')
return redirect('personas')
@login_required
def pdf_tres(request, pdf_id):
try:
fecha = datetime.now().date()
img_uno = settings.STATIC_ROOT + '/imagenes/imagen.png'
img_dos = settings.STATIC_ROOT + '/imagenes/dos.png'
brigada = Brigada.objects.get(batallones=pdf_id)
batallones =Batallones.objects.get(id=pdf_id)
armas = Armas.objects.filter(segundo=batallones)
template = get_template('pdf/pdf_tres.html')
context = {
'brigada':brigada,
'batallones':batallones,
'armas':armas,
'fecha':fecha,
'img_uno':img_uno,
'img_dos':img_dos
}
html = template.render(context)
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = f'attachment; filename="reporte.pdf"'
pisa_status = pisa.CreatePDF(html, dest=response)
if pisa_status.err:
messages.error(request, 'Error al generar el PDF', extra_tags='alert-danger')
return redirect('servicio')
return response
except Brigada.DoesNotExist:
messages.error(request, 'PDF de Brigada no Encontrada')
return redirect('servicio')
except Batallones.DoesNotExist:
messages.error(request, 'PDF de Batallones no Encontrada')
return redirect('servicio')
except Armas.DoesNotExist:
messages.error(request, 'PDF de Armas no Encontrada')
return redirect('servicio')
@login_required
def pdf_cuatro(request, pdf_id):
try:
fecha = datetime.now().date()
img_uno = settings.STATIC_ROOT + '/imagenes/imagen.png'
img_dos = settings.STATIC_ROOT + '/imagenes/dos.png'
brigada = Brigada.objects.get(batallones=pdf_id)
batallones =Batallones.objects.get(id=pdf_id)
municion = Municiones.objects.filter(tercero=batallones)
template = get_template('pdf/pdf_cuatro.html')
context = {
'brigada':brigada,
'batallones':batallones,
'municion':municion,
'fecha':fecha,
'img_uno':img_uno,
'img_dos':img_dos
}
html = template.render(context)
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = f'attachment; filename="reporte.pdf"'
pisa_status = pisa.CreatePDF(html, dest=response)
if pisa_status.err:
messages.error(request, 'Error al generar el PDF', extra_tags='alert-danger')
return redirect('servicio')
return response
except Brigada.DoesNotExist:
messages.error(request, 'PDF de Brigada no Encontrada')
return redirect('servicio')
except Batallones.DoesNotExist:
messages.error(request, 'PDF de Batallones no Encontrada')
return redirect('servicio')
except Municiones.DoesNotExist:
messages.error(request, 'PDF de Municion no Encontrada')
return redirect('servicio')
@login_required
def pdf_cinco(request, pdf_id):
try:
fecha = datetime.now().date()
img_uno = settings.STATIC_ROOT + '/imagenes/imagen.png'
img_dos = settings.STATIC_ROOT + '/imagenes/dos.png'
armas = Armas.objects.get(pk=pdf_id)
person = Batallones.objects.filter(armas=armas)
codigo = Brigada.objects.get(batallones__armas=armas)
template = get_template('pdf/pdf_cinco.html')
context = {'armas': armas ,
'person':person,
'img_uno':img_uno,
'img_dos':img_dos,
'fecha':fecha,
'codigo':codigo
}
html = template.render(context)
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = f'attachment; filename="reporte.pdf"'
pisa_status = pisa.CreatePDF(html, dest=response)
if pisa_status.err:
messages.error(request, 'Error al generar el PDF', extra_tags='alert-danger')
return redirect('servicio')
return response
except Armas.DoesNotExist:
sweetify.error(request, 'PDF de Armas no Encontrada', timer=8000)
return redirect('servicio')
except Brigada.DoesNotExist:
sweetify.error(request, 'PDF de Brigada no Encontrada', timer=8000)
return redirect('servicio')
@login_required
def pdf_sexto(request, id):
try:
fecha = datetime.now().date()
img_uno = settings.STATIC_ROOT + '/imagenes/imagen.png'
img_dos = settings.STATIC_ROOT + '/imagenes/dos.png'
municiones = Municiones.objects.get(id=id)
batallones = Batallones.objects.filter(municiones=municiones)
brigada = Brigada.objects.get(batallones__municiones = municiones)
template = 'pdf/pdf_sexto.html'
context = {
'batallones':batallones,
'municiones':municiones,
'brigada':brigada,
'img_uno':img_uno,
'img_dos':img_dos,
'fecha':fecha,
}
template = get_template(template)
html = template.render(context)
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = f'attachment; filename="reporte.pdf"'
pisa_status = pisa.CreatePDF(html, dest=response)
if pisa_status.err:
messages.error(request, 'Error al generar el PDF')
return HttpResponse('We had some errors <pre>' + html + '</pre>')
return response
except Municiones.DoesNotExist:
messages.error(request, 'PDF de Municiones no Encontrada')
return redirect('servicio')
except Batallones.DoesNotExist:
messages.error(request, 'PDF de Batallones no Encontrada')
return redirect('servicio')
except Brigada.DoesNotExist:
messages.error(request, 'PDF de Brigada no Encontrada')
return redirect('servicio')
def pdf_sextimo(request, id):
try:
fecha = datetime.now().date()
img_uno = settings.STATIC_ROOT + '/imagenes/imagen.png'
img_dos = settings.STATIC_ROOT + '/imagenes/dos.png'
producto = Producto.objects.get(id=id)
template = get_template('pdf/pdf_sextimo.html')
context ={
'producto':producto,
'img_uno':img_uno,
'img_dos':img_dos,
'fecha':fecha,
}
html = template.render(context)
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = f'attachment: filename="reporte.pdf'
pisa_status = pisa.CreatePDF(html, dest=response)
if pisa_status.err:
messages.error(request, 'Error al generar el PDF')
return redirect('inventario')
return response
except Producto.DoesNotExist:
messages.error(request, 'PDF del Producto no Encontrado')
return redirect('inventario')
def pdf_ocho(request):
try:
fecha = datetime.now().date()
img_uno = settings.STATIC_ROOT + '/imagenes/imagen.png'
img_dos = settings.STATIC_ROOT + '/imagenes/dos.png'
producto = Producto.objects.all()
template = get_template('pdf/pdf_ocho.html')
context ={
'producto':producto,
'img_uno':img_uno,
'img_dos':img_dos,
'fecha':fecha,
}
html = template.render(context)
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = f'attachment: filename="reporte.pdf'
pisa_status = pisa.CreatePDF(html, dest=response)
if pisa_status.err:
messages.error(request, 'Error al generar el PDF', timer=8000)
return redirect('inventario')
return response
except Producto.DoesNotExist:
messages.error(request, 'PDF de la Lista de Producto no Encontrado', timer=8000)
return redirect('inventario')
# AQUI ESTAN LOS CENTROS DE REPARACIONES
@login_required
def cemantar(request):
cemantar = Cemantar.objects.all()
if request.method == 'POST':
formulario_cemantar = CemantarForm(request.POST)
if formulario_cemantar.is_valid():
formulario_cemantar.save()
messages.success(request, 'El Registro del Equipo Cemantar se efectuó con Éxito')
return redirect('cemantar')
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
else:
formulario_cemantar = CemantarForm()
context = {'cemantar': cemantar, 'formulario_cemantar': formulario_cemantar}
return render(request, 'centros/cemantar_index.html', context)
@login_required
def cemansac(request):
cemansac = Cemansac.objects.all()
if request.method == 'POST':
formulario_cemansac = CemansacForm(request.POST)
if formulario_cemansac.is_valid():
formulario_cemansac.save()
messages.success(request, 'El Registro del Equipo Cemansac se efectuó con Éxito')
return redirect('cemansac')
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
else:
formulario_cemansac = CemansacForm()
context = {'cemansac': cemansac, 'formulario_cemansac': formulario_cemansac}
return render(request, 'centros/cemansac_index.html', context)
@login_required
def cemanblin(request):
cemanblin = Cemanblin.objects.all()
if request.method == 'POST':
formulario_cemanblin = CemanblinForm(request.POST)
if formulario_cemanblin.is_valid():
formulario_cemanblin.save()
messages.success(request, 'El Registro del Equipo Cemanblin se efectuó con Éxito')
return redirect('cemanblin')
else:
messages.error(request, 'Faltaron campos por rellenar en el Formulario')
else:
formulario_cemanblin = CemanblinForm()
context = {'cemanblin': cemanblin, 'formulario_cemanblin': formulario_cemanblin}
return render(request, 'centros/cemanblin_index.html', context)
# USUARIOS Y RESGISTROS Y PERMISOS
from django.contrib.auth.models import User, Permission
from django.contrib.auth import logout
from .forms import EditUserForm, RegisterForm, CambioForm, RegistroForm
@login_required
def exit(request):
if request.session.is_empty():
messages.error(request, "Su sesión ha expirado. Por favor, inicie sesión nuevamente para continuar.")
logout(request)
return redirect(reverse('login'))
@login_required
def usuarios(request):
usuarios = User.objects.all()
if request.method == 'POST':
form = RegisterForm(request.POST)
if form.is_valid():
user = form.save(commit=False)
user.set_password(form.cleaned_data['password'])
user.save()
messages.success(request, 'Se Registro Usuario con Éxito')
return redirect('usuarios')
else:
messages.error(request, 'Faltan Campos por Rellenar o la Contraseña no Coinciden')
else:
form = RegisterForm()
context = {'usuarios': usuarios, 'form': form}
return render(request, 'usuarios/tabla_user.html', context)
@login_required
def info_user(request, user_id):
info_user = User.objects.get(id=user_id)
permissions = Permission.objects.all()
assigned_permissions_ids = info_user.user_permissions.values_list('id', flat=True)
if request.method == 'POST':
form = EditUserForm(request.POST, instance=info_user)
if form.is_valid():
form.save()
selected_permissions_ids = request.POST.getlist('user_permissions')
selected_permissions = Permission.objects.filter(id__in=selected_permissions_ids)
info_user.user_permissions.set(selected_permissions)
messages.success(request, 'Se Actualizo con Éxito')
return redirect('usuarios')
else:
messages.error(request, 'Faltaron campos 2 por rellenar en el Formulario')
else:
form = EditUserForm(instance=info_user)
context = {'info_user': info_user, 'permissions': permissions, 'form': form, 'assigned_permissions_ids': assigned_permissions_ids}
return render(request, 'usuarios/info_user.html', context)
@login_required
def cambio_password(request, id):
cambio = User.objects.get(id=id)
print(id)
if request.method == 'POST':
formulario_cambio = CambioForm(request.POST, instance=cambio)
if formulario_cambio.is_valid():
user = formulario_cambio.save(commit=False)
user.set_password(formulario_cambio.cleaned_data['password'])
user.save()
messages.success(request, "Contraseña Cambiada Correctamente")
return redirect('info_user', user_id=cambio.id)
else:
messages.error(request, 'Las Contrasenas no Coinciden o no cumplen las normas de seguridad')
else:
formulario_cambio = CambioForm(instance=cambio)
return render(request, 'usuarios/cambio_password.html', {'formulario_cambio': formulario_cambio , 'cambio':cambio})
def registro(request):
registro_super = User.objects.all()
if request.method == 'POST':
form = RegistroForm(request.POST)
if form.is_valid():
# Obtener los datos del formulario
password = form.cleaned_data.get('password')
password_confirmation = request.POST.get('password_confirmation')
is_active = request.POST.get('is_active', False)
is_staff = request.POST.get('is_staff', False)
# Validar que las contraseñas coincidan
if password != password_confirmation:
form.add_error('password', 'Las contraseñas no coinciden')
else:
# Crear el usuario
user = form.save(commit=False) # No guardar aún
user.set_password(password) # Establecer la contraseña
user.save() # Ahora sí guardar el usuario
return redirect('login')
else:
form = RegistroForm()
context = {'form': form, 'registro_super': registro_super}
return render(request, 'registration/registro.html', context)

0
sistema/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

16
sistema/asgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
ASGI config for sistema project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sistema.settings')
application = get_asgi_application()

154
sistema/settings.py Normal file
View File

@ -0,0 +1,154 @@
"""
Django settings for sistema project.
Generated by 'django-admin startproject' using Django 4.2.6.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-77dy70cm#9jggc=**fi30=tkvso8%2fr7ql(p2v-@)pn+fd9k0'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
MESSAGE_STORAGE = "django.contrib.messages.storage.cookie.CookieStorage"
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'seajb',
'adminlte3',
'reportlab',
'sweetify',
'wkhtmltopdf',
'xhtml2pdf',
]
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django_session_timeout.middleware.SessionTimeoutMiddleware",
]
ROOT_URLCONF = 'sistema.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'sistema.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'saejb',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '3306',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES'",
},
},
}
# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
LANGUAGE_CODE = 'es'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
MEDIA_URL = '/imagenes/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
LOGIN_REDIRECT_URL = '/'
SESSION_EXPIRE_SECONDS = 200 # Expire después de 5 minutos
SESSION_EXPIRE_AFTER_LAST_ACTIVITY = True
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

24
sistema/urls.py Normal file
View File

@ -0,0 +1,24 @@
"""
URL configuration for sistema project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("", include("seajb.urls")),
path('accounts/', include('django.contrib.auth.urls')),
path('admin/', admin.site.urls),
]

16
sistema/wsgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
WSGI config for sistema project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sistema.settings')
application = get_wsgi_application()

View File

@ -0,0 +1,15 @@
{
"env": {
"browser": false,
"node": true
},
"parserOptions": {
"sourceType": "script"
},
"extends": "../../.eslintrc.json",
"rules": {
"no-console": "off",
"strict": "error",
"unicorn/prefer-module": "off"
}
}

View File

@ -0,0 +1,14 @@
'use strict'
module.exports = {
map: {
inline: false,
annotation: true,
sourcesContent: true
},
plugins: [
require('autoprefixer')({
cascade: false
})
]
}

View File

@ -0,0 +1,32 @@
'use strict'
const { babel } = require('@rollup/plugin-babel')
const pkg = require('../../package')
const year = new Date().getFullYear()
const banner = `/*!
* AdminLTE v${pkg.version} (${pkg.homepage})
* Copyright 2014-${year} ${pkg.author}
* Licensed under MIT (https://github.com/ColorlibHQ/AdminLTE/blob/master/LICENSE)
*/`
module.exports = {
input: 'build/js/AdminLTE.js',
output: {
banner,
file: 'dist/js/adminlte.js',
format: 'umd',
globals: {
jquery: 'jQuery'
},
name: 'adminlte'
},
external: ['jquery'],
plugins: [
babel({
exclude: 'node_modules/**',
// Include the helpers in the bundle, at most one copy of each
babelHelpers: 'bundled'
})
]
}

View File

@ -0,0 +1,33 @@
import CardRefresh from './CardRefresh'
import CardWidget from './CardWidget'
import ControlSidebar from './ControlSidebar'
import DirectChat from './DirectChat'
import Dropdown from './Dropdown'
import ExpandableTable from './ExpandableTable'
import Fullscreen from './Fullscreen'
import IFrame from './IFrame'
import Layout from './Layout'
import PushMenu from './PushMenu'
import SidebarSearch from './SidebarSearch'
import NavbarSearch from './NavbarSearch'
import Toasts from './Toasts'
import TodoList from './TodoList'
import Treeview from './Treeview'
export {
CardRefresh,
CardWidget,
ControlSidebar,
DirectChat,
Dropdown,
ExpandableTable,
Fullscreen,
IFrame,
Layout,
PushMenu,
SidebarSearch,
NavbarSearch,
Toasts,
TodoList,
Treeview
}

View File

@ -0,0 +1,166 @@
/**
* --------------------------------------------
* AdminLTE CardRefresh.js
* License MIT
* --------------------------------------------
*/
import $ from 'jquery'
/**
* Constants
* ====================================================
*/
const NAME = 'CardRefresh'
const DATA_KEY = 'lte.cardrefresh'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
const EVENT_LOADED = `loaded${EVENT_KEY}`
const EVENT_OVERLAY_ADDED = `overlay.added${EVENT_KEY}`
const EVENT_OVERLAY_REMOVED = `overlay.removed${EVENT_KEY}`
const CLASS_NAME_CARD = 'card'
const SELECTOR_CARD = `.${CLASS_NAME_CARD}`
const SELECTOR_DATA_REFRESH = '[data-card-widget="card-refresh"]'
const Default = {
source: '',
sourceSelector: '',
params: {},
trigger: SELECTOR_DATA_REFRESH,
content: '.card-body',
loadInContent: true,
loadOnInit: true,
loadErrorTemplate: true,
responseType: '',
overlayTemplate: '<div class="overlay"><i class="fas fa-2x fa-sync-alt fa-spin"></i></div>',
errorTemplate: '<span class="text-danger"></span>',
onLoadStart() {},
onLoadDone(response) {
return response
},
onLoadFail(_jqXHR, _textStatus, _errorThrown) {}
}
class CardRefresh {
constructor(element, settings) {
this._element = element
this._parent = element.parents(SELECTOR_CARD).first()
this._settings = $.extend({}, Default, settings)
this._overlay = $(this._settings.overlayTemplate)
if (element.hasClass(CLASS_NAME_CARD)) {
this._parent = element
}
if (this._settings.source === '') {
throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.')
}
}
load() {
this._addOverlay()
this._settings.onLoadStart.call($(this))
$.get(this._settings.source, this._settings.params, response => {
if (this._settings.loadInContent) {
if (this._settings.sourceSelector !== '') {
response = $(response).find(this._settings.sourceSelector).html()
}
this._parent.find(this._settings.content).html(response)
}
this._settings.onLoadDone.call($(this), response)
this._removeOverlay()
}, this._settings.responseType !== '' && this._settings.responseType)
.fail((jqXHR, textStatus, errorThrown) => {
this._removeOverlay()
if (this._settings.loadErrorTemplate) {
const msg = $(this._settings.errorTemplate).text(errorThrown)
this._parent.find(this._settings.content).empty().append(msg)
}
this._settings.onLoadFail.call($(this), jqXHR, textStatus, errorThrown)
})
$(this._element).trigger($.Event(EVENT_LOADED))
}
_addOverlay() {
this._parent.append(this._overlay)
$(this._element).trigger($.Event(EVENT_OVERLAY_ADDED))
}
_removeOverlay() {
this._parent.find(this._overlay).remove()
$(this._element).trigger($.Event(EVENT_OVERLAY_REMOVED))
}
// Private
_init() {
$(this).find(this._settings.trigger).on('click', () => {
this.load()
})
if (this._settings.loadOnInit) {
this.load()
}
}
// Static
static _jQueryInterface(config) {
let data = $(this).data(DATA_KEY)
const _options = $.extend({}, Default, $(this).data())
if (!data) {
data = new CardRefresh($(this), _options)
$(this).data(DATA_KEY, typeof config === 'string' ? data : config)
}
if (typeof config === 'string' && /load/.test(config)) {
data[config]()
} else {
data._init($(this))
}
}
}
/**
* Data API
* ====================================================
*/
$(document).on('click', SELECTOR_DATA_REFRESH, function (event) {
if (event) {
event.preventDefault()
}
CardRefresh._jQueryInterface.call($(this), 'load')
})
$(() => {
$(SELECTOR_DATA_REFRESH).each(function () {
CardRefresh._jQueryInterface.call($(this))
})
})
/**
* jQuery API
* ====================================================
*/
$.fn[NAME] = CardRefresh._jQueryInterface
$.fn[NAME].Constructor = CardRefresh
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT
return CardRefresh._jQueryInterface
}
export default CardRefresh

Some files were not shown because too many files have changed in this diff Show More