
<li class="task <? if ( !\factory\Tasks::is_taks_is_opened_by_user( $this -> task['id'], $this -> user['id'] ) ):?> notopened<? endif;?>" task_id="<?= $this -> task['id'];?>">
  <div class="top">
    <div class="_users">
      <? if ( is_array( $this -> task['users'] ) ): foreach ( $this -> task['users'] as $user_tmp_id ):?>
        <?
          $user_tmp = \factory\Users::user_details( $user_tmp_id );
          echo '<div class="user" style="background: ' . $user_tmp['color'] . '" title="' . $user_tmp['name'] . $user_tmp['surname'] . '">' . $user_tmp['name'][0] . $user_tmp['surname'][0] . '</div>';
        ?>
      <? endforeach; endif;?>
    </div>
    <div class="_timer">
      <a href="#" class="task_start <? if ( $this -> task_open ):?> hidden<? endif;?>" task_id="<?= $this -> task['id'];?>">
        <i class="fa fa-play"></i>
      </a>
      <a href="#" class="task_end <? if ( !$this -> task_open ):?> hidden<? else:?> animate<? endif;?>" task_id="<?= $this -> task['id'];?>">
        <i class="fa fa-stop"></i>
      </a>
      <? if ( $this -> task['recursively'] ):?>
        <div class="recursively">
          <i class="fa fa-solid fa-repeat"></i>
        </div>
      <? endif;?>
    </div>
  </div>
  <div class="middle">
    <a href="#" class="name"><?= $this -> task['name'];?></a>
    <? if ( $this -> task['date_start'] or $this -> task['date_end'] ):?>
      <div class="dates">
        <? if ( $this -> task['date_start'] ):?>
          <div class="date_start"><i class="fa fa-regular fa-calendar"></i><?= $this -> task['date_start'];?></div>
        <? endif;?>
        <? if ( $this -> task['date_end'] ):?>
          <div class="date_end <? if ( $this -> task['status'] != 2 and $this -> task['date_end'] == date( 'Y-m-d' ) ):?> warning<? endif;?> <? if ( $this -> task['status'] != 2 and $this -> task['date_end'] < date( 'Y-m-d' ) ):?> danger<? endif;?>"><i class="fa fa-regular fa-calendar"></i><?= $this -> task['date_end'];?></div>
        <? endif;?>
      </div>
    <? endif;?>
    <div class="bottom">
      <div class="current_status">
        Status:<br><strong><?= $this -> statuses[ $this -> task['status'] ];?></strong>
        <div class="status_change">
          <select name="task_status" task_id="<?= $this -> task['id'];?>">
            <? foreach ( \factory\Tasks::get_statuses() as $key => $status ):?>
              <option value="<?= $key;?>" <? if ( $this -> task['status'] == $key ):?>selected="selected"<? endif;?>><?= $status;?></option>
            <? endforeach;?>
          </select>
        </div>
      </div>
      <? if ( $this -> task['client_id'] ):?>
        <div class="client_info" task-id="<?= $this -> task['id'];?>">Klient:<br><strong><?= \factory\Crm::get_client_name( $this -> task['client_id'] );?></strong></div>
      <? endif;?>
    </div>
  </div>
</li>