sell product changes

This commit is contained in:
2015-10-05 07:37:17 +02:00
parent e9f9567618
commit 36c8d37914
18 changed files with 704 additions and 141 deletions

View File

@@ -1,85 +1,106 @@
<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model frontend\models\ProductSaleForm */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $currencies common\models\Currency[] */
function mkOptions($options){
// $o = $options;
$all = ['' => '-' ];
$o = $all + $options;
return $o;
}
$currencyOptions = mkOptions( ArrayHelper::map($currencies, 'id_currency', 'name') );
$accountOptions = mkOptions( ArrayHelper::map($accounts, 'id_account', 'name') );
$discountOptions = mkOptions( ArrayHelper::map($discounts, 'id_discount', 'name') );
?>
<?php ?>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Product name'))?>
</div>
<div class='col-md-6'>
<?php echo Html::tag('span','',[ 'class' => 'product product-name']); ?>
<div class="col-md-12">
<?php echo $this->render('_view')?>
</div>
</div>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Product price'))?>
</div>
<div class='col-md-6'>
<?php echo Html::tag('span','',[ 'class' => 'product product-price']); ?>
<?php $form = ActiveForm::begin([
'id' => 'filter_text_form',
'class' =>'form-inline',
'layout' => 'horizontal',
'fieldConfig' => [
'horizontalCssClasses' => [
'label' => 'col-sm-5',
'offset' => 'col-sm-offset-6',
'wrapper' => 'col-sm-7',
'error' => '',
'hint' => '',
],
],
] )?>
<div class='col-md-12'>
<?php echo $form->field($lookupModel,'filter_text')->textInput(['id'=>'filter_text']); ?>
</div>
<?php ActiveForm::end()?>
</div>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Product number'))?>
<?php $form = ActiveForm::begin(
[
'id' => 'product_form',
'class' =>'form-inline',
'layout' => 'horizontal',
'fieldConfig' => [
'horizontalCssClasses' => [
'label' => 'col-sm-5',
'offset' => 'col-sm-offset-6',
'wrapper' => 'col-sm-7',
'error' => '',
'hint' => '',
],
],
]
); ?>
<?php echo Html::activeHiddenInput($model, 'id_product') ?>
<div class="row">
<div class='col-md-12'>
<?php echo $form->field($model, 'count')->input("number") ?>
</div>
</div>
<div class='col-md-6'>
<?php echo Html::tag('span','',[ 'class' => 'product product-number']); ?>
<div class="row">
<div class='col-md-12'>
<?php echo $form->field($model,'id_currency')->dropDownList($currencyOptions) ?>
</div>
</div>
</div>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Barcode'))?>
<div class="row">
<div class='col-md-12'>
<?php echo $form->field($model,'id_account')->dropDownList($accountOptions) ?>
</div>
</div>
<div class='col-md-6'>
<?php echo Html::tag('span','',[ 'class' => 'product barcode']); ?>
<div class="row">
<div class='col-md-12'>
<?php echo $form->field($model,'id_discount')->dropDownList($discountOptions) ?>
</div>
</div>
</div>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Count'))?>
<div class="row">
<div class='col-md-12'>
<?php echo $form->field( $model,'comment' )->textarea() ?>
</div>
</div>
<div class='col-md-6'>
<?php echo Html::textInput('count') ?>
<div class="row">
<div class='col-md-5'>
<?php echo Html::a(Yii::t("frontend/product","Sell product"),null,['class' => 'btn btn-success', 'id' => 'btn_sell'] );?>
</div>
<div class='col-md-7'>
<?php echo Html::a(Yii::t("frontend/product","Sell product and add to total"),null,['class' => 'btn btn-success', 'id' => 'btn_sell_append'] );?>
</div>
</div>
</div>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Currency'))?>
</div>
<div class='col-md-6'>
<?php echo Html::dropDownList('currency',null,[],[]); ?>
</div>
</div>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Account'))?>
</div>
<div class='col-md-6'>
<?php echo Html::dropDownList('account',null,[],[]); ?>
</div>
</div>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Discount'))?>
</div>
<div class='col-md-6'>
<?php echo Html::dropDownList('discount',null,[],[]); ?>
</div>
</div>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Comment'))?>
</div>
</div>
<div class="row">
<div class='col-md-10'>
<?php echo Html::textarea('comment', ''); ?>
</div>
</div>
<div class="row">
<div class='col-md-3'>
<?php echo Html::a(Yii::t("frontend/product","Sell product"),null,['class' => 'btn btn-success'] );?>
</div>
<div class='col-md-7'>
<?php echo Html::a(Yii::t("frontend/product","Sell product and add to total"),null,['class' => 'btn btn-success'] );?>
</div>
</div>
<?php ActiveForm::end(); ?>

View File

@@ -1,19 +1,9 @@
<?php
use yii\bootstrap\Html;
?>
<div class="row">
<div class='col-md-10'>
<?php echo Html::label(Yii::t('frontend/product', 'Bill'))?>
</div>
</div>
<div class="row">
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Debit'))?>
</div>
<div class='col-md-6'>
<?php echo Html::tag("span",'0,00',['sale', 'sale-debit'])?>
</div>
</div>
<div class="row">
<div class='col-md-12'>
<table class="table table-bordered table-striped">
@@ -37,27 +27,6 @@ use yii\bootstrap\Html;
</tr>
</thead>
<tbody>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,56 @@
<?php
?>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<th>
<?php echo Yii::t('frontend/product','Name')?>
</th>
<td colspan="3">
<span class="product-name"></span>
</td>
</tr>
<tr>
<th>
<?php echo Yii::t('frontend/product','Barcode')?>
</th>
<td>
<span class="product-barcode">123456789</span>
</td>
<th>
<?php echo Yii::t('frontend/product','Product number')?>
</th>
<td>
<span class="product-number">123456789</span>
</td>
</tr>
<tr>
<th>
<?php echo Yii::t('frontend/product','Stock'). ' (Db)'?>
</th>
<td>
<span class="product-stock"></span>
</td>
<th>
<?php echo Yii::t('frontend/product','Count'). ' (Db)'?>
</th>
<td>
<span class="product-count">1</span>
</td>
</tr>
<tr>
<th>
<?php echo Yii::t('frontend/product','Sale Price')?>
</th>
<td>
<span class="product-sale-price"></span>
</td>
<th>
<?php echo Yii::t('frontend/product','Price')?>
</th>
<td>
<span class="product-price">100 000</span>
</td>
</tr>
</tbody>
</table>

View File

@@ -6,6 +6,12 @@ use yii\helpers\Html;
use common\models\Product;
use frontend\assets\ProductSellAsset;
use yii\helpers\Url;
use yii\bootstrap\ActiveForm;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $currencies common\models\Currency[] */
ProductSellAsset::register($this);
@@ -20,9 +26,19 @@ $this->registerJs ( 'new ProductSell( '. json_encode($options).');' );
?>
<style>
/*
.product-form input, .product-form select, .product-form textarea{
width: 100%;
}
*/
.product-count{
text-align: right;
}
.form-group{
margin-bottom: 3px;
}
</style>
<div class='row'>
@@ -32,23 +48,11 @@ $this->registerJs ( 'new ProductSell( '. json_encode($options).');' );
<div class='col-md-4'>
<?php echo ReceptionCardNumberWidget::widget( [ 'customer' => $customer, 'card' =>$card, 'route' => ['product/sale'] ] )?>
</div>
<div class='col-md-4'>
</div>
</div>
<h1><?php echo Yii::t('frontend/product','Sell product')?></h1>
<div class='row'>
<div class='col-md-4'>
<?php echo Html::label(Yii::t('frontend/product', 'Product'))?>
<?php echo Html::textInput('filter_text','', ['id'=>'filter_text'])?>
</div>
<div class='col-md-4'>
</div>
<div class='col-md-4'>
</div>
</div>
<div class='row '>
<div class='col-md-6 product-form'>
<?php echo $this->render('_sale_form' ) ?>
<?php echo $this->render('_sale_form' ,['model' =>$model , 'lookupModel' =>$lookupModel, 'currencies' => $currencies, 'accounts' => $accounts,'discounts' => $discounts,]) ?>
</div>
<div class='col-md-6'>
<?php echo $this->render('_sold_items' ) ?>