Ejemplo n.º 1
0
<div class="row">
<div class="form col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<?php 
$form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'cards-form', 'htmlOptions' => array('class' => 'well'), 'enableAjaxValidation' => false));
?>
    <legend><?php 
echo CHtml::encode($legend);
?>
</legend>
    <p class="note"><span class="help-block"><?php 
echo Yii::t('app', 'Fields with <span class="required">*</span> are required.');
?>
</span></p>
    <?php 
//echo $form->errorSummary($model);
?>
    <?php 
echo $form->dropDownListGroup($model, 'series', array('widgetOptions' => array('data' => Cards::getSeriesList())));
?>
    <?php 
echo $form->textFieldGroup($model, 'number');
?>
    <?php 
echo $form->dropDownListGroup($model, 'expired_var', array('widgetOptions' => array('data' => Cards::getExpiredList())));
?>
    <?php 
$this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => Yii::t('app', 'Create')));
$this->endWidget();
?>

</div><!-- form -->
Ejemplo n.º 2
0
Booster::getBooster()->registerPackage('datepicker');
$cs = Yii::app()->clientScript;
$cs->registerScript(__CLASS__ . __LINE__, 'jQuery("#CardsHistory_action_date").datepicker({"language":"' . Yii::app()->language . '", format:"dd.mm.yyyy"}); jQuery("#CardsHistory_action_date").on("changeDate", function(ev){
    jQuery(this).datepicker("hide");
});', CClientScript::POS_READY);
?>

<h1><?php 
echo Yii::t('app', 'History of the card #') . CHtml::encode($model->number);
?>
</h1>
<div class="row">
    <div class="col-sm-6">
        <?php 
$this->widget('booster.widgets.TbDetailView', array('data' => $model, 'type' => array('striped', 'bordered'), 'attributes' => array(array('name' => 'series', 'type' => 'raw', 'value' => function ($data) {
    return Cards::getSeriesList($data->series);
}), 'number', array('name' => 'created_at', 'type' => 'raw', 'value' => function ($data) {
    return date("d.m.Y H:i:s", strtotime($data->created_at));
}), array('name' => 'expired_at', 'type' => 'raw', 'value' => function ($data) {
    return date("d.m.Y H:i:s", $data->expired_at);
}), array('name' => 'status', 'type' => 'raw', 'value' => function ($data) {
    return $data->cardStatus;
}))));
?>
    </div>
    <div class="col-sm-6">
        <?php 
$this->widget('booster.widgets.TbGridView', array('id' => 'history-grid', 'dataProvider' => $historyModel->search(), 'filter' => $historyModel, 'afterAjaxUpdate' => 'function(){
jQuery("#CardsHistory_action_date").datepicker({"language":"' . Yii::app()->language . '", format:"dd.mm.yyyy"}); jQuery("#CardsHistory_action_date").on("changeDate", function(ev){
    jQuery(this).datepicker("hide");
});}', 'type' => 'striped bordered', 'template' => "{items}\n{pager}", 'enablePagination' => true, 'pager' => array('class' => 'booster.widgets.TbPager'), 'columns' => array('action_date' => array('name' => 'action_date', 'value' => 'date("d.m.Y H:i:s", strtotime($data->action_date))', 'htmlOptions' => array('data-title' => Yii::t('app', 'Date'))), 'status' => array('name' => 'status', 'filter' => CardsHistory::getStatusList(), 'value' => '$data->cardStatus', 'type' => 'raw', 'htmlOptions' => array('data-title' => Yii::t('app', 'Status'))))));
Ejemplo n.º 3
0
/* @var $this CardsController */
/* @var $model Cards */
Booster::getBooster()->registerPackage('datepicker');
$cs = Yii::app()->clientScript;
$cs->registerScript(__CLASS__ . __LINE__, 'jQuery("#Cards_created_at").datepicker({"language":"' . Yii::app()->language . '", format:"dd.mm.yyyy"}); jQuery("#Cards_created_at").on("changeDate", function(ev){
    jQuery(this).datepicker("hide");
});', CClientScript::POS_READY);
$cs->registerScript(__CLASS__ . __LINE__, 'jQuery("#Cards_expired_at").datepicker({"language":"' . Yii::app()->language . '", format:"dd.mm.yyyy"}); jQuery("#Cards_expired_at").on("changeDate", function(ev){
    jQuery(this).datepicker("hide");
});', CClientScript::POS_READY);
?>

<h1><?php 
echo Yii::t('app', 'Manage cards');
?>
</h1>

<hr>
<?php 
$this->widget('booster.widgets.TbButtonGroup', array('buttons' => array(array('label' => Yii::t('app', 'Create card'), 'buttonType' => 'link', 'url' => array('create'), 'icon' => 'plus', 'context' => 'success', 'htmlOptions' => array('title' => Yii::t('app', 'Create card'))))));
echo '<hr>';
$this->widget('booster.widgets.TbGridView', array('dataProvider' => $model->search(), 'filter' => $model, 'type' => 'striped bordered', 'template' => "{items}\n{pager}", 'enablePagination' => true, 'afterAjaxUpdate' => 'function(){
jQuery("#Cards_created_at").datepicker({"language":"' . Yii::app()->language . '", format:"dd.mm.yyyy"}); jQuery("#Cards_created_at").on("changeDate", function(ev){
        jQuery(this).datepicker("hide");
    });
jQuery("#Cards_expired_at").datepicker({"language":"' . Yii::app()->language . '", format:"dd.mm.yyyy"}); jQuery("#Cards_expired_at").on("changeDate", function(ev){
    jQuery(this).datepicker("hide");
});    
}', 'pager' => array('class' => 'booster.widgets.TbPager'), 'columns' => array('series' => array('name' => 'series', 'filter' => Cards::getSeriesList(), 'type' => 'raw', 'value' => 'Cards::getSeriesList($data->series)', 'htmlOptions' => array('data-title' => Yii::t('app', 'Series'))), 'number' => array('name' => 'number', 'htmlOptions' => array('data-title' => Yii::t('app', 'Number'))), 'created_at' => array('name' => 'created_at', 'value' => 'date("d.m.Y H:i:s", strtotime($data->created_at))', 'htmlOptions' => array('data-title' => Yii::t('app', 'Issue date'))), 'expired_at' => array('name' => 'expired_at', 'value' => 'date("d.m.Y H:i:s", $data->expired_at)', 'htmlOptions' => array('data-title' => Yii::t('app', 'Expiration date'))), 'status' => array('name' => 'status', 'filter' => Cards::getStatusList(), 'value' => '$data->cardStatus', 'type' => 'raw', 'htmlOptions' => array('data-title' => Yii::t('app', 'Status'))), array('class' => 'booster.widgets.TbToggleColumn', 'toggleAction' => 'update', 'filter' => false, 'name' => 'status', 'value' => '$data->status==1', 'uncheckedIcon' => 'ok-circle', 'uncheckedButtonLabel' => Yii::t('app', 'Activation'), 'checkedIcon' => 'ban-circle', 'checkedButtonLabel' => Yii::t('app', 'Deactivation'), 'header' => Yii::t('app', 'Change status'), 'htmlOptions' => array('data-title' => Yii::t('app', 'Change status'), 'style' => 'text-align:center;')), array('class' => 'booster.widgets.TbButtonColumn', 'updateButtonOptions' => array('style' => 'display:none'), 'viewButtonIcon' => 'time', 'viewButtonOptions' => array('title' => Yii::t('app', 'View history')), 'htmlOptions' => array('data-title' => Yii::t('app', 'Action'))))));