<?php

use home\assets\MainAsset;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use home\modules\customer\models\Contacter;
use common\models\Common;
use home\models\Attachment;
use common\models\PermissionScope;

/* @var $this \yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \home\modules\customer\models\Customer */

$this->title = '详情-' . $model->name;

$deletePermissions = PermissionScope::getScopeUser('schedule/schedule/delete');
$viewPermissions = PermissionScope::getScopeUser('schedule/schedule/view');
$js = '';
if ($viewPermissions === false || (!in_array($model->user_id, $viewPermissions) && !empty($viewPermissions))) {
    $js.= <<<JS
    art.dialog.top.$('.aui_buttons button').eq(1).attr("disabled",true);
JS;
}
if ($deletePermissions === false || (!in_array($model->user_id, $deletePermissions) && !empty($deletePermissions))) {
    $js.= <<<JS
    art.dialog.top.$('.aui_buttons button').eq(2).attr("disabled",true);
JS;
}


empty($js) || $this->registerJs($js);
?>


<!--container-->
<div class="container manage-project fix">
    <!--manage-left -->

    <div class="manage-right">
        <div class="mgt10">
            <table class="table task-table taskdetail-table">
                <tr>
                    <td width="15%" class="table-blue" >主题</td>
                    <td width="35%" ><?= $model['title'] ?></td>
                    <td width="15%" class="table-blue"  >日期</td>
                    <td width="35%"><?= date('Y-m-d', $model['create_time']) ?></td>
                </tr>
                <tr>
                    <td width="15%" class="table-blue"  ><?= $model['type_name'] ?></td>
                    <td width="35%" ><?= $model['name'] ?></td>
                    <td width="15%" class="table-blue"  >联系人</td>
                    <td width="35%"> <?= empty($model['contacter']['name']) ? '无' : $model['contacter']['name'] ?></td>
                </tr>
                <tr>
                    <td width="15%" class="table-blue"  >执行人</td>
                    <td width="35%"><?= $model['join_names'] ?></td>
                    <td width="15%" class="table-blue"  >类型</td>
                    <td width="35%"> <?= empty($model['category']['name']) ? '无' : $model['category']['name'] ?></td>
                </tr>
                <tr>
                    <td width="15%" class="table-blue"  >行动描述</td>
                    <td width="85%" colspan="3"  style=" text-align: left"><?= $model['content'] ?></td>
                </tr>
                <tr>
                    <td width="15%" class="table-blue"  >附件</td>
                    <td width="85%" colspan="3"  style=" text-align: left">
                        <?php if (!$attachs = Attachment::getAttachByDot($model['attach_ids'])) : ?>
                        <?php else : ?>
                            <?php foreach ($attachs as $attach) : ?>
                                <p><a href="<?= Url::to(['/attachment/download', 'id' => $attach['attach_id']]) ?>" title="点击下载" ><?= $attach['file_name'] ?></a> <?php if ($attach['is_image'] == 1) : ?> <a href="javascript:parent.imagePriview('<?= $attach['file_path'] ?>')" >[预览]</a><?php endif; ?></p>
                            <?php endforeach; ?>
                        <?php endif; ?>
                    </td>
                </tr>

            </table>
        </div>
        <!--loglist-->
    </div>
    <!--manage-right-->
</div>
<!--container-->
