Gotita Normativa listo
git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C318
This commit is contained in:
parent
1e2b2da9dd
commit
0e7a467653
3 changed files with 221 additions and 3 deletions
|
|
@ -1 +1,218 @@
|
|||
|
||||
var model = {};
|
||||
var Nombre;
|
||||
var IdGotita;
|
||||
var NombreDocumento;
|
||||
var DescTipoproyecto;
|
||||
var modelDocumentoAdjunto;
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
getDataModel();
|
||||
|
||||
$('#tableDocGotita').TableInit(0, false, false, false, false, null, null);
|
||||
$('#tableDocGotita').DataTable().column(0).visible(false);
|
||||
$('#tableDocGotita').DataTable().column(4).visible(false);
|
||||
|
||||
|
||||
});
|
||||
this.getDataModel = function () {
|
||||
$("#btnGuardar").unbind("click");
|
||||
$('#btnGuardar').click(function () {
|
||||
GuardarGotitaNormativa();
|
||||
});
|
||||
$("#txtFechaCaducidad").datepicker();
|
||||
}
|
||||
|
||||
this.GuardarGotitaNormativa = function () {
|
||||
|
||||
|
||||
|
||||
if (!$("#formGotitaNormativa").valid()) {
|
||||
toastr.warning("Ingresar todos los campos que son requeridos.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsNullOrEmpty(modelDocumentoAdjunto)) {
|
||||
toastr.warning("Antes de continuar; debe de ingresar un Documento Adjunto.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!confirm("Va a ingresar una nueva Gotita Normativa .\n ¿Desea continuar?"))
|
||||
{ return; }
|
||||
|
||||
|
||||
GotitaNormativa = {
|
||||
Nombre: $("#txtNombre").val(),
|
||||
Descripcion: $("#txtDescripcion").val(),
|
||||
FechaCaducidad: $("#txtFechaCaducidad").DateFormatWCF(),
|
||||
IdDocumentoAdjunto: IsNullOrEmpty(modelDocumentoAdjunto) ? 0 : modelDocumentoAdjunto.Adjuntos.IdDocumentoAdjunto,
|
||||
DescripcionDocumentoAdjunto: IsNullOrEmpty(modelDocumentoAdjunto) ? 0 : modelDocumentoAdjunto.Adjuntos.Nombre,
|
||||
Estado: 1
|
||||
|
||||
}
|
||||
//model.GotitasNormativa = GotitaNormativa;
|
||||
|
||||
|
||||
var uri = SinortWCF + '/api/InsertarGotitasNormativas';
|
||||
AjaxPostData(uri, GotitaNormativa, true, true, LimpiarControles, null, null);
|
||||
|
||||
}
|
||||
|
||||
this.LimpiarControles = function () {
|
||||
$('#txtDescripcion').val('');
|
||||
$('#txtNombre').val('');
|
||||
$('#txtFechaCaducidad').val('');
|
||||
|
||||
$('#txtDescripcionDocAux').val('');
|
||||
$('#txtComentarioDocAux').val('');
|
||||
var tableDocGota = $('#tableDocGotita').DataTable();
|
||||
tableDocGota.clear().draw();
|
||||
|
||||
|
||||
ENDREQUEST();
|
||||
}
|
||||
|
||||
//Adjuntos
|
||||
this.AbrirAdjuntos = function () {
|
||||
DescTipoproyecto = 'Gotita Normativa';
|
||||
ActualizarUpload();
|
||||
$('#modalDocumentosAuxiliares').modal('show');
|
||||
}
|
||||
this.GuardarAdjuntos = function (nombre) {
|
||||
|
||||
var uri = SinortWCF + '/api/GuardarAdjuntos';
|
||||
|
||||
var nombredoc = replaceAll(" ", "_", nombre);
|
||||
var ruta = DescTipoproyecto + '\\' + nombredoc;
|
||||
var Idetipoproyecto = 4;
|
||||
|
||||
var Arraynombre = [];
|
||||
Arraynombre = nombredoc.split(".");
|
||||
|
||||
|
||||
var AdjuntosDocumentosAuxiliar
|
||||
= {
|
||||
Nombre: $("#txtDescripcionDocAux").val(),
|
||||
Comentario: $("#txtComentarioDocAux").val(),
|
||||
IdTipoDocumento: Idetipoproyecto,
|
||||
DescTipoDocumento: DescTipoproyecto,
|
||||
RutaFisica: RepositorioLocal + ruta,
|
||||
RutaDescarga: RepositorioVirtual + ruta,
|
||||
TipoArchivo: Arraynombre.pop()
|
||||
}
|
||||
|
||||
model.Adjuntos = AdjuntosDocumentosAuxiliar;
|
||||
|
||||
AjaxPostData(uri, model, true, false, CargarGridDocumento, null, null);
|
||||
|
||||
}
|
||||
function ActualizarUpload() {
|
||||
|
||||
|
||||
$('#fileupload').fileupload({
|
||||
|
||||
url: FileUploadHandler + '/FileUploadHandler.ashx?tipo=' + DescTipoproyecto,
|
||||
type: 'POST',
|
||||
|
||||
add: function (e, data) {
|
||||
|
||||
data.submit();
|
||||
},
|
||||
progress: function (e, data) {
|
||||
var progress = parseInt(data.loaded / data.total * 100, 10);
|
||||
$('#progress .progress-bar').css(
|
||||
'width',
|
||||
progress + '%'
|
||||
);
|
||||
|
||||
var tableAdjuntos = $('#tableAdjuntos').DataTable();
|
||||
|
||||
$.each(data.files, function (index, file) {
|
||||
|
||||
NombreDocumento = file.name;
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
success: function (response, status) {
|
||||
|
||||
GuardarAdjuntos(NombreDocumento);
|
||||
$('#progress .progress-bar').css(
|
||||
'width', '0%');
|
||||
ENDREQUEST();
|
||||
|
||||
},
|
||||
|
||||
error: function (error) {
|
||||
|
||||
if (error.status = "200") {
|
||||
|
||||
$('#progress .progress-bar').css(
|
||||
'width', '0%');
|
||||
ENDREQUEST();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
this.CargarGridDocumento = function (data) {
|
||||
|
||||
modelDocumentoAdjunto = data;
|
||||
|
||||
var tipo = $('#hiddenSubTipoDocumento').val();
|
||||
var lista = data.Adjuntos;
|
||||
|
||||
var option = $("#ucAbrirDocumento").html();
|
||||
var ext = lista.TipoArchivo.toLowerCase();
|
||||
switch (ext) {
|
||||
case 'pdf':
|
||||
option = replaceAll("[$icon]", "fa-file-pdf-o", option);
|
||||
break;
|
||||
case 'doc':
|
||||
option = replaceAll("[$icon]", "fa-file-word-o", option);
|
||||
break;
|
||||
case 'docx':
|
||||
option = replaceAll("[$icon]", "fa-file-word-o", option);
|
||||
break;
|
||||
case 'png':
|
||||
option = replaceAll("[$icon]", "fa-file-image-o", option);
|
||||
break;
|
||||
case 'jpg':
|
||||
option = replaceAll("[$icon]", "fa-file-image-o", option);
|
||||
break;
|
||||
case 'xls':
|
||||
option = replaceAll("[$icon]", "fa-file-excel-o", option);
|
||||
break;
|
||||
case 'xlsx':
|
||||
option = replaceAll("[$icon]", "fa-file-excel-o", option);
|
||||
break;
|
||||
default:
|
||||
option = replaceAll("[$icon]", "fa-file-text", option);
|
||||
}
|
||||
|
||||
$('#tableDocGotita').DataTable().column(0).visible(false);
|
||||
$('#tableDocGotita').DataTable().column(4).visible(false);
|
||||
|
||||
var tableDocGota = $('#tableDocGotita').DataTable();
|
||||
tableDocGota.clear().draw();
|
||||
tableDocGota.row.add([lista.IdDocumentoAdjunto,
|
||||
option,
|
||||
lista.Nombre,
|
||||
lista.UsuarioCreacion,
|
||||
lista.RutaDescarga]).draw();
|
||||
|
||||
|
||||
$('#fileupload').prop("disabled", true);
|
||||
}
|
||||
|
||||
$('#tableDocGotita').on('click', 'button', function () {
|
||||
|
||||
var data = $('#tableDocGotita').DataTable().row($(this).parents('tr')).data();
|
||||
|
||||
window.open(data[4]);
|
||||
|
||||
});
|
||||
//fin adjuntos
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
}
|
||||
|
||||
|
||||
<form id="formFichaTecnica" class="form-horizontal" role="form">
|
||||
<form id="formGotitaNormativa" class="form-horizontal" role="form">
|
||||
<div class="panel-body"> <h3> <i class="glyphicon glyphicon-tint"></i> Gotita Normativa</h3> </div>
|
||||
<div style="background-color: #fff">
|
||||
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
|
||||
</div>
|
||||
@*---------------------Documento ---------------------------------------------------------*@
|
||||
<table id="tableDocFichaTecnica" class="display">
|
||||
<table id="tableDocGotita" class="display">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
|||
int? Next_id = Conn.Emisor.Max(t => (int?)t.IdEmisor);
|
||||
model.IdGotitaNormativa = (Next_id == null) ? 1 : Next_id.Value + 1;
|
||||
model.FechaCreacion = DateTime.Now;
|
||||
model.UsuarioCreacion = Actual.UsuarioCreacion;
|
||||
Conn.GotitasNormativas.Add(model);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue