Catalogos de Contenido
git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C121
This commit is contained in:
parent
00101861ef
commit
b52dc13461
5 changed files with 312 additions and 1 deletions
|
|
@ -7675,6 +7675,7 @@
|
|||
<Content Include="Scripts\umd\popper.min.js" />
|
||||
<Content Include="Scripts\_references.js" />
|
||||
<Content Include="Sinort-Scripts\Aplicacion.js" />
|
||||
<Content Include="Sinort-Scripts\Contenido.js" />
|
||||
<Content Include="Sinort-Scripts\EmisorPN.js" />
|
||||
<Content Include="Sinort-Scripts\Global.js" />
|
||||
<Content Include="Sinort-Scripts\Mantenimientos.js" />
|
||||
|
|
@ -7719,6 +7720,7 @@
|
|||
<Content Include="Views\PropuestaNormativa\DetallePropuesta.cshtml" />
|
||||
<Content Include="Views\PopUp\_Catalogo.cshtml" />
|
||||
<Content Include="Views\Catalogos\Usuario.cshtml" />
|
||||
<Content Include="Views\Catalogos\Contenido.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
|
|
|||
|
|
@ -35,7 +35,11 @@ namespace AYA.SlnSinort.Controllers.Catalogos
|
|||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Contenido()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
200
AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Contenido.js
Normal file
200
AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Contenido.js
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
var DataCatalogo;
|
||||
var id_column = 1;
|
||||
var Item = {};
|
||||
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
getDataModel();
|
||||
|
||||
});
|
||||
|
||||
this.getDataModel = function () {
|
||||
|
||||
$('#txtDescripcion').attr('size', 50);
|
||||
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
|
||||
|
||||
$('#btnLimpiarControles').click(function () {
|
||||
LimpiarControles();
|
||||
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
});
|
||||
|
||||
$('#btnGuardar').click(function () {
|
||||
ActualizarItem();
|
||||
});
|
||||
|
||||
$('#btnInsertar').click(function () {
|
||||
InsertarItem();
|
||||
});
|
||||
|
||||
|
||||
$('#TableItems').TableInit(0, false, true, true, false, null, null);
|
||||
ObtenerContenido();
|
||||
|
||||
}
|
||||
|
||||
this.CargarGridContenido = function (data) {
|
||||
|
||||
var TableItems = $('#TableItems').DataTable();
|
||||
var lista = data;
|
||||
|
||||
$.each(lista, function (key, item) {
|
||||
|
||||
var option = $("#ucItemsCatalogo").html();
|
||||
|
||||
option = replaceAll("[$CodItem]", item.IdContenido, option);
|
||||
|
||||
var stateIcon = $("#ucItemsIcon").html();
|
||||
|
||||
if (item.Estado == false) {
|
||||
stateIcon = replaceAll("[$icon]", "fa-check-circle", stateIcon);
|
||||
stateIcon = replaceAll("[$state_color]", "muted", stateIcon);
|
||||
|
||||
option = replaceAll("[$opcion]", "Habilitar", option);
|
||||
option = replaceAll("[$icon]", "fa-check", option);
|
||||
option = replaceAll("[$value]", "1", option);
|
||||
}
|
||||
else {
|
||||
stateIcon = replaceAll("[$icon]", "fa-check-circle", stateIcon);
|
||||
stateIcon = replaceAll("[$state_color]", "success", stateIcon);
|
||||
|
||||
option = replaceAll("[$opcion]", "Deshabilitar", option);
|
||||
option = replaceAll("[$icon]", "fa-times", option);
|
||||
option = replaceAll("[$value]", "0", option);
|
||||
}
|
||||
TableItems.column(1).visible(false);
|
||||
TableItems.row.add([stateIcon,
|
||||
item.IdContenido,
|
||||
item.Descripcion,
|
||||
option]).draw();
|
||||
|
||||
});
|
||||
|
||||
ENDREQUEST();
|
||||
}
|
||||
|
||||
this.ObtenerContenido = function () {
|
||||
|
||||
var uri = CatalogosWCF + '/api/ObtenerContenido';
|
||||
AjaxPostData(uri, null, false, false, CargarGridContenido, null, null);
|
||||
|
||||
}
|
||||
|
||||
this.EditarItem = function (id) {
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
LimpiarControles();
|
||||
var indexes = getRowIndex(TableItems, id_column, id);
|
||||
|
||||
if (indexes != null) {
|
||||
|
||||
$('#hiddenId').val(id)
|
||||
$('#txtDescripcion').val(TableItems.cell(indexes, 2).data());
|
||||
|
||||
$("#formCatalogo").validateElement("#txtDescripcion");
|
||||
|
||||
$('#lbTituloAccion').empty();
|
||||
$('#lbTituloAccion').append('Editar Valor de Campo ID: ' + id);
|
||||
|
||||
$('#btnInsertar').hide();
|
||||
$('#btnGuardar').show();
|
||||
}
|
||||
}
|
||||
|
||||
this.toggleEnabledItem = function (id, value) {
|
||||
|
||||
var msg = '¿Está seguro que desea habilitar el Contenido?';
|
||||
|
||||
if (value == 0) {
|
||||
msg = '¿Está seguro que desea deshabilitar el Contendido?';
|
||||
}
|
||||
|
||||
if (id == null || value == null) {
|
||||
toastr.warning("No se pudo obtener el ID del Contenido seleccionado.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm(msg))
|
||||
{ return; }
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
|
||||
Contenido = {
|
||||
IdContenido: id,
|
||||
Estado: value,
|
||||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarContenido';
|
||||
AjaxPostData(uri, Contenido, true, true, CompletarAccion, null, null);
|
||||
}
|
||||
|
||||
this.ActualizarItem = function () {
|
||||
|
||||
if (!$("#formCatalogo").valid()) {
|
||||
toastr.warning("Ingresar todos los campos que son requeridos.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!confirm("Se guardarán los cambios.\n ¿Desea continuar?"))
|
||||
{ return; }
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
|
||||
Contenido = {
|
||||
IdContenido: $('#hiddenId').val(),
|
||||
Descripcion: $('#txtDescripcion').val(),
|
||||
Estado: 1,
|
||||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarContenido';
|
||||
AjaxPostData(uri, Contenido, true, true, CompletarAccion, null, null);
|
||||
}
|
||||
|
||||
this.InsertarItem = function () {
|
||||
|
||||
|
||||
if (!$("#formCatalogo").valid()) {
|
||||
toastr.warning("Ingresar todos los campos que son requeridos.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!confirm("Va a ingresar un nuevo Emisor .\n ¿Desea continuar?"))
|
||||
{ return; }
|
||||
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
Contenido = {
|
||||
IdContenido: 1,
|
||||
Descripcion: $("#txtDescripcion").val(),
|
||||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarContenido';
|
||||
AjaxPostData(uri, Contenido , true, true, CompletarAccion, null, null);
|
||||
|
||||
}
|
||||
|
||||
this.CompletarAccion = function () {
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
|
||||
TableItems.clear().draw();
|
||||
ObtenerContenido();
|
||||
LimpiarControles();
|
||||
ENDREQUEST();
|
||||
}
|
||||
|
||||
this.LimpiarControles = function () {
|
||||
|
||||
$('#txtDescripcion').val('');
|
||||
$("#formCatalogo").validateElement("#txtDescripcion");
|
||||
|
||||
$('#lbTituloAccion').empty();
|
||||
$('#lbTituloAccion').append('Ingresar Nuevo Contenido');
|
||||
}
|
||||
|
||||
|
||||
105
AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Contenido.cshtml
Normal file
105
AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Contenido.cshtml
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
@{
|
||||
ViewBag.Title = "Contenido";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
|
||||
}
|
||||
|
||||
<input type="hidden" id="hiddenId" value="true">
|
||||
<form id="formCatalogo" class="form-horizontal" role="form">
|
||||
<div class="panel-body"> <h3> <i class="fa fa-briefcase"></i> Contenido </h3> </div>
|
||||
<div class="panel panel-success">
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<table id="TableItems" class="display">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="col-sm-1">ID</th>
|
||||
<th class="col-sm-4">Descripción</th>
|
||||
@*<th class="col-sm-4">Tipo Emisor</th>*@
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div id="ucItemsIcon" style="display:none;">
|
||||
<div class="text-[$state_color]">
|
||||
<i class="fa [$icon] fa-2x"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ucItemsCatalogo" style="display:none;">
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-info dropdown-toggle btn-xs" data-toggle="dropdown">
|
||||
<i class="fa fa-wrench"></i> Opciones <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript: EditarItem([$CodItem]);"><i class="fa fa-wrench"></i> Editar</a></li>
|
||||
<li><a href="javascript: toggleEnabledItem([$CodItem],[$value]);"><i class="fa [$icon]"></i> [$opcion]</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<i class="fa fa-bars"></i> <label id="lbTituloAccion">Ingresar Nuevo Contenido</label>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
@*Descripción*@
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label ControlsForms">Descripción</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" id="txtDescripcion" name="txtDescripcion" class="form-control imput-xs" required="required" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-md-2"></label>
|
||||
<div class="col-md-4 ">
|
||||
|
||||
<button type="button" class="btn btn-default btn-sm pull-right" id="btnLimpiar">
|
||||
<span class="fa fa-eraser" aria-hidden="true"></span> Limpiar
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-4 ">
|
||||
<button type="button" class="btn btn-default btn-sm pull-right" id="btnInsertar">
|
||||
<span class="fa fa-upload" aria-hidden="true"></span> Insertar
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm pull-right" id="btnGuardar">
|
||||
<span class="fa fa-floppy-o" aria-hidden="true"></span> Guardar
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@Scripts.Render("~/Sinort-Scripts/Contenido.js")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Reference in a new issue