fix merge conflicts
This commit is contained in:
commit
8e235a8d3c
@ -41,6 +41,9 @@ class AdminMenuStructure{
|
||||
$items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index'] ];
|
||||
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ];
|
||||
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
|
||||
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index'] ];
|
||||
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'] ];
|
||||
$items[] = ['label' => 'Bérletkártyák', 'url' => ['/card/index'] ];
|
||||
|
||||
if ( count($items) > 0 ){
|
||||
$userMainMenu = ['label' => 'Beállítások', 'url' => null,
|
||||
|
||||
159
backend/controllers/CardController.php
Normal file
159
backend/controllers/CardController.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\Card;
|
||||
use backend\models\CardSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\base\Object;
|
||||
use yii\db\Query;
|
||||
use common\models\Customer;
|
||||
use yii\helpers\Json;
|
||||
|
||||
/**
|
||||
* CardController implements the CRUD actions for Card model.
|
||||
*/
|
||||
class CardController extends Controller
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Card models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new CardSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single Card model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Card model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new Card();
|
||||
$model->status = Card::STATUS_ACTIVE;
|
||||
$model->type = Card::TYPE_RFID;
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_card]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing Card model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_card]);
|
||||
} else {
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing Card model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Card model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return Card the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = Card::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Your controller action to fetch the list
|
||||
*/
|
||||
public function actionList($search = null) {
|
||||
$query = new Query();
|
||||
|
||||
$query->select ( [
|
||||
'card.number as number',
|
||||
'customer.name as name',
|
||||
"concat( card.number , case when customer.name is null then '' else customer.name end ) as txt ",
|
||||
] )->from (Card::tableName() )->join("left join", Customer::tableName(), 'card.id_card = customer.id_customer_card')->where ( ' lower(number) LIKE "%' . strtolower ( $search ) . '%"' )->orderBy ( 'number' ) ;
|
||||
|
||||
if ( isset($_GET['onlyFree']) && $_GET['onlyFree'] == '1'){
|
||||
$query->andWhere( 'customer.id_customer is null' );
|
||||
}
|
||||
|
||||
$command = $query->createCommand ();
|
||||
$data = $command->queryAll ();
|
||||
$out = [ ];
|
||||
foreach ( $data as $d ) {
|
||||
$out [] = [
|
||||
'number' => $d ['number'],
|
||||
'name' => $d ['name'],
|
||||
'txt' => $d ['txt'],
|
||||
];
|
||||
}
|
||||
echo Json::encode ( $out );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
172
backend/controllers/CityController.php
Normal file
172
backend/controllers/CityController.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\City;
|
||||
use backend\models\CitySearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\base\Object;
|
||||
use yii\db\Query;
|
||||
use yii\helpers\Json;
|
||||
|
||||
/**
|
||||
* CityController implements the CRUD actions for City model.
|
||||
*/
|
||||
class CityController extends Controller
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all City models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new CitySearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single City model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new City model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new City();
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_city]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing City model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_city]);
|
||||
} else {
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing City model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the City model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return City the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = City::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Your controller action to fetch the list
|
||||
*/
|
||||
public function actionNameList($search = null) {
|
||||
$query = new Query();
|
||||
|
||||
$query->select ( [
|
||||
'name',
|
||||
'min(zip) as zip',
|
||||
'concat( zip, \' \', name) as fullname'
|
||||
] )->from (City::tableName() )->where ( ' lower(name) LIKE "%' . strtolower ( $search ) . '%"' )->orderBy ( 'name' )->groupBy('name')->limit(20);
|
||||
$command = $query->createCommand ();
|
||||
$data = $command->queryAll ();
|
||||
$out = [ ];
|
||||
foreach ( $data as $d ) {
|
||||
$out [] = [
|
||||
'name' => $d ['name'],
|
||||
'zip' => $d ['zip'],
|
||||
'fullname' => $d ['fullname'],
|
||||
];
|
||||
}
|
||||
echo Json::encode ( $out );
|
||||
}
|
||||
/**
|
||||
* Your controller action to fetch the list
|
||||
*/
|
||||
public function actionZipList($search = null) {
|
||||
$query = new Query();
|
||||
|
||||
$query->select ( [
|
||||
'name',
|
||||
'min(zip) as zip',
|
||||
'concat( zip, \' \', name) as fullname'
|
||||
] )->from (City::tableName() )->where ( ' lower(zip) LIKE "%' . strtolower ( $search ) . '%"' )->orderBy ( 'name' )->groupBy('name')->limit(20);
|
||||
$command = $query->createCommand ();
|
||||
$data = $command->queryAll ();
|
||||
$out = [ ];
|
||||
foreach ( $data as $d ) {
|
||||
$out [] = [
|
||||
'name' => $d ['name'],
|
||||
'zip' => $d ['zip'],
|
||||
'fullname' => $d ['fullname'],
|
||||
];
|
||||
}
|
||||
echo Json::encode ( $out );
|
||||
}
|
||||
}
|
||||
131
backend/controllers/CustomerController.php
Normal file
131
backend/controllers/CustomerController.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\Customer;
|
||||
use backend\models\CustomerSearch;
|
||||
use backend\models\CustomerCreate;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\base\Object;
|
||||
use backend\models\CustomerUpdate;
|
||||
|
||||
/**
|
||||
* CustomerController implements the CRUD actions for Customer model.
|
||||
*/
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Customer models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new CustomerSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single Customer model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Customer model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new CustomerCreate();
|
||||
|
||||
$model->country = "Magyarország";
|
||||
$model->id_user = Yii::$app->user->id;
|
||||
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_customer]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing Customer model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
if (($model = CustomerUpdate::findOne($id)) == null) {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_customer]);
|
||||
} else {
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing Customer model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Customer model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return Customer the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = Customer::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
215
backend/controllers/ProcurementController.php
Normal file
215
backend/controllers/ProcurementController.php
Normal file
@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\Procurement;
|
||||
use backend\models\ProcurementSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use common\models\Warehouse;
|
||||
use common\models\Product;
|
||||
use common\models\User;
|
||||
|
||||
/**
|
||||
* ProcurementController implements the CRUD actions for Procurement model.
|
||||
*/
|
||||
class ProcurementController extends Controller
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Procurement models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
|
||||
$warehouses = Warehouse::read(null);
|
||||
$products = Product::read(null);
|
||||
$users = User::read(null);
|
||||
|
||||
$searchModel = new ProcurementSearch();
|
||||
|
||||
$today = time();
|
||||
$tomorrow = time()+86400;
|
||||
$searchModel->timestampStart = date("Y-m-d" , $today );
|
||||
$searchModel->timestampEnd = date("Y-m-d" , $tomorrow );
|
||||
$searchModel->date_start = Yii::$app->formatter->asDate($today);
|
||||
$searchModel->date_end = Yii::$app->formatter->asDate($tomorrow);
|
||||
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
'users' => $users,
|
||||
'products' => $products,
|
||||
'warehouses' => $warehouses,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single Procurement model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Procurement model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new Procurement();
|
||||
$model->scenario = 'create_general';
|
||||
|
||||
$model->id_user = Yii::$app->user->id;
|
||||
|
||||
$warehouses = Warehouse::read(null);
|
||||
|
||||
if ( count($warehouses) <= 0 ){
|
||||
throw new NotFoundHttpException( Yii::t('common/procurement' ,'No active warehouse found.' ));
|
||||
}
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
|
||||
|
||||
$connection = \Yii::$app->db;
|
||||
|
||||
$transaction = $connection->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$product = Product::findOne( $model->id_product );
|
||||
$model->stock = $product->stock;
|
||||
$result = $model->save(false);
|
||||
|
||||
$product->stock = $product->stock + $model->count;
|
||||
$result &= $product->save(false);
|
||||
|
||||
if ($result) {
|
||||
$transaction->commit();
|
||||
} else {
|
||||
$transaction->rollback();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$transaction->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
return $this->redirect(['index' ]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
'warehouses' =>$warehouses
|
||||
]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Creates a new Procurement model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreateProduct($id)
|
||||
{
|
||||
|
||||
$product = $this->findProduct($id);
|
||||
|
||||
$model = new Procurement();
|
||||
|
||||
$warehouses = Warehouse::read(null);
|
||||
|
||||
$model->id_user = Yii::$app->user->id;
|
||||
$model->id_product = $product->id_product;
|
||||
$model->stock = $product->stock;
|
||||
|
||||
$warehouses = Warehouse::read(null);
|
||||
|
||||
if ( count($warehouses) <= 0 ){
|
||||
throw new NotFoundHttpException( Yii::t('common/procurement' ,'No active warehouse found.' ));
|
||||
}
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
|
||||
|
||||
$connection = \Yii::$app->db;
|
||||
|
||||
$transaction = $connection->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$result = $model->save(false);
|
||||
|
||||
$product->stock = $product->stock + $model->count;
|
||||
$result &= $product->save(false);
|
||||
|
||||
if ($result) {
|
||||
$transaction->commit();
|
||||
} else {
|
||||
$transaction->rollback();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$transaction->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id_procurement]);
|
||||
} else {
|
||||
return $this->render('create_product', [
|
||||
'model' => $model,
|
||||
'warehouses' =>$warehouses,
|
||||
'product' => $product
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Procurement model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return Procurement the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = Procurement::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Finds the Product model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return Procurement the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findProduct($id)
|
||||
{
|
||||
if (($model = Product::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,7 @@ use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use common\models\Account;
|
||||
use common\models\ProductCategory;
|
||||
|
||||
/**
|
||||
* ProductController implements the CRUD actions for Product model.
|
||||
@ -62,8 +63,10 @@ class ProductController extends Controller
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new Product();
|
||||
$model->stock = 0;
|
||||
$model->status = Product::STATUS_ACTIVE;
|
||||
$accounts = Account::readAccounts(null);
|
||||
|
||||
$categories = ProductCategory::read(null);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_product]);
|
||||
@ -71,6 +74,8 @@ class ProductController extends Controller
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
'categories' => $categories ,
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -85,11 +90,16 @@ class ProductController extends Controller
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
$accounts = Account::readAccounts($model->id_account);
|
||||
$categories = ProductCategory::read($model->id_product_category);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_product]);
|
||||
} else {
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
'categories' => $categories ,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
88
backend/models/CardSearch.php
Normal file
88
backend/models/CardSearch.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Card;
|
||||
use common\models\Customer;
|
||||
|
||||
/**
|
||||
* CardSearch represents the model behind the search form about `common\models\Card`.
|
||||
*/
|
||||
class CardSearch extends Card
|
||||
{
|
||||
|
||||
public $searchCustomerName;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_card', 'status', 'type'], 'integer'],
|
||||
[[ 'searchCustomerName', 'number', 'created_at', 'updated_at'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = Card::find();
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
|
||||
$dataProvider->sort ->attributes['customerName'] =[
|
||||
'asc' => ['customer.name' => SORT_ASC ],
|
||||
'desc' => ['customer.name' => SORT_DESC ],
|
||||
];
|
||||
|
||||
$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->leftJoin(Customer::tableName(), 'customer.id_customer_card = card.id_card');
|
||||
|
||||
$query->andFilterWhere([
|
||||
'card.status' => $this->status,
|
||||
'card.type' => $this->type,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'card.number', $this->number]);
|
||||
$query->andFilterWhere(['like', 'customer.name', $this->searchCustomerName]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
public function attributeLabels(){
|
||||
$result = parent::attributeLabels();
|
||||
$result +=[
|
||||
'searchCustomerName' => Yii::t('common/card','Customer')
|
||||
];
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
76
backend/models/CitySearch.php
Normal file
76
backend/models/CitySearch.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\City;
|
||||
|
||||
/**
|
||||
* CitySearch represents the model behind the search form about `common\models\City`.
|
||||
*/
|
||||
class CitySearch extends City
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_city', 'cso_code', 'rig_id', 'population', 'homes'], 'integer'],
|
||||
[['zip', 'name', 'city_code'], 'safe'],
|
||||
[['latitude', 'longitude', 'range'], 'number'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = City::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([
|
||||
'id_city' => $this->id_city,
|
||||
'latitude' => $this->latitude,
|
||||
'longitude' => $this->longitude,
|
||||
'cso_code' => $this->cso_code,
|
||||
'rig_id' => $this->rig_id,
|
||||
'range' => $this->range,
|
||||
'population' => $this->population,
|
||||
'homes' => $this->homes,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'zip', $this->zip])
|
||||
->andFilterWhere(['like', 'name', $this->name])
|
||||
->andFilterWhere(['like', 'city_code', $this->city_code]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
||||
117
backend/models/CustomerCreate.php
Normal file
117
backend/models/CustomerCreate.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use common\models\Customer;
|
||||
use common\models\Card;
|
||||
|
||||
/**
|
||||
* This is the model class for table "customer".
|
||||
*
|
||||
* @property integer $id_customer
|
||||
* @property integer $id_customer_card
|
||||
* @property integer $id_user
|
||||
* @property integer $id_partner_card
|
||||
* @property integer $id_proposer
|
||||
* @property string $name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
* @property string $phone
|
||||
* @property integer $sex
|
||||
* @property string $date_stundent_card_expire
|
||||
* @property string $birthdate
|
||||
* @property string $image
|
||||
* @property string $description
|
||||
* @property string $tax_number
|
||||
* @property string $country
|
||||
* @property string $zip
|
||||
* @property string $city
|
||||
* @property string $address
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
* @property string $cardNumber
|
||||
*/
|
||||
class CustomerCreate extends \common\models\Customer
|
||||
{
|
||||
|
||||
public $cardNumber;
|
||||
public $partnerCardNumber;
|
||||
|
||||
public $password_plain;
|
||||
public $password_repeat;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'customer';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['cardNumber'], 'required' ],
|
||||
[['cardNumber'], 'string', 'max' => 10],
|
||||
[['cardNumber'], 'validateCustomerCard' ],
|
||||
|
||||
[['partnerCardNumber'], 'string', 'max' => 10],
|
||||
[['partnerCardNumber'], 'validatePartnerCard' ],
|
||||
|
||||
[['name'], 'required' ],
|
||||
[['name'], 'string', 'max' => 128],
|
||||
|
||||
[['email'], 'string', 'max' => 255],
|
||||
[['email'], 'email' ],
|
||||
[['email'], 'unique' ],
|
||||
|
||||
[['password_plain','password_repeat'], 'string', 'max' => 32],
|
||||
|
||||
[['sex'], 'integer'],
|
||||
|
||||
[[ 'birthdate', ], 'date' ],
|
||||
[[ 'date_stundent_card_expire', ], 'date' ],
|
||||
|
||||
[[ 'description', 'address'], 'string', 'max' => 255],
|
||||
|
||||
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
|
||||
|
||||
[['zip'], 'string', 'max' => 8],
|
||||
|
||||
[['city'], 'string', 'max' => 30]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function validateCustomerCard($a,$p){
|
||||
$card = null;
|
||||
|
||||
if ( !empty($this->cardNumber)){
|
||||
$card = Card::readCard($this->cardNumber,true);
|
||||
}
|
||||
|
||||
if ( $card == null ){
|
||||
$this->addError($a,Yii::t('common/customer', "Bérlet kártya nem üres vagy hibás kártyaszám"));
|
||||
}else{
|
||||
$this->id_customer_card = $card->id_card;
|
||||
}
|
||||
|
||||
// $this->addError($a,Yii::t('common/customer', "Bérlet kártya nem üres vagy hibás kártyaszám"));
|
||||
}
|
||||
|
||||
public function validatePartnerCard($a,$p){
|
||||
if ( !empty($this->partnerCardNumber) ){
|
||||
$card = Card::readCard($this->partnerCardNumber,true);
|
||||
if ( $card == null ){
|
||||
$this->addError($a,Yii::t('common/customer', "Bérlet kártya nem üres vagy hibás kártyaszám"));
|
||||
}else{
|
||||
$this->id_partner_card = $card->id_card;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
117
backend/models/CustomerSearch.php
Normal file
117
backend/models/CustomerSearch.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Customer;
|
||||
use common\models\Card;
|
||||
|
||||
/**
|
||||
* CustomerSearch represents the model behind the search form about `common\models\Customer`.
|
||||
*/
|
||||
class CustomerSearch extends Customer
|
||||
{
|
||||
|
||||
public $cardNumber;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['cardNumber', 'name', 'email'] ,'safe']
|
||||
// [['id_customer', 'id_customer_card', 'id_user', 'id_partner_card', 'id_proposer', 'sex'], 'integer'],
|
||||
// [['name', 'email', 'password', 'phone', 'date_stundent_card_expire', 'birthdate', 'image', 'description', 'tax_number', 'country', 'zip', 'city', 'address', 'created_at', 'updated_at'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = Customer::find();
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
|
||||
$dataProvider->sort ->attributes['customerCardNumber'] =[
|
||||
'asc' => ['card.number' => SORT_ASC ],
|
||||
'desc' => ['card.number' => SORT_DESC ],
|
||||
];
|
||||
$dataProvider->sort->defaultOrder = [
|
||||
'name' => SORT_ASC,
|
||||
];
|
||||
|
||||
|
||||
// $dataProvider->setSort(
|
||||
|
||||
|
||||
// [
|
||||
// 'attributes' => [
|
||||
// 'id',
|
||||
// 'fullName' => [
|
||||
// 'asc' => ['first_name' => SORT_ASC, 'last_name' => SORT_ASC],
|
||||
// 'desc' => ['first_name' => SORT_DESC, 'last_name' => SORT_DESC],
|
||||
// 'label' => 'Full Name',
|
||||
// 'default' => SORT_ASC
|
||||
// ],
|
||||
// 'country_id'
|
||||
// ]
|
||||
// ]);
|
||||
|
||||
|
||||
$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->leftJoin(Card::tableName(), " customer.id_customer_card = card.id_card" );
|
||||
|
||||
// $query->andFilterWhere([
|
||||
// 'id_customer' => $this->id_customer,
|
||||
// 'id_customer_card' => $this->id_customer_card,
|
||||
// 'id_user' => $this->id_user,
|
||||
// 'id_partner_card' => $this->id_partner_card,
|
||||
// 'id_proposer' => $this->id_proposer,
|
||||
// 'sex' => $this->sex,
|
||||
// 'date_stundent_card_expire' => $this->date_stundent_card_expire,
|
||||
// 'birthdate' => $this->birthdate,
|
||||
// 'created_at' => $this->created_at,
|
||||
// 'updated_at' => $this->updated_at,
|
||||
// ]);
|
||||
|
||||
$query->andFilterWhere(['like', 'customer.name', $this->name])
|
||||
->andFilterWhere(['like', 'customer.email', $this->email])
|
||||
->andFilterWhere(['like', 'card.number', $this->cardNumber])
|
||||
->andFilterWhere(['like', 'address', $this->address]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
public function attributeLabels( ) {
|
||||
$labels = parent::attributeLabels();
|
||||
return $labels;
|
||||
}
|
||||
}
|
||||
96
backend/models/CustomerUpdate.php
Normal file
96
backend/models/CustomerUpdate.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use common\models\Customer;
|
||||
|
||||
/**
|
||||
* This is the model class for table "customer".
|
||||
*
|
||||
* @property integer $id_customer
|
||||
* @property integer $id_customer_card
|
||||
* @property integer $id_user
|
||||
* @property integer $id_partner_card
|
||||
* @property integer $id_proposer
|
||||
* @property string $name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
* @property string $phone
|
||||
* @property integer $sex
|
||||
* @property string $date_stundent_card_expire
|
||||
* @property string $birthdate
|
||||
* @property string $image
|
||||
* @property string $description
|
||||
* @property string $tax_number
|
||||
* @property string $country
|
||||
* @property string $zip
|
||||
* @property string $city
|
||||
* @property string $address
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
* @property string $cardNumber
|
||||
*/
|
||||
class CustomerUpdate extends \common\models\Customer
|
||||
{
|
||||
|
||||
public $cardNumber;
|
||||
public $partnerCardNumber;
|
||||
|
||||
public $password_plain;
|
||||
public $password_repeat;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'customer';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// [['cardNumber'], 'required' ],
|
||||
// [['cardNumber'], 'string', 'max' => 10],
|
||||
// [['cardNumber'], 'validateCustomerCard' ],
|
||||
|
||||
[['partnerCardNumber'], 'string', 'max' => 10],
|
||||
[['partnerCardNumber'], 'validatePartnerCard' ],
|
||||
|
||||
[['name'], 'required' ],
|
||||
[['name'], 'string', 'max' => 128],
|
||||
|
||||
[['email'], 'string', 'max' => 255],
|
||||
[['email'], 'email' ],
|
||||
[['email'], 'unique' ],
|
||||
|
||||
[['password_plain','password_repeat'], 'string', 'max' => 32],
|
||||
|
||||
[['sex'], 'integer'],
|
||||
|
||||
[[ 'birthdate', ], 'date' ],
|
||||
[[ 'date_stundent_card_expire', ], 'date' ],
|
||||
|
||||
[[ 'description', 'address'], 'string', 'max' => 255],
|
||||
|
||||
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
|
||||
|
||||
[['zip'], 'string', 'max' => 8],
|
||||
|
||||
[['city'], 'string', 'max' => 30]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function validateCustomerCard($a,$p){
|
||||
// Customer::find()->andWhere( [$this->cardNumber )
|
||||
}
|
||||
public function validatePartnerCard($a,$p){
|
||||
// Customer::find()->andWhere( [$this->cardNumber )
|
||||
}
|
||||
|
||||
}
|
||||
86
backend/models/ProcurementSearch.php
Normal file
86
backend/models/ProcurementSearch.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Procurement;
|
||||
|
||||
/**
|
||||
* ProcurementSearch represents the model behind the search form about `common\models\Procurement`.
|
||||
*/
|
||||
class ProcurementSearch extends Procurement
|
||||
{
|
||||
|
||||
public $date_start;
|
||||
public $date_end;
|
||||
|
||||
public $timestampStart;
|
||||
public $timestampEnd;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[[ 'id_warehouse', 'id_user', 'id_product', ], 'integer'],
|
||||
[[ 'date_start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
[[ 'date_end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = Procurement::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;
|
||||
}
|
||||
|
||||
|
||||
if ( empty($this->date_start) ){
|
||||
$this->timestampStart = '';
|
||||
}
|
||||
if ( empty($this->date_end) ){
|
||||
$this->timestampEnd = '';
|
||||
}
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id_warehouse' => $this->id_warehouse,
|
||||
'id_user' => $this->id_user,
|
||||
'id_product' => $this->id_product,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere([ '>=', 'created_at', $this->date_start ] );
|
||||
$query->andFilterWhere([ '<', 'created_at', $this->timestampEnd ] );
|
||||
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
||||
@ -18,8 +18,8 @@ class ProductSearch extends Product
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_product', 'id_product_type', 'id_account', 'purchase_price', 'sale_price', 'profit_margins', 'status'], 'integer'],
|
||||
[['product_number', 'barcode', 'description', 'created_at', 'updated_at'], 'safe'],
|
||||
[[ 'id_product_category', 'id_account', 'status'], 'integer'],
|
||||
[['product_number', 'barcode' ], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -56,20 +56,13 @@ class ProductSearch extends Product
|
||||
}
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id_product' => $this->id_product,
|
||||
'id_product_type' => $this->id_product_type,
|
||||
'id_product_category' => $this->id_product_category,
|
||||
'id_account' => $this->id_account,
|
||||
'purchase_price' => $this->purchase_price,
|
||||
'sale_price' => $this->sale_price,
|
||||
'profit_margins' => $this->profit_margins,
|
||||
'status' => $this->status,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'product_number', $this->product_number])
|
||||
->andFilterWhere(['like', 'barcode', $this->barcode])
|
||||
->andFilterWhere(['like', 'description', $this->description]);
|
||||
->andFilterWhere(['like', 'barcode', $this->barcode]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
29
backend/views/card/_form.php
Normal file
29
backend/views/card/_form.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use common\models\Card;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Card */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="card-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'status')->dropDownList(Card::statuses()) ?>
|
||||
|
||||
<?= $form->field($model, 'type')->dropDownList(Card::types()) ?>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/card', 'Create') : Yii::t('common/card', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
60
backend/views/card/_search.php
Normal file
60
backend/views/card/_search.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use common\models\Card;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\CardSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
<?php
|
||||
|
||||
function mkOptions($options){
|
||||
|
||||
$all = ['' => Yii::t('common/product','All' ) ];
|
||||
|
||||
$o = $all + $options;
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
||||
$typeOptions = mkOptions(Card::types());
|
||||
$statusOptions = mkOptions(Card::statuses());
|
||||
|
||||
|
||||
?>
|
||||
<div class="card-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'number') ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'status')->dropDownList($statusOptions) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'type')->dropDownList($typeOptions) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'searchCustomerName')->textInput() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('common/card', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
21
backend/views/card/create.php
Normal file
21
backend/views/card/create.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Card */
|
||||
|
||||
$this->title = Yii::t('common/card', 'Create Card');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/card', 'Cards'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="card-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
52
backend/views/card/index.php
Normal file
52
backend/views/card/index.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\CardSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('common/card', 'Cards');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="card-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/card', 'Create Card'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
[
|
||||
'attribute' => 'number',
|
||||
'value' => 'number'
|
||||
],
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'value' => 'statusHuman'
|
||||
],
|
||||
[
|
||||
'attribute' => 'type',
|
||||
'value' => 'typeHuman'
|
||||
],
|
||||
[
|
||||
'attribute' => 'customerName',
|
||||
'value' => 'customerName'
|
||||
],
|
||||
'updated_at:datetime',
|
||||
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view}{update}'
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
23
backend/views/card/update.php
Normal file
23
backend/views/card/update.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Card */
|
||||
|
||||
$this->title = Yii::t('common/card', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Card',
|
||||
]) . ' ' . $model->id_card;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/card', 'Cards'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->number, 'url' => ['view', 'id' => $model->id_card]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/card', 'Update');
|
||||
?>
|
||||
<div class="card-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
32
backend/views/card/view.php
Normal file
32
backend/views/card/view.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Card */
|
||||
|
||||
$this->title = Yii::t('common/card','Card: ').$model->number;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/card', 'Cards'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="card-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/card', 'Update'), ['update', 'id' => $model->id_card], ['class' => 'btn btn-primary']) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'number',
|
||||
['attribute' => 'status', 'value' => $model->statusHuman],
|
||||
['attribute' => 'type', 'value' => $model->typeHuman],
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
41
backend/views/city/_form.php
Normal file
41
backend/views/city/_form.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\City */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="city-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'zip')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'city_code')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'latitude')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'longitude')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'cso_code')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'rig_id')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'range')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'population')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'homes')->textInput() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/city', 'Create') : Yii::t('common/city', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
47
backend/views/city/_search.php
Normal file
47
backend/views/city/_search.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\CitySearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="city-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id_city') ?>
|
||||
|
||||
<?= $form->field($model, 'zip') ?>
|
||||
|
||||
<?= $form->field($model, 'name') ?>
|
||||
|
||||
<?= $form->field($model, 'city_code') ?>
|
||||
|
||||
<?= $form->field($model, 'latitude') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'longitude') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'cso_code') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'rig_id') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'range') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'population') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'homes') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('common/city', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton(Yii::t('common/city', 'Reset'), ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
21
backend/views/city/create.php
Normal file
21
backend/views/city/create.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\City */
|
||||
|
||||
$this->title = Yii::t('common/city', 'Create City');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/city', 'Cities'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="city-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
44
backend/views/city/index.php
Normal file
44
backend/views/city/index.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\CitySearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('common/city', 'Cities');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="city-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/city', 'Create City'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'id_city',
|
||||
'zip',
|
||||
'name',
|
||||
'city_code',
|
||||
'latitude',
|
||||
// 'longitude',
|
||||
// 'cso_code',
|
||||
// 'rig_id',
|
||||
// 'range',
|
||||
// 'population',
|
||||
// 'homes',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
23
backend/views/city/update.php
Normal file
23
backend/views/city/update.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\City */
|
||||
|
||||
$this->title = Yii::t('common/city', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'City',
|
||||
]) . ' ' . $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/city', 'Cities'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_city]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/city', 'Update');
|
||||
?>
|
||||
<div class="city-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
45
backend/views/city/view.php
Normal file
45
backend/views/city/view.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\City */
|
||||
|
||||
$this->title = $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/city', 'Cities'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="city-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/city', 'Update'), ['update', 'id' => $model->id_city], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a(Yii::t('common/city', 'Delete'), ['delete', 'id' => $model->id_city], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('common/city', 'Are you sure you want to delete this item?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_city',
|
||||
'zip',
|
||||
'name',
|
||||
'city_code',
|
||||
'latitude',
|
||||
'longitude',
|
||||
'cso_code',
|
||||
'rig_id',
|
||||
'range',
|
||||
'population',
|
||||
'homes',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
61
backend/views/customer/_form.php
Normal file
61
backend/views/customer/_form.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="customer-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'id_customer_card')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'id_user')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'id_partner_card')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'id_proposer')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'sex')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'date_stundent_card_expire')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'birthdate')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'image')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'zip')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'city')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'created_at')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'updated_at')->textInput() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/customer', 'Create') : Yii::t('common/customer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
128
backend/views/customer/_form_create.php
Normal file
128
backend/views/customer/_form_create.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use common\models\Customer;
|
||||
use common\components\CityNameTypeahead;
|
||||
use common\components\CityZipTypeahead;
|
||||
use common\components\CardNumberTypeahead;
|
||||
use kartik\widgets\DatePicker;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="customer-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?php echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'partnerCardNumber')->textInput() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'password_plain')->passwordInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'password_repeat')->passwordInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'birthdate')->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'date_stundent_card_expire')->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-2'>
|
||||
<?= $form->field($model, 'zip')->widget(CityZipTypeahead::className(),[
|
||||
'pluginEvents' =>[
|
||||
"typeahead:select" => "function(a,b) {
|
||||
$('#customercreate-city').typeahead( 'val', b.name );
|
||||
}",]
|
||||
])?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php echo $form->field($model, 'city')->widget(CityNameTypeahead::className(),[
|
||||
'pluginEvents' =>[
|
||||
"typeahead:select" => "function(a,b) {
|
||||
$('#customercreate-zip').typeahead( 'val', b.zip );
|
||||
}",]
|
||||
|
||||
])?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/customer', 'Create') : Yii::t('common/customer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
132
backend/views/customer/_form_update.php
Normal file
132
backend/views/customer/_form_update.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use common\models\Customer;
|
||||
use common\components\CityNameTypeahead;
|
||||
use common\components\CityZipTypeahead;
|
||||
use common\components\CardNumberTypeahead;
|
||||
use kartik\widgets\DatePicker;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="customer-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?php //echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
||||
<label><?php echo $model->getAttributeLabel('id_customer_card')?></label>
|
||||
<div>
|
||||
<?php echo $model->customerCardNumber ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'partnerCardNumber')->textInput() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'password_plain')->passwordInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'password_repeat')->passwordInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'birthdate')->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= $form->field($model, 'date_stundent_card_expire')->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-2'>
|
||||
<?= $form->field($model, 'zip')->widget(CityZipTypeahead::className(),[
|
||||
'pluginEvents' =>[
|
||||
"typeahead:select" => "function(a,b) {
|
||||
$('#customercreate-city').typeahead( 'val', b.name );
|
||||
}",]
|
||||
])?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php echo $form->field($model, 'city')->widget(CityNameTypeahead::className(),[
|
||||
'pluginEvents' =>[
|
||||
"typeahead:select" => "function(a,b) {
|
||||
$('#customercreate-zip').typeahead( 'val', b.zip );
|
||||
}",]
|
||||
|
||||
])?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/customer', 'Create') : Yii::t('common/customer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
38
backend/views/customer/_search.php
Normal file
38
backend/views/customer/_search.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\CustomerSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="customer-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'cardNumber') ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php echo $form->field($model, 'name') ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php echo $form->field($model, 'email') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('common/customer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
21
backend/views/customer/create.php
Normal file
21
backend/views/customer/create.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
|
||||
$this->title = Yii::t('common/customer', 'Create Customer');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="customer-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form_create', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
56
backend/views/customer/index.php
Normal file
56
backend/views/customer/index.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\CustomerSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('common/customer', 'Customers');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="customer-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/customer', 'Create Customer'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'customerCardNumber' ,
|
||||
// 'value' => 'customerCardNumber'
|
||||
],
|
||||
// 'id_user',
|
||||
// 'id_partner_card',
|
||||
// 'id_proposer',
|
||||
'name',
|
||||
'email:email',
|
||||
// 'password',
|
||||
'phone',
|
||||
// 'sex',
|
||||
// 'date_stundent_card_expire',
|
||||
// 'birthdate',
|
||||
// 'image',
|
||||
// 'description',
|
||||
// 'tax_number',
|
||||
// 'country',
|
||||
// 'zip',
|
||||
// 'city',
|
||||
// 'address',
|
||||
'created_at:datetime',
|
||||
// 'updated_at',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' =>'{view}{update}'
|
||||
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
23
backend/views/customer/update.php
Normal file
23
backend/views/customer/update.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
|
||||
$this->title = Yii::t('common/customer', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Customer',
|
||||
]) . ' ' . $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_customer]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/customer', 'Update');
|
||||
?>
|
||||
<div class="customer-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form_update', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
56
backend/views/customer/view.php
Normal file
56
backend/views/customer/view.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
|
||||
$this->title = $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="customer-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/customer', 'Update'), ['update', 'id' => $model->id_customer], ['class' => 'btn btn-primary']) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
[
|
||||
'attribute' => 'id_customer_card',
|
||||
'value' => $model->customerCardNumber
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_user',
|
||||
'value' => $model->username
|
||||
],
|
||||
'id_partner_card',
|
||||
'id_proposer',
|
||||
'name',
|
||||
'email:email',
|
||||
'password',
|
||||
'phone',
|
||||
[
|
||||
'attribute' => 'sex',
|
||||
'value' => $model->sexHuman
|
||||
],
|
||||
'date_stundent_card_expire',
|
||||
'birthdate:date',
|
||||
'image',
|
||||
'description',
|
||||
'tax_number',
|
||||
'country',
|
||||
'zip',
|
||||
'city',
|
||||
'address',
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
38
backend/views/procurement/_form.php
Normal file
38
backend/views/procurement/_form.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Procurement */
|
||||
/* @var $warehouses common\models\Warehouse[] */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
<?php
|
||||
|
||||
$warehouseOptions = ArrayHelper::map($warehouses, 'id_warehouse', 'name') ;
|
||||
|
||||
?>
|
||||
<div class="procurement-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'productIdentifier')->textInput()->hint(Yii::t('common/procurement', "Product name, product number or barcode")) ?>
|
||||
|
||||
<?= $form->field($model, 'id_warehouse')->dropDownList($warehouseOptions) ?>
|
||||
|
||||
<?= $form->field($model, 'count')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'purchase_price')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/procurement', 'Create') : Yii::t('common/procurement', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
54
backend/views/procurement/_form_product.php
Normal file
54
backend/views/procurement/_form_product.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Procurement */
|
||||
/* @var $warehouses common\models\Warehouse[] */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
<?php
|
||||
|
||||
$warehouseOptions = ArrayHelper::map($warehouses, 'id_warehouse', 'name') ;
|
||||
|
||||
?>
|
||||
|
||||
<h3><?= Yii::t('common/product', 'Product') ?> </h3>
|
||||
<?php
|
||||
|
||||
echo DetailView::widget([
|
||||
'model' => $product,
|
||||
'attributes' =>[
|
||||
'productCategoryName',
|
||||
'accountName',
|
||||
'product_number',
|
||||
'barcode',
|
||||
'stock',
|
||||
]
|
||||
]);
|
||||
|
||||
?>
|
||||
|
||||
<div class="procurement-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
|
||||
<?= $form->field($model, 'id_warehouse')->dropDownList($warehouseOptions) ?>
|
||||
|
||||
<?= $form->field($model, 'count')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'purchase_price')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/procurement', 'Create') : Yii::t('common/procurement', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
76
backend/views/procurement/_search.php
Normal file
76
backend/views/procurement/_search.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use kartik\widgets\DatePicker;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\ProcurementSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
function mkOptions($options){
|
||||
// $o = $options;
|
||||
|
||||
$all = ['' => Yii::t('common/product','All' ) ];
|
||||
|
||||
$o = $all + $options;
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
$products = mkOptions( ArrayHelper::map( $products ,'id_product','name') );
|
||||
$users = mkOptions( ArrayHelper::map( $users ,'id','username') );
|
||||
$warehouses = mkOptions( ArrayHelper::map( $warehouses ,'id_warehouse','name') );
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="procurement-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'id_warehouse')->dropDownList($warehouses) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'id_user')->dropDownList($users) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'id_product')->dropDownList($products) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'date_start')->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'date_end') ->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('common/procurement', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
23
backend/views/procurement/create.php
Normal file
23
backend/views/procurement/create.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Procurement */
|
||||
/* @var $warehouses common\models\Warehouse[] */
|
||||
|
||||
$this->title = Yii::t('common/procurement', 'Create Procurement');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/procurement', 'Procurements'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="procurement-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
'warehouses' => $warehouses
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
24
backend/views/procurement/create_product.php
Normal file
24
backend/views/procurement/create_product.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Procurement */
|
||||
/* @var $warehouses common\models\Warehouse[] */
|
||||
|
||||
$this->title = Yii::t('common/procurement', 'Create Procurement');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/procurement', 'Procurements'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="procurement-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form_product', [
|
||||
'product' => $product,
|
||||
'model' => $model,
|
||||
'warehouses' => $warehouses
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
56
backend/views/procurement/index.php
Normal file
56
backend/views/procurement/index.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\ProcurementSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('common/procurement', 'Procurements');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="procurement-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php echo $this->render('_search', [
|
||||
'model' => $searchModel,
|
||||
'users' => $users,
|
||||
'products' => $products,
|
||||
'warehouses' => $warehouses,]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/procurement', 'Create Procurement'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'id_warehouse',
|
||||
'value' => 'wareHouseName'
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_user',
|
||||
'value' => 'userName'
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_product',
|
||||
'value' => 'productName'
|
||||
|
||||
],
|
||||
'count',
|
||||
'stock',
|
||||
'purchase_price',
|
||||
'created_at:datetime',
|
||||
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view}',
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
23
backend/views/procurement/update.php
Normal file
23
backend/views/procurement/update.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Procurement */
|
||||
|
||||
$this->title = Yii::t('common/procurement', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Procurement',
|
||||
]) . ' ' . $model->id_procurement;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/procurement', 'Procurements'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id_procurement, 'url' => ['view', 'id' => $model->id_procurement]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/procurement', 'Update');
|
||||
?>
|
||||
<div class="procurement-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
48
backend/views/procurement/view.php
Normal file
48
backend/views/procurement/view.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Procurement */
|
||||
|
||||
$this->title = Yii::t('common/procurement','Procurement') .' ' . $model->id_procurement;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/procurement', 'Procurements'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="procurement-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_procurement',
|
||||
[
|
||||
'attribute' => 'id_warehouse',
|
||||
'value' => $model->warehouseName,
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_user',
|
||||
'value' => $model->userName,
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_product',
|
||||
'value' => $model->productName,
|
||||
|
||||
],
|
||||
'count',
|
||||
'stock',
|
||||
'purchase_price',
|
||||
[
|
||||
'attribute' => 'description',
|
||||
'value' => nl2br($model->description),
|
||||
'format' => 'raw'
|
||||
],
|
||||
'created_at:datetime',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
@ -11,14 +11,19 @@ use yii\helpers\ArrayHelper;
|
||||
?>
|
||||
<?php
|
||||
$account_options = ArrayHelper::map($accounts, 'id_account', 'name');
|
||||
$product_category_options = ArrayHelper::map($categories, 'id_product_category', 'name');
|
||||
|
||||
?>
|
||||
<div class="product-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'id_account')->dropDownList($account_options) ?>
|
||||
|
||||
<?= $form->field($model, 'id_product_category')->dropDownList($product_category_options) ?>
|
||||
|
||||
<?= $form->field($model, 'product_number')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'barcode')->textInput(['maxlength' => true]) ?>
|
||||
@ -31,10 +36,10 @@ $account_options = ArrayHelper::map($accounts, 'id_account', 'name');
|
||||
|
||||
<?= $form->field($model, 'status')->checkbox( ['value' => 10, 'label' => Yii::t('common/product', "Active") ]) ?>
|
||||
|
||||
<?= $form->field($model, 'description')->textarea(['maxlength' => true])->hint( Yii::t( 'common/prodcut', "Max 255 character")) ?>
|
||||
<?= $form->field($model, 'description')->textarea(['maxlength' => true])->hint( Yii::t( 'common/product', "Max 255 character")) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/ticket_type', 'Create') : Yii::t('common/ticket_type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/product', 'Create') : Yii::t('common/product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
@ -2,12 +2,30 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use common\models\Product;
|
||||
use common\models\ProductCategory;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use common\models\Account;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\ProductSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
<?php
|
||||
|
||||
function mkOptions($options){
|
||||
$o = $options;
|
||||
$o[''] = Yii::t('common/product','All' ) ;
|
||||
return $o;
|
||||
}
|
||||
|
||||
$statusOptions = mkOptions( Product::statuses() );
|
||||
|
||||
$productCategories = mkOptions( ArrayHelper::map( ProductCategory::read(null) ,'id_product_category','name') );
|
||||
|
||||
$accounts = mkOptions( ArrayHelper::map( Account::readAccounts(null) ,'id_account','name'));
|
||||
|
||||
?>
|
||||
<div class="product-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
@ -15,33 +33,29 @@ use yii\widgets\ActiveForm;
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id_product') ?>
|
||||
|
||||
<?= $form->field($model, 'id_product_type') ?>
|
||||
|
||||
<?= $form->field($model, 'id_account') ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'id_product_category')->dropDownList($productCategories) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'id_account')->dropDownList($accounts) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php echo $form->field($model, 'status')->dropDownList($statusOptions) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'product_number') ?>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'barcode') ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php // echo $form->field($model, 'purchase_price') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'sale_price') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'profit_margins') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'status') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'description') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'created_at') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'updated_at') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('common/ticket_type', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton(Yii::t('common/ticket_type', 'Reset'), ['class' => 'btn btn-default']) ?>
|
||||
<?= Html::submitButton(Yii::t('common/product', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
@ -7,8 +7,8 @@ use yii\helpers\Html;
|
||||
/* @var $model common\models\Product */
|
||||
/* @var $accounts common\models\Account[] */
|
||||
|
||||
$this->title = Yii::t('common/ticket_type', 'Create Product');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_type', 'Products'), 'url' => ['index']];
|
||||
$this->title = Yii::t('common/product', 'Create Product');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/product', 'Products'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="product-create">
|
||||
@ -18,6 +18,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
'categories' => $categories ,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
|
||||
@ -2,28 +2,32 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\ProductSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('common/ticket_type', 'Products');
|
||||
$this->title = Yii::t('common/product', 'Products');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="product-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/ticket_type', 'Create Product'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
<?= Html::a(Yii::t('common/product', 'Create Product'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'id_product_type',
|
||||
'attribute' => 'name',
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_product_category',
|
||||
'value' => 'productCategoryName',
|
||||
],
|
||||
[
|
||||
@ -32,15 +36,38 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
],
|
||||
'product_number',
|
||||
'barcode',
|
||||
'purchase_price',
|
||||
'sale_price',
|
||||
'profit_margins',
|
||||
'status',
|
||||
'description',
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
[
|
||||
'attribute' => 'status',
|
||||
'value' => 'statusHuman',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
'stock',
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view} {update} {procurement}',
|
||||
'buttons' =>[
|
||||
'view' => function ($url, $model, $key) {
|
||||
return Html::a( Yii::t('common/product', 'Details' ), $url,[ 'class' => 'btn btn-xs btn-primary' ]) ;
|
||||
},
|
||||
'update' => function ($url, $model, $key) {
|
||||
return Html::a( Yii::t('common/product', 'Update' ), $url,[ 'class' => 'btn btn-xs btn-primary' ]) ;
|
||||
},
|
||||
'procurement' => function ($url, $model, $key) {
|
||||
return Html::a( Yii::t('common/product', 'Procurement' ), $url,[ 'class' => 'btn btn-xs btn-primary' ]) ;
|
||||
},
|
||||
],
|
||||
'urlCreator' => function ( $action, $model, $key, $index ){
|
||||
$result = '';
|
||||
if ( $action == 'procurement' ){
|
||||
$result = Url::toRoute(['procurement/create-product' , 'id' => $model->id_product]);
|
||||
}else{
|
||||
$result = Url::toRoute(['product/'.$action , 'id' => $model->id_product]);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
|
||||
@ -5,12 +5,10 @@ use yii\helpers\Html;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Product */
|
||||
|
||||
$this->title = Yii::t('common/ticket_type', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Product',
|
||||
]) . ' ' . $model->id_product;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_type', 'Products'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id_product, 'url' => ['view', 'id' => $model->id_product]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/ticket_type', 'Update');
|
||||
$this->title = Yii::t('common/product', 'Update product:' ) . ' ' . $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/product', 'Products'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_product]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('common/product', 'Update');
|
||||
?>
|
||||
<div class="product-update">
|
||||
|
||||
@ -18,6 +16,8 @@ $this->params['breadcrumbs'][] = Yii::t('common/ticket_type', 'Update');
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
'categories' => $categories ,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
|
||||
@ -6,8 +6,8 @@ use yii\widgets\DetailView;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Product */
|
||||
|
||||
$this->title = $model->id_product;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_type', 'Products'), 'url' => ['index']];
|
||||
$this->title = $model->name ;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/product', 'Products'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="product-view">
|
||||
@ -15,31 +15,28 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/ticket_type', 'Update'), ['update', 'id' => $model->id_product], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a(Yii::t('common/ticket_type', 'Delete'), ['delete', 'id' => $model->id_product], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('common/ticket_type', 'Are you sure you want to delete this item?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
<?= Html::a(Yii::t('common/product', 'Update'), ['update', 'id' => $model->id_product], ['class' => 'btn btn-primary']) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_product',
|
||||
'id_product_type',
|
||||
'id_account',
|
||||
'productCategoryName',
|
||||
'accountName',
|
||||
'product_number',
|
||||
'barcode',
|
||||
'purchase_price',
|
||||
'sale_price',
|
||||
'profit_margins',
|
||||
'status',
|
||||
'description',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'statusHuman',
|
||||
'stock',
|
||||
[
|
||||
'attribute' => 'description',
|
||||
'value' => nl2br($model->description),
|
||||
'format' => 'raw'
|
||||
],
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
|
||||
52
common/components/CardNumberTypeahead.php
Normal file
52
common/components/CardNumberTypeahead.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace common\components;
|
||||
|
||||
use Yii;
|
||||
use kartik\widgets\Typeahead;
|
||||
use yii\helpers\Url;
|
||||
use yii\web\JsExpression;
|
||||
|
||||
|
||||
class CardNumberTypeahead extends Typeahead{
|
||||
|
||||
public $item_template = '<div><p class="">{{txt}}</p></div>';
|
||||
|
||||
public $options = ['placeholder' => 'Válassz bérletkártyát!'];
|
||||
|
||||
public $pluginOptions = ['highlight'=>true , 'minLength' => 3 ];
|
||||
|
||||
public $scrollable = true;
|
||||
|
||||
public $display = 'number';
|
||||
|
||||
public $pluginEvents = [ "typeahead:select" => "function(a,b) { }",];
|
||||
|
||||
public $onlyFreeCards = true;
|
||||
|
||||
|
||||
|
||||
public function init(){
|
||||
parent::init();
|
||||
$this->dataset = $this->createDefaultDataset();
|
||||
}
|
||||
|
||||
protected function createDefaultDataset(){
|
||||
return [
|
||||
[
|
||||
'limit' => 20,
|
||||
'remote' => [
|
||||
'ttl' => 1,
|
||||
'url' => Url::to(['card/list']) . '&onlyFree='.($this->onlyFreeCards ? '1' :'0').'&search=%QUERY&' . rand(0, 100000000),
|
||||
'wildcard' => '%QUERY'
|
||||
],
|
||||
'limit' => 10,
|
||||
'display' => $this->display,
|
||||
'templates' => [
|
||||
'notFound' => '<div class="text-danger" style="padding:0 8px">Unable to find number for selected query.</div>',
|
||||
'suggestion' => new JsExpression("Handlebars.compile('{$this->item_template}')")
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
50
common/components/CityNameTypeahead.php
Normal file
50
common/components/CityNameTypeahead.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
namespace common\components;
|
||||
|
||||
use Yii;
|
||||
use kartik\widgets\Typeahead;
|
||||
use yii\helpers\Url;
|
||||
use yii\web\JsExpression;
|
||||
|
||||
|
||||
class CityNameTypeahead extends Typeahead{
|
||||
|
||||
public $item_template = '<div><p class="">{{fullname}}</p></div>';
|
||||
|
||||
public $options = ['placeholder' => 'Válassz várost'];
|
||||
|
||||
public $pluginOptions = ['highlight'=>true];
|
||||
|
||||
public $scrollable = true;
|
||||
|
||||
public $display = 'name';
|
||||
|
||||
public $pluginEvents = [ "typeahead:select" => "function(a,b) { }",];
|
||||
|
||||
|
||||
|
||||
public function init(){
|
||||
parent::init();
|
||||
$this->dataset = $this->createDefaultDataset();
|
||||
}
|
||||
|
||||
protected function createDefaultDataset(){
|
||||
return [
|
||||
[
|
||||
'limit' => 20,
|
||||
'remote' => [
|
||||
'ttl' => 1,
|
||||
'url' => Url::to(['city/name-list']) . '&search=%QUERY&' . rand(0, 100000000),
|
||||
'wildcard' => '%QUERY'
|
||||
],
|
||||
'limit' => 10,
|
||||
'display' => $this->display,
|
||||
'templates' => [
|
||||
'notFound' => '<div class="text-danger" style="padding:0 8px">Unable to find repositories for selected query.</div>',
|
||||
'suggestion' => new JsExpression("Handlebars.compile('{$this->item_template}')")
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
50
common/components/CityZipTypeahead.php
Normal file
50
common/components/CityZipTypeahead.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
namespace common\components;
|
||||
|
||||
use Yii;
|
||||
use kartik\widgets\Typeahead;
|
||||
use yii\helpers\Url;
|
||||
use yii\web\JsExpression;
|
||||
|
||||
|
||||
class CityZipTypeahead extends Typeahead{
|
||||
|
||||
public $item_template = '<div><p class="">{{fullname}}</p></div>';
|
||||
|
||||
public $options = ['placeholder' => 'Válassz irányítószám'];
|
||||
|
||||
public $pluginOptions = ['highlight'=>true];
|
||||
|
||||
public $scrollable = true;
|
||||
|
||||
public $display = 'zip';
|
||||
|
||||
public $pluginEvents = [ "typeahead:select" => "function(a,b) { }",];
|
||||
|
||||
|
||||
|
||||
public function init(){
|
||||
parent::init();
|
||||
$this->dataset = $this->createDefaultDataset();
|
||||
}
|
||||
|
||||
protected function createDefaultDataset(){
|
||||
return [
|
||||
[
|
||||
'limit' => 20,
|
||||
'remote' => [
|
||||
'ttl' => 1,
|
||||
'url' => Url::to(['city/zip-list']) . '&search=%QUERY&' . rand(0, 100000000),
|
||||
'wildcard' => '%QUERY'
|
||||
],
|
||||
'limit' => 10,
|
||||
'display' => $this->display,
|
||||
'templates' => [
|
||||
'notFound' => '<div class="text-danger" style="padding:0 8px">Unable to find repositories for selected query.</div>',
|
||||
'suggestion' => new JsExpression("Handlebars.compile('{$this->item_template}')")
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@ -55,6 +55,9 @@ return [
|
||||
// Message categories to ignore
|
||||
'ignoreCategories' => [
|
||||
'yii',
|
||||
'fileinput',
|
||||
'kvdate',
|
||||
'kvdatetime',
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
4154
common/data/telepulesek.txt
Normal file
4154
common/data/telepulesek.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,7 @@
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
*/
|
||||
return [
|
||||
'It is recommended you use an upgraded browser to display the {type} control properly.' => 'Ajánlott újabb böngésző verziót használni!',
|
||||
'Aktív' => 'Aktív',
|
||||
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné ezt az element?',
|
||||
'Delete' => 'Törlés',
|
||||
|
||||
39
common/messages/hu/common/card.php
Normal file
39
common/messages/hu/common/card.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
*
|
||||
* This file is automatically generated by 'yii message' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
*/
|
||||
return [
|
||||
'Active' => 'Aktív',
|
||||
'BARCODE' => 'VONALKÓD',
|
||||
'Card: ' => 'Bérletkártya: ',
|
||||
'Cards' => 'Bérletkártyák',
|
||||
'Create' => 'Mentés',
|
||||
'Create Card' => 'Új bérletkártya',
|
||||
'Created At' => 'Létrehozás ideje',
|
||||
'Customer' => 'Vendég',
|
||||
'Id Card' => 'Azonosító',
|
||||
'Inactive' => 'Inaktív',
|
||||
'Number' => 'Kártyaszám',
|
||||
'QRCODE' => 'QRCODE',
|
||||
'RFID' => 'RFID',
|
||||
'Search' => 'Keresés',
|
||||
'Status' => 'Státusz',
|
||||
'Type' => 'Típus',
|
||||
'Update' => 'Módosítás',
|
||||
'Update {modelClass}: ' => '{modelClass} módosítása:',
|
||||
'Updated At' => 'Módosítás ideje',
|
||||
];
|
||||
40
common/messages/hu/common/city.php
Normal file
40
common/messages/hu/common/city.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
*
|
||||
* This file is automatically generated by 'yii message' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
*/
|
||||
return [
|
||||
'Are you sure you want to delete this item?' => '',
|
||||
'Cities' => '',
|
||||
'City Code' => '',
|
||||
'Create' => '',
|
||||
'Create City' => '',
|
||||
'Cso Code' => '',
|
||||
'Delete' => '',
|
||||
'Homes' => '',
|
||||
'Id City' => '',
|
||||
'Latitude' => '',
|
||||
'Longitude' => '',
|
||||
'Name' => '',
|
||||
'Population' => '',
|
||||
'Range' => '',
|
||||
'Reset' => '',
|
||||
'Rig ID' => '',
|
||||
'Search' => '',
|
||||
'Update' => '',
|
||||
'Update {modelClass}: ' => '',
|
||||
'Zip' => '',
|
||||
];
|
||||
52
common/messages/hu/common/customer.php
Normal file
52
common/messages/hu/common/customer.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
*
|
||||
* This file is automatically generated by 'yii message' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
*/
|
||||
return [
|
||||
'Bérlet kártya nem üres vagy hibás kártyaszám' => '',
|
||||
'Man' => 'Férfi',
|
||||
'Password' => '',
|
||||
'Unknown sex' => 'Nincs megadva',
|
||||
'Woman' => 'Nő',
|
||||
'Address' => 'Cím',
|
||||
'Birthdate' => 'Születésnap',
|
||||
'Card number' => 'Kártyaszám',
|
||||
'City' => 'Város',
|
||||
'Country' => 'Ország',
|
||||
'Create' => 'Mentés',
|
||||
'Create Customer' => 'Új vendég',
|
||||
'Created At' => 'Létrehozás ideje',
|
||||
'Customers' => 'Vendégek',
|
||||
'Date Stundent Card Expire' => 'Diákigazolvány lejárati dátum',
|
||||
'Description' => 'Megjegyzés',
|
||||
'Email' => 'Email',
|
||||
'Id Customer' => 'Azonosító',
|
||||
'Id Customer Card' => 'Bérletkártya azonosító',
|
||||
'Id Partner Card' => 'Partnerkártya azonosító',
|
||||
'Id Proposer' => 'Ajánló',
|
||||
'Id User' => 'Admin',
|
||||
'Image' => 'Kép',
|
||||
'Name' => 'Név',
|
||||
'Phone' => 'Telefon',
|
||||
'Search' => 'Keresés',
|
||||
'Sex' => 'Nem',
|
||||
'Tax Number' => 'Adószám',
|
||||
'Update' => 'Módosítás',
|
||||
'Update {modelClass}: ' => '{modelClass} módosítása:',
|
||||
'Updated At' => 'Módosítás ideje',
|
||||
'Zip' => 'Irsz.',
|
||||
];
|
||||
40
common/messages/hu/common/procurement.php
Normal file
40
common/messages/hu/common/procurement.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
*
|
||||
* This file is automatically generated by 'yii message' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
*/
|
||||
return [
|
||||
'Count' => 'Beszerzett mennyiség',
|
||||
'Create' => 'Mentés',
|
||||
'Create Procurement' => 'Új beszerzés',
|
||||
'Created At' => 'Beszerzés ideje',
|
||||
'Description' => 'Megjegyzés',
|
||||
'Id Procurement' => 'Beszerzés azonosító',
|
||||
'Id Product' => 'Termék',
|
||||
'Id User' => 'Felhasználó',
|
||||
'Id Warehouse' => 'Raktár',
|
||||
'Invalid product' => 'Termék nincs megadva',
|
||||
'No active warehouse found.' => 'Nem találtam aktív raktárat',
|
||||
'Procurement' => 'Beszerzés',
|
||||
'Procurements' => 'Beszerzések',
|
||||
'Product name, product number or barcode' => 'Termék neve, termék száma vagy vonalkód',
|
||||
'Purchase Price' => 'Beszerzési ár',
|
||||
'Search' => 'Keresés',
|
||||
'Stock' => 'Beszerzés előtti raktárkészlet',
|
||||
'Update' => 'Módosítás',
|
||||
'Update {modelClass}: ' => '{modelClass} módosítása: ',
|
||||
'Updated At' => 'Módosítva',
|
||||
];
|
||||
46
common/messages/hu/common/product.php
Normal file
46
common/messages/hu/common/product.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
*
|
||||
* This file is automatically generated by 'yii message' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
*/
|
||||
return [
|
||||
'Details' => 'Részletek',
|
||||
'Procurement' => 'Beszerzés',
|
||||
'Product' => 'Termék',
|
||||
'Active' => 'Aktív',
|
||||
'All' => 'Mind',
|
||||
'Barcode' => 'Vonalkód',
|
||||
'Create' => 'Mentés',
|
||||
'Create Product' => 'Új termék',
|
||||
'Created At' => 'Létrehozás ideje',
|
||||
'Description' => 'Leírás',
|
||||
'Id Account' => 'Kassza',
|
||||
'Id Product' => 'Termék',
|
||||
'Id Product Category' => 'Termék kategória',
|
||||
'Inactive' => 'Inaktív',
|
||||
'Max 255 character' => 'Max 255 karakter',
|
||||
'Name' => 'Név',
|
||||
'Product Number' => 'Termék szám',
|
||||
'Products' => 'Termékek',
|
||||
'Profit Margins' => 'Haszonkulcs',
|
||||
'Purchase Price' => 'Beszerzési ár',
|
||||
'Sale Price' => 'Eladási ár',
|
||||
'Search' => 'Keresés',
|
||||
'Status' => 'Státusz',
|
||||
'Update' => 'Módosítás',
|
||||
'Update product:' => 'Termék módosítása:',
|
||||
'Updated At' => 'Módosítás ideje',
|
||||
];
|
||||
137
common/models/Card.php
Normal file
137
common/models/Card.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "card".
|
||||
*
|
||||
* @property integer $id_card
|
||||
* @property string $number
|
||||
* @property integer $status
|
||||
* @property integer $type
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class Card extends \common\models\BaseFitnessActiveRecord
|
||||
{
|
||||
|
||||
const STATUS_DELETED = 0;
|
||||
const STATUS_ACTIVE = 10;
|
||||
|
||||
const TYPE_RFID = 10;
|
||||
const TYPE_QRCODE = 20;
|
||||
const TYPE_BARCODE = 30;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'card';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['number', 'type','status'], 'required'],
|
||||
[['status', 'type'], 'integer'],
|
||||
[['number'], 'string', 'max' => 20],
|
||||
[['number'], 'unique' ]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id_card' => Yii::t('common/card', 'Id Card'),
|
||||
'number' => Yii::t('common/card', 'Number'),
|
||||
'status' => Yii::t('common/card', 'Status'),
|
||||
'type' => Yii::t('common/card', 'Type'),
|
||||
'created_at' => Yii::t('common/card', 'Created At'),
|
||||
'updated_at' => Yii::t('common/card', 'Updated At'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
static function statuses() {
|
||||
return [
|
||||
self::STATUS_ACTIVE => Yii::t('common/card', 'Active'),
|
||||
self::STATUS_DELETED => Yii::t('common/card', 'Inactive'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getStatusHuman(){
|
||||
$result = null;
|
||||
$s = self::statuses($this->status);
|
||||
if ( array_key_exists($this->status, $s)){
|
||||
$result = $s[$this->status];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
static function types() {
|
||||
return [
|
||||
self::TYPE_RFID => Yii::t('common/card', 'RFID'),
|
||||
self::TYPE_QRCODE => Yii::t('common/card', 'QRCODE'),
|
||||
self::TYPE_BARCODE => Yii::t('common/card', 'BARCODE'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getTypeHuman(){
|
||||
$result = null;
|
||||
$s = self::types($this->type);
|
||||
if ( array_key_exists($this->type, $s)){
|
||||
$result = $s[$this->type];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isInactive(){
|
||||
return $this->status == self::STATUS_DELETED;
|
||||
}
|
||||
|
||||
public static function readCard($number,$free = null){
|
||||
$card = null;
|
||||
$query = Card::find()
|
||||
->leftJoin(Customer::tableName(), 'card.id_card = customer.id_customer_card ' )
|
||||
->andWhere(['number'=>$number ]);
|
||||
|
||||
if ( isset($free) ){
|
||||
if ( $free == true){
|
||||
$query->andWhere('customer.id_customer is null');
|
||||
}else{
|
||||
$query->andWhere('customer.id_customer is not null');
|
||||
}
|
||||
}
|
||||
|
||||
$cards = $query->all();
|
||||
|
||||
if ( count($cards) == 1){
|
||||
$card = $cards[0];
|
||||
}
|
||||
return $card;
|
||||
}
|
||||
|
||||
|
||||
public function getCustomer(){
|
||||
return $this->hasOne(Customer::className(), ['id_customer_card' => 'id_card']);
|
||||
}
|
||||
|
||||
public function getCustomerName(){
|
||||
$name = null;
|
||||
$customer = $this->customer;
|
||||
if ( $this->customer != null){
|
||||
$name = $this->customer->name;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
}
|
||||
66
common/models/City.php
Normal file
66
common/models/City.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "city".
|
||||
*
|
||||
* @property integer $id_city
|
||||
* @property string $zip
|
||||
* @property string $name
|
||||
* @property string $city_code
|
||||
* @property double $latitude
|
||||
* @property double $longitude
|
||||
* @property integer $cso_code
|
||||
* @property integer $rig_id
|
||||
* @property double $range
|
||||
* @property integer $population
|
||||
* @property integer $homes
|
||||
*/
|
||||
class City extends \yii\db\ActiveRecord
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'city';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['zip', 'name', 'city_code'], 'required'],
|
||||
[['latitude', 'longitude', 'range'], 'number'],
|
||||
[['cso_code', 'rig_id', 'population', 'homes'], 'integer'],
|
||||
[['zip'], 'string', 'max' => 8],
|
||||
[['name'], 'string', 'max' => 64],
|
||||
[['city_code'], 'string', 'max' => 2]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id_city' => Yii::t('common/city', 'Id City'),
|
||||
'zip' => Yii::t('common/city', 'Zip'),
|
||||
'name' => Yii::t('common/city', 'Name'),
|
||||
'city_code' => Yii::t('common/city', 'City Code'),
|
||||
'latitude' => Yii::t('common/city', 'Latitude'),
|
||||
'longitude' => Yii::t('common/city', 'Longitude'),
|
||||
'cso_code' => Yii::t('common/city', 'Cso Code'),
|
||||
'rig_id' => Yii::t('common/city', 'Rig ID'),
|
||||
'range' => Yii::t('common/city', 'Range'),
|
||||
'population' => Yii::t('common/city', 'Population'),
|
||||
'homes' => Yii::t('common/city', 'Homes'),
|
||||
];
|
||||
}
|
||||
}
|
||||
168
common/models/Customer.php
Normal file
168
common/models/Customer.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "customer".
|
||||
*
|
||||
* @property integer $id_customer
|
||||
* @property integer $id_customer_card
|
||||
* @property integer $id_user
|
||||
* @property integer $id_partner_card
|
||||
* @property integer $id_proposer
|
||||
* @property string $name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
* @property string $phone
|
||||
* @property integer $sex
|
||||
* @property string $date_stundent_card_expire
|
||||
* @property string $birthdate
|
||||
* @property string $image
|
||||
* @property string $description
|
||||
* @property string $tax_number
|
||||
* @property string $country
|
||||
* @property string $zip
|
||||
* @property string $city
|
||||
* @property string $address
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class Customer extends \yii\db\ActiveRecord
|
||||
{
|
||||
|
||||
const STATUS_DELETED = 0;
|
||||
const STATUS_ACTIVE = 10;
|
||||
|
||||
const SEX_UNKNOWN = 0;
|
||||
const SEX_MAN = 10;
|
||||
const SEX_WOMAN = 20;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'customer';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_customer_card', 'id_user', 'id_partner_card', 'id_proposer', 'sex'], 'integer'],
|
||||
[['date_stundent_card_expire', 'birthdate', 'created_at', 'updated_at'], 'safe'],
|
||||
[['name'], 'string', 'max' => 128],
|
||||
[['email', 'image', 'description', 'address'], 'string', 'max' => 255],
|
||||
[['password'], 'string', 'max' => 32],
|
||||
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
|
||||
[['zip'], 'string', 'max' => 8],
|
||||
[['city'], 'string', 'max' => 30]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id_customer' => Yii::t('common/customer', 'Id Customer'),
|
||||
'id_customer_card' => Yii::t('common/customer', 'Id Customer Card'),
|
||||
'id_user' => Yii::t('common/customer', 'Id User'),
|
||||
'id_partner_card' => Yii::t('common/customer', 'Id Partner Card'),
|
||||
'id_proposer' => Yii::t('common/customer', 'Id Proposer'),
|
||||
'name' => Yii::t('common/customer', 'Name'),
|
||||
'email' => Yii::t('common/customer', 'Email'),
|
||||
'password' => Yii::t('common/customer', 'Password'),
|
||||
'phone' => Yii::t('common/customer', 'Phone'),
|
||||
'sex' => Yii::t('common/customer', 'Sex'),
|
||||
'date_stundent_card_expire' => Yii::t('common/customer', 'Date Stundent Card Expire'),
|
||||
'birthdate' => Yii::t('common/customer', 'Birthdate'),
|
||||
'image' => Yii::t('common/customer', 'Image'),
|
||||
'description' => Yii::t('common/customer', 'Description'),
|
||||
'tax_number' => Yii::t('common/customer', 'Tax Number'),
|
||||
'country' => Yii::t('common/customer', 'Country'),
|
||||
'zip' => Yii::t('common/customer', 'Zip'),
|
||||
'city' => Yii::t('common/customer', 'City'),
|
||||
'address' => Yii::t('common/customer', 'Address'),
|
||||
'created_at' => Yii::t('common/customer', 'Created At'),
|
||||
'updated_at' => Yii::t('common/customer', 'Updated At'),
|
||||
'customerCardNumber' => Yii::t('common/customer', 'Card number'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
static function statuses() {
|
||||
return [
|
||||
self::STATUS_ACTIVE => Yii::t('common/account', 'Active'),
|
||||
self::STATUS_DELETED => Yii::t('common/account', 'Inactive'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getStatusHuman(){
|
||||
$result = null;
|
||||
$s = self::statuses($this->status);
|
||||
if ( array_key_exists($this->status, $s)){
|
||||
$result = $s[$this->status];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
static function sexes() {
|
||||
return [
|
||||
self::SEX_UNKNOWN => Yii::t('common/customer', 'Unknown sex'),
|
||||
self::SEX_MAN => Yii::t('common/customer', 'Man'),
|
||||
self::SEX_WOMAN => Yii::t('common/customer', 'Woman'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getSexHuman(){
|
||||
$result = null;
|
||||
$s = self::sexes( );
|
||||
if ( array_key_exists($this->sex, $s)){
|
||||
$result = $s[$this->sex];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isInactive(){
|
||||
return $this->status == self::STATUS_DELETED;
|
||||
}
|
||||
|
||||
|
||||
public function getCard(){
|
||||
return $this->hasOne ( Card::className (), [
|
||||
'id_card' => 'id_customer_card'
|
||||
] );
|
||||
}
|
||||
public function getUser(){
|
||||
return $this->hasOne ( User::className (), [
|
||||
'id' => 'id_user'
|
||||
] );
|
||||
}
|
||||
|
||||
public function getCustomerCardNumber(){
|
||||
$result = null;
|
||||
$card = $this->card;
|
||||
if ( $card != null) {
|
||||
$result = $card->number;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
public function getUsername(){
|
||||
$result = null;
|
||||
$user = $this->user;
|
||||
if ( $user != null) {
|
||||
$result = $user->username;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
127
common/models/Procurement.php
Normal file
127
common/models/Procurement.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "procurement".
|
||||
*
|
||||
* @property integer $id_procurement
|
||||
* @property integer $id_warehouse
|
||||
* @property integer $id_user
|
||||
* @property integer $id_product
|
||||
* @property integer $count
|
||||
* @property integer $stock
|
||||
* @property integer $purchase_price
|
||||
* @property string $description
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class Procurement extends \common\models\BaseFitnessActiveRecord
|
||||
{
|
||||
|
||||
public $productIdentifier;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'procurement';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_warehouse', 'count', 'purchase_price' ], 'required'],
|
||||
[['id_warehouse', 'count', 'productIdentifier', 'purchase_price' ], 'required' , 'on' => 'create_general'],
|
||||
[['id_warehouse', 'id_user', 'id_product', 'count', 'stock', 'purchase_price'], 'integer'],
|
||||
[['description'], 'string', 'max' => 255],
|
||||
[['productIdentifier'], 'string', 'max' => 128],
|
||||
[['productIdentifier'] ,'validateProductIdentifier', 'on' => 'create_general']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id_procurement' => Yii::t('common/procurement', 'Id Procurement'),
|
||||
'id_warehouse' => Yii::t('common/procurement', 'Id Warehouse'),
|
||||
'id_user' => Yii::t('common/procurement', 'Id User'),
|
||||
'id_product' => Yii::t('common/procurement', 'Id Product'),
|
||||
'count' => Yii::t('common/procurement', 'Count'),
|
||||
'stock' => Yii::t('common/procurement', 'Stock'),
|
||||
'purchase_price' => Yii::t('common/procurement', 'Purchase Price'),
|
||||
'description' => Yii::t('common/procurement', 'Description'),
|
||||
'created_at' => Yii::t('common/procurement', 'Created At'),
|
||||
'updated_at' => Yii::t('common/procurement', 'Updated At'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function validateProductIdentifier($attribute,$params){
|
||||
$product = null;
|
||||
|
||||
if ( isset($this->productIdentifier)){
|
||||
$id = $this->productIdentifier;
|
||||
$conditionProductName = ['name' =>$id];
|
||||
$conditionProductNumber = ['product_number' =>$id];
|
||||
$conditionBarcode= ['barcode' =>$id];
|
||||
$products = Product::find()->andWhere(['or', ['name' =>$id] , ['product_number' =>$id] ,['barcode' =>$id] ] )->all();
|
||||
if ( count($products) == 1 ){
|
||||
$product = $products[0];
|
||||
$this->id_product = $product->id_product;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $product == null ){
|
||||
$this->addError('productIdentifier' , Yii::t("common/procurement", "Invalid product"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// PRODUCT
|
||||
////////////////////////////////
|
||||
public function getProduct() {
|
||||
return $this->hasOne ( Product::className (), [
|
||||
'id_product' => 'id_product'
|
||||
] );
|
||||
}
|
||||
public function getProductName() {
|
||||
return $this->product->name;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// WAREHOUSE
|
||||
////////////////////////////////
|
||||
public function getWarehouse() {
|
||||
return $this->hasOne ( Warehouse::className (), [
|
||||
'id_warehouse' => 'id_warehouse'
|
||||
] );
|
||||
}
|
||||
|
||||
public function getWarehouseName(){
|
||||
return $this->warehouse->name;
|
||||
}
|
||||
////////////////////////////////
|
||||
// USER
|
||||
////////////////////////////////
|
||||
public function getUser() {
|
||||
return $this->hasOne ( User::className (), [
|
||||
'id' => 'id_user'
|
||||
] );
|
||||
}
|
||||
|
||||
public function getUserName(){
|
||||
return $this->user->username;
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,7 +8,8 @@ use Yii;
|
||||
* This is the model class for table "product".
|
||||
*
|
||||
* @property integer $id_product
|
||||
* @property integer $id_product_type
|
||||
* @property string $name length 64
|
||||
* @property integer $id_product_category
|
||||
* @property integer $id_account
|
||||
* @property string $product_number
|
||||
* @property string $barcode
|
||||
@ -16,6 +17,7 @@ use Yii;
|
||||
* @property integer $sale_price
|
||||
* @property integer $profit_margins
|
||||
* @property integer $status
|
||||
* @property integer $stock
|
||||
* @property string $description
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
@ -39,10 +41,13 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_product_type', 'id_account'], 'required'],
|
||||
[['id_product_type', 'id_account', 'purchase_price', 'sale_price', 'profit_margins', 'status'], 'integer'],
|
||||
[['id_product_category', 'id_account', 'name'], 'required'],
|
||||
[['id_product_category', 'id_account', 'purchase_price', 'sale_price', 'profit_margins', 'status'], 'integer'],
|
||||
[['product_number', 'barcode'], 'string', 'max' => 20],
|
||||
[['description'], 'string', 'max' => 255]
|
||||
[['name'], 'string', 'max' => 128],
|
||||
[['description'], 'string', 'max' => 255],
|
||||
[['product_number'], 'unique' ],
|
||||
[['barcode'], 'unique' ],
|
||||
];
|
||||
}
|
||||
|
||||
@ -53,7 +58,7 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
||||
{
|
||||
return [
|
||||
'id_product' => Yii::t('common/product', 'Id Product'),
|
||||
'id_product_type' => Yii::t('common/product', 'Id Product Type'),
|
||||
'id_product_category' => Yii::t('common/product', 'Id Product Category'),
|
||||
'id_account' => Yii::t('common/product', 'Id Account'),
|
||||
'product_number' => Yii::t('common/product', 'Product Number'),
|
||||
'barcode' => Yii::t('common/product', 'Barcode'),
|
||||
@ -61,6 +66,7 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
||||
'sale_price' => Yii::t('common/product', 'Sale Price'),
|
||||
'profit_margins' => Yii::t('common/product', 'Profit Margins'),
|
||||
'status' => Yii::t('common/product', 'Status'),
|
||||
'name' => Yii::t('common/product', 'Name'),
|
||||
'description' => Yii::t('common/product', 'Description'),
|
||||
'created_at' => Yii::t('common/product', 'Created At'),
|
||||
'updated_at' => Yii::t('common/product', 'Updated At'),
|
||||
@ -104,4 +110,19 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* $param int $forceIncludeAccount id warehouse, that should be included in list, even if it is inactive
|
||||
* */
|
||||
public static function read($forceIncludeObjectWithId = null){
|
||||
$warehouses = null;
|
||||
|
||||
if ( $forceIncludeObjectWithId == null){
|
||||
$warehouses = Product::find()->andWhere(['status' => Product::STATUS_ACTIVE])->all();
|
||||
}else{
|
||||
$warehouses = Product::find()->andWhere( ['or', ['status' => Product::STATUS_ACTIVE], ['id_product' => $forceIncludeObjectWithId ] ])->all();
|
||||
}
|
||||
|
||||
return $warehouses;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -69,4 +69,20 @@ class ProductCategory extends \common\models\BaseFitnessActiveRecord
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $param int $forceIncludeAccount id account, that should be included in list, even if it is inactive
|
||||
* */
|
||||
public static function read($forceIncludeObjectWithId = null){
|
||||
$categories = null;
|
||||
|
||||
if ( $forceIncludeObjectWithId == null){
|
||||
$categories = ProductCategory::find()->andWhere(['status' => ProductCategory::STATUS_ACTIVE])->all();
|
||||
}else{
|
||||
$categories = ProductCategory::find()->andWhere( ['or', ['status' => ProductCategory::STATUS_ACTIVE], ['id_product_category' => $forceIncludeObjectWithId ] ])->all();
|
||||
}
|
||||
|
||||
return $categories;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -209,4 +209,21 @@ class User extends ActiveRecord implements IdentityInterface
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* $param int $forceIncludeAccount id warehouse, that should be included in list, even if it is inactive
|
||||
* */
|
||||
public static function read($forceIncludeObjectWithId = null){
|
||||
$warehouses = null;
|
||||
|
||||
if ( $forceIncludeObjectWithId == null){
|
||||
$warehouses = User::find()->andWhere(['status' => User::STATUS_ACTIVE])->all();
|
||||
}else{
|
||||
$warehouses = User::find()->andWhere( ['or', ['status' => User::STATUS_ACTIVE], ['id' => $forceIncludeObjectWithId ] ])->all();
|
||||
}
|
||||
|
||||
return $warehouses;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -83,4 +83,20 @@ class Warehouse extends \yii\db\ActiveRecord
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $param int $forceIncludeAccount id warehouse, that should be included in list, even if it is inactive
|
||||
* */
|
||||
public static function read($forceIncludeObjectWithId = null){
|
||||
$warehouses = null;
|
||||
|
||||
if ( $forceIncludeObjectWithId == null){
|
||||
$warehouses = Warehouse::find()->andWhere(['status' => Warehouse::STATUS_ACTIVE])->all();
|
||||
}else{
|
||||
$warehouses = Warehouse::find()->andWhere( ['or', ['status' => Warehouse::STATUS_ACTIVE], ['id_warehouse' => $forceIncludeObjectWithId ] ])->all();
|
||||
}
|
||||
|
||||
return $warehouses;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,7 +17,9 @@
|
||||
"php": ">=5.4.0",
|
||||
"yiisoft/yii2": ">=2.0.6",
|
||||
"yiisoft/yii2-bootstrap": "*",
|
||||
"yiisoft/yii2-swiftmailer": "*"
|
||||
"yiisoft/yii2-swiftmailer": "*",
|
||||
"kartik-v/yii2-widgets": "^3.4",
|
||||
"kartik-v/yii2-widget-typeahead": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"yiisoft/yii2-codeception": "*",
|
||||
|
||||
1124
composer.lock
generated
1124
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
use common\models\Product;
|
||||
|
||||
class m150924_162425_alter__table__product_fix_columns extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->renameColumn('product','id_product_type','id_product_category');
|
||||
$this->addColumn('product','stock', 'int(11)' );
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m150924_162425_alter__table__product_fix_columns cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150924_170806_alter__table__product__add__column__name extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->addColumn('product','name', 'varchar(128)' );
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m150924_170806_alter__table__product__add__column__name cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
47
console/migrations/m150925_055052_add__table_procurement.php
Normal file
47
console/migrations/m150925_055052_add__table_procurement.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150925_055052_add__table_procurement extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$tableOptions = null;
|
||||
if ($this->db->driverName === 'mysql') {
|
||||
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||
}
|
||||
|
||||
$this->createTable('{{%procurement}}', [
|
||||
'id_procurement' => $this->primaryKey(),
|
||||
'id_warehouse' => $this->integer()->notNull(),
|
||||
'id_user' => $this->integer()->notNull(),
|
||||
'id_product' => $this->integer()->notNull(),
|
||||
'count' => $this->integer()->notNull(),
|
||||
'stock' => $this->integer(),
|
||||
'purchase_price' => $this->integer(),
|
||||
'description' => $this->string(255),
|
||||
'created_at' => $this->timestamp()->notNull(),
|
||||
'updated_at' => $this->timestamp()->notNull(),
|
||||
], $tableOptions);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m150925_055052_add__table_procurement cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
48
console/migrations/m150925_194508_add__table__customer.php
Normal file
48
console/migrations/m150925_194508_add__table__customer.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150925_194508_add__table__customer extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$tableOptions = null;
|
||||
if ($this->db->driverName === 'mysql') {
|
||||
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||
}
|
||||
|
||||
$this->createTable('{{%customer}}', [
|
||||
'id_customer' => $this->primaryKey(),
|
||||
'id_customer_card' => $this->integer(),
|
||||
'id_user' => $this->integer(),
|
||||
'id_partner_card' => $this->integer(),
|
||||
'id_proposer' =>$this->integer(),
|
||||
'name' => $this->string(128),
|
||||
'email' => $this->string(255),
|
||||
'password' => $this->string(32),
|
||||
'phone' => $this->string(20),
|
||||
'sex' => $this->smallInteger(),
|
||||
'date_stundent_card_expire' => $this->date(),
|
||||
'birthdate' => $this->date(),
|
||||
'image' => $this->string(255),
|
||||
'description' => $this->string(255),
|
||||
'tax_number' => $this->string(20),
|
||||
'country' => $this->string(20),
|
||||
'zip' => $this->string(8),
|
||||
'city' => $this->string(30),
|
||||
'address' => $this->string(255),
|
||||
'created_at' => $this->timestamp()->notNull(),
|
||||
'updated_at' => $this->timestamp()->notNull(),
|
||||
], $tableOptions);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m150925_194508_add__table__customer cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
43
console/migrations/m150925_201715_add__table__card.php
Normal file
43
console/migrations/m150925_201715_add__table__card.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150925_201715_add__table__card extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$tableOptions = null;
|
||||
if ($this->db->driverName === 'mysql') {
|
||||
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||
}
|
||||
|
||||
$this->createTable('{{%card}}', [
|
||||
'id_card' => $this->primaryKey(),
|
||||
'number' => $this->string(20)->notNull(),
|
||||
'status' => $this->smallInteger()->notNull()->defaultValue(10),
|
||||
'type' => $this->integer(11)->notNull(),
|
||||
'created_at' => $this->timestamp()->notNull(),
|
||||
'updated_at' => $this->timestamp()->notNull(),
|
||||
], $tableOptions);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m150925_201715_add__table__card cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
59
console/migrations/m150926_123638_add__table__city.php
Normal file
59
console/migrations/m150926_123638_add__table__city.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m150926_123638_add__table__city extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$tableOptions = null;
|
||||
if ($this->db->driverName === 'mysql') {
|
||||
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
||||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
|
||||
}
|
||||
|
||||
$this->createTable('{{%city}}', [
|
||||
'id_city' => $this->primaryKey(),
|
||||
'zip' => $this->string(8)->notNull(),
|
||||
'name' => $this->string(64)->notNull(),
|
||||
'city_code' => $this->string(2)->notNull(),
|
||||
'latitude' => $this->float(),
|
||||
'longitude' => $this->float() ,
|
||||
'cso_code' => $this->integer(11) ,
|
||||
'rig_id' => $this->integer(11) ,
|
||||
'range' => $this->float() ,
|
||||
'population' =>$this->integer(11) ,
|
||||
'homes' => $this->integer(11) ,
|
||||
], $tableOptions);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m150926_123638_add__table__city cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
id_city
|
||||
zip
|
||||
name
|
||||
city_code
|
||||
latitude
|
||||
longitude
|
||||
cso_code
|
||||
rig_id
|
||||
cit_range
|
||||
population
|
||||
homes
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
54
frontend/components/FrontendMenuStructure.php
Normal file
54
frontend/components/FrontendMenuStructure.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
namespace frontend\components;
|
||||
|
||||
use Yii;
|
||||
use common\models\Order;
|
||||
use yii\helpers\Html;
|
||||
|
||||
class FrontendMenuStructure{
|
||||
|
||||
public $menuItems;
|
||||
|
||||
public function FrontendMenuStructure(){
|
||||
$this->menuItems = [];
|
||||
}
|
||||
|
||||
protected function can($authItem){
|
||||
$result = false;
|
||||
if (\Yii::$app->user->can($authItem)) {
|
||||
$result = true;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected function addUserMainMenu(){
|
||||
$this->menuItems[] = ['label' => 'Recepcio', 'url' => ['/customer/reception'] ];
|
||||
}
|
||||
|
||||
|
||||
protected function addLoginMainMenu(){
|
||||
if (Yii::$app->user->isGuest) {
|
||||
$mainMenuItem= ['label' => 'Login', 'url' => ['/site/login']];
|
||||
} else {
|
||||
$mainMenuItem= [
|
||||
'label' => 'Kijelentkezés (' . Yii::$app->user->identity->username . ')',
|
||||
'url' => ['/site/logout'],
|
||||
'linkOptions' => ['data-method' => 'post']
|
||||
];
|
||||
}
|
||||
$this->menuItems[] = $mainMenuItem;
|
||||
}
|
||||
|
||||
|
||||
public function run(){
|
||||
$this->addUserMainMenu();
|
||||
$this->addLoginMainMenu();
|
||||
return $this->menuItems;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
141
frontend/controllers/CustomerController.php
Normal file
141
frontend/controllers/CustomerController.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\Customer;
|
||||
use frontend\models\ReceptionForm;
|
||||
use frontend\models\CustomerSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\base\Object;
|
||||
|
||||
/**
|
||||
* CustomerController implements the CRUD actions for Customer model.
|
||||
*/
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function actionReception(){
|
||||
|
||||
$model = new ReceptionForm();
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
|
||||
|
||||
// return $this->redirect(['view', 'id' => $model->id_customer]);
|
||||
}
|
||||
|
||||
|
||||
return $this->render('reception',['model' => $model]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Lists all Customer models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new CustomerSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single Customer model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Customer model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new Customer();
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_customer]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing Customer model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_customer]);
|
||||
} else {
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing Customer model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Customer model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return Customer the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = Customer::findOne($id)) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
85
frontend/models/CustomerSearch.php
Normal file
85
frontend/models/CustomerSearch.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Customer;
|
||||
|
||||
/**
|
||||
* CustomerSearch represents the model behind the search form about `common\models\Customer`.
|
||||
*/
|
||||
class CustomerSearch extends Customer
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_customer', 'id_customer_card', 'id_user', 'id_partner_card', 'id_proposer', 'sex'], 'integer'],
|
||||
[['name', 'email', 'password', 'phone', 'date_stundent_card_expire', 'birthdate', 'image', 'description', 'tax_number', 'country', 'zip', 'city', 'address', 'created_at', 'updated_at'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = Customer::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([
|
||||
'id_customer' => $this->id_customer,
|
||||
'id_customer_card' => $this->id_customer_card,
|
||||
'id_user' => $this->id_user,
|
||||
'id_partner_card' => $this->id_partner_card,
|
||||
'id_proposer' => $this->id_proposer,
|
||||
'sex' => $this->sex,
|
||||
'date_stundent_card_expire' => $this->date_stundent_card_expire,
|
||||
'birthdate' => $this->birthdate,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'name', $this->name])
|
||||
->andFilterWhere(['like', 'email', $this->email])
|
||||
->andFilterWhere(['like', 'password', $this->password])
|
||||
->andFilterWhere(['like', 'phone', $this->phone])
|
||||
->andFilterWhere(['like', 'image', $this->image])
|
||||
->andFilterWhere(['like', 'description', $this->description])
|
||||
->andFilterWhere(['like', 'tax_number', $this->tax_number])
|
||||
->andFilterWhere(['like', 'country', $this->country])
|
||||
->andFilterWhere(['like', 'zip', $this->zip])
|
||||
->andFilterWhere(['like', 'city', $this->city])
|
||||
->andFilterWhere(['like', 'address', $this->address]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
||||
36
frontend/models/ReceptionForm.php
Normal file
36
frontend/models/ReceptionForm.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
|
||||
/**
|
||||
* ContactForm is the model behind the contact form.
|
||||
*/
|
||||
class ReceptionForm extends Model
|
||||
{
|
||||
public $number;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['number'], 'required'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'verifyCode' => 'Verification Code',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
61
frontend/views/customer/_form.php
Normal file
61
frontend/views/customer/_form.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="customer-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'id_customer_card')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'id_user')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'id_partner_card')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'id_proposer')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'sex')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'date_stundent_card_expire')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'birthdate')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'image')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'zip')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'city')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'created_at')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'updated_at')->textInput() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('frontend/customer', 'Create') : Yii::t('frontend/customer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
66
frontend/views/customer/_form_reception.php
Normal file
66
frontend/views/customer/_form_reception.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<style >
|
||||
.reception-form .btn.btn-reception{
|
||||
width:100%;
|
||||
margin-top: 6px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="reception-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class='col-md-3'>
|
||||
<div class='row'>
|
||||
<div class='col-md-8'>
|
||||
<?php echo Html::a(Yii::t( 'frontend/customer', 'Adatlap') , null, ['class' => 'btn btn-primary btn-reception'] )?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php echo Html::a(Html::tag("i","", [ 'class' => 'glyphicon glyphicon-plus' ] ) , null, ['class' => 'btn btn-primary btn-reception'] )?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-8'>
|
||||
<?php echo Html::a(Yii::t( 'frontend/customer', 'Befizetések') ,null,['class' => 'btn btn-primary btn-reception'] )?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php echo Html::a(Html::tag("i","", [ 'class' => 'glyphicon glyphicon-plus' ] ) , null, ['class' => 'btn btn-primary btn-reception'] )?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<?php echo Html::a(Yii::t( 'frontend/customer', 'Jelentkezések') , null,['class' => 'btn btn-primary btn-reception'] )?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<?php echo Html::a(Yii::t( 'frontend/customer', 'Egyenleg') , null,['class' => 'btn btn-primary btn-reception'] )?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<?php echo Html::a(Yii::t( 'frontend/customer', 'Termékeladás') , null,['class' => 'btn btn-primary btn-reception'] )?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-2'>
|
||||
<?php echo $form->field($model, 'number')->textInput()?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
67
frontend/views/customer/_search.php
Normal file
67
frontend/views/customer/_search.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model frontend\models\CustomerSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="customer-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id_customer') ?>
|
||||
|
||||
<?= $form->field($model, 'id_customer_card') ?>
|
||||
|
||||
<?= $form->field($model, 'id_user') ?>
|
||||
|
||||
<?= $form->field($model, 'id_partner_card') ?>
|
||||
|
||||
<?= $form->field($model, 'id_proposer') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'name') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'email') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'password') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'phone') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'sex') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'date_stundent_card_expire') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'birthdate') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'image') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'description') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'tax_number') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'country') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'zip') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'city') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'address') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'created_at') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'updated_at') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('frontend/customer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton(Yii::t('frontend/customer', 'Reset'), ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
21
frontend/views/customer/create.php
Normal file
21
frontend/views/customer/create.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
|
||||
$this->title = Yii::t('frontend/customer', 'Create Customer');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/customer', 'Customers'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="customer-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
54
frontend/views/customer/index.php
Normal file
54
frontend/views/customer/index.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel frontend\models\CustomerSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('frontend/customer', 'Customers');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="customer-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('frontend/customer', 'Create Customer'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'id_customer',
|
||||
'id_customer_card',
|
||||
'id_user',
|
||||
'id_partner_card',
|
||||
'id_proposer',
|
||||
// 'name',
|
||||
// 'email:email',
|
||||
// 'password',
|
||||
// 'phone',
|
||||
// 'sex',
|
||||
// 'date_stundent_card_expire',
|
||||
// 'birthdate',
|
||||
// 'image',
|
||||
// 'description',
|
||||
// 'tax_number',
|
||||
// 'country',
|
||||
// 'zip',
|
||||
// 'city',
|
||||
// 'address',
|
||||
// 'created_at',
|
||||
// 'updated_at',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
11
frontend/views/customer/reception.php
Normal file
11
frontend/views/customer/reception.php
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<h1>Recepció</h1>
|
||||
<?php
|
||||
|
||||
?>
|
||||
<?php echo $this->render('_form_reception', [ 'model' => $model ]); ?>
|
||||
23
frontend/views/customer/update.php
Normal file
23
frontend/views/customer/update.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
|
||||
$this->title = Yii::t('frontend/customer', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Customer',
|
||||
]) . ' ' . $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/customer', 'Customers'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_customer]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('frontend/customer', 'Update');
|
||||
?>
|
||||
<div class="customer-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
55
frontend/views/customer/view.php
Normal file
55
frontend/views/customer/view.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Customer */
|
||||
|
||||
$this->title = $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/customer', 'Customers'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="customer-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('frontend/customer', 'Update'), ['update', 'id' => $model->id_customer], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a(Yii::t('frontend/customer', 'Delete'), ['delete', 'id' => $model->id_customer], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('frontend/customer', 'Are you sure you want to delete this item?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_customer',
|
||||
'id_customer_card',
|
||||
'id_user',
|
||||
'id_partner_card',
|
||||
'id_proposer',
|
||||
'name',
|
||||
'email:email',
|
||||
'password',
|
||||
'phone',
|
||||
'sex',
|
||||
'date_stundent_card_expire',
|
||||
'birthdate',
|
||||
'image',
|
||||
'description',
|
||||
'tax_number',
|
||||
'country',
|
||||
'zip',
|
||||
'city',
|
||||
'address',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
@ -9,6 +9,8 @@ use yii\bootstrap\NavBar;
|
||||
use yii\widgets\Breadcrumbs;
|
||||
use frontend\assets\AppAsset;
|
||||
use common\widgets\Alert;
|
||||
use common\components\FrotnendMenuStructure;
|
||||
use frontend\components\FrontendMenuStructure;
|
||||
|
||||
AppAsset::register($this);
|
||||
?>
|
||||
@ -27,6 +29,10 @@ AppAsset::register($this);
|
||||
|
||||
<div class="wrap">
|
||||
<?php
|
||||
|
||||
$menuStruct = new FrontendMenuStructure();
|
||||
$items = $menuStruct->run();
|
||||
|
||||
NavBar::begin([
|
||||
'brandLabel' => 'My Company',
|
||||
'brandUrl' => Yii::$app->homeUrl,
|
||||
@ -51,7 +57,7 @@ AppAsset::register($this);
|
||||
}
|
||||
echo Nav::widget([
|
||||
'options' => ['class' => 'navbar-nav navbar-right'],
|
||||
'items' => $menuItems,
|
||||
'items' => $items,
|
||||
]);
|
||||
NavBar::end();
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user