function scJQGeneralAdd() { scLoadScInput('input:text.sc-js-input'); scLoadScInput('input:password.sc-js-input'); scLoadScInput('input:checkbox.sc-js-input'); scLoadScInput('input:radio.sc-js-input'); scLoadScInput('select.sc-js-input'); scLoadScInput('textarea.sc-js-input'); } // scJQGeneralAdd function scFocusField(sField) { var $oField = $('#id_sc_field_' + sField); if (0 == $oField.length) { $oField = $('input[name=' + sField + ']'); } if (0 == $oField.length && document.F1.elements[sField]) { $oField = $(document.F1.elements[sField]); } if ($("#id_ac_" + sField).length > 0) { if ($oField.hasClass("select2-hidden-accessible")) { if (false == scSetFocusOnField($oField, sField)) { setTimeout(function() { scSetFocusOnField($oField, sField); }, 500); } } else { if (false == scSetFocusOnField($oField, sField)) { if (false == scSetFocusOnField($("#id_ac_" + sField, sField))) { setTimeout(function() { scSetFocusOnField($("#id_ac_" + sField, sField)); }, 500); } } else { setTimeout(function() { scSetFocusOnField($oField, sField); }, 500); } } } else { setTimeout(function() { scSetFocusOnField($oField, sField); }, 500); } } // scFocusField function scSetFocusOnField($oField, sField) { if ($oField.length > 0 && $oField[0].offsetHeight > 0 && $oField[0].offsetWidth > 0 && !$oField[0].disabled) { $oField[0].focus(); return true; } return false; } // scSetFocusOnField function scEventControl_init(iSeqRow) { scEventControl_data["manual" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["doc" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["tycm" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["tycdoc" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["documento" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["ping" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; } function scEventControl_active(iSeqRow) { if (scEventControl_data["manual" + iSeqRow] && scEventControl_data["manual" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["manual" + iSeqRow] && scEventControl_data["manual" + iSeqRow]["change"]) { return true; } if (scEventControl_data["doc" + iSeqRow] && scEventControl_data["doc" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["doc" + iSeqRow] && scEventControl_data["doc" + iSeqRow]["change"]) { return true; } if (scEventControl_data["tycm" + iSeqRow] && scEventControl_data["tycm" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["tycm" + iSeqRow] && scEventControl_data["tycm" + iSeqRow]["change"]) { return true; } if (scEventControl_data["tycdoc" + iSeqRow] && scEventControl_data["tycdoc" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["tycdoc" + iSeqRow] && scEventControl_data["tycdoc" + iSeqRow]["change"]) { return true; } if (scEventControl_data["documento" + iSeqRow] && scEventControl_data["documento" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["documento" + iSeqRow] && scEventControl_data["documento" + iSeqRow]["change"]) { return true; } if (scEventControl_data["ping" + iSeqRow] && scEventControl_data["ping" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["ping" + iSeqRow] && scEventControl_data["ping" + iSeqRow]["change"]) { return true; } return false; } // scEventControl_active function scEventControl_onFocus(oField, iSeq) { var fieldId, fieldName; fieldId = $(oField).attr("id"); fieldName = fieldId.substr(12); scEventControl_data[fieldName]["blur"] = true; scEventControl_data[fieldName]["change"] = false; } // scEventControl_onFocus function scEventControl_onBlur(sFieldName) { scEventControl_data[sFieldName]["blur"] = false; if (scEventControl_data[sFieldName]["change"]) { if (scEventControl_data[sFieldName]["original"] == $("#id_sc_field_" + sFieldName).val() || scEventControl_data[sFieldName]["calculated"] == $("#id_sc_field_" + sFieldName).val()) { scEventControl_data[sFieldName]["change"] = false; } } } // scEventControl_onBlur function scEventControl_onChange(sFieldName) { scEventControl_data[sFieldName]["change"] = false; } // scEventControl_onChange function scEventControl_onAutocomp(sFieldName) { scEventControl_data[sFieldName]["autocomp"] = false; } // scEventControl_onChange var scEventControl_data = {}; function scJQEventsAdd(iSeqRow) { $('#id_sc_field_documento' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_control_matricula_documento_onblur('#id_sc_field_documento' + iSeqRow, iSeqRow, event);}, 300) }) .bind('change', function() { sc_control_matricula_documento_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_control_matricula_documento_onfocus(this, iSeqRow, event) }); $('#id_sc_field_ping' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_control_matricula_ping_onblur('#id_sc_field_ping' + iSeqRow, iSeqRow, event);}, 300) }) .bind('change', function() { sc_control_matricula_ping_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_control_matricula_ping_onfocus(this, iSeqRow, event) }); $('#id_sc_field_tycm' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_control_matricula_tycm_onblur('#id_sc_field_tycm' + iSeqRow, iSeqRow, event);}, 300) }) .bind('change', function() { sc_control_matricula_tycm_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_control_matricula_tycm_onfocus(this, iSeqRow, event) }); $('#id_sc_field_tycdoc' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_control_matricula_tycdoc_onblur('#id_sc_field_tycdoc' + iSeqRow, iSeqRow, event);}, 300) }) .bind('change', function() { sc_control_matricula_tycdoc_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_control_matricula_tycdoc_onfocus(this, iSeqRow, event) }); $('#id_sc_field_manual' + iSeqRow).bind('blur', function() { sc_control_matricula_manual_onblur('#id_sc_field_manual' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_control_matricula_manual_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_control_matricula_manual_onfocus(this, iSeqRow, event) }); $('#id_sc_field_doc' + iSeqRow).bind('blur', function() { sc_control_matricula_doc_onblur('#id_sc_field_doc' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_control_matricula_doc_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_control_matricula_doc_onfocus(this, iSeqRow, event) }); $('.sc-ui-checkbox-tycm' + iSeqRow).on('click', function() { scMarkFormAsChanged(); }); $('.sc-ui-checkbox-tycdoc' + iSeqRow).on('click', function() { scMarkFormAsChanged(); }); } // scJQEventsAdd Upload_Cancel = false; function sc_control_matricula_documento_onblur(oThis, iSeqRow, event) { do_ajax_control_matricula_validate_documento(); scCssBlur(oThis); } function sc_control_matricula_documento_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_control_matricula_documento_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_matricula_ping_onblur(oThis, iSeqRow, event) { do_ajax_control_matricula_validate_ping(); scCssBlur(oThis); } function sc_control_matricula_ping_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_control_matricula_ping_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_matricula_tycm_onblur(oThis, iSeqRow, event) { do_ajax_control_matricula_validate_tycm(); scCssBlur(oThis); } function sc_control_matricula_tycm_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_control_matricula_tycm_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_matricula_tycdoc_onblur(oThis, iSeqRow, event) { do_ajax_control_matricula_validate_tycdoc(); scCssBlur(oThis); } function sc_control_matricula_tycdoc_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_control_matricula_tycdoc_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_matricula_manual_onblur(oThis, iSeqRow, event) { do_ajax_control_matricula_validate_manual(); scCssBlur(oThis); } function sc_control_matricula_manual_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_control_matricula_manual_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_matricula_doc_onblur(oThis, iSeqRow, event) { do_ajax_control_matricula_validate_doc(); scCssBlur(oThis); } function sc_control_matricula_doc_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_control_matricula_doc_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function displayChange_block(block, status) { if ("0" == block) { displayChange_block_0(status); } if ("1" == block) { displayChange_block_1(status); } if ("2" == block) { displayChange_block_2(status); } } function displayChange_block_0(status) { displayChange_field("manual", "", status); displayChange_field("doc", "", status); displayChange_field("tycm", "", status); displayChange_field("tycdoc", "", status); } function displayChange_block_1(status) { displayChange_field("documento", "", status); } function displayChange_block_2(status) { displayChange_field("ping", "", status); } function displayChange_row(row, status) { displayChange_field_manual(row, status); displayChange_field_doc(row, status); displayChange_field_tycm(row, status); displayChange_field_tycdoc(row, status); displayChange_field_documento(row, status); displayChange_field_ping(row, status); } function displayChange_field(field, row, status) { if ("manual" == field) { displayChange_field_manual(row, status); } if ("doc" == field) { displayChange_field_doc(row, status); } if ("tycm" == field) { displayChange_field_tycm(row, status); } if ("tycdoc" == field) { displayChange_field_tycdoc(row, status); } if ("documento" == field) { displayChange_field_documento(row, status); } if ("ping" == field) { displayChange_field_ping(row, status); } } function displayChange_field_manual(row, status) { var fieldId; } function displayChange_field_doc(row, status) { var fieldId; } function displayChange_field_tycm(row, status) { var fieldId; } function displayChange_field_tycdoc(row, status) { var fieldId; } function displayChange_field_documento(row, status) { var fieldId; } function displayChange_field_ping(row, status) { var fieldId; } function scRecreateSelect2() { } function scResetPagesDisplay() { $(".sc-form-page").show(); } function scHidePage(pageNo) { $("#id_control_matricula_form" + pageNo).hide(); } function scCheckNoPageSelected() { if (!$(".sc-form-page").filter(".scTabActive").filter(":visible").length) { var inactiveTabs = $(".sc-form-page").filter(".scTabInactive").filter(":visible"); if (inactiveTabs.length) { var tabNo = $(inactiveTabs[0]).attr("id").substr(28); } } } function scJQPopupAdd(iSeqRow) { $('.scFormPopupBubble' + iSeqRow).each(function() { var distance = 10; var time = 250; var hideDelay = 500; var hideDelayTimer = null; var beingShown = false; var shown = false; var trigger = $('.scFormPopupTrigger', this); var info = $('.scFormPopup', this).css('opacity', 0); $([trigger.get(0), info.get(0)]).mouseover(function() { if (hideDelayTimer) clearTimeout(hideDelayTimer); if (beingShown || shown) { // don't trigger the animation again return; } else { // reset position of info box beingShown = true; var left_pos = trigger.offset().left - ((info.width() - trigger.width()) / 2); if (left_pos < 10) { left_pos = 10; } info.css({ top: trigger.offset().top - (info.height() - trigger.height()), left: left_pos, display: 'block' }).animate({ top: '-=' + distance + 'px', opacity: 1 }, time, 'swing', function() { beingShown = false; shown = true; }); } return false; }).mouseout(function() { if (hideDelayTimer) clearTimeout(hideDelayTimer); hideDelayTimer = setTimeout(function() { hideDelayTimer = null; info.animate({ top: '-=' + distance + 'px', opacity: 0 }, time, 'swing', function() { shown = false; info.css('display', 'none'); }); }, hideDelay); return false; }); }); } // scJQPopupAdd function scJQUploadAdd(iSeqRow) { } // scJQUploadAdd var api_cache_requests = []; function ajax_check_file(img_name, field ,t, p, p_cache, iSeqRow, hasRun, img_before){ setTimeout(function(){ if(img_name == '') return; iSeqRow= iSeqRow !== undefined && iSeqRow !== null ? iSeqRow : ''; var hasVar = p.indexOf('_@NM@_') > -1 || p_cache.indexOf('_@NM@_') > -1 ? true : false; p = p.split('_@NM@_'); $.each(p, function(i,v){ try{ p[i] = $('[name='+v+iSeqRow+']').val(); } catch(err){ p[i] = v; } }); p = p.join(''); p_cache = p_cache.split('_@NM@_'); $.each(p_cache, function(i,v){ try{ p_cache[i] = $('[name='+v+iSeqRow+']').val(); } catch(err){ p_cache[i] = v; } }); p_cache = p_cache.join(''); img_before = img_before !== undefined ? img_before : $(t).attr('src'); var str_key_cache = '