add js transferlist
This commit is contained in:
parent
36c8d37914
commit
203dfeac72
45
common/models/UserSoldItem.php
Normal file
45
common/models/UserSoldItem.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "user_sold_item".
|
||||||
|
*
|
||||||
|
* @property integer $id_user_sold_item
|
||||||
|
* @property integer $id_user
|
||||||
|
* @property integer $id_transfer
|
||||||
|
*/
|
||||||
|
class UserSoldItem extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'user_sold_item';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id_user', 'id_transfer'], 'integer']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id_user_sold_item' => Yii::t('common/user-sold-item', 'Id User Sold Item'),
|
||||||
|
'id_user' => Yii::t('common/user-sold-item', 'Id User'),
|
||||||
|
'id_transfer' => Yii::t('common/user-sold-item', 'Id Transfer'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
42
console/migrations/m151005_054611_add__user_sold_item.php
Normal file
42
console/migrations/m151005_054611_add__user_sold_item.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m151005_054611_add__user_sold_item 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('{{%user_sold_item}}', [
|
||||||
|
'id_user_sold_item' => $this->primaryKey(),
|
||||||
|
'id_user' => $this->integer(11) ,
|
||||||
|
'id_transfer' => $this->integer(11) ,
|
||||||
|
], $tableOptions);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m151005_054611_add__user_sold_item cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -20,6 +20,7 @@ class ProductSellAsset extends AssetBundle
|
|||||||
public $css = [
|
public $css = [
|
||||||
];
|
];
|
||||||
public $js = [
|
public $js = [
|
||||||
|
'js/transferlist.js',
|
||||||
'js/product.sell.js',
|
'js/product.sell.js',
|
||||||
];
|
];
|
||||||
public $depends = [
|
public $depends = [
|
||||||
|
|||||||
65
frontend/web/js/transferlist.js
Normal file
65
frontend/web/js/transferlist.js
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
$.widget( "fitness.transferList", {
|
||||||
|
options: {
|
||||||
|
transfers: [],
|
||||||
|
columns: [
|
||||||
|
{ 'label' : 'Termék' },
|
||||||
|
{ 'label' : 'Ár' },
|
||||||
|
{ 'label' : 'Db' },
|
||||||
|
{ 'label' : 'Összesen' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
_create: function() {
|
||||||
|
var o;
|
||||||
|
o = this.options;
|
||||||
|
},
|
||||||
|
_refresh: function(){
|
||||||
|
var s;
|
||||||
|
s = this._render('table',{ 'columns' : this.options.columns });
|
||||||
|
this.element.html(s);
|
||||||
|
},
|
||||||
|
_render: function(template,params){
|
||||||
|
var s;
|
||||||
|
var columsn;
|
||||||
|
s = "";
|
||||||
|
switch(template){
|
||||||
|
case 'table':
|
||||||
|
s += this._render('openTable', {});
|
||||||
|
s += this._render('header', { 'columns' : params.columns });
|
||||||
|
s += this._render('closeTable', {});
|
||||||
|
break;
|
||||||
|
case 'openTable':
|
||||||
|
s += '<table class="table table-bordered table-striped">';
|
||||||
|
break;
|
||||||
|
case 'closeTable':
|
||||||
|
s += '</table>';
|
||||||
|
break;
|
||||||
|
case 'header':
|
||||||
|
s += '<thead>'
|
||||||
|
columns = params.columns;
|
||||||
|
for(var i = 0; i < columns.length; i++){
|
||||||
|
s += this._render('headrow', { 'column' : columns[i] })
|
||||||
|
}
|
||||||
|
s += '</thead>';
|
||||||
|
break;
|
||||||
|
case 'headrow':
|
||||||
|
s += '<th>';
|
||||||
|
s += params.column.label;
|
||||||
|
s += '</th>';
|
||||||
|
break;
|
||||||
|
case 'body':
|
||||||
|
s += '<tbody>';
|
||||||
|
for( var i = 0; i < transfers.length; i++){
|
||||||
|
|
||||||
|
}
|
||||||
|
s += '</tbody>';
|
||||||
|
break;
|
||||||
|
case 'row':
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user