232201_test_to_master #1582
|
@ -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 {
|
||||
constructor($element, $) {
|
||||
|
@ -35,9 +36,23 @@ export default class Ticket extends ModuleMain {
|
|||
const hasExcludedParams = excludedParams.some(param => {
|
||||
return $params && $params[param] != undefined;
|
||||
});
|
||||
// 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');
|
||||
|
||||
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');
|
||||
const hasScopeDays = seachPanelParams.some(subarray => subarray.length > 0 && subarray[0] === 'scopeDays');
|
||||
|
||||
if (!hasFromParam)
|
||||
delete this.filterParams.from;
|
||||
|
||||
if (!hasToParam)
|
||||
delete this.filterParams.to;
|
||||
|
||||
if (!hasScopeDays)
|
||||
delete this.filterParams.scopeDays;
|
||||
|
||||
if ((!hasFromParam || !hasToParam) && !hasScopeDays)
|
||||
throw new UserError(`The filter 'From' and 'To' or 'Days onward' must be filled in`);
|
||||
|
||||
const hasParams = Object.entries($params).length;
|
||||
if (!hasParams || !hasExcludedParams)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
The filter 'From' and 'To' or 'Days onward' must be filled in: El filtro 'Desde' y 'Hasta' o 'Dias adelante' debe estar rellenado
|
Loading…
Reference in New Issue