<div ng-controller="FO1Ctrl" class="wrapper" anc-bac-controle-common-logic>
  <controle-form-cfg type="currentControle.properties.type" ng-if="!ctrl_clos" form-data="cdata"
    validation="ctrlCfgValid.values"></controle-form-cfg>

  <div class="mainFormTitle">
    <span>Contrôle de conception</span>
  </div>
  <div class="mainFormSubTitle condensedInfos">
    <div class="row">
      <div class="col-xs-4">
        <label data-for="cdata.datesDossier.date_controle_rdv">
          Date de rendez-vous
        </label>
      </div>
      <div class="col-xs-8">
        <div class="row" ng-if="priseRDV.active">
          <div class="col-xs-11">
            <div javautildate model-date-format="'hours'" gcatt="{name:'date_controle_rdv'}" result="cdata.datesDossier"
              ng-init="cdata.datesDossier.date_controle_rdv = cdata.datesDossier.date_controle_rdv ?cdata.datesDossier.date_controle_rdv : {}"
              data-ng-model="cdata.datesDossier.date_controle_rdv" data-type="date" field-data="{disabled:true}"></div>
          </div>
          <div class="col-xs-1 text-right">
            <button class="btn btn-default" ng-click="actionPriseRdv(true)" ng-disabled="disableRdv || AppAndroid
                                       || !rendezVousIsPossible(currentControle)">
              <i class="fa fa-calendar"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="col-xs-8">
        <div class="row" ng-if="!priseRDV.active">
          <div class="col-xs-12">
            <div javautildate model-date-format="'hours'" gcatt="{name:'date_controle_rdv'}" result="cdata.datesDossier"
              data-ignore="_doublon_"
              ng-init="cdata.datesDossier.date_controle_rdv = cdata.datesDossier.date_controle_rdv ? cdata.datesDossier.date_controle_rdv : {}"
              data-ng-model="cdata.datesDossier.date_controle_rdv" data-type="date" field-data="{disabled:ctrl_clos}">
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-4">
        <label data-for="cdata.datesDossier.date_controle">
          Date du contrôle effectué
        </label>
      </div>
      <div class="col-xs-8">
        <div class="row" ng-if="priseRDV.active">
          <div class="col-xs-11">
            <div javautildate model-date-format="'hours'" gcatt="{name:'date_controle'}" result="cdata.datesDossier"
              ng-init="cdata.datesDossier.date_controle = cdata.datesDossier.date_controle ?cdata.datesDossier.date_controle : {}"
              data-ng-model="cdata.datesDossier.date_controle" data-type="date" field-data="{disabled:ctrl_clos}"></div>
          </div>
          <div class="col-xs-1 text-right">
            <button class="btn btn-default" ng-click="copyDate()"
              ng-disabled="ctrl_clos || AppAndroid || !cdata.datesDossier.date_controle_rdv || angular.equals(cdata.datesDossier.date_controle_rdv, {});">
              =
            </button>
          </div>
        </div>
        <div class="row" ng-if="!priseRDV.active">
          <div class="col-xs-11">
            <div javautildate model-date-format="'hours'" gcatt="{name:'date_controle'}" result="cdata.datesDossier"
              data-ignore="_doublon_"
              ng-init="cdata.datesDossier.date_controle = cdata.datesDossier.date_controle ?cdata.datesDossier.date_controle : {}"
              data-ng-model="cdata.datesDossier.date_controle" data-type="date" field-data="{disabled:ctrl_clos}"></div>
          </div>
          <div class="col-xs-1 text-right">
            <button class="btn btn-default" ng-click="copyDate()"
              ng-disabled="!cdata.datesDossier.date_controle_rdv || cdata.datesDossier.date_controle_rdv == {}">
              =
            </button>
          </div>
        </div>
      </div>
    </div>

    <div class="row">
      <div class="col-xs-4">
        <label data-for="cdata.datesDossier.passage_reception">
          Date de la dernière demande
        </label>
      </div>
      <div class="col-xs-8">
        <div javautildate model-date-format="'no_hours'" gcatt="{name:'passage_reception'}" result="cdata.datesDossier"
          data-ng-model="cdata.datesDossier.passage_reception" data-type="date" field-data="{disabled:true}"></div>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-4">
        <label data-for="cdata.datesDossier.date_reception_dossier">
          Date de réception du dossier
        </label>
      </div>
      <div class="col-xs-8">
        <div javautildate model-date-format="'no_hours'" gcatt="{name:'date_reception_dossier'}"
          result="cdata.datesDossier"
          ng-init="cdata.datesDossier.date_reception_dossier = cdata.datesDossier.date_reception_dossier ?cdata.datesDossier.date_reception_dossier : {}"
          data-ng-model="cdata.datesDossier.date_reception_dossier" data-type="date" field-data="{disabled:ctrl_clos}">
        </div>
      </div>
    </div>

    <div class="row">
      <div class="col-xs-4">
        <label data-for="cdata.general.taille_filiere">
          Taille de la filière :
        </label>
      </div>
      <div class="col-xs-8">
        <span ng-bind="renderRestriction(filiereFti, 'volume_eh')" ng-model="cdata.general.taille_filiere"></span>
      </div>
    </div>

    <div class="row">
      <div class="col-xs-4">
        <label data-for="cdata.general.statut_rdv"> Statut </label>
      </div>
      <div class="col-xs-8">
        <div class="input-group">
          <select class="form-control" ng-model="cdata.general.statut_rdv"
            ng-options="statut.value as statut.label for statut in choixStatutRDV"
            ng-disabled="ctrl_clos || !allowChangementAvis"></select>
          <span class="input-group-btn">
            <div class="btn btn-default" ng-click="unlinkStatut()"
              ng-disabled="!allowChangementAvis || !cdata.general.statut_rdv">
              <i class="fa fa-close"></i>
            </div>
          </span>
        </div>
      </div>
    </div>

    <div class="row spbrow"
      ng-if="allowChangementAvis && cdata.general.statut_rdv && cdata.general.statut_rdv!='present' && !ctrl_clos">
      <div class="input-group">
        <div class="col-xs-4">
          <label data-for="cdata.general.origine_du_report_annulation">Origine du report/annulation</label>
        </div>
        <div class="col-xs-8">
          <div class="input-group">
            <div form-field fti="kis_anc_listes_deroulantes_controles" attname="'origine_du_report_annulation'"
              ng-model="cdata.general.origine_du_report_annulation" res="cdata.general"
              field-data="{disabled:ctrl_clos}">
            </div>
          </div>
        </div>
      </div>

      <div class="input-group">
        <div class="col-xs-4">
          <label data-for="cdata.general.statut_rdv_commnentaire"> Commentaire </label>
        </div>
        <div class="col-xs-8">
          <textarea class="form-control" ng-model="cdata.general.statut_rdv_commnentaire"></textarea>
        </div>
        <br /><br /><br />
      </div>

      <div class="col-xs-12 text-right">
        <div class="btn btn-danger" ng-click="pre_appliquerAvisControle(1)">
          Appliquer ce statut au contrôle
        </div>
      </div>
    </div>
  </div>

  <anc-bac-extra-form-fields apptype="'anc'" cdata="cdata" current-controle="currentControle" ctrl-clos="ctrl_clos">
  </anc-bac-extra-form-fields>

  <div class="panel-group" data-allow-multiple="true" data-start-collapsed="true" bs-collapse>
    <div class="panel panel-info ">
      <div class="panel-heading">
        <a bs-collapse-toggle> Informations générales </a>
      </div>
      <div class="panel-collapse" bs-collapse-target>
        <div class="panel-body">
          <ng-include src="'js/XG/widgets/ancapp/main/views/controle/FO1/informations_generales.html'" />
        </div>
      </div>
    </div>
    <div class="panel panel-info">
      <div class="panel-heading">
        <a bs-collapse-toggle> Données du contrôle </a>
      </div>
      <div class="panel-collapse" bs-collapse-target>
        <div class="panel-body">
          <ng-include src="'js/XG/widgets/ancapp/main/views/controle/FO1/donnees_controle.html'" />
        </div>
      </div>
    </div>
    <div class="panel panel-info">
      <div class="panel-heading">
        <a bs-collapse-toggle> Avis </a>
      </div>
      <div class="panel-collapse" bs-collapse-target>
        <div class="panel-body">
          <ng-include src="'js/XG/widgets/ancapp/main/views/controle/FO1/avis_tech.html'" />
        </div>
      </div>
    </div>
  </div>
</div>