示例#1
0
文件: view.php 项目: netscorpion/CRM
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
// use yii\widgets\DetailView;
use kartik\detail\DetailView;
use kartik\grid\GridView;
/* @var $this yii\web\View */
/* @var $model app\models\Partner */
// Добавление моделей
use app\models\AppBankAccount;
use app\models\AppPatrnerType;
$this->title = $model->Name;
$this->params['breadcrumbs'][] = ['label' => 'Контрагенты', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
/*************************************************************************
 * Подготовка данных для представления в 
 ************************************************************************/
$attributes = [['group' => true, 'label' => 'Общая информация', 'rowOptions' => ['class' => 'info']], 'Name:ntext', 'FullName', ['group' => true, 'label' => 'Контактная информация', 'rowOptions' => ['class' => 'info']], 'MailAddress', 'ActualAddress', 'Phone', 'Fax', 'Email:email', ['group' => true, 'label' => 'Юридическая информация', 'rowOptions' => ['class' => 'info']], 'LegalAddress', ['columns' => [['attribute' => 'INN', 'valueColOptions' => ['style' => 'width:30%']], ['attribute' => 'KPP', 'valueColOptions' => ['style' => 'width:30%']]]], ['attribute' => 'ID_BankAccount', 'value' => $model->ID_BankAccount != null ? $model->iDBankAccount->Account : '', 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(AppBankAccount::find()->all(), 'ID', 'Account', 'bank.Name')]], ['attribute' => 'ID_TypePatrner', 'value' => $model->ID_TypePatrner != null ? $model->iDTypePatrner->description : '', 'type' => DetailView::INPUT_SELECT2, 'widgetOptions' => ['data' => ArrayHelper::map(AppPatrnerType::find()->all(), 'ID', 'description')]]];
// View file rendering the widget
echo DetailView::widget(['model' => $model, 'condensed' => true, 'hover' => true, 'mode' => DetailView::MODE_VIEW, 'panel' => ['heading' => 'Клиент : ' . $model->FullName, 'type' => DetailView::TYPE_PRIMARY], 'attributes' => $attributes, 'deleteOptions' => ['url' => ['delete', 'id' => $model->ID], 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this record?'), 'method' => 'post']]]);
/*****************  Вывод грида по договорам   *************************/
echo Yii::$app->controller->renderPartial('viewcontractgrid', ['model' => $model]);
/*****************  Вывод грида по договорам   *************************/
?>
</div>
示例#2
0
文件: index.php 项目: netscorpion/CRM
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
//use yii\grid\GridView;
use kartik\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel app\models\PartnerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
use app\models\AppPatrnerType;
$this->title = 'Контрагенты';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="partner-index">
<?php 
$gridColumns = [['class' => 'kartik\\grid\\SerialColumn', 'contentOptions' => ['class' => 'kartik-sheet-style'], 'header' => '', 'headerOptions' => ['class' => 'kartik-sheet-style']], ['attribute' => 'FullName'], ['attribute' => 'ID_TypePatrner', 'value' => 'iDTypePatrner.description', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map(AppPatrnerType::find()->all(), 'ID', 'description'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Типы сотрудничества']], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{view}{info}']];
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $gridColumns, 'responsive' => true, 'hover' => true, 'pjax' => true, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-folder-open"></i>' . '&nbsp;&nbsp' . Html::encode($this->title) . '</h3>', 'type' => 'primary', 'before' => Html::a('<i class="glyphicon glyphicon-plus"></i> Создать контрагента', ['create'], ['class' => 'btn btn-success']), 'footer' => false], 'toolbar' => ['{export}', '{toggleData}']]);
?>
    
</div>
示例#3
0
文件: _form.php 项目: netscorpion/CRM
echo $form->field($model, 'Phone')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'Fax')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'Email')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'ID_BankAccount', ['showLabels' => true])->widget(Select2::classname(), ['data' => ArrayHelper::map(AppBankAccount::find()->all(), 'ID', 'Account'), 'pluginOptions' => ['allowClear' => true], 'options' => ['placeholder' => 'Выберете счет...']]);
?>
    <?php 
echo $form->field($model, 'ID_TypePatrner')->dropDownList(ArrayHelper::map(AppPatrnerType::find()->all(), 'ID', 'description'), ['prompt' => 'Тип...']);
?>
                    
</div>    
    
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <hr>
            <?php 
echo Html::submitButton('Создать', ['class' => 'btn btn-primary']);
?>
  
            <?php 
echo Html::resetButton('Очистить', ['class' => 'btn btn-default']);
?>
        </div>
示例#4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getiDTypePatrner()
 {
     return $this->hasOne(AppPatrnerType::className(), ['ID' => 'ID_TypePatrner']);
 }