/// /************************************************* // // PANEL NON CONFORMITA // **************************************************/ function NCDetails(IDNC) { // Make an ajax call to load the NC Details $('#NC_Detail').busy(); $('#NC_Detail').load('/PANEL/NCDetails/' + IDNC.toString(), function (html) { $('#NC_Detail').busy('hide'); $('#NC_Detail').html(html); }); } function CreateNC() { // Use the received ID to call the DOC var IDPratica = $('#IDPratica').val(); // Make an ajax call to create the NC $('#NC_Detail').busy(); $('#NC_Detail').load('/PANEL/NCCreate/' + IDPratica.toString(), function (html) { $('#NC_Detail').busy('hide'); OpenPage($('a#ID_PNL_NCs')); }); } function DeleteNC(IDNC, btnRef) { if (!show_confirm()) return; var old = $(btnRef).parent().html(); var parent = $(btnRef).parent(); parent.html(WaitingIcon(true)); $.ajax({ type: "GET", url: "/PANEL/DeleteNC/" + IDNC.toString(), success: function (data) { if (data == 'OK') { OpenPage($('a#ID_PNL_NCs')); } else { $(btnRef).parent().html(old); $(btnRef).parent().after(newError(data, 10, null)); } }, error: function () { parent.html(old); parent.append(newError('Unspecified error on the server', 10, null)); } }); } function CloseNC(IDNC, btnRef) { if (!show_confirm()) return; var old = $(btnRef).parent().html(); var parent = $(btnRef).parent(); parent.html(WaitingIcon(true)); $.ajax({ type: "GET", url: "/PANEL/CloseNC/" + IDNC.toString(), success: function (data) { OpenPage($('a#ID_PNL_NCs')); }, error: function () { parent.html(old); parent.append(newError('Unspecified error on the server', 10, null)); } }); } function PreapareNCAction(formId) { var form = $('#' + formId); var parent = form.parent(); var divPage = $('#NC_Detail'); form.find("input:submit").button(); form.append(''); // add an hidden submit field to track the clicked button form.find('input:submit').each(function () { $(this).mouseenter(function (e) { $('#btnValue').val($(this).attr('id')); }); }); form.unbind('submit').submit(function (e) { if (typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') { jQuery.data(this, "disabledOnSubmit", { submited: true }); $('input[type=submit], input[type=button]', this).each(function () { $(this).attr("disabled", "disabled"); }); e.preventDefault(); var dati = $(this).serialize(); var buttonId = $('#btnValue').val(); var actionurl = $('#' + buttonId).attr('icaction'); var old = $('#' + buttonId).parent().html(); $('#' + buttonId).parent().html(WaitingIcon(true)); $.ajax({ type: "POST", url: actionurl, data: dati, success: function (data) { form.unbind(); divPage.html(data); }, error: function () { $('#' + buttonId).parent().html(old); $('#' + buttonId).parent().after(newError('Unspecified error on the server', 10, null)); } }); } else { return false; } return false; }); } /************************************************* // // PANEL PRATICHE // **************************************************/ function ShowPratica() { // Use the received ID to call the DOC var IDPratica = $('#IDPratica').val(); // Make an ajax call to load the Pratica Details $('#PraticaDetails').busy(); $('#PraticaDetails').load('/PANEL/Pratica/' + IDPratica.toString(), function (html) { $('#PraticaDetails').busy('hide'); $('#PraticaDetails').html(html); }); } function OrganizePraticaDocs() { var pratica = $('#PraticaDetails'); var dispRule = [false, true, false, true, false, true, false, true, true, true, true]; var currDisp = 0; var currDoc, isFirst = true; for (i = 1; i < 12; i++) { // Find the element at the current position i currDoc = pratica.find('div.praticaDocCont[icPosition^="' + i.toString() + '"][icPosition$="' + i.toString() + '"]'); if (currDoc.length != 0) { // Add displaement if required if (dispRule[i - 1]) { if (isFirst) { currDisp -= 10; } else { currDisp -= 30; } currDoc.css('margin-top', (currDisp).toString() + 'px'); currDisp = 0; isFirst = false; } // Get the new displacement currDisp = currDisp + currDoc.height(); } else { if (i < 12) {dispRule[i] = true; } } } } /************************************************* // // ORD FR VALIDATION // **************************************************/ function OFRVAL_Show(IDDoc) { // Use the received ID to call the DOC $('#IDDoc').val(IDDoc); ShowDoc(); } /************************************************* // // FIll out the texts after Sede Selection // **************************************************/ function ConfOrdCL_FillOutFields(cbID, groupLetter) { var cb = $('#' + cbID); // Bind the change event on the dropdown cb.unbind('change').change(function() { var idSede = cb.val(); var sUrl = '/Combos/GetSedeData/' + idSede.toString()+ '?gruppo='+groupLetter; cb.css('padding-left','16px'); cb.before($(WaitingIcon(false)).css({position:'absolute', top: '6px;'})); $.ajax({ type: "GET", url: sUrl, success: function (json) { // Check the server answer RemoveWaitingIcon(cb.parent(), false); cb.css('padding-left','0px'); var data = eval(json); if (data[0].label == 'ERROR') { // Let the user know that something went wrong on the server addError(data[0].Value, null, cb, null); } else { // Populate teh fields $('input[name^="'+groupLetter+'_"], textarea[name^="'+groupLetter+'_"], select[name^="'+groupLetter+'_"]').each(function() { // set the value on the found elements var nome = $(this).attr('name'); for (i=0;i'); var tdID = $(this).attr('id'); var IDNorm = $(this).attr('icIDNorm'); var td = $(this); SetAutoComplete('normValue', tdID, '/' + controller + '/GetCandidates/?IDNorm=' + IDNorm.toString() + '&stp=' + step.toString(), function () { $('#normValue').autocomplete('destroy'); td.html($('#normValue').val()); td.removeClass('icCandidateSelected'); ui.newHeader.find('td.savingNeeded a').fadeIn(); }, 3, 'icIDCand', true); $('#normValue').focus(); }); // Bind the IsNew and IsCodInt checked event to enable saving ui.newContent.find('input[type="checkbox"]').click(function (e) { ui.newHeader.find('td.savingNeeded a').fadeIn(); }); // Bind the click event on the saveNeeded button ui.newHeader.find('td.savingNeeded a').click(function (e) { // Stop event propagation e.stopPropagation(); // Loop all the modified items, saving them to DB ui.newContent.find('td.icCandidate').each(function () { var elemTD = $(this); var IDNorm = elemTD.attr('icIDNorm'); var IDCand = elemTD.attr('icIDCand'); var IsNew = $('#IsNew' + IDNorm.toString() + ':checked').length == 0 ? false : true; var IsCodInt = $('#IsCodInt' + IDNorm.toString() + ':checked').length == 0 ? false : true; if ((IDCand != undefined && isNumber(IDCand) && IDCand > 0) || IsNew) { var dati = { IDNorm: IDNorm, IDCand: IDCand, IsNew: IsNew, IsCodInt: IsCodInt }; var sUrl = '/' + controller + '/SaveCandidate/' + step.toString(); elemTD.append(WaitingIcon(false)); $.ajax({ type: "POST", url: sUrl, data: dati, success: function (data) { // Check the server answer elemTD.find('.waiting-icon-small').remove(); if (data == 'OK') { elemTD.addClass('icCandidateSaved'); window.setTimeout(function () { elemTD.parent().fadeOut(); ui.newHeader.find('#NumNorm_' + step.toString()).html(WaitingIcon(false)); ui.newHeader.find('#NumNorm_' + step.toString()).load( '/' + controller + '/WZDNormalizeQty/?stp=' + step.toString()); }, 2000) } else { elemTD.addClass('icCandidateSavedBad'); } }, error: function () { elemTD.addClass('icCandidateSavedBad'); } }); } }); ui.newHeader.find('td.savingNeeded a').fadeOut(); }); }); } } }); } /************************************************* // // EXCEL FILE UPLOADING // **************************************************/ function CompleteUpload(msg) { if (msg == 'OK') { // Ask the server the processing part var what = $('#what').val(); var controller = ''; if (what == 0) { controller = 'OFF' } else { controller = 'RFQ' } $('#wzdProcess').busy(); $('#wzdProcess').load('/' + controller + '/WZDSteps/?what=' + what.toString(), null, function () { $('#wzdProcess').busy('hide'); }); } else { alert(msg); } } // This function initiate the FileUpload interface for multiple fotos function PrepUpload() { var regexp; var SizeLimit = 12000000; regexp = /\.(xls)$/i; $('#excel_upload').fileUploadUI({ acceptFileTypes: regexp, uploadTable: $('#files'), downloadTable: $('#files'), maxNumberOfFiles: 1, buildUploadRow: function (files, index) { return $('<\/td>' + '' + files[index].name + '<\/td>' + '
<\/div><\/td>' + '' + '