Merge pull request '5836-clientDefaulterisWorker' (!1639) from 5836-clientDefaulterisWorker into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1639
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Carlos Satorres 2023-07-03 10:53:03 +00:00
commit 5612c56aed
4 changed files with 28 additions and 5 deletions

View File

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

View File

@ -60,6 +60,7 @@ module.exports = Self => {
DISTINCT c.id clientFk, DISTINCT c.id clientFk,
c.name clientName, c.name clientName,
c.salesPersonFk, c.salesPersonFk,
c.businessTypeFk,
u.name salesPersonName, u.name salesPersonName,
d.amount, d.amount,
co.created, co.created,

View File

@ -4,7 +4,7 @@
filter="::$ctrl.filter" filter="::$ctrl.filter"
limit="20" limit="20"
order="amount DESC" order="amount DESC"
data="defaulters" data="$ctrl.defaulters"
on-data-change="$ctrl.reCheck()" on-data-change="$ctrl.reCheck()"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
@ -34,7 +34,7 @@
</div> </div>
<div class="vn-pa-md"> <div class="vn-pa-md">
<vn-button <vn-button
ng-show="$ctrl.checked.length > 0" disabled="$ctrl.checked.length == 0"
ng-click="notesDialog.show()" ng-click="notesDialog.show()"
name="notesDialog" name="notesDialog"
vn-tooltip="Add observation" vn-tooltip="Add observation"
@ -54,6 +54,9 @@
<th field="clientFk"> <th field="clientFk">
<span translate>Client</span> <span translate>Client</span>
</th> </th>
<th>
<span translate>Es trabajador</span>
</th>
<th field="salesPersonFk"> <th field="salesPersonFk">
<span translate>Comercial</span> <span translate>Comercial</span>
</th> </th>
@ -94,7 +97,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="defaulter in defaulters"> <tr ng-repeat="defaulter in $ctrl.defaulters">
<td shrink> <td shrink>
<vn-check <vn-check
ng-model="defaulter.checked" ng-model="defaulter.checked"
@ -110,6 +113,12 @@
{{::defaulter.clientName}} {{::defaulter.clientName}}
</span> </span>
</td> </td>
<td>
<vn-check
ng-model="defaulter.isWorker"
disabled="true">
</vn-check>
</td>
<td> <td>
<span <span
title="{{::defaulter.salesPersonName}}" title="{{::defaulter.salesPersonName}}"

View File

@ -6,6 +6,7 @@ export default class Controller extends Section {
constructor($element, $) { constructor($element, $) {
super($element, $); super($element, $);
this.defaulter = {}; this.defaulter = {};
this.defaulters = [];
this.checkedDefaulers = []; this.checkedDefaulers = [];
this.smartTableOptions = { this.smartTableOptions = {
@ -69,6 +70,18 @@ export default class Controller extends Section {
this.getBalanceDueTotal(); this.getBalanceDueTotal();
} }
set defaulters(value) {
if (!value || !value.length) return;
for (let defaulter of value)
defaulter.isWorker = defaulter.businessTypeFk === 'worker';
this._defaulters = value;
}
get defaulters() {
return this._defaulters;
}
get checked() { get checked() {
const clients = this.$.model.data || []; const clients = this.$.model.data || [];
const checkedLines = []; const checkedLines = [];