claim search-panel & connector-mysql fix date
This commit is contained in:
parent
ba51c0cc97
commit
d3406fecde
|
@ -2,6 +2,7 @@ export * from './module';
|
|||
|
||||
import './index/';
|
||||
import './card';
|
||||
import './search-panel';
|
||||
import './detail';
|
||||
import './descriptor';
|
||||
import './basic-data';
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<div class="vn-list">
|
||||
<vn-card pad-medium-h>
|
||||
<vn-searchbar
|
||||
panel="vn-ticket-search-panel"
|
||||
panel="vn-claim-search-panel"
|
||||
model="model"
|
||||
expr-builder="$ctrl.exprBuilder(param, value)">
|
||||
</vn-searchbar>
|
||||
|
@ -25,7 +25,6 @@
|
|||
<vn-th field="clientFk">Client</vn-th>
|
||||
<vn-th field="created">Created</vn-th>
|
||||
<vn-th field="workerFk">Worker</vn-th>
|
||||
<vn-th field="observation">Observation</vn-th>
|
||||
<vn-th field="claimStateFk">State</vn-th>
|
||||
<vn-th></vn-th>
|
||||
</vn-tr>
|
||||
|
@ -37,7 +36,6 @@
|
|||
<vn-td>{{::claim.client.name}}</vn-td>
|
||||
<vn-td>{{::claim.created | date:'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td>{{::claim.worker.firstName}} {{::claim.worker.name}}</vn-td>
|
||||
<vn-td>{{::claim.observation}}</vn-td>
|
||||
<vn-td>{{::claim.claimState.description}}</vn-td>
|
||||
<vn-td>
|
||||
<vn-icon-button
|
||||
|
|
|
@ -30,6 +30,24 @@ export default class Controller {
|
|||
};
|
||||
}
|
||||
|
||||
exprBuilder(param, value) {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return /^\d+$/.test(value)
|
||||
? {id: value}
|
||||
: {client: {regexp: value}};
|
||||
case 'client':
|
||||
return {[param]: {regexp: value}};
|
||||
case 'created':
|
||||
return {created: {between: [value, value]}};
|
||||
case 'id':
|
||||
case 'clientFk':
|
||||
case 'workerFk':
|
||||
case 'claimStateFk':
|
||||
return {[param]: value};
|
||||
}
|
||||
}
|
||||
|
||||
showDescriptor(event, clientFk) {
|
||||
this.$.descriptor.clientFk = clientFk;
|
||||
this.$.descriptor.parent = event.target;
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<div pad-large style="min-width: 30em">
|
||||
<form ng-submit="$ctrl.onSearch()">
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Client"
|
||||
model="filter.client"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Claim id"
|
||||
model="filter.id">
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Client id"
|
||||
model="filter.clientFk">
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
label="State"
|
||||
field="filter.claimStateFk"
|
||||
url="/claim/api/ClaimStates"
|
||||
show-field="description"
|
||||
value-field="id">
|
||||
<tpl-item>{{description}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
label="Worker"
|
||||
field="filter.workerFk"
|
||||
url="/claim/api/Workers"
|
||||
show-field="firstName"
|
||||
value-field="id">
|
||||
<tpl-item>{{firstName}} {{name}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Created"
|
||||
model="filter.created">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal margin-large-top>
|
||||
<vn-submit label="Search"></vn-submit>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
import ngModule from '../module';
|
||||
import SearchPanel from 'core/src/components/searchbar/search-panel';
|
||||
|
||||
ngModule.component('vnClaimSearchPanel', {
|
||||
template: require('./index.html'),
|
||||
controller: SearchPanel
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
Ticket id: Id ticket
|
||||
Client id: Id cliente
|
||||
Nickname: Alias
|
||||
From: Desde
|
||||
To: Hasta
|
||||
Agency: Agencia
|
||||
Warehouse: Almacén
|
|
@ -22,18 +22,17 @@ describe('Claim', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// descomentar este test despues de completar la tarea #629 claim index buscador avanzado
|
||||
// it('should search for the claim with id 1', () => {
|
||||
// return nightmare
|
||||
// .wait(selectors.claimsIndex.searchResult)
|
||||
// .type(selectors.claimsIndex.searchClaimInput, '1')
|
||||
// .click(selectors.claimsIndex.searchButton)
|
||||
// .waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
|
||||
// .countElement(selectors.claimsIndex.searchResult)
|
||||
// .then(result => {
|
||||
// expect(result).toEqual(1);
|
||||
// });
|
||||
// });
|
||||
it('should search for the claim with id 1', () => {
|
||||
return nightmare
|
||||
.wait(selectors.claimsIndex.searchResult)
|
||||
.type(selectors.claimsIndex.searchClaimInput, '1')
|
||||
.click(selectors.claimsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
|
||||
.countElement(selectors.claimsIndex.searchResult)
|
||||
.then(result => {
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the ticket Basic Data`, () => {
|
||||
return nightmare
|
||||
|
|
|
@ -45,12 +45,14 @@ VnMySQL.prototype.toColumnValue = function(prop, val) {
|
|||
if (val == null || !prop || prop.type !== Date)
|
||||
return MySQL.prototype.toColumnValue.call(this, prop, val);
|
||||
|
||||
val = new Date(val);
|
||||
|
||||
return val.getFullYear() + '-' +
|
||||
fillZeros(val.getMonth() + 1) + '-' +
|
||||
fillZeros(val.getDate()) + ' ' +
|
||||
fillZeros(val.getHours()) + ':' +
|
||||
fillZeros(val.getMinutes()) + ':' +
|
||||
fillZeros(val.getSeconds());
|
||||
fillZeros(val.getMonth() + 1) + '-' +
|
||||
fillZeros(val.getDate()) + ' ' +
|
||||
fillZeros(val.getHours()) + ':' +
|
||||
fillZeros(val.getMinutes()) + ':' +
|
||||
fillZeros(val.getSeconds());
|
||||
|
||||
function fillZeros(v) {
|
||||
return v < 10 ? '0' + v : v;
|
||||
|
@ -96,7 +98,7 @@ VnMySQL.prototype._makeWhere = function(model, where) {
|
|||
}
|
||||
stmt.merge({
|
||||
sql: branches.join(' ' + key.toUpperCase() + ' '),
|
||||
params: branchParams,
|
||||
params: branchParams
|
||||
});
|
||||
whereStmts.push(stmt);
|
||||
continue;
|
||||
|
@ -154,15 +156,13 @@ VnMySQL.prototype._makeWhere = function(model, where) {
|
|||
columnValue = self.toColumnValue(p, expression);
|
||||
if (columnValue === null) {
|
||||
stmt.merge(columnName + ' IS NULL');
|
||||
} else if (columnValue instanceof ParameterizedSQL) {
|
||||
stmt.merge(columnName + '=').merge(columnValue);
|
||||
} else {
|
||||
if (columnValue instanceof ParameterizedSQL) {
|
||||
stmt.merge(columnName + '=').merge(columnValue);
|
||||
} else {
|
||||
stmt.merge({
|
||||
sql: columnName + '=?',
|
||||
params: [columnValue],
|
||||
});
|
||||
}
|
||||
stmt.merge({
|
||||
sql: columnName + '=?',
|
||||
params: [columnValue]
|
||||
});
|
||||
}
|
||||
}
|
||||
whereStmts.push(stmt);
|
||||
|
@ -175,7 +175,7 @@ VnMySQL.prototype._makeWhere = function(model, where) {
|
|||
}
|
||||
var whereStmt = new ParameterizedSQL({
|
||||
sql: sqls.join(' AND '),
|
||||
params: params,
|
||||
params: params
|
||||
});
|
||||
return whereStmt;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue