<commit_before>{% extends "ndf/mis_base_create_edit.html" %}
{% load i18n %}
{% load ndf_tags %}
{% load pagination_tags %}

{% block body_content %} 
  <form data-abide id="form-edit-node" method="POST" action="">

    <header class="row">
      <h2 class="medium-12 columns">
        {% if node %}
        {% trans "Editing" %} {{title}}: {{node.name}}
        {% else %}
        {% trans "Register a New" %} {{title}}
        {% endif %}
      </h2>
      <nav class="medium-12 columns">
        <dl class="tabs" data-tab>
          <dd>
            {% blocktrans %}<h4>Tabs:</h4>{% endblocktrans %}
          </dd>

          {% for tab_details in property_order_list %}
          <dd {% if forloop.counter == 1 %}class="active"{% endif %} title="Click here to add Name, start-time, end-time, attendence...">
            <a href="#panel_{{tab_details.0}}">{{tab_details.0}}</a>
          </dd>
          {% endfor %}

          <!-- Add more tabs below 
          <dd title="Click here to add/edit...">
            <a href="#panel_?" class="tab_?">Prior Node</a>
          </dd>
          -->
        </dl>
      </nav>
    </header>

    {% csrf_token %}

    <br>
    <div id="event-details-edit-div" class="tabs-content" >
      {% for tab_name, tab_fields_list in property_order_list %}
      <div class="{% if forloop.counter == 1 %}active {% endif %}content row" id="panel_{{tab_name}}">
        {% for field in tab_fields_list %}
        <div class="row">
          <div class="small-3 columns"> 
            <label for="{{field.name}}" class="left inline"> {{field.altnames}} </label>
          </div>
          <div class="small-7 end columns">
            {% html_widget groupid node.pk field %}
          </div>
        </div>
        {% endfor %}
      </div>
      {% endfor %}

      <!-- Additional panels if required
      <div class="" id="panel_?">
      </div>
      -->
      <input type="hidden" id="name" name="name" value="">
    </div>

    <br>
    <div class="row">
      <div class="small-4 small-offset-2 end columns">
        <input type="submit" id="save-node" class="small button expand" value="Save" />
      </div>
    </div>    

  </form>

{% endblock %}

{% block script %}
  // <script type="text/javascript">

  $("#save-node").click(function() {
    // alert($(this).val() + " clicked...")
    name = ""
    first_name = $("#first_name").val().trim()
    middle_name = $("#middle_name").val().trim()
    last_name = $("#last_name").val().trim()

    name = first_name
    if (middle_name != "") {
      name = first_name + " " + middle_name
    }

    if (last_name != "") {
      name = name + " " + last_name
    }

    $("#name").val(name)

    alert($("#name").val())
  });

  var dtOBInput = $("#dob")
  // alert(dtOBInput)
  if(dtOBInput.length > 0) {
    dtOBInput.datetimepicker({ 

      hourGrid: 6,
      minuteGrid: 15,

      // onClose: function(dateText, inst) {

      //   if (endDtInput.val() != '') {

      //     var testStartDate = dtOBInput.datetimepicker('getDate');
      //     var testEndDate = endDtInput.datetimepicker('getDate');

      //     if (testStartDate > testEndDate)
      //       endDtInput.datetimepicker('setDate', testStartDate);

      //   }
      //   else {
      //     endDtInput.val(dateText);
      //   }
      // },
      onSelect: function (selectedDateTime){
        endDtInput.datetimepicker('option', 'minDate', dtOBInput.datetimepicker('getDate') );
      }
    });
  }

  // totWhen ---------------
  var totWhen = $("#tot_when")

  if(totWhen.length > 0) {
    totWhen.datetimepicker();
    $(totWhen).after('&nbsp;<input class="button tiny" type="button" value="Add Date"><br/>')
    $("input.tiny").after("<div id='tot-when-date-list'></div>")
  }

  $(totWhen).change(function() { 

    if($(totWhen).val().length > 0) {
      $("input.tiny").removeClass("disabled");
    }

    else {
      $("input.tiny").addClass("disabled");
    }
  });

  $("input.tiny").click(function() {
    if(!$(this).hasClass("disabled")) {
      $("#tot-when-date-list").append('<span class="secondary label" style="margin-right:5px;"><span class="date-item">'+$(totWhen).val()+' </span><span style="font-size:large; cursor:pointer;" onclick="$(this).parent().remove();">&times;</span></span>');
      // $(totWhen).val("");
      // alert(getTotWhen())
      $(totWhen).val(getTotWhen());
      $("input.tiny").addClass("disabled");
    }
  });

  function getTotWhen() {
    var datesList = []
    dts = $("#tot-when-date-list .date-item");
    $.each(dts, function(i, val){datesList.push($(val).text().trim())});

    return datesList;
  }
  // </script>
{% endblock %}	
<commit_msg>Updated date widget set for DOB field.<commit_after>{% extends "ndf/mis_base_create_edit.html" %}
{% load i18n %}
{% load ndf_tags %}
{% load pagination_tags %}

{% block body_content %} 
  <form data-abide id="form-edit-node" method="POST" action="">

    <header class="row">
      <h2 class="medium-12 columns">
        {% if node %}
        {% trans "Editing" %} {{title}}: {{node.name}}
        {% else %}
        {% trans "Register a New" %} {{title}}
        {% endif %}
      </h2>
      <nav class="medium-12 columns">
        <dl class="tabs" data-tab>
          <dd>
            {% blocktrans %}<h4>Tabs:</h4>{% endblocktrans %}
          </dd>

          {% for tab_details in property_order_list %}
          <dd {% if forloop.counter == 1 %}class="active"{% endif %} title="Click here to add Name, start-time, end-time, attendence...">
            <a href="#panel_{{tab_details.0}}">{{tab_details.0}}</a>
          </dd>
          {% endfor %}

          <!-- Add more tabs below 
          <dd title="Click here to add/edit...">
            <a href="#panel_?" class="tab_?">Prior Node</a>
          </dd>
          -->
        </dl>
      </nav>
    </header>

    {% csrf_token %}

    <br>
    <div id="event-details-edit-div" class="tabs-content" >
      {% for tab_name, tab_fields_list in property_order_list %}
      <div class="{% if forloop.counter == 1 %}active {% endif %}content row" id="panel_{{tab_name}}">
        {% for field in tab_fields_list %}
        <div class="row">
          <div class="small-3 columns"> 
            <label for="{{field.name}}" class="left inline"> {{field.altnames}} </label>
          </div>
          <div class="small-9 columns">
            {% html_widget groupid node.pk field %}
          </div>
        </div>
        {% endfor %}
      </div>
      {% endfor %}

      <!-- Additional panels if required
      <div class="" id="panel_?">
      </div>
      -->
      <input type="hidden" id="name" name="name" value="">
    </div>

    <br>
    <div class="row">
      <div class="small-4 small-offset-2 end columns">
        <input type="submit" id="save-node" class="small button expand" value="Save" />
      </div>
    </div>    

  </form>

{% endblock %}

{% block script %}
  // <script type="text/javascript">

  $(function() {
    $("#dob").datepicker({
      changeMonth: true,
      changeYear: true,
      yearRange: "1980:2005"
    });
  });

  $("#save-node").click(function() {
    name = ""
    first_name = $("#first_name").val().trim()
    middle_name = $("#middle_name").val().trim()
    last_name = $("#last_name").val().trim()

    name = first_name
    if (middle_name != "") {
      name = first_name + " " + middle_name
    }

    if (last_name != "") {
      name = name + " " + last_name
    }

    $("#name").val(name)
  });

  // totWhen ---------------
  var totWhen = $("#tot_when")

  if(totWhen.length > 0) {
    totWhen.datetimepicker();
    $(totWhen).after('&nbsp;<input class="button tiny" type="button" value="Add Date"><br/>')
    $("input.tiny").after("<div id='tot-when-date-list'></div>")
  }

  $(totWhen).change(function() { 

    if($(totWhen).val().length > 0) {
      $("input.tiny").removeClass("disabled");
    }

    else {
      $("input.tiny").addClass("disabled");
    }
  });

  $("input.tiny").click(function() {
    if(!$(this).hasClass("disabled")) {
      $("#tot-when-date-list").append('<span class="secondary label" style="margin-right:5px;"><span class="date-item">'+$(totWhen).val()+' </span><span style="font-size:large; cursor:pointer;" onclick="$(this).parent().remove();">&times;</span></span>');
      // $(totWhen).val("");
      // alert(getTotWhen())
      $(totWhen).val(getTotWhen());
      $("input.tiny").addClass("disabled");
    }
  });

  function getTotWhen() {
    var datesList = []
    dts = $("#tot-when-date-list .date-item");
    $.each(dts, function(i, val){datesList.push($(val).text().trim())});

    return datesList;
  }
  // </script>
{% endblock %}	

{'fraction_non_alphanumeric': 0.2143762239373344, 'fraction_numerical': 0.006220481511346619, 'mean_word_length': 2.3729603729603728, 'pattern_counts': {'":': 0, '<': 119, '<?xml version=': 0, '>': 125, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5451420', 'n_tokens_mistral': 2974, 'n_tokens_neox': 2771, 'n_words': 535}