{% extends "ndf/mis_base_create_edit.html" %} {% load i18n %} {% load ndf_tags %} {% load pagination_tags %} {% block style %} {{block.super}} /* Disable tab's (anchor tag's) click as it's navigation is propagated on buttons (Next & Previous) */ dl.tabs>dd a.disable { pointer-events: none; cursor: default; } .row .row { margin: 0 0; } /* Resetting css-properties for fieldset (also legend, input) */ /* fieldset (padding-bottom) */ fieldset { padding: 1.25rem 1.25rem 1.25rem 1.25rem !important; } /* legend (background-color) */ fieldset legend { background-color: transparent !important; } /* input (margin) */ fieldset input { margin: 0 !important; } fieldset label.note { color: #909b9c; margin-bottom: 0.8rem; font-size: 0.875em; font-weight: bold; padding-left: 8.8rem; } /* Setting css-properties for reveal-modal's label */ div.reveal-modal > label { color: white; font-weight: bold; font-size: 1rem; } /* css-properties for table */ .width-5p { width: 5%; } .width-8p { width: 8%; } .width-10p { width: 10%; } .width-20p { width: 20%; } .width-30p { width: 30%; } .width-37p { width: 37%; } .width-80p { width: 80%; } .margin-0r { margin: 0 !important; } .counter { font-weight: bold; text-align: right; } {% endblock %} {% block body_content %}
×

{% if node %} {% trans "Editing" %} {{title}}: {{node.name}} {% else %} {% trans "Register " %} {{title}} {% endif %}

{% csrf_token %}

{% html_widget groupid node.pk property_order_list.0.1.0 %}
{% html_widget groupid node.pk property_order_list.0.1.1 %}
{% html_widget groupid node.pk property_order_list.0.1.2 %}
{% html_widget groupid node.pk property_order_list.0.1.3 %}
{% html_widget groupid node.pk property_order_list.0.1.4 %}
{% html_widget groupid node.pk property_order_list.0.1.5 %}
{% html_widget groupid node.pk property_order_list.0.1.6 %}
{% html_widget groupid node.pk property_order_list.0.1.7 %}

{% html_widget groupid node.pk property_order_list.0.1.8 %}
{% html_widget groupid node.pk property_order_list.0.1.9 %}
{% html_widget groupid node.pk property_order_list.0.1.10 %}
{% html_widget groupid node.pk property_order_list.0.1.11 %}


{% html_widget groupid node.pk property_order_list.1.1.0 %}
{% html_widget groupid node.pk property_order_list.1.1.1 %}
{% html_widget groupid node.pk property_order_list.1.1.2 %}
{% html_widget groupid node.pk property_order_list.1.1.3 %}
{% html_widget groupid node.pk property_order_list.1.1.4 %}
{% html_widget groupid node.pk property_order_list.1.1.5 %}
{% html_widget groupid node.pk property_order_list.1.1.6 %}

{% html_widget groupid "" nussd_course_type %}
* {% trans "Please select course" %}!
* {% trans "Please select university" %}!
* {% trans "Please select college" %}!
{% trans "S. #" %} {% trans "Course Type" %} {% trans "Course" %} {% trans "College" %}

{% for field in property_order_list.3.1 %}
{% html_widget groupid node.pk field %}
{% endfor %}

{% for field in property_order_list.4.1 %}
{% html_widget groupid node.pk field %}
{% endfor %}
{% endblock %} {% block script %} {{block.super}} // Global variables for script var currentYear = (new Date()).getFullYear() lowerYearLimit = currentYear - 70; course_enrollement_details = {}; course_requirements = {}; node_course_requirements = {} course_data = {}; node_id = "{{node.pk}}"; // Tabs navigation: Enable and Disable tabs in sequential manner using Next & Previous buttons ---- $(".content").on('click', '.tab_next' ,function(event){ event.preventDefault(); // Forcefully blur all input elements, so that mandatory fields become data-invalid if not fill $(this).parents(".tab-nav").parents(".content").find(':input[required]').blur(); // Then check no. of data-invalid fields // if count == 0, then only proceed to next tab parent_tab = $(this).parents(".tab-nav").parents(".content"); tab_id = parent_tab.attr("id"); // Special case for Course tab if (tab_id == "panel_{{property_order_list.2.0}}") { event.preventDefault(); // Reset course_requirements (dictionary), only when node exists meaning while editing if (node_id != "") { if (JSON.stringify(course_requirements) == "{}") { course_requirements = node_course_requirements; } else { $.each(course_requirements, function(k, v) { if (node_course_requirements.hasOwnProperty(k)) { $.each(course_requirements[k], function(index, dict_val) { $.each(node_course_requirements[k], function(index, node_dict_val) { if (dict_val["text"] == node_dict_val["text"]) { dict_val["has_qualification"] = node_dict_val["has_qualification"]; return false; } }); }); } }); } } // Set Course Requirements fieldset = ""; course_list = []; main_fieldset_legend = ""; $("#tblCourseDetails > tbody > tr").each(function(index) { courseSelected = $(this).find(".course").html(); if (course_list.indexOf(courseSelected) < 0) { course_list.push(courseSelected); main_fieldset_legend_name = '{% trans "Course Qualification Specifications" %}' main_fieldset_legend = "" + "" + "" inner_fieldset_legend_name = '{% trans "' + courseSelected + '" %}' inner_fieldset_legend = "" + "" + "" if (course_requirements.hasOwnProperty(courseSelected) && course_requirements[courseSelected] != "None") { th1 = "{% trans 'Mandatory' %}" th2 = "{% trans 'Qualifications' %}" th3 = "{% trans 'Select' %}" specification_table_head = "" + "" + th1 + "" + "" + th2 + "" + "" + th3 + "" + "" table_rows = "" $.each(course_requirements[courseSelected], function(index, requirement_dict){ td1 = ""; if (requirement_dict["mandatory"]) { td1 = ""; } td2 = requirement_dict["text"]; td3 = ""; if (requirement_dict.hasOwnProperty("has_qualification")) { if (requirement_dict["has_qualification"]) { td3 = ""; } } table_rows += "" + "" + td1 + "" + "" + td2 + "" + "" + td3 + "" + "" }); specification_table_body = "" + table_rows + "" specification_table = "" + specification_table_head + specification_table_body + "
" } else { // Dont show table specification_table = "" } fieldset += "
" + inner_fieldset_legend + specification_table + "
" } }); $("#fsCourseRequirements").html(main_fieldset_legend + fieldset); // Move to next Tab $('.active').removeClass('active').next().addClass('active'); } else if(parent_tab.find(':input[data-invalid]').length == 0) { // Valid, move to next step $('.active').removeClass('active').next().addClass('active'); } }); $(".content").on('click', '.tab_prev' ,function(event){ event.preventDefault(); $('.active').removeClass('active').prev().addClass('active'); }); // Only keeping year's drop-down and hiding other datepicker's elements ------------------------------------------ $(document).on('focus click blur', '.date_year' ,function(){ $(".ui-datepicker-calendar").hide(); $(".ui-datepicker-month").hide(); $(".ui-datepicker-prev").hide(); $(".ui-datepicker-next").hide(); $("#ui-datepicker-div").position({ my: "center top", at: "center bottom", of: $(this) }); }); // State-wise District selection ------------------------------------------------------------------ // Disable District field, later on will be enabled after a state is selected $("select#person_belongs_to_district").attr('disabled', 'disabled') $("select#person_belongs_to_state").change(function() { // Get selected State's value (ObjectId) and selected-index selected_state_id = $(this).val() selected_state_index = this.selectedIndex if (selected_state_index != 0) { // Perform this only when a State is selected // Ajax call that fetches all Districts belonging to selected State $.ajax({ url:"{% url 'get_districts' groupid %}", data: { state_id: selected_state_id }, type: "GET", dataType: "json", complete: function () { // Enable District field $("select#person_belongs_to_district").removeAttr('disabled') }, success: function (data) { if (data.hasOwnProperty("message")) { // Pops-up only when there is any error found during the ajax call alert(data["message"]) } else { // First empty all values of District field (dropdown/select) $("select#person_belongs_to_district").empty(); // Make very first entry as given below $("select#person_belongs_to_district").append( $("") .attr("value", "") .text("- - - Select district - - -") ); // Fill returned district values based on which state is selected $.each(data, function(i, value) { $("select#person_belongs_to_district").append( $("") .attr("value", value[0]) .text(value[1]) ); }); // Set very first entry so that user doesn't forgets to select a value $("select#person_belongs_to_district").prop("selectedIndex", 0); } } }); } else { // If state is not selected or changed back to very first element from State's dropdown // then set even District field's value to very first entry and disabled it until user again selects any state $("select#person_belongs_to_district").prop("selectedIndex", 0); $("select#person_belongs_to_district").attr('disabled', 'disabled') } }); // Empty dropdowns ("selCourse", "selUniversity", "selCollege") ----------------------------------- function empty3Select() { // Except Oth index option, i.e. "- - - Select ??? - - -", // this function removes all other existing option(s) $("#selCourse option:not(:first)").remove(); $("#selUniversity option:not(:first)").remove(); $("#selCollege option:not(:first)").remove(); } // Fill dropdown ---------------------------------------------------------------------------------- function fillSelect(selectElement, dataList) { $.each(dataList, function(index, data_value) { selectElement.append($('