0
1
Fork 0
This commit is contained in:
Juan Ferrer Toribio 2017-08-21 12:20:36 +02:00
parent fab5253406
commit b8c83df08f
20 changed files with 95 additions and 127 deletions

View File

@ -12,7 +12,7 @@ Hedera.Address = new Class
,onStatusChange: function (form)
{
if (form.ready && this.hash.get ('address') == 0)
if (form.ready && this.$('params').$.address == 0)
form.insertRow ();
}

View File

@ -1,14 +1,15 @@
<vn>
<vn-group>
<vn-param id="address"/>
<vn-hash-param key="address" param="address"/>
<vn-lot-query id="params">
<vn-spec name="address" type="Number"/>
</vn-lot-query>
<db-form id="iter" on-status-changed="onStatusChange">
<db-model
id="model"
property="model"
updatable="true"
mode="ON_DEMAND"
lot="hash"
lot="params"
on-operations-done="onOperationsDone">
SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country
FROM address_view a

View File

@ -164,17 +164,8 @@ Hedera.Catalog = new Class
,onRealmChange: function ()
{
var newValue = this.hash.get ('realm');
if (newValue)
{
this.$('filters').style.display = 'block';
this.$('realm-msg').style.display = 'none';
}
else
{
this.$('filters').style.display = 'none';
this.$('realm-msg').style.display = 'block';
}
this.$('filters').style.display = newValue ? 'block' : 'none';
this.$('realm-msg').style.display = newValue ? 'none' : 'block';
this.refreshTitleColor ();
this.hash.params = {
@ -445,9 +436,7 @@ Vn.Filter = new Class
this._ul = this.createElement ('ul');
this.node.appendChild (this._ul);
this._modelLot = new Vn.LotQuery ({
type: Vn.LotQuery.Type.EXCLUDE
});
this._modelLot = new Vn.LotQuery ();
this.parent (props);
}

View File

@ -1,12 +1,17 @@
<vn>
<vn-group>
<vn-lot-query
id="lot"
source="hash"
on-change="onLotChange"/>
<vn-lot-query id="params" on-change="onLotChange">
<vn-spec name="realm" type="Number"/>
<vn-spec name="type" type="Number"/>
<vn-spec name="search" type="String"/>
<vn-spec name="color" type="String"/>
<vn-spec name="origin" type="Number"/>
<vn-spec name="category" type="String"/>
<vn-spec name="producer" type="Number"/>
</vn-lot-query>
<vn-lot id="card-lot"/>
<vn-param lot="hash" name="realm" on-changed="onRealmChange"/>
<vn-param lot="hash" name="type" on-changed="refreshTitle"/>
<vn-param lot="params" name="realm" on-changed="onRealmChange"/>
<vn-param lot="params" name="type" on-changed="refreshTitle"/>
<sql-filter type="AND" id="filter">
<sql-filter-item type="EQUAL"
field="tipo_id" target="a"
@ -35,7 +40,7 @@
<db-model
id="items"
result-index="2"
lot="lot"
lot="params"
auto-load="false">
CREATE TEMPORARY TABLE tmp.bionic_calc
(INDEX (item_id))
@ -111,7 +116,7 @@
tip="_Switch view"
on-click="onSwitchViewClick"/>
<htk-search-entry
lot="hash"
lot="params"
name="search"/>
</div>
<div id="main" class="catalog">
@ -208,14 +213,14 @@
<div id="filters" class="filters">
<h2><t>Filter by</t></h2>
<vn-filter
lot="hash"
lot="params"
name="type"
placeholder="_Family">
<db-model
id="types"
property="model"
conn="conn"
lot="hash"
lot="params"
result-index="1"
on-status-changed="refreshTitle">
CALL item_available ();
@ -230,7 +235,7 @@
</vn-filter>
<vn-filter
id="test"
lot="hash"
lot="params"
name="color"
placeholder="_Color"
filter="filter">
@ -247,7 +252,7 @@
</db-model>
</vn-filter>
<vn-filter
lot="hash"
lot="params"
name="producer"
placeholder="_Producer"
filter="filter">
@ -263,7 +268,7 @@
</db-model>
</vn-filter>
<vn-filter
lot="hash"
lot="params"
name="origin"
placeholder="_Origin"
filter="filter">
@ -280,7 +285,7 @@
</db-model>
</vn-filter>
<vn-filter
lot="hash"
lot="params"
name="category"
placeholder="_Category"
filter="filter">

View File

@ -44,12 +44,12 @@
<div class="card form">
<div>
<label><t>Show orders from</t></label>
<htk-date-chooser lot="hash" name="from"/>
<htk-date-chooser lot="params" name="from"/>
</div>
</div>
<div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" lot="hash">
<db-model property="model" lot="params">
CALL clientTicketList (#from, NULL)
</db-model>
<custom>

View File

@ -1,11 +1,12 @@
<vn>
<vn-group>
<db-form id="ticket">
<db-model property="model" lot="hash">
CALL clientTicketGet(#ticket)
</db-model>
</db-form>
</vn-group>
<vn-lot-query id="params">
<vn-spec name="ticket" type="Number"/>
</vn-lot-query>
<db-form id="ticket">
<db-model property="model" lot="params">
CALL clientTicketGet(#ticket)
</db-model>
</db-form>
<h1 id="title">
<t>OrderDetail</t>
</h1>
@ -54,7 +55,7 @@
</div>
</div>
<htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" id="movements" lot="hash">
<db-model property="model" id="movements" lot="params">
CALL clientTicketRowGet(#ticket)
</db-model>
<custom>

View File

@ -1,4 +1,7 @@
<vn>
<vn-lot-query id="params">
<vn-spec name="config" type="Number"/>
</vn-lot-query>
<vn-lot id="lot"/>
<h1 id="title">
<t>Shelves</t>
@ -17,7 +20,7 @@
id="config"
placeholder="_Select config"
model="configs-model"
lot="hash"
lot="params"
name="config"
on-changed="onConfigChange"
on-ready="onConfigChange">

View File

@ -309,7 +309,7 @@ Klass.implement
return true;
for (var key in params)
if (params[key] === undefined)
if (params[key] == null)
return false;
return true;

View File

@ -23,7 +23,7 @@ module.exports = new Class
{
var object = params[this.id];
if (object != null)
if (object !== undefined)
{
if (!(object instanceof SqlObject))
{

View File

@ -50,7 +50,7 @@ module.exports =
,'Feb'
,'Mar'
,'Apr'
,'May'
,'MayAbr'
,'Jun'
,'Jul'
,'Ago'

View File

@ -149,22 +149,11 @@ module.exports = new Class
switch (typeof v)
{
case 'number':
return '(Number)'+ v;
case 'boolean':
return '(Boolean)'+ (v ? 'true' : 'false');
case 'object':
if (v instanceof Date)
return '(Date)'+ VnDate.strftime (v, '%Y-%m-%d');
return VnDate.strftime (v, '%Y-%m-%d');
else
return '(Object)'+ JSON.stringify (v)
}
switch (v.charAt (0))
{
case '(':
case '\\':
return '\\'+ v;
return JSON.stringify (v)
}
return v;
@ -177,43 +166,10 @@ module.exports = new Class
v = decodeURIComponent (v);
if (v === '')
return v;
var typeStr;
switch (v.charAt(0))
{
case '(':
var index = v.indexOf (')');
typeStr = v.substr (1, index - 1);
v = v.substr (index + 1);
break;
case '\\':
v = v.substr (1);
break;
}
if (v === '')
return null;
if (!typeStr)
return v;
switch (typeStr)
{
case 'Boolean':
return (/^(true|1)$/i).test (v);
case 'Number':
return 0 + new Number (v);
case 'Date':
var date = new Date (v);
date.setHours (0, 0, 0, 0);
return date;
case 'Object':
return JSON.parse (v);
default:
return v;
}
return v;
}
,_destroy: function ()

View File

@ -32,7 +32,7 @@
,"Feb": "Febr"
,"Mar": "Març"
,"Apr": "Abr"
,"May": "Maig"
,"MayAbr": "Maig"
,"Jun": "Juny"
,"Jul": "Jul"
,"Ago": "Ag"

View File

@ -32,7 +32,7 @@
,"Feb": "Feb"
,"Mar": "Mar"
,"Apr": "Apr"
,"May": "May"
,"MayAbr": "May"
,"Jun": "Jun"
,"Jul": "Jul"
,"Ago": "Ago"

View File

@ -32,7 +32,7 @@
,"Feb": "Feb"
,"Mar": "Mar"
,"Apr": "Abr"
,"May": "May"
,"MayAbr": "May"
,"Jun": "Jun"
,"Jul": "Jul"
,"Ago": "Ago"

View File

@ -32,7 +32,7 @@
,"Feb": "Fév"
,"Mar": "Mars"
,"Apr": "Avr"
,"May": "Mai"
,"MayAbr": "Mai"
,"Jun": "Juin"
,"Jul": "Juil"
,"Ago": "Août"

View File

@ -32,7 +32,7 @@
,"Feb": "хоё"
,"Mar": "Гур"
,"Apr": "Дөр"
,"May": "May"
,"MayAbr": "May"
,"Jun": "Jun"
,"Jul": "Jul"
,"Ago": "Най"

View File

@ -32,7 +32,7 @@
,"Feb": "Fev"
,"Mar": "Mar"
,"Apr": "Abr"
,"May": "Mai"
,"MayAbr": "Mai"
,"Jun": "Jun"
,"Jul": "Jul"
,"Ago": "Ago"

View File

@ -43,6 +43,7 @@ module.exports = new Class
Object.assign (this, {
_fields: null,
_source: null,
_lockSource: false,
_specs: {}
});
this.parent (props);
@ -58,6 +59,9 @@ module.exports = new Class
,_onSourceChange: function ()
{
if (this._lockSource)
return;
var params = this._source ? this._source.params : {};
var myParams = {};
@ -67,6 +71,32 @@ module.exports = new Class
this.assign (myParams);
}
,assign: function (params)
{
params = this.transformParams (params);
var diff = Value.partialDiff (this._params, params);
if (diff)
{
Object.assign (this._params, diff);
if (this.source)
{
this._lockSource = true;
this.source.assign (diff);
this._lockSource = false;
}
this._paramsChanged (diff);
this.changed (diff);
}
}
,setAll: function (params)
{
this.assign (params);
}
,transformParams: function (params)
{
var newParams = {};
@ -87,17 +117,17 @@ function cast (value, type)
switch (type)
{
case Boolean:
return (/^(true|1)$/i).test (v);
return (/^(true|1)$/i).test (value);
case Number:
return 0 + new Number (v);
return 0 + new Number (value);
case Date:
var date = new Date (v);
var date = new Date (value);
date.setHours (0, 0, 0, 0);
return date;
default:
if (type instanceof Object)
return JSON.parse (v);
return JSON.parse (value);
else
return v;
return value;
}
}

View File

@ -42,11 +42,6 @@ module.exports = new Class
this.parent (props);
}
,get: function (field)
{
return this._params[field];
}
,keys: function ()
{
return Object.keys (this._params);
@ -54,7 +49,6 @@ module.exports = new Class
,assign: function (params)
{
params = this.transformParams (params);
var diff = Value.partialDiff (this._params, params);
if (diff)
@ -67,7 +61,6 @@ module.exports = new Class
,setAll: function (params)
{
params = this.transformParams (params);
var diff = Value.diff (this._params, params);
if (diff)
@ -85,16 +78,4 @@ module.exports = new Class
* @param {Object} diff Changed parameters and its new values
*/
,_paramsChanged: function () {}
/**
* Called when lot params changes to apply transformations over them, can be
* implemented by child classes.
*
* @param {Object} params New parameters
* @return {Object} Transformed parameters
*/
,transformParams: function (params)
{
return params;
}
});

View File

@ -13,9 +13,7 @@ var baseConfig = {
entry: wpConfig.entry,
output: {
path: outputPath,
publicPath: publicPath,
filename: '[name].js',
chunkFilename: 'chunk.[id].js'
publicPath: publicPath
},
module: {
rules: [
@ -64,13 +62,17 @@ var prodConfig = {
};
var devConfig = {
output: {
filename: '[name].js',
chunkFilename: 'chunk.[id].js'
},
plugins: [
new webpack.NamedModulesPlugin ()
],
devServer: {
host: '0.0.0.0',
port: wpConfig.devServerPort,
headers: { "Access-Control-Allow-Origin": "*" },
headers: { 'Access-Control-Allow-Origin': '*' },
stats: { chunks: false }
},
devtool: 'eval'