public function add($ajax = null)
 {
     $login = Auth::check('member');
     $location = Locations::create($this->request->data);
     $actief = self::$actief;
     $breadcrumb = self::$breadcrumb;
     if ($this->request->data && $location->save()) {
         return compact('login', 'location', 'actief', 'breadcrumb');
     }
     return compact('login', 'location', 'product', 'actief', 'breadcrumb');
 }
Пример #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Locations::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['cellar_loc_id' => $this->cellar_loc_id, 'cellar_id' => $this->cellar_id]);
     $query->andFilterWhere(['like', 'location', $this->location]);
     return $dataProvider;
 }
 public function edit($username)
 {
     $login = Auth::check('member');
     $user = Users::find('first', array('conditions' => array('username' => $username)));
     if ($login['rol'] != 'administrator' && $user->username != $login->username) {
         return $this->redirect('/');
     }
     if ($this->request->data) {
         $user->username = $this->request->data['username'];
         if (!empty($this->request->data['password'])) {
             $user->password = $this->request->data['password'];
         }
         $user->location = $this->request->data['location'];
         $user->voornaam = $this->request->data['voornaam'];
         $user->achternaam = $this->request->data['achternaam'];
         $user->rol = $this->request->data['rol'];
         if ($user->save()) {
             return $this->redirect('users/view/' . $username);
         }
     }
     $locations = Locations::find('all', array('order' => array('district' => 'ASC')));
     foreach ($locations as $key => $location) {
         $provincie = $locations[$key]['provincie'];
         $district = $locations[$key]['district'];
         if ($login['rol'] != 'administrator') {
             if ($provincie == $login['location']) {
                 $locaties[$district] = $district . ' (' . $locations[$key]['provincie'] . ')';
             }
         } else {
             $locaties[$district] = $district . ' (' . $locations[$key]['provincie'] . ')';
         }
     }
     $actief = self::$actief;
     $breadcrumb = self::$breadcrumb;
     $breadcrumb[] = array('naam' => 'Gebruiker bewerken');
     return compact('user', 'login', 'actief', 'breadcrumb', 'locaties');
 }
Пример #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getLocations()
 {
     return $this->hasMany(Locations::className(), ['cellar_id' => 'id']);
 }
Пример #5
0
 /**
  * Finds the Locations model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Locations the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Locations::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #6
0
<?php

use app\models\Cellars;
use app\models\Wines;
use app\models\Locations;
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use kartik\widgets\ActiveForm;
use kartik\widgets\Select2;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
/**
 * @var yii\web\View $this
 * @var app\models\Cellarwines $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="cellarwines-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['cellar_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Cellars::find()->orderBy('cellar_name')->asArray()->all(), 'id', 'cellar_name')], 'wine_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => Wines::getListing()], 'quantity' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Quantity...']], 'cellar_loc_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Locations::find()->orderBy('loc_name')->asArray()->all(), 'id', 'loc_name')], 'rating' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Rating...']], 'created_at' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Created At...']], 'updated_at' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Updated At...']], 'cost' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Cost...', 'maxlength' => 10]]]]);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
ActiveForm::end();
?>

</div>
Пример #7
0
 public static function locationFilter($id = "")
 {
     $data = \App\Models\Locations::all();
     if ($id != "") {
         $data = \App\Models\Locations::where('area_id', $id)->get();
     }
     $selecttop = '<select name="location_id" id="location_id"  class="form-control select2">';
     $option = '<option value="">- Select Location -</option>';
     foreach ($data as $key => $value) {
         $option = $option . "<option value='{$value->id}'>{$value->name}</option>";
     }
     $selectbottom = '</select>';
     $list = $selecttop . $option . $selectbottom;
     return $list;
 }
Пример #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCellarLoc()
 {
     return $this->hasOne(Locations::className(), ['cellar_loc_id' => 'cellar_loc_id']);
 }
Пример #9
0
 public function buildForm()
 {
     $this->add('bank_id', 'select', ['attr' => ['class' => 'frm-e form-control'], 'choices' => \App\Models\Banks::lists("name", "id")->toArray(), 'empty_value' => '- Select Banks -', 'label' => 'Bank'])->add('area_id', 'select', ['attr' => ['class' => 'frm-e form-control'], 'choices' => \App\Models\Areas::lists("name_area", "id")->toArray(), 'empty_value' => '- Select Area-', 'label' => 'Area'])->add('location_id', 'select', ['attr' => ['class' => 'frm-e form-control'], 'choices' => \App\Models\Locations::lists("name", "id")->toArray(), 'empty_value' => '- Select Lokasi-', 'label' => 'Lokasi'])->add('machine_id', 'select', ['attr' => ['class' => 'frm-e form-control'], 'choices' => \App\Models\Machines::lists("name_machine", "id")->toArray(), 'empty_value' => '- Pilih Mesin -', 'label' => 'Mesin'])->add('from', 'text', ['attr' => ['class' => 'form-control datepicker1', 'required' => 'true']])->add('to', 'text', ['attr' => ['class' => 'form-control datepicker2', 'required' => 'true']])->add('format', 'choice', ['choices' => ['pdf' => 'PDF', 'csv' => 'CSV', 'xls' => 'XLS'], 'attr' => ['required' => 'true'], 'label' => "Format", 'choice_options' => ['wrapper' => ['class' => 'choice-wrapper']]]);
 }
 public function add_provincie()
 {
     $login = Auth::check('member');
     $lijsten = Lijsten::find('all');
     $locaties = '';
     foreach ($lijsten as $key => $lijst) {
         $locatie = Locations::find('first', array('conditions' => array('districtnummer' => $lijsten[$key]['districtscode'])));
         Lijsten::Update(array('$set' => array('provincie' => $locatie->provincie)), array('_id' => $lijsten[$key]['_id']));
         $locaties .= $lijsten[$key]['districtscode'] . ' => ' . $locatie->provincie . ' SET<br />';
     }
     $actief = self::$actief;
     $breadcrumb = self::$breadcrumb;
     $breadcrumb[] = array('naam' => 'Lijsten bekijken');
     return compact('login', 'actief', 'breadcrumb', 'locaties');
 }