Fix hide reception cart
- add property user_cart_on - add property product_sale_default_focus - add property ticket_create-price_editable - add discount product/ticket enabled
This commit is contained in:
parent
b476febb10
commit
2e3a8d53ca
@ -66,7 +66,7 @@ class AdminMenuStructure{
|
|||||||
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ];
|
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ];
|
||||||
$items[] = ['label' => 'Kulcsok', 'url' =>['/key/index']];
|
$items[] = ['label' => 'Kulcsok', 'url' =>['/key/index']];
|
||||||
// $items[] = ['label' => 'Pénznem', 'url' => ['/currency/index'] ];
|
// $items[] = ['label' => 'Pénznem', 'url' => ['/currency/index'] ];
|
||||||
$this->menuItems[] = ['label' => 'Törszadatok', 'url' =>$this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Törzsadatok', 'url' =>$this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -19,9 +19,12 @@ use common\models\Discount;
|
|||||||
|
|
||||||
<?= $form->field($model, 'type')->dropDownList(Discount::types()) ?>
|
<?= $form->field($model, 'type')->dropDownList(Discount::types()) ?>
|
||||||
|
|
||||||
|
|
||||||
<?= $form->field($model, 'value')->textInput() ?>
|
<?= $form->field($model, 'value')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'product_enabled')->checkbox() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'ticket_enabled')->checkbox() ?>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/discount', 'Create') : Yii::t('common/discount', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/discount', 'Create') : Yii::t('common/discount', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
|||||||
@ -33,8 +33,17 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
[
|
[
|
||||||
'attribute' => 'type',
|
'attribute' => 'type',
|
||||||
'value' => 'typeHuman',
|
'value' => 'typeHuman',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'ticket_enabled',
|
||||||
|
'value' => 'ticketEnabledHuman',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'product_enabled',
|
||||||
|
'value' => 'procutEnabledHuman',
|
||||||
],
|
],
|
||||||
'value',
|
'value',
|
||||||
|
|
||||||
'created_at:datetime',
|
'created_at:datetime',
|
||||||
'updated_at:datetime',
|
'updated_at:datetime',
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,14 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'attribute' => 'type',
|
'attribute' => 'type',
|
||||||
'value' => $model->typeHuman
|
'value' => $model->typeHuman
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'product_enabled',
|
||||||
|
'value' => $model->getProcutEnabledHuman()
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'ticket_enabled',
|
||||||
|
'value' => $model->getTicketEnabledHuman()
|
||||||
|
],
|
||||||
// 'status',
|
// 'status',
|
||||||
// 'type',
|
// 'type',
|
||||||
'value',
|
'value',
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
|
-0.0.42
|
||||||
|
- add property user_cart_on
|
||||||
|
- add property product_sale_default_focus
|
||||||
|
- add property ticket_create_price_editable
|
||||||
|
- add discount visibility for ticket/product
|
||||||
-0.0.42
|
-0.0.42
|
||||||
- add detsta import improvements
|
- add detsta import improvements
|
||||||
- add procurement/create-product , translations, redirects
|
- add procurement/create-product , translations, redirects
|
||||||
|
|||||||
@ -278,6 +278,13 @@ class Helper {
|
|||||||
return \Yii::$app->params ['company'] == 'movar';
|
return \Yii::$app->params ['company'] == 'movar';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isUserCartOn() {
|
||||||
|
return \Yii::$app->params ['user_cart_on'] == true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getProductSaleDefaultFocus() {
|
||||||
|
return \Yii::$app->params ['product_sale_default_focus'] ;
|
||||||
|
}
|
||||||
public static function isProductVisibilityAccount() {
|
public static function isProductVisibilityAccount() {
|
||||||
return \Yii::$app->params ['product_visiblity'] == 'account';
|
return \Yii::$app->params ['product_visiblity'] == 'account';
|
||||||
}
|
}
|
||||||
@ -298,6 +305,11 @@ class Helper {
|
|||||||
return \Yii::$app->params ['reception_visibility_days'] ;
|
return \Yii::$app->params ['reception_visibility_days'] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function isTicketCreatePriceEditable() {
|
||||||
|
return \Yii::$app->params ['ticket_create_price_editable'] == true ;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getRealUserIp() {
|
public static function getRealUserIp() {
|
||||||
$client = @$_SERVER ['HTTP_CLIENT_IP'];
|
$client = @$_SERVER ['HTTP_CLIENT_IP'];
|
||||||
$forward = @$_SERVER ['HTTP_X_FORWARDED_FOR'];
|
$forward = @$_SERVER ['HTTP_X_FORWARDED_FOR'];
|
||||||
|
|||||||
@ -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.42',
|
'version' => 'v0.0.43',
|
||||||
'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
|
||||||
@ -30,12 +30,17 @@ return [
|
|||||||
* */
|
* */
|
||||||
'reception_visibility_days' => 3,
|
'reception_visibility_days' => 3,
|
||||||
'backend_skin' => 'skin-red', //skin-green
|
'backend_skin' => 'skin-red', //skin-green
|
||||||
|
/**User cart module on/off*/
|
||||||
|
'user_cart_on' => true,
|
||||||
/**
|
/**
|
||||||
* if products in carts are visible for everyone or only for the user
|
* a termék eladás oldalon hol legyen az alaéprtelmezett focus
|
||||||
* possible values :
|
* a vonalkód mezőn vagy az autocomplete mezőn
|
||||||
* - user: a felhasználó csak azokat a termékeket látja a kosrába, amiket ő rakott bele
|
barcode | autocomplete */
|
||||||
* - global: a felhasználó minden kosrában lévő terméket lát, még azokat is , amiket nem ő rakott bele
|
'product_sale_default_focus' => 'barcode',
|
||||||
*
|
/**
|
||||||
**/
|
* Bérlet eladásnál módosítható e az ár
|
||||||
|
* */
|
||||||
|
'ticket_create_price_editable' => true,
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@ -14,6 +14,8 @@ use yii\helpers\ArrayHelper;
|
|||||||
* @property integer $status
|
* @property integer $status
|
||||||
* @property integer $type
|
* @property integer $type
|
||||||
* @property integer $value
|
* @property integer $value
|
||||||
|
* @property integer $product_enabled
|
||||||
|
* @property integer $ticket_enabled
|
||||||
* @property string $created_at
|
* @property string $created_at
|
||||||
* @property string $updated_at
|
* @property string $updated_at
|
||||||
*/
|
*/
|
||||||
@ -51,7 +53,7 @@ class Discount extends \yii\db\ActiveRecord
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['name','value'], 'required'],
|
[['name','value'], 'required'],
|
||||||
[['status', 'type', 'value'], 'integer'],
|
[['status', 'type', 'value','product_enabled','ticket_enabled'], 'integer'],
|
||||||
[['name'], 'string', 'max' => 64]
|
[['name'], 'string', 'max' => 64]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -69,6 +71,8 @@ class Discount extends \yii\db\ActiveRecord
|
|||||||
'value' => Yii::t('common/discount', 'Value'),
|
'value' => Yii::t('common/discount', 'Value'),
|
||||||
'created_at' => Yii::t('common/discount', 'Created At'),
|
'created_at' => Yii::t('common/discount', 'Created At'),
|
||||||
'updated_at' => Yii::t('common/discount', 'Updated At'),
|
'updated_at' => Yii::t('common/discount', 'Updated At'),
|
||||||
|
'product_enabled' => "Termékre adható",
|
||||||
|
'ticket_enabled' => "Bérletre adható",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,10 +108,28 @@ class Discount extends \yii\db\ActiveRecord
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getProcutEnabledHuman(){
|
||||||
|
return $this->product_enabled == 1 ? 'Igen' : 'Nem';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTicketEnabledHuman(){
|
||||||
|
return $this->ticket_enabled == 1 ? 'Igen' : 'Nem';
|
||||||
|
}
|
||||||
|
|
||||||
public static function read(){
|
public static function read(){
|
||||||
return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE ])->all();
|
return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE ])->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function readProductDiscounts(){
|
||||||
|
return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE , 'product_enabled' => 1 ])->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function readTicketDiscounts(){
|
||||||
|
return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE , 'ticket_enabled' => 1 ])->all();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param integer $money
|
* @param integer $money
|
||||||
* @param common\models\Discount $discount
|
* @param common\models\Discount $discount
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m160228_111209_alter__table__discount__add__columns__product_on__ticket__on extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn("discount", "product_enabled", "int default 0");
|
||||||
|
$this->addColumn("discount", "ticket_enabled", "int default 0");
|
||||||
|
|
||||||
|
$this->execute("update discount set product_enabled = 1 , ticket_enabled = 1;");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m160228_111209_alter__table__discount__add__columns__product_on__ticket__on cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -95,7 +95,7 @@ class ProductController extends Controller {
|
|||||||
|
|
||||||
$accounts = Account::read ();
|
$accounts = Account::read ();
|
||||||
|
|
||||||
$discounts = Discount::read ();
|
$discounts = Discount::readProductDiscounts();
|
||||||
|
|
||||||
$user = User::findOne ( Yii::$app->user->id );
|
$user = User::findOne ( Yii::$app->user->id );
|
||||||
|
|
||||||
|
|||||||
@ -104,7 +104,7 @@ class TicketController extends FrontendController
|
|||||||
|
|
||||||
$model = new TicketCreate();
|
$model = new TicketCreate();
|
||||||
|
|
||||||
$discounts = Discount::read();
|
$discounts = Discount::readTicketDiscounts();
|
||||||
|
|
||||||
$ticketTypes = TicketType::read(null, null);
|
$ticketTypes = TicketType::read(null, null);
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ use common\models\Discount;
|
|||||||
$types = TicketType::findAll(['status' => TicketType::STATUS_ACTIVE ,'installment_enabled' => '1']);
|
$types = TicketType::findAll(['status' => TicketType::STATUS_ACTIVE ,'installment_enabled' => '1']);
|
||||||
$types = HtmlHelper::mkTicketTypeOptions($types);
|
$types = HtmlHelper::mkTicketTypeOptions($types);
|
||||||
|
|
||||||
$discounts = Discount::read();
|
$discounts = Discount::readTicketDiscounts();
|
||||||
$discounts = ['' => ''] + HtmlHelper::mkDiscountOptions($discounts);
|
$discounts = ['' => ''] + HtmlHelper::mkDiscountOptions($discounts);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -3,6 +3,7 @@ use yii\helpers\Html;
|
|||||||
use yii\bootstrap\ActiveForm;
|
use yii\bootstrap\ActiveForm;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
use common\models\Transfer;
|
use common\models\Transfer;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model frontend\models\ProductSaleForm */
|
/* @var $model frontend\models\ProductSaleForm */
|
||||||
@ -110,7 +111,9 @@ $discountOptions = mkOptions( ArrayHelper::map($discounts, 'id_discount', 'name'
|
|||||||
<?php echo Html::a(Yii::t("frontend/product","Sell"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
|
<?php echo Html::a(Yii::t("frontend/product","Sell"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
|
<?php if ( Helper::isUserCartOn()){ ?>
|
||||||
<?php echo Html::a(Yii::t("frontend/product","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_sell_append'] );?>
|
<?php echo Html::a(Yii::t("frontend/product","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_sell_append'] );?>
|
||||||
|
<?php }?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use frontend\components\ReceptionWidget;
|
|||||||
use yii\bootstrap\ActiveForm;
|
use yii\bootstrap\ActiveForm;
|
||||||
use yii\helpers\Url;
|
use yii\helpers\Url;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $form yii\bootstrap\ActiveForm */
|
/* @var $form yii\bootstrap\ActiveForm */
|
||||||
@ -30,6 +31,9 @@ if ( isset($model->card) ){
|
|||||||
$options['discounts'] = Discount::modelsToArray($discounts);
|
$options['discounts'] = Discount::modelsToArray($discounts);
|
||||||
$options['id_account'] = Account::readDefault();
|
$options['id_account'] = Account::readDefault();
|
||||||
|
|
||||||
|
$options['product_sale_default_focus'] = Helper::getProductSaleDefaultFocus();
|
||||||
|
$options['user_cart_on'] = Helper::isUserCartOn();
|
||||||
|
|
||||||
|
|
||||||
$this->registerJs ( 'new ProductSell( '. json_encode($options).');' );
|
$this->registerJs ( 'new ProductSell( '. json_encode($options).');' );
|
||||||
|
|
||||||
@ -97,7 +101,9 @@ $this->params['breadcrumbs'][] = Yii::t('frontend/product', 'Sale');
|
|||||||
<?php if ( $receptionForm->isCardWithCustomer() ){ ?>
|
<?php if ( $receptionForm->isCardWithCustomer() ){ ?>
|
||||||
<?php echo $this->render('_customer_cart' , ['model' => $model]) ?>
|
<?php echo $this->render('_customer_cart' , ['model' => $model]) ?>
|
||||||
<?php }?>
|
<?php }?>
|
||||||
|
<?php if ( Helper::isUserCartOn()) {?>
|
||||||
<?php echo $this->render('_user_cart' ) ?>
|
<?php echo $this->render('_user_cart' ) ?>
|
||||||
|
<?php }?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use frontend\components\HtmlHelper;
|
|||||||
use kartik\widgets\DatePicker;
|
use kartik\widgets\DatePicker;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use common\models\Transfer;
|
use common\models\Transfer;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\Ticket */
|
/* @var $model common\models\Ticket */
|
||||||
@ -65,7 +66,15 @@ use common\models\Transfer;
|
|||||||
|
|
||||||
<?= $form->field($model, 'max_usage_count')->input('number') ?>
|
<?= $form->field($model, 'max_usage_count')->input('number') ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'price_brutto')->input('number') ?>
|
<?php
|
||||||
|
if ( Helper::isTicketCreatePriceEditable()){
|
||||||
|
echo $form->field($model, 'price_brutto')->input('number' );
|
||||||
|
}else{
|
||||||
|
echo $form->field($model, 'price_brutto')->input('number' ,['readonly' => true] );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<?= $form->field($model, 'comment')->textarea(['maxlength' => true]) ?>
|
<?= $form->field($model, 'comment')->textarea(['maxlength' => true]) ?>
|
||||||
|
|
||||||
@ -74,7 +83,12 @@ use common\models\Transfer;
|
|||||||
<?php echo Html::a(Yii::t("frontend/ticket","Fizetve"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
|
<?php echo Html::a(Yii::t("frontend/ticket","Fizetve"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?php echo Html::a(Yii::t("frontend/ticket","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_user_cart'] );?>
|
|
||||||
|
<?php
|
||||||
|
if ( Helper::isUserCartOn()){
|
||||||
|
echo Html::a(Yii::t("frontend/ticket","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_user_cart'] );
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use frontend\assets\TicketSellAsset;
|
|||||||
use common\models\TicketType;
|
use common\models\TicketType;
|
||||||
use yii\helpers\Url;
|
use yii\helpers\Url;
|
||||||
use frontend\components\ReceptionWidget;
|
use frontend\components\ReceptionWidget;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
@ -68,7 +69,11 @@ $this->registerJs ( 'new TicketSell( '. json_encode($options).');' );
|
|||||||
<?php if ( $receptionForm->isCardWithCustomer() ){ ?>
|
<?php if ( $receptionForm->isCardWithCustomer() ){ ?>
|
||||||
<?php echo $this->render('_customer_cart' ,['model' => $receptionForm]) ?>
|
<?php echo $this->render('_customer_cart' ,['model' => $receptionForm]) ?>
|
||||||
<?php }?>
|
<?php }?>
|
||||||
<?php echo $this->render('_user_cart' ) ?>
|
<?php
|
||||||
|
if ( Helper::isUserCartOn() ) {
|
||||||
|
echo $this->render('_user_cart' ) ;
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -34,6 +34,12 @@ function ProductSell(o){
|
|||||||
url_pay_transaction : '',
|
url_pay_transaction : '',
|
||||||
value_number: '',
|
value_number: '',
|
||||||
name_number: '',
|
name_number: '',
|
||||||
|
user_cart_on: true,
|
||||||
|
//if enter pressed in count field, what to submet: 'paid' or 'add_to_user_cart' action
|
||||||
|
product_count_enter_action: 'user_cart',
|
||||||
|
//barcode or autocomplete
|
||||||
|
product_sale_default_focus: 'barcode',
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,10 +59,7 @@ function ProductSell(o){
|
|||||||
|
|
||||||
createCarts();
|
createCarts();
|
||||||
|
|
||||||
addPayoutButtons();
|
|
||||||
|
|
||||||
productChanged();
|
productChanged();
|
||||||
// addDocumentKeypressedListener();
|
|
||||||
|
|
||||||
initAutocomplete();
|
initAutocomplete();
|
||||||
disalbeMousewheelSpinOnNumberInput();
|
disalbeMousewheelSpinOnNumberInput();
|
||||||
@ -68,13 +71,6 @@ function ProductSell(o){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* payout out user or customer cart
|
|
||||||
* */
|
|
||||||
function addPayoutButtons(){
|
|
||||||
// addBehaviourPayoutUserCart();
|
|
||||||
// addBehaviourPayoutCustomerCart();
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* display user and customer cart on page load
|
* display user and customer cart on page load
|
||||||
* */
|
* */
|
||||||
@ -111,41 +107,6 @@ function ProductSell(o){
|
|||||||
$("#productsaleform-id_discount").change(refreshCalculatedValues);
|
$("#productsaleform-id_discount").change(refreshCalculatedValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addDocumentKeypressedListener(){
|
|
||||||
$( document ).keypress(function( event ) {
|
|
||||||
|
|
||||||
var tag = event.target.tagName.toLowerCase();
|
|
||||||
if ( tag != 'input' && tag != 'textarea') {
|
|
||||||
|
|
||||||
resetSequenceIfToMuchTimePassedOrEnterWasPressed(event);
|
|
||||||
|
|
||||||
if ( event.which == 13 ) {
|
|
||||||
app.enterPressed = 1;
|
|
||||||
$( document ).trigger( "wordtyped", [ { originalEvent: event, 'word': app.seq } ] );
|
|
||||||
}else {
|
|
||||||
appendCharToSeq(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$( document ).on( "wordtyped", function( event, data ) {
|
|
||||||
var word;
|
|
||||||
word = data.word;
|
|
||||||
if ( word.length > 0){
|
|
||||||
if ( word.length >= 6 && word.length <= 9 ){
|
|
||||||
//lookupuser
|
|
||||||
}else{
|
|
||||||
$("#filter_text").val(data.word);
|
|
||||||
_lookupProduct(data.word);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function resetSequenceIfToMuchTimePassedOrEnterWasPressed(){
|
function resetSequenceIfToMuchTimePassedOrEnterWasPressed(){
|
||||||
var prevDate, timePassed;
|
var prevDate, timePassed;
|
||||||
prevDate= app.keyDate;
|
prevDate= app.keyDate;
|
||||||
@ -181,7 +142,11 @@ function ProductSell(o){
|
|||||||
* set the focus for text input #filter_text
|
* set the focus for text input #filter_text
|
||||||
* */
|
* */
|
||||||
function setFocus(){
|
function setFocus(){
|
||||||
|
if ( app.defaults.product_sale_default_focus == 'barcode'){
|
||||||
$("#filter_text").focus();
|
$("#filter_text").focus();
|
||||||
|
}else{
|
||||||
|
$("#product_search").focus();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +175,18 @@ function ProductSell(o){
|
|||||||
if ( event.which == 13 ) {
|
if ( event.which == 13 ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
|
|
||||||
|
if ( app.defaults.user_cart_on ){
|
||||||
|
if ( app.defaults.product_count_enter_action == 'user_cart'){
|
||||||
submitSellAndAppend();
|
submitSellAndAppend();
|
||||||
|
}else{
|
||||||
|
submitSell();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
submitSell();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -445,44 +421,6 @@ function ProductSell(o){
|
|||||||
$(app.defaults.selector_customer_cart ).transferList( 'option', 'transfers' , app.defaults.customer_cart );
|
$(app.defaults.selector_customer_cart ).transferList( 'option', 'transfers' , app.defaults.customer_cart );
|
||||||
}
|
}
|
||||||
|
|
||||||
function addBehaviourPayoutUserCart( ){
|
|
||||||
$( app.defaults.selector_btn_pay_user_cart ).on('click',function(){
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: app.defaults.url_pay_user_cart,
|
|
||||||
type: 'post',
|
|
||||||
data: {},
|
|
||||||
success: function (response) {
|
|
||||||
if ( response.code == 'success'){
|
|
||||||
app.defaults.user_cart = response.transfers;
|
|
||||||
refreshUserCart();
|
|
||||||
$.notify(app.defaults.message_paid, { 'type' : 'success' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function addBehaviourPayoutCustomerCart( ){
|
|
||||||
$( app.defaults.selector_btn_pay_customer_cart ).on('click',function(){
|
|
||||||
$.ajax({
|
|
||||||
url: app.defaults.url_pay_customer_card,
|
|
||||||
type: 'post',
|
|
||||||
data: {},
|
|
||||||
success: function (response) {
|
|
||||||
if ( response.code == 'success'){
|
|
||||||
app.defaults.customer_cart = response.customer_cart;
|
|
||||||
refreshCustomerCart();
|
|
||||||
}
|
|
||||||
$.notify(response.message, { 'type' : response.code });
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
alert('Hiba történt');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function createUserCartTable(){
|
function createUserCartTable(){
|
||||||
$(app.defaults.selector_user_cart).transferList({
|
$(app.defaults.selector_user_cart).transferList({
|
||||||
|
|||||||
@ -50,6 +50,8 @@ function TicketSell(o){
|
|||||||
url_pay_transaction: '',
|
url_pay_transaction: '',
|
||||||
discounts : [],
|
discounts : [],
|
||||||
discount: null,
|
discount: null,
|
||||||
|
//if user cart module is on or off
|
||||||
|
user_cart_on: true
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ function TicketSell(o){
|
|||||||
addBehaviourDiscountChangedListener();
|
addBehaviourDiscountChangedListener();
|
||||||
useDefaults();
|
useDefaults();
|
||||||
createCarts();
|
createCarts();
|
||||||
addPayoutButtons();
|
// addPayoutButtons();
|
||||||
addSellButtons();
|
addSellButtons();
|
||||||
// addBehaviourBtnCartPaid();
|
// addBehaviourBtnCartPaid();
|
||||||
}
|
}
|
||||||
@ -82,16 +84,19 @@ function TicketSell(o){
|
|||||||
/**
|
/**
|
||||||
* payout out user or customer cart
|
* payout out user or customer cart
|
||||||
* */
|
* */
|
||||||
|
/*
|
||||||
function addPayoutButtons(){
|
function addPayoutButtons(){
|
||||||
// addBehaviourPayoutUserCart();
|
// addBehaviourPayoutUserCart();
|
||||||
// addBehaviourPayoutCustomerCart();
|
// addBehaviourPayoutCustomerCart();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* display user and customer cart on page load
|
* display user and customer cart on page load
|
||||||
* */
|
* */
|
||||||
function createCarts(){
|
function createCarts(){
|
||||||
|
if ( app.defaults.user_cart_on ){
|
||||||
createUserCartTable();
|
createUserCartTable();
|
||||||
|
}
|
||||||
createCustomerCartTable();
|
createCustomerCartTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +122,9 @@ function TicketSell(o){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addSellButtons(){
|
function addSellButtons(){
|
||||||
|
if ( app.defaults.user_cart_on ){
|
||||||
addBehaviourBtnSellAndAppendToUserCart();
|
addBehaviourBtnSellAndAppendToUserCart();
|
||||||
|
}
|
||||||
addBehaviourBtnAddToCustomerCart();
|
addBehaviourBtnAddToCustomerCart();
|
||||||
addBehaviourBtnSell();
|
addBehaviourBtnSell();
|
||||||
}
|
}
|
||||||
@ -148,44 +155,6 @@ function TicketSell(o){
|
|||||||
$('#btn_sell').on('click',submitSell);
|
$('#btn_sell').on('click',submitSell);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addBehaviourPayoutUserCart( ){
|
|
||||||
// $( app.defaults.selector_btn_pay_user_cart ).on('click',function(){
|
|
||||||
//
|
|
||||||
// $.ajax({
|
|
||||||
// url: app.defaults.url_pay_user_cart,
|
|
||||||
// type: 'post',
|
|
||||||
// data: {},
|
|
||||||
// success: function (response) {
|
|
||||||
// if ( response.code == 'success'){
|
|
||||||
// app.defaults.user_cart = response.transfers;
|
|
||||||
// refreshUserCart();
|
|
||||||
// $.notify(app.defaults.message_paid, { 'type' : 'success' });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
function addBehaviourPayoutCustomerCart( ){
|
|
||||||
// $( app.defaults.selector_btn_pay_customer_cart ).on('click',function(){
|
|
||||||
// $.ajax({
|
|
||||||
// url: app.defaults.url_pay_customer_card,
|
|
||||||
// type: 'post',
|
|
||||||
// data: {},
|
|
||||||
// success: function (response) {
|
|
||||||
// if ( response.code == 'success'){
|
|
||||||
// app.defaults.customer_cart = response.customer_cart;
|
|
||||||
// refreshCustomerCart();
|
|
||||||
// }
|
|
||||||
// $.notify(response.message, { 'type' : response.code });
|
|
||||||
// },
|
|
||||||
// error: function(){
|
|
||||||
// alert('Hiba történt');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function addBehaviourTypeChangedListener(){
|
function addBehaviourTypeChangedListener(){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user