add new
This commit is contained in:
63
RS_system/Views/Ubicaciones/Create.cshtml
Normal file
63
RS_system/Views/Ubicaciones/Create.cshtml
Normal file
@@ -0,0 +1,63 @@
|
||||
@model Rs_system.Models.Ubicacion
|
||||
@{
|
||||
ViewData["Title"] = "Nueva Ubicación";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Nueva Ubicación</h4>
|
||||
<p class="text-muted mb-0">Registrar un nuevo lugar de almacenamiento</p>
|
||||
</div>
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> Volver
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="card-custom" style="max-width: 800px; margin: 0 auto;">
|
||||
<div class="card-body">
|
||||
<form asp-action="Create" method="post">
|
||||
<div asp-validation-summary="ModelOnly" class="alert alert-danger"></div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="Nombre" class="form-label">Nombre <span class="text-danger">*</span></label>
|
||||
<input asp-for="Nombre" class="form-control" placeholder="Ej: Bodega Central, Auditorio, Oficina Pastoral" autofocus />
|
||||
<span asp-validation-for="Nombre" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="Descripcion" class="form-label">Descripción</label>
|
||||
<textarea asp-for="Descripcion" class="form-control" rows="2" placeholder="Detalles sobre la ubicación (opcional)"></textarea>
|
||||
<span asp-validation-for="Descripcion" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="Responsable" class="form-label">Responsable</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi-person"></i></span>
|
||||
<input asp-for="Responsable" class="form-control" placeholder="Nombre de la persona encargada" />
|
||||
</div>
|
||||
<div class="form-text">Persona a cargo de esta ubicación (opcional).</div>
|
||||
<span asp-validation-for="Responsable" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input asp-for="Activo" class="form-check-input" type="checkbox" role="switch" checked />
|
||||
<label asp-for="Activo" class="form-check-label">Ubicación Activa</label>
|
||||
</div>
|
||||
<div class="form-text">Si está inactiva, no se podrá asignar a nuevos artículos.</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end gap-2 mt-4">
|
||||
<a asp-action="Index" class="btn btn-secondary">Cancelar</a>
|
||||
<button type="submit" class="btn btn-primary-custom">
|
||||
<i class="bi bi-save me-1"></i> Guardar
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
||||
64
RS_system/Views/Ubicaciones/Edit.cshtml
Normal file
64
RS_system/Views/Ubicaciones/Edit.cshtml
Normal file
@@ -0,0 +1,64 @@
|
||||
@model Rs_system.Models.Ubicacion
|
||||
@{
|
||||
ViewData["Title"] = "Editar Ubicación";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Editar Ubicación</h4>
|
||||
<p class="text-muted mb-0">Modificar información del lugar</p>
|
||||
</div>
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> Volver
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="card-custom" style="max-width: 800px; margin: 0 auto;">
|
||||
<div class="card-body">
|
||||
<form asp-action="Edit" method="post">
|
||||
<input type="hidden" asp-for="Id" />
|
||||
<div asp-validation-summary="ModelOnly" class="alert alert-danger"></div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="Nombre" class="form-label">Nombre <span class="text-danger">*</span></label>
|
||||
<input asp-for="Nombre" class="form-control" placeholder="Ej: Bodega Central, Auditorio" />
|
||||
<span asp-validation-for="Nombre" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="Descripcion" class="form-label">Descripción</label>
|
||||
<textarea asp-for="Descripcion" class="form-control" rows="2" placeholder="Detalles sobre la ubicación (opcional)"></textarea>
|
||||
<span asp-validation-for="Descripcion" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="Responsable" class="form-label">Responsable</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi-person"></i></span>
|
||||
<input asp-for="Responsable" class="form-control" placeholder="Nombre de la persona encargada" />
|
||||
</div>
|
||||
<div class="form-text">Persona a cargo de esta ubicación (opcional).</div>
|
||||
<span asp-validation-for="Responsable" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input asp-for="Activo" class="form-check-input" type="checkbox" role="switch" />
|
||||
<label asp-for="Activo" class="form-check-label">Ubicación Activa</label>
|
||||
</div>
|
||||
<div class="form-text">Si está inactiva, no se podrá asignar a nuevos artículos.</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end gap-2 mt-4">
|
||||
<a asp-action="Index" class="btn btn-secondary">Cancelar</a>
|
||||
<button type="submit" class="btn btn-primary-custom">
|
||||
<i class="bi bi-save me-1"></i> Guardar Cambios
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
||||
131
RS_system/Views/Ubicaciones/Index.cshtml
Normal file
131
RS_system/Views/Ubicaciones/Index.cshtml
Normal file
@@ -0,0 +1,131 @@
|
||||
@model IEnumerable<Rs_system.Models.Ubicacion>
|
||||
@{
|
||||
ViewData["Title"] = "Ubicaciones de Inventario";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Ubicaciones de Inventario</h4>
|
||||
<p class="text-muted mb-0">Gestión de lugares físicos de almacenamiento</p>
|
||||
</div>
|
||||
<a asp-action="Create" class="btn btn-primary-custom">
|
||||
<i class="bi bi-plus-lg me-1"></i> Nueva Ubicación
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="card-custom">
|
||||
<div class="table-responsive">
|
||||
<table class="table-custom">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nombre</th>
|
||||
<th>Descripción</th>
|
||||
<th>Responsable</th>
|
||||
<th class="text-center">Estado</th>
|
||||
<th class="text-center">Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (!Model.Any())
|
||||
{
|
||||
<tr>
|
||||
<td colspan="5" class="text-center text-muted py-4">
|
||||
<i class="bi bi-geo-alt fs-1 d-block mb-2"></i>
|
||||
No hay ubicaciones registradas
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<strong>@item.Nombre</strong>
|
||||
</td>
|
||||
<td>
|
||||
@if (!string.IsNullOrEmpty(item.Descripcion))
|
||||
{
|
||||
<span>@item.Descripcion</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-muted">-</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (!string.IsNullOrEmpty(item.Responsable))
|
||||
{
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="bi bi-person-circle me-2 text-muted"></i>
|
||||
<span>@item.Responsable</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-muted">-</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (item.Activo)
|
||||
{
|
||||
<span class="badge bg-success">Activo</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="badge bg-secondary">Inactivo</span>
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a asp-action="Edit" asp-route-id="@item.Id" class="btn btn-sm btn-outline-secondary" title="Editar">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger" onclick="confirmDelete(@item.Id)" title="Eliminar">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delete Form -->
|
||||
<form id="deleteForm" asp-action="Delete" method="post" style="display: none;">
|
||||
<input type="hidden" name="id" id="deleteId" />
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
function confirmDelete(id) {
|
||||
Swal.fire({
|
||||
title: '¿Eliminar ubicación?',
|
||||
text: 'Esta acción archivará la ubicación.',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#6c757d',
|
||||
confirmButtonText: 'Sí, eliminar',
|
||||
cancelButtonText: 'Cancelar'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
document.getElementById('deleteId').value = id;
|
||||
document.getElementById('deleteForm').submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Show success/error messages
|
||||
@if (TempData["SuccessMessage"] != null)
|
||||
{
|
||||
<text>
|
||||
toastr.success('@TempData["SuccessMessage"]');
|
||||
</text>
|
||||
}
|
||||
@if (TempData["ErrorMessage"] != null)
|
||||
{
|
||||
<text>
|
||||
toastr.error('@TempData["ErrorMessage"]');
|
||||
</text>
|
||||
}
|
||||
</script>
|
||||
}
|
||||
Reference in New Issue
Block a user