Merge branch 'dev' into 5639-seccionesFormaPagoYPais(MOROSOS)
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
6cf2c38927
|
@ -203,7 +203,7 @@ export default class Searchbar extends Component {
|
|||
|
||||
doSearch(filter, source) {
|
||||
if (filter === this.filter && !this.isIndex) return;
|
||||
let promise = this.onSearch({$params: filter});
|
||||
let promise = this.onSearch({$params: filter}, source);
|
||||
promise = promise || this.$q.resolve();
|
||||
promise.then(data => this.onFilter(filter, source, data));
|
||||
this.toBar(filter);
|
||||
|
@ -259,12 +259,6 @@ export default class Searchbar extends Component {
|
|||
|
||||
this.filter = filter;
|
||||
|
||||
if (source == 'removeBar') {
|
||||
delete params[this.toRemove];
|
||||
delete this.model.userParams[this.toRemove];
|
||||
this.model.refresh();
|
||||
}
|
||||
|
||||
if (!filter && this.model)
|
||||
this.model.clear();
|
||||
if (source != 'state')
|
||||
|
@ -279,7 +273,7 @@ export default class Searchbar extends Component {
|
|||
return {id: params.$row.id};
|
||||
}
|
||||
|
||||
onSearch(args) {
|
||||
onSearch(args, source) {
|
||||
if (!this.model) return;
|
||||
let filter = args.$params;
|
||||
|
||||
|
@ -325,6 +319,12 @@ export default class Searchbar extends Component {
|
|||
for (let param in stateFilter.tableQ)
|
||||
params[param] = stateFilter.tableQ[param];
|
||||
|
||||
if (source == 'removeBar') {
|
||||
delete params[this.toRemove];
|
||||
delete this.model.userParams[this.toRemove];
|
||||
delete stateFilter[this.toRemove];
|
||||
}
|
||||
|
||||
const newParams = Object.assign(stateFilter, params);
|
||||
return this.model.applyParams(newParams)
|
||||
.then(() => this.model.data);
|
||||
|
|
|
@ -197,7 +197,7 @@ describe('Component vnSearchbar', () => {
|
|||
controller.doSearch(filter, 'any');
|
||||
$scope.$apply();
|
||||
|
||||
expect(controller.onSearch).toHaveBeenCalledWith({$params: filter});
|
||||
expect(controller.onSearch).toHaveBeenCalledWith({$params: filter}, 'any');
|
||||
expect(controller.onFilter).toHaveBeenCalledWith(filter, 'any', undefined);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import ngModule from '../module';
|
||||
import ModuleMain from 'salix/components/module-main';
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
export default class Ticket extends ModuleMain {
|
||||
fetchParams($params) {
|
||||
|
@ -14,10 +15,19 @@ export default class Ticket extends ModuleMain {
|
|||
'scopeDays'
|
||||
];
|
||||
|
||||
const seachPanelParams = Object.entries($params);
|
||||
const hasFromParam = seachPanelParams.some(subarray => subarray.length > 0 && subarray[0] === 'from');
|
||||
const hasToParam = seachPanelParams.some(subarray => subarray.length > 0 && subarray[0] === 'to');
|
||||
|
||||
if ((hasFromParam && !hasToParam) || (!hasFromParam && hasToParam))
|
||||
throw new UserError(`Date range must have 'from' and 'to'`);
|
||||
|
||||
const hasExcludedParams = excludedParams.some(param => {
|
||||
return $params && $params[param] != undefined;
|
||||
});
|
||||
|
||||
const hasParams = Object.entries($params).length;
|
||||
|
||||
if (!hasParams || !hasExcludedParams)
|
||||
$params.scopeDays = 1;
|
||||
|
||||
|
@ -28,7 +38,6 @@ export default class Ticket extends ModuleMain {
|
|||
const to = new Date(from.getTime());
|
||||
to.setDate(to.getDate() + $params.scopeDays);
|
||||
to.setHours(23, 59, 59, 999);
|
||||
|
||||
Object.assign($params, {from, to});
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Date range must have 'from' and 'to': El rango de fechas debe tener 'desde' y 'hasta'
|
Loading…
Reference in New Issue