} else { return "No"; } }, 'options' => array('width' => 60), 'format' => 'raw'], ['attribute' => 'status', 'value' => function ($data) { $details = ""; if ($data->is_disputed == 1) { $details = ""; } else { if ($data->is_disputed != 1 && $data->shipment_date == "0000-00-00") { $details = ""; } else { if ($data->is_disputed != 1 && $data->delivery_date != "0000-00-00" && $data->shipment_date != "0000-00-00") { $details = " - received on " . $data->delivery_date; } else { if ($data->is_disputed != 1 && $data->delivery_date == "0000-00-00" && $data->shipment_date != "0000-00-00") { $details = " - en route since " . \app\models\Package::getDaysElapsed($data->shipment_date); } else { $details = ""; } } } } return "<b style='color:red;'>" . $data->status . "</b>" . $details; }, 'filter' => Html::activeDropDownList($searchModel, 'status', ArrayHelper::map(\app\models\Package::find()->orderBy(['status' => SORT_ASC])->addGroupBy(['status'])->asArray()->all(), 'status', 'status'), ['class' => 'form-control', 'prompt' => 'Select...']), 'options' => array('width' => 160), 'format' => 'raw'], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'width:105px;'], 'template' => '{view} {shipped} {received} {update} {delete}', 'buttons' => ['shipped' => function ($url, $model) { if ($model->shipment_date == "0000-00-00") { $shippedButtonClass = "glyphicon-unchecked"; $shippedButtonTitle = "Mark item as shipped?"; } else { $shippedButtonClass = "glyphicon-check"; $shippedButtonTitle = "Mistake? Mark item not shipped"; }