<div class="taskManager">
  <!--<h4> Controle d'installation CI20160831X</h4>-->

  <div class="mhead">
    <div class="up">
      <div class="mfilter">
        <input
          type="text"
          class="form-control"
          ng-model="filter.tasks"
          placeholder="{{ 'taskmanager.filter' | translate }}"
        />
      </div>
      <div class="addTask">
        <div class="btn btn-default" ng-click="addTaskDialog()">
          <i class="fa fa-plus"></i
          ><translate>taskmanager.addtask.btn_title</translate>
        </div>
      </div>
    </div>
    <div class="row" ng-show="taskStatuses.annule>0">
      <div class="col-xs-12">
        <input type="checkbox" ng-model="filter.displayCanceled" />
        <translate>taskmanager.display_canceled_task</translate>
        ({{taskStatuses.annule}})
      </div>
    </div>
  </div>

  <div class="alert alert-info" ng-show="!loadingTasks && !tasks.length">
    <translate>taskmanager.notasks</translate>
  </div>

  <div class="tasks">
    <div
      ng-repeat="task in tasks | filter: {properties: {title: filter.tasks}}"
      class="task"
      ng-show="task.properties.status!='annule' || filter.displayCanceled"
    >
      <div class="tinner">
        <div class="thead {{task.properties.status}}">
          <div class="editbtn">
            <div
              class="btn btn-xs btn-default"
              data-placement="right"
              data-template="js/XG/containers/views/popover/taskmanager.edit.task.html"
              data-animation="am-fade-and-scale"
              data-auto-close="true"
              ng-click="pre_editTaskMetaData(task)"
              title="{{ 'taskmanager.task_status' | translate}}"
              bs-popover
            >
              <i
                class="fa fa-clock-o"
                ng-show="task.properties.status=='normal'"
              ></i>
              <i
                class="fa fa-check"
                ng-show="task.properties.status=='cloture'"
              ></i>
              <i
                class="fa fa-times"
                ng-show="task.properties.status=='annule'"
              ></i>
            </div>
          </div>
          <div class="taskTitle">
            {{ task.properties.title}}
          </div>
          <div class="actions text-right">
            <div
              class="btn btn-xs btn-default"
              data-placement="left"
              data-template="js/XG/containers/views/popover/taskmanager.edit.taskgeneral.html"
              data-animation="am-fade-and-scale"
              data-auto-close="true"
              ng-click="pre_editTaskGeneral(task)"
              title="{{ 'taskmanager.task_data' | translate}}"
              bs-popover
            >
              <i class="fa fa-gear"></i>
            </div>
            <div
              class="btn btn-xs btn-default"
              title="{{ 'taskmanager.addevent.button' | translate}}"
              ng-click="editEventTaskDialog(task)"
            >
              <i class="fa fa-plus"></i>
            </div>
            <div
              class="btn btn-xs btn-default"
              ng-disabled="!tasksEvents[task.id].length"
              title="{{ 'taskmanager.tasktotpl.button' | translate}}"
              ng-click="taskToTemplateDialog(task)"
            >
              <i class="fa fa-save"></i>
            </div>
          </div>
        </div>

        <div class="theaddesc">
          <div class="desc">
            <!--<i class="fa fa-info-circle"></i>-->
            <i ng-bind-html="task.properties.description  | nl2br"></i>
          </div>
        </div>

        <div class="tloadingevent" ng-show="!tasksEvents[task.id]">
          <i class="fa fa-spinner fa-spin"></i>
        </div>
        <div class="tnoevents" ng-show="tasksEvents[task.id].length==0">
          <translate>taskmanager.noevents</translate>
        </div>

        <div class="tevents" ng-show="tasksEvents[task.id]">
          <div
            class="tevent {{ event.properties.status}}"
            ng-show="tasksEvents[task.id].length"
            ng-repeat="event in tasksEvents[task.id] track by $index"
          >
            <div class="editbtn">
              <div
                class="btn btn-xs btn-default"
                data-placement="right"
                data-template="js/XG/containers/views/popover/taskmanager.edit.event.html"
                data-animation="am-fade-and-scale"
                data-auto-close="true"
                ng-click="pre_editEventMetaData(event,task,$index)"
                title="{{ 'taskmanager.event_status' | translate}}"
                bs-popover
              >
                <i
                  class="fa fa-clock-o"
                  ng-show="event.properties.status=='normal'"
                ></i>
                <i
                  class="fa fa-check"
                  ng-show="event.properties.status=='acquitte'"
                ></i>
                <i
                  class="fa fa-times"
                  ng-show="event.properties.status=='annule'"
                ></i>
              </div>
            </div>

            <div class="tdate" style="background: #{{event.properties.color }}">
              <div
                class="dm"
                title="{{ event.properties.start | date:'dd-MM-yyyy'}}"
              >
                {{ event.properties.start | date:'dd-MM'}}
              </div>
              <!--  <div class="y"> {{ event.properties.start | date:'yyyy'}} </div>-->
            </div>

            <div class="titledesc">
              <div class="title">
                <a
                  ng-show="event.properties.status!='annule'"
                  href=""
                  ng-click="editEventTaskDialog(task,event,$index)"
                  >{{ event.properties.title}}</a
                >
                <b ng-show="event.properties.status=='annule'"
                  >{{ event.properties.title}}</b
                >
              </div>
              <div
                class="desc"
                ng-bind-html="event.properties.description | nl2br"
              ></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
