Пример #1
0
  <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center']], ['label' => 'Isi Tugas', 'value' => 'task_detail', 'format' => 'html', 'attribute' => 'task_detail', 'headerOptions' => ['class' => 'text-center']], ['label' => 'Tanggal Mulai', 'value' => function ($data) {
    $keterangan = date('d F Y', strtotime($data->task_start));
    return $keterangan;
}, 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center']], ['label' => 'Tanggal Selesai', 'value' => function ($data) {
    $keterangan = date('d F Y', strtotime($data->task_end));
    return $keterangan;
}, 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center']], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Lampiran', 'template' => '{download}', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center'], 'buttons' => ['download' => function ($url, $model) {
    if (!empty($model->attachment)) {
        return Html::a('<i class="fa fa-download fa-2x"></i>', Url::to(['download', 'id' => $model->id]), ['title' => 'Download Lampiran']);
    }
    return '-';
}]], ['value' => function ($model) {
    return Status::getPeriod($model->period);
}, 'attribute' => 'period', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center'], 'header' => 'Periode'], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Status Tugas', 'template' => '{update}', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center'], 'buttons' => ['update' => function ($url, $model) {
    $taskStatus = Status::getTaskStatus($model->status);
    $taskColor = Status::getTaskColor($model->status);
    return Html::a($taskStatus, '#', ['title' => Yii::t('app', 'Status Tugas'), 'data-id' => $model->id, 'class' => 'btn ' . $taskColor . ' btn-md modal-status']);
}]], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['class' => 'text-center'], 'buttons' => ['delete' => function ($url, $model) {
    $url = ['task/reply-delete', 'id' => $model->id];
    if ($model->task_to === Yii::$app->user->getId()) {
        return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Apakah anda yakin data tugas ini akan dihapus?')]);
    }
}, 'update' => function ($url, $model) {
    $url = ['task/reply-update', 'id' => $model->id];
    if ($model->task_to === Yii::$app->user->getId()) {
        return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update')]);
    }
}]]]]);
?>
</div>
Пример #2
0
}, 'update' => function ($url, $model) {
    // jika tugas dari sama dengan user yang sedang login
    // maka tampilkan icon update
    if ($model->task_from === Yii::$app->user->getId()) {
        return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update')]);
    }
}]]]]);
Panel::end();
?>

<?php 
Modal::begin(['header' => 'Ubah Status Tugas', 'id' => 'modal-ubah-status-tugas', 'clientOptions' => ['backdrop' => false]]);
$colorList = Status::getTaskColorList();
echo '<div style="margin:0 auto" class="text-center">';
foreach ($colorList as $key => $val) {
    echo Html::a(Status::getTaskStatus($key), '#', ['class' => 'btn ' . $val . ' btn-md task-status', 'data-status' => $key]) . '&nbsp;';
}
echo '</div>';
Modal::end();
?>

<?php 
$this->registerJs('$(document).ready(function(){

    var id_status = "";

    $("body").on("click", ".modal-status", function(e){
        e.preventDefault();
        id_status = $(this).data("id");

        $("#modal-ubah-status-tugas").modal("show");
Пример #3
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ListView;
use yii\widgets\DetailView;
use app\components\Status;
use app\components\Panel;
/* @var $this yii\web\View */
/* @var $model app\models\Task */
$this->title = 'Detil Tugas : ' . $model->task_title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Tasks'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Panel::begin(['title' => $this->title, 'icon' => 'fa fa-file-text-o']);
?>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => [['label' => 'Judul Tugas', 'value' => $model->task_title], ['label' => 'Tanggal Mulai & Selesai Tugas', 'value' => date('d F Y', strtotime($model->task_start)) . ' s.d ' . date('d F Y', strtotime($model->task_end))], ['label' => 'Lampiran', 'value' => call_user_func(function ($model) {
    if (!empty($model->attachment)) {
        return Html::a('<i class="fa fa-download fa-2x"></i>', Url::to(['download', 'id' => $model->id]), ['title' => 'Download Lampiran']);
    }
}, $model), 'format' => 'html'], ['label' => 'Status Tugas', 'value' => Status::getTaskStatus($model->status)], ['label' => 'Periode Tugas', 'value' => Status::getPeriod($model->period)], ['label' => 'Detil Tugas', 'value' => $model->task_detail, 'format' => 'html']]]);
?>
     <?php 
echo Html::a('<i class="fa fa-arrow-left"></i> ' . Yii::t('app', 'Kembali'), ['index'], ['class' => 'btn btn-lg btn-warning']);
?>

<?php 
Panel::end();