<div class="task-overview">
    <h2>{{task.title}}</h2>

    <table class="task-overview-details">
        <tbody>
        <tr>
            <td class="task-overview-details-description" translate>Effective date: </td>
            <td class="task-overview-details-data">{{task.dataDate | date:'yyyy-MM-dd'}}</td>
        </tr>
        <tr ng-if="workflowRule === 'soft' || workflowRule === 'hard'">
            <td class="task-overview-details-description" translate>Current status: </td>
            <td class="task-overview-details-data">{{task.status | translate }}</td>
        </tr>
        <tr>
            <td class="task-overview-details-description" translate>Assigned to: </td>
            <td class="task-overview-details-data">{{task.assigned_to | userIdToName}}</td>
        </tr>
        <tr>
            <td class="task-overview-details-description" translate>Created at: </td>
            <td class="task-overview-details-data">{{task.created_at | date:'yyyy-MM-dd HH:mm:ss'}}</td>
        </tr>
        <tr>
            <td class="task-overview-details-description" translate>Last modified at: </td>
            <td class="task-overview-details-data">{{task.last_modified_at | date:'yyyy-MM-dd HH:mm:ss'}}</td>
        </tr>
        <tr>
            <td class="task-overview-details-description" translate>Last modified by: </td>
            <td class="task-overview-details-data">{{task.last_modified_by | userIdToName}}</td>
        </tr>

        </tbody>
    </table>

    <p ng-bind-html="task.description"></p>

    <div class="task-overview-update-status" ng-if="!fromArchive && (workflowRule === 'soft' || workflowRule === 'hard')">
        <p translate>Update workflow status to:</p>

        <ul>
            <li><a class="link-as-button" ng-click="changeStatus('New')" translate>New</a></li>
            <li><a class="link-as-button" ng-click="changeStatus('Open')" translate>Open</a></li>
            <li><a class="link-as-button" ng-click="changeStatus('Done')" translate>Done</a></li>
            <li><a class="link-as-button" ng-click="changeStatus('Reviewed')" translate>Reviewed</a></li>
        </ul>
    </div>


    <table class="task-overview-workflow-changes" ng-if="workflowRule === 'soft' || workflowRule === 'hard'">
        <thead>
        <tr>
            <th translate>Date</th>
            <th translate>New Status</th>
            <th translate>Set by...</th>
        </tr>
        </thead>

        <tbody>
        <tr ng-repeat="workflow in task.workflowChanges track by workflow.change_at">
            <td>{{workflow.change_at | date:'yyyy-MM-dd HH:mm:ss'}}</td>
            <td>{{workflow.status | translate }}</td>
            <td>{{workflow.change_by | userIdToName}}</td>
        </tr>
        </tbody>
    </table>

    <div class="task-overview-archive" ng-if="!fromArchive && hasArchivePermissions && (workflowRule !== 'hard' || task.status === 'Reviewed') && !isSaving">
        <button ng-click="archiveTask()" translate>Archive this task</button>
    </div>

    <div class="task-overview-saving loadingIndicator" ng-show="isSaving" translate>
      Saving... Please wait.
    </div>

    <div class="task-overview-interactions" ng-if="task.id >= 0">
        <interaction-buttons target-type="'task'"
                             target-id="task.id"
                             target-description="task.title"
                             source-url="'#/tasks/' + task.id"
                             interaction-summary="task.interactionSummary">
    </div>
</div>
