{% extends "ishtar/wizard/wizard_person_orga.html" %}
{% load replace_underscore %}

{% block corporation %}
  <tr class='required'>
    <th>{{ wizard.form.corporation_general_contractor.label_tag }}</th>
    <td> {{ wizard.form.corporation_general_contractor.errors }}{{wizard.form.corporation_general_contractor|safe}}</td>
  </tr>
{% endblock %}

{% block natural %}
  <tr class='required'>
    <th>{{ wizard.form.general_contractor.label_tag }}</th>
    <td> {{ wizard.form.general_contractor.errors }}{{wizard.form.general_contractor|safe}}</td>
  </tr>
{% endblock %}
{% block extra_head_po %}
<script type='text/javascript'>
$(function() {
var corp_id = '#id_{{wizard.form.prefix}}-corporation_general_contractor';
var pers_id = "#id_select_{{wizard.form.prefix}}-general_contractor" ;
var pers_select_id = "#id_select_{{wizard.form.prefix}}-general_contractor" ;
$(corp_id).change(
  function(){
    $(pers_select_id).autocomplete(
        "option", "source",
        source_{{wizard.form.prefix|replace_underscore}}_general_contractor
            + $(corp_id).val() + '/');
    $(pers_select_id).val("");
    $(pers_id).val("");
    if ($(corp_id).val()){
        $(pers_select_id).prop("disabled", false);
    } else {
        $(pers_select_id).prop("disabled", true);
    }
});
});
</script>
{% endblock %}
