Finish version/v.0.0.38
This commit is contained in:
commit
fdcc4623a2
@ -32,9 +32,6 @@ return [
|
|||||||
'session' => [
|
'session' => [
|
||||||
'name' => '_backendSessionId', // unique for backend
|
'name' => '_backendSessionId', // unique for backend
|
||||||
'savePath' => __DIR__ . '/../runtime', // a temporary folder on backend
|
'savePath' => __DIR__ . '/../runtime', // a temporary folder on backend
|
||||||
'cookieParams' => [
|
|
||||||
'path' => '/backend/web',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
'log' => [
|
'log' => [
|
||||||
'traceLevel' => YII_DEBUG ? 3 : 0,
|
'traceLevel' => YII_DEBUG ? 3 : 0,
|
||||||
|
|||||||
@ -33,7 +33,7 @@ class KeyController extends Controller {
|
|||||||
'rules' => [
|
'rules' => [
|
||||||
// allow authenticated users
|
// allow authenticated users
|
||||||
[
|
[
|
||||||
'actions' => ['create','index','view','update'],
|
'actions' => ['create','index','view','update','import'],
|
||||||
'allow' => true,
|
'allow' => true,
|
||||||
'roles' => ['admin','employee','reception'],
|
'roles' => ['admin','employee','reception'],
|
||||||
],
|
],
|
||||||
@ -156,10 +156,18 @@ class KeyController extends Controller {
|
|||||||
public function actionImport() {
|
public function actionImport() {
|
||||||
$model = new KeyImportForm();
|
$model = new KeyImportForm();
|
||||||
$arr = [ ];
|
$arr = [ ];
|
||||||
|
$updated = 0;
|
||||||
|
$inserted = 0;
|
||||||
|
$failed = 0;
|
||||||
|
$found = 0;
|
||||||
|
|
||||||
if (Yii::$app->request->isPost) {
|
if (Yii::$app->request->isPost) {
|
||||||
|
|
||||||
|
|
||||||
$model->file = UploadedFile::getInstance ( $model, 'file' );
|
$model->file = UploadedFile::getInstance ( $model, 'file' );
|
||||||
|
|
||||||
|
if ( isset($model->file)){
|
||||||
|
|
||||||
// print_r($model->file);
|
// print_r($model->file);
|
||||||
// $model->message = "ok";
|
// $model->message = "ok";
|
||||||
$file = $model->file->tempName;
|
$file = $model->file->tempName;
|
||||||
@ -191,25 +199,48 @@ class KeyController extends Controller {
|
|||||||
$arr [] = $item;
|
$arr [] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$found = count($arr);
|
||||||
|
|
||||||
foreach ( $arr as $item ) {
|
foreach ( $arr as $item ) {
|
||||||
try {
|
try {
|
||||||
|
$key = Key::findOne(['number' => $item ['number']]);
|
||||||
|
if ( !isset($key)){
|
||||||
$key = new Key ();
|
$key = new Key ();
|
||||||
$key->number = $item ['number'];
|
$key->number = $item ['number'];
|
||||||
$key->rfid_key = $item ['key'];
|
$key->rfid_key = $item ['key'];
|
||||||
$key->status = Key::STATUS_ACTIVE;
|
$key->status = Key::STATUS_ACTIVE;
|
||||||
$key->type = Key::TYPE_NORMAL;
|
$key->type = Key::TYPE_NORMAL;
|
||||||
$key->save ( false );
|
$key->save ( false );
|
||||||
|
$inserted++;
|
||||||
|
}else{
|
||||||
|
$key->rfid_key = $item['key'];
|
||||||
|
$key->update(false);
|
||||||
|
$updated++;
|
||||||
|
}
|
||||||
} catch ( \Exception $e ) {
|
} catch ( \Exception $e ) {
|
||||||
\Yii::error ( "Failed to save key: " . $key->number );
|
\Yii::error ( "Failed to save key: " . $key->number );
|
||||||
}
|
$failed++;
|
||||||
}
|
|
||||||
|
|
||||||
$this->redirect ( [
|
}
|
||||||
|
}
|
||||||
|
$message = "Fájlnév: " . $model->file->name;
|
||||||
|
$message .= "<br> Fájlból beolvasva: $found ";
|
||||||
|
$message .= "<br> Új kulcs sikeresen importálva: $inserted ";
|
||||||
|
$message .= "<br> Rendszerben lévő kulcs sikeresen módosítva: $updated ";
|
||||||
|
$message .= "<br> Sikertelen kulcs importálás/módosítás: $failed ";
|
||||||
|
\Yii::$app->session->setFlash('success',$message);
|
||||||
|
|
||||||
|
$model->message = $message;
|
||||||
|
|
||||||
|
\Yii::$app->session->set('mymessage',$model->message);
|
||||||
|
|
||||||
|
return $this->redirect ( [
|
||||||
'import'
|
'import'
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$model->message = \Yii::$app->session->get('mymessage');
|
||||||
|
\Yii::$app->session->remove('mymessage');
|
||||||
return $this->render ( 'import', [
|
return $this->render ( 'import', [
|
||||||
'model' => $model
|
'model' => $model
|
||||||
] );
|
] );
|
||||||
|
|||||||
@ -9,8 +9,24 @@ use yii\helpers\Html;
|
|||||||
|
|
||||||
<button>Submit</button>
|
<button>Submit</button>
|
||||||
<?php
|
<?php
|
||||||
echo ($model->message);
|
if ( isset($model->message)){
|
||||||
|
?>
|
||||||
|
<br>
|
||||||
|
<div class="panel panel-default" style="margin-top: 24px;">
|
||||||
|
<!-- Default panel contents -->
|
||||||
|
<div class="panel-heading">Importálás összegzése</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<?php echo $model->message;?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php ActiveForm::end() ?>
|
<?php ActiveForm::end() ?>
|
||||||
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
use yii\widgets\Breadcrumbs;
|
use yii\widgets\Breadcrumbs;
|
||||||
use dmstr\widgets\Alert;
|
|
||||||
use kartik\widgets\AlertBlock;
|
use kartik\widgets\AlertBlock;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/* @var $this \yii\web\View */
|
/* @var $this \yii\web\View */
|
||||||
/* @var $content string */
|
/* @var $content string */
|
||||||
@ -16,7 +17,7 @@ use yii\helpers\Html;
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<a class="navbar-brand" href="#">Adminisztráció</a>
|
<a class="navbar-brand" href="#"> <?php echo Helper::getCompanyName() ?> Adminisztráció</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="navbar-custom-menu">
|
<div class="navbar-custom-menu">
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/* @var $this \yii\web\View */
|
/* @var $this \yii\web\View */
|
||||||
/* @var $content string */
|
/* @var $content string */
|
||||||
@ -45,7 +46,7 @@ if (Yii::$app->controller->action->id === 'login') {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="hold-transition skin-red sidebar-mini">
|
<body class="hold-transition <?php echo Helper::getBackendSkin()?> sidebar-mini">
|
||||||
<?php $this->beginBody() ?>
|
<?php $this->beginBody() ?>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
-0.0.38
|
||||||
|
- add backend skin
|
||||||
|
- add import add/edit to key
|
||||||
-0.0.37
|
-0.0.37
|
||||||
- fix backend user acces
|
- fix backend user acces
|
||||||
- fix sell product account will not anymore changed
|
- fix sell product account will not anymore changed
|
||||||
|
|||||||
@ -256,9 +256,16 @@ class Helper {
|
|||||||
return \Yii::$app->params ['user_cart_item_visibility'] == 'user';
|
return \Yii::$app->params ['user_cart_item_visibility'] == 'user';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getBackendSkin() {
|
||||||
|
return \Yii::$app->params ['backend_skin'] ;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getCompany() {
|
public static function getCompany() {
|
||||||
return \Yii::$app->params ['company'] ;
|
return \Yii::$app->params ['company'] ;
|
||||||
}
|
}
|
||||||
|
public static function getCompanyName() {
|
||||||
|
return \Yii::$app->params ['company_name'] ;
|
||||||
|
}
|
||||||
|
|
||||||
public static function isCompanyMovar() {
|
public static function isCompanyMovar() {
|
||||||
return \Yii::$app->params ['company'] == 'movar';
|
return \Yii::$app->params ['company'] == 'movar';
|
||||||
|
|||||||
@ -4,7 +4,7 @@ return [
|
|||||||
'supportEmail' => 'rocho02@gmail.com',
|
'supportEmail' => 'rocho02@gmail.com',
|
||||||
'infoEmail' => 'info@rocho-net.hu',
|
'infoEmail' => 'info@rocho-net.hu',
|
||||||
'user.passwordResetTokenExpire' => 3600,
|
'user.passwordResetTokenExpire' => 3600,
|
||||||
'version' => 'v0.0.37',
|
'version' => 'v0.0.38',
|
||||||
'company' => 'movar',//gyor
|
'company' => 'movar',//gyor
|
||||||
'company_name' => "Freimann Kft.",
|
'company_name' => "Freimann Kft.",
|
||||||
'product_visiblity' => 'account',// on reception which products to display. account or global
|
'product_visiblity' => 'account',// on reception which products to display. account or global
|
||||||
@ -17,7 +17,7 @@ return [
|
|||||||
'login_admin_email' => true, //if admin login should send email
|
'login_admin_email' => true, //if admin login should send email
|
||||||
'account_state_close_preload_money' => 'true',//preload money wnen show account state close page
|
'account_state_close_preload_money' => 'true',//preload money wnen show account state close page
|
||||||
'ugiro_duplom_kod' => 1,
|
'ugiro_duplom_kod' => 1,
|
||||||
'ugiro_kezdemenyezo_szamlaszam' => '5860025215371128',
|
'ugiro_kezdemenyezo_szamlaszam' => '000000000000000',//5860025215371128
|
||||||
'ugiro_kezdemenyezo_azonosito' => 'A25366936T244',
|
'ugiro_kezdemenyezo_azonosito' => 'A25366936T244',
|
||||||
//a recepicó kosár csak az aktuális user által kiadott termékeket tartalmazza
|
//a recepicó kosár csak az aktuális user által kiadott termékeket tartalmazza
|
||||||
//vagy mindent
|
//vagy mindent
|
||||||
@ -26,5 +26,6 @@ return [
|
|||||||
/**
|
/**
|
||||||
* Hány napig láthatják visszamenőleg a recepciósok az adatokat
|
* Hány napig láthatják visszamenőleg a recepciósok az adatokat
|
||||||
* */
|
* */
|
||||||
'reception_visibility_days' => 3
|
'reception_visibility_days' => 3,
|
||||||
|
'backend_skin' => 'skin-red', //skin-green
|
||||||
];
|
];
|
||||||
|
|||||||
@ -94,6 +94,8 @@ class Key extends \yii\db\ActiveRecord
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param yii\db\Query $query
|
* @param yii\db\Query $query
|
||||||
* */
|
* */
|
||||||
|
|||||||
@ -41,7 +41,16 @@ class KeyToggleForm extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function toggleKey(){
|
public function toggleKey(){
|
||||||
$this->keyModel = Key::find()->andWhere(['rfid_key' => $this->key])->one();
|
$query= Key::find();
|
||||||
|
|
||||||
|
$query->andWhere(['or',
|
||||||
|
['and',[ 'in','key.number' , [$this->key]],"trim(coalesce(key.number, '')) <>'' " ],
|
||||||
|
['and', ['in','key.rfid_key' ,[ $this->key ] ],"trim(coalesce(key.rfid_key, '')) <>'' "],
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->keyModel = $query->one();
|
||||||
|
|
||||||
if ( isset($this->keyModel) ){
|
if ( isset($this->keyModel) ){
|
||||||
$assignments = CardKeyAssignment::find()->andWhere(['id_key' => $this->keyModel->id_key])->all();
|
$assignments = CardKeyAssignment::find()->andWhere(['id_key' => $this->keyModel->id_key])->all();
|
||||||
if ( count($assignments) > 0){
|
if ( count($assignments) > 0){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user