Merge branch 'dev' into 5297-newWorker_iban_not_required
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-05-24 08:02:33 +00:00
commit a99b7cd4f1
12 changed files with 89 additions and 16 deletions

View File

@ -0,0 +1,20 @@
-- vn.defaulter source
CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `vn`.`defaulter` AS
select
`d`.`clientFk` AS `clientFk`,
`d`.`created` AS `created`,
`d`.`amount` AS `amount`,
`d`.`defaulterSinced` AS `defaulterSinced`,
`d`.`hasChanged` AS `hasChanged`,
`c`.`countryFk` AS `country`,
`c`.`payMethodFk` AS `payMethod`
from
(((`bs`.`defaulter` `d`
join `vn`.`client` `c` on
(`c`.`id` = `d`.`clientFk`))
join `vn`.`country` `co` on
(`co`.`id` = `c`.`countryFk`))
join `vn`.`payMethod` `pm` on
(`pm`.`id` = `c`.`payMethodFk`));

View File

@ -313,7 +313,7 @@ export default {
anyClient: 'vn-client-defaulter tbody > tr',
firstClientName: 'vn-client-defaulter tbody > tr:nth-child(1) > td:nth-child(2) > span',
firstSalesPersonName: 'vn-client-defaulter tbody > tr:nth-child(1) > td:nth-child(3) > span',
firstObservation: 'vn-client-defaulter tbody > tr:nth-child(1) > td:nth-child(6) > vn-textarea[ng-model="defaulter.observation"]',
firstObservation: 'vn-client-defaulter tbody > tr:nth-child(1) > td:nth-child(8) > vn-textarea[ng-model="defaulter.observation"]',
allDefaulterCheckbox: 'vn-client-defaulter thead vn-multi-check',
addObservationButton: 'vn-client-defaulter vn-button[icon="icon-notes"]',
observation: '.vn-dialog.shown vn-textarea[ng-model="$ctrl.defaulter.observation"]',

View File

@ -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);

View File

@ -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);
});
});

View File

@ -67,9 +67,13 @@ module.exports = Self => {
uw.id workerFk,
uw.name workerName,
c.creditInsurance,
d.defaulterSinced
d.defaulterSinced,
cn.country,
pm.name payMethod
FROM vn.defaulter d
JOIN vn.client c ON c.id = d.clientFk
JOIN vn.country cn ON cn.id = c.countryFk
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
LEFT JOIN vn.clientObservation co ON co.clientFk = c.id
LEFT JOIN account.user u ON u.id = c.salesPersonFk
LEFT JOIN account.user uw ON uw.id = co.workerFk

View File

@ -29,6 +29,16 @@
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
},
"country": {
"type": "belongsTo",
"model": "Country",
"foreignKey": "country"
},
"payMethod": {
"type": "belongsTo",
"model": "PayMethod",
"foreignKey": "payMethod"
}
}
}

View File

@ -57,6 +57,13 @@
<th field="salesPersonFk">
<span translate>Comercial</span>
</th>
<th field="country">
<span translate>Country</span>
</th>
<th field="payMethod"
vn-tooltip="Pay Method">
<span translate>P.Method</span>
</th>
<th
field="amount"
vn-tooltip="Balance due">
@ -111,6 +118,12 @@
{{::defaulter.salesPersonName | dashIfEmpty}}
</span>
</td>
<td>
{{::defaulter.country}}
</td>
<td>
{{::defaulter.payMethod}}
</td>
<td>{{::defaulter.amount | currency: 'EUR': 2}}</td>
<td>
<span

View File

@ -20,8 +20,7 @@ export default class Controller extends Section {
showField: 'name',
valueField: 'id'
}
},
{
}, {
field: 'salesPersonFk',
autocomplete: {
url: 'Workers/activeWithInheritedRole',
@ -30,6 +29,18 @@ export default class Controller extends Section {
showField: 'name',
valueField: 'id',
}
}, {
field: 'country',
autocomplete: {
showField: 'country',
valueField: 'country'
}
}, {
field: 'payMethodFk',
autocomplete: {
showField: 'name',
valueField: 'id'
}
},
{
field: 'workerFk',
@ -132,7 +143,7 @@ export default class Controller extends Section {
sendMail() {
const params = {
defaulters: this.checked,
observation: this.defaulter.observation
observation: this.defaulter.observation,
};
this.$http.post(`Defaulters/observationEmail`, params);
}
@ -143,6 +154,8 @@ export default class Controller extends Section {
case 'amount':
case 'clientFk':
case 'workerFk':
case 'country':
case 'payMethod':
case 'salesPersonFk':
return {[`d.${param}`]: value};
case 'created':

View File

@ -9,3 +9,6 @@ Search client: Buscar clientes
Worker who made the last observation: Trabajador que ha realizado la última observación
Email sended!: Email enviado!
Observation saved!: Observación añadida!
P.Method: F.Pago
Pay Method: Forma de Pago
Country: Pais

View File

@ -16,4 +16,4 @@
<vn-portal slot="menu">
<vn-left-menu></vn-left-menu>
</vn-portal>
<ui-view></ui-view>
<ui-view></ui-view>

View File

@ -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});
}

View File

@ -0,0 +1 @@
Date range must have 'from' and 'to': El rango de fechas debe tener 'desde' y 'hasta'