Ejemplo n.º 1
0
 /**
  * Lists all SalesActivity models.
  * @return mixed
  */
 public function actionIndex()
 {
     $resGroupsModel = \app\models\ResGroups::find()->where('name like :name')->addParams([':name' => 'All Sales User'])->one();
     $salesData = new ArrayDataProvider(['allModels' => $resGroupsModel->users, 'sort' => ['attributes' => ['name'], 'defaultOrder' => ['name' => SORT_ASC]]]);
     $searchModel = new SalesActivitySearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'salesData' => $salesData]);
 }
Ejemplo n.º 2
0
 public function actionUserlist($search = null, $id = null)
 {
     $out = ['more' => false];
     if (!is_null($search)) {
         $query = new Query();
         $query->select('id, login AS text')->from('res_users')->where(['like', 'login', $search])->limit(20);
         $command = $query->createCommand();
         $data = $command->queryAll();
         $out['results'] = array_values($data);
     } elseif ($id > 0) {
         $out['results'] = ['id' => $id, 'text' => ResGroups::find($id)->login];
     } else {
         $out['results'] = ['id' => 0, 'text' => 'No matching records found'];
     }
     echo Json::encode($out);
 }
Ejemplo n.º 3
0
use yii\helpers\Html;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\widgets\DatePicker;
use kartik\widgets\Select2;
use yii\web\JsExpression;
/* @var $this yii\web\View */
/* @var $model app\models\SalesActivitySearch */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="sales-activity-search">

    <?php 
$form = ActiveForm::begin(['action' => [''], 'method' => 'get']);
$saleGroup = \app\models\ResGroups::find()->select('id')->with(['users', 'users.partner' => function ($query) {
    $query->orderBy('name ASC');
}])->where(['name' => 'All Sales User'])->asArray()->one();
$saleUsers = \yii\helpers\ArrayHelper::map($saleGroup['users'], 'id', 'partner.name');
// var_dump($saleGroup);
?>
    <div class="form-group">
        <label class="controll-label" for="sales">Sales</label>
        <?php 
echo Select2::widget(['model' => $model, 'attribute' => 'sales', 'data' => $saleUsers, 'value' => Yii::$app->request->get('sales'), 'options' => ['placeholder' => 'Select Sales ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
    </div>
    <div class="form-group">
        <label class="controll-label" for="customer">Customer</label>

        <?php 
Ejemplo n.º 4
0
 /**
  * Get User who in Management User Group
  * @return Has Many Rel ResUsers of ResGroups
  */
 private function getTrackOrderManagementUsers()
 {
     return \yii\helpers\ArrayHelper::map(ResGroups::find()->where(['name' => 'Management'])->one()->users, 'id', 'login');
 }