#1815 - show summary correct photos on claim index
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-10-18 09:53:30 +02:00
parent bdbadaf61a
commit 18b0ae034c
6 changed files with 215 additions and 189 deletions

View File

@ -530,13 +530,13 @@ export default {
header: 'vn-claim-summary > vn-card > div > h5',
state: 'vn-claim-summary vn-label-value[label="State"] > section > span',
observation: 'vn-claim-summary vn-textarea[ng-model="$ctrl.summary.claim.observation"] textarea',
firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(4) > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span',
firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(4) vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span',
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
itemDescriptorPopoverItemDiaryButton: '.vn-popover.shown vn-item-descriptor a[href="#!/item/2/diary"]',
firstDevelopmentWorker: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > span',
firstDevelopmentWorker: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > span',
firstDevelopmentWorkerGoToClientButton: '.vn-popover.shown vn-worker-descriptor div.quicklinks > a[href="#!/client/21/summary"]',
firstActionTicketId: 'vn-claim-summary > vn-card > div > vn-horizontal > vn-auto:nth-child(6) > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
firstActionTicketId: 'vn-claim-summary > vn-card > div > vn-horizontal > vn-auto:nth-child(6) vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
firstActionTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor'
},
claimBasicData: {

View File

@ -1,84 +1,84 @@
<vn-crud-model
auto-load="false"
vn-id="model"
<vn-crud-model vn-id="model"
auto-load="true"
url="claim/api/ClaimBeginnings"
filter="$ctrl.filter"
data="$ctrl.salesClaimed"
on-data-change="$ctrl.calculateTotals()">
</vn-crud-model>
<vn-vertical>
<vn-card class="vn-pa-lg">
<vn-vertical>
<vn-horizontal>
<div class="totalBox">
<vn-label-value label="Total"
value="{{$ctrl.paidTotal | currency: 'EUR':2}}">
</vn-label-value>
<vn-label-value label="Total claimed"
value="{{$ctrl.claimedTotal | currency: 'EUR':2}}">
</vn-label-value>
</div>
</vn-horizontal>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th center>Landed</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th>Claimed</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th>
<vn-th number>Disc.</vn-th>
<vn-th number>Total</vn-th>
<vn-th></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.salesClaimed" vn-repeat-last>
<vn-td center>{{::saleClaimed.sale.ticket.landed | dateTime:'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{::saleClaimed.sale.quantity}}</vn-td>
<vn-td>
<vn-input-number
vn-focus min="0"
step="1"
ng-model="saleClaimed.quantity"
on-change="$ctrl.setClaimedQuantity(saleClaimed.id, saleClaimed.quantity)">
</vn-input-number>
</vn-td>
<vn-td expand title="{{::saleClaimed.sale.concept}}">
<span
class="link"
ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale.itemFk)">
{{::saleClaimed.sale.concept}}
</span>
</vn-td>
<vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>
<span class="link"
vn-tooltip="Edit discount"
ng-click="$ctrl.showEditPopover($event, saleClaimed)">
{{::saleClaimed.sale.discount}} %
</span>
</vn-td>
<vn-td number>
{{::$ctrl.getSaleTotal(saleClaimed.sale) | currency: 'EUR':2}}
</vn-td>
<vn-td shrink>
<vn-icon-button
vn-tooltip="Remove sale"
icon="delete"
ng-click="$ctrl.deleteClaimedSale($index)"
tabindex="-1">
</vn-icon-button>
</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
</vn-vertical>
</vn-card>
<a ng-click="$ctrl.openAddSalesDialog()" vn-tooltip="Add sale item" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>
</vn-vertical>
<vn-card class="vn-mb-md vn-pa-lg vn-w-lg" style="text-align: right"
ng-if="$ctrl.salesClaimed.length > 0">
<vn-label-value label="Total"
value="{{$ctrl.paidTotal | currency: 'EUR':2}}">
</vn-label-value>
<vn-label-value label="Total claimed"
value="{{$ctrl.claimedTotal | currency: 'EUR':2}}">
</vn-label-value>
</vn-card>
<vn-card class="vn-pa-lg">
<vn-data-viewer model="model">
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th center>Landed</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th>Claimed</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th>
<vn-th number>Disc.</vn-th>
<vn-th number>Total</vn-th>
<vn-th></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.salesClaimed" vn-repeat-last>
<vn-td center>{{::saleClaimed.sale.ticket.landed | dateTime:'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{::saleClaimed.sale.quantity}}</vn-td>
<vn-td>
<vn-input-number
vn-focus min="0"
step="1"
ng-model="saleClaimed.quantity"
on-change="$ctrl.setClaimedQuantity(saleClaimed.id, saleClaimed.quantity)">
</vn-input-number>
</vn-td>
<vn-td expand title="{{::saleClaimed.sale.concept}}">
<span
class="link"
ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale.itemFk)">
{{::saleClaimed.sale.concept}}
</span>
</vn-td>
<vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>
<span class="link"
vn-tooltip="Edit discount"
ng-click="$ctrl.showEditPopover($event, saleClaimed)">
{{::saleClaimed.sale.discount}} %
</span>
</vn-td>
<vn-td number>
{{::$ctrl.getSaleTotal(saleClaimed.sale) | currency: 'EUR':2}}
</vn-td>
<vn-td shrink>
<vn-icon-button
vn-tooltip="Remove sale"
icon="delete"
ng-click="$ctrl.deleteClaimedSale($index)"
tabindex="-1">
</vn-icon-button>
</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
</vn-data-viewer>
</vn-card>
<a ng-click="$ctrl.openAddSalesDialog()" vn-tooltip="Add sale item" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>
<!-- Add Lines Dialog -->
<vn-dialog vn-id="add-sales" class="modal-form">
<tpl-body>

View File

@ -1,11 +1,9 @@
<vn-crud-model
<vn-crud-model vn-id="model"
url="/api/ClaimDms"
where="{claimFk: $ctrl.$stateParams.id}"
data="photos"
auto-load="true">
data="photos">
</vn-crud-model>
<vn-card class="summary">
<h5>{{$ctrl.summary.claim.id}} - {{$ctrl.summary.claim.client.name}}</h5>
<h5>{{::$ctrl.summary.claim.id}} - {{::$ctrl.summary.claim.client.name}}</h5>
<vn-horizontal>
<vn-one>
<vn-label-value label="Created"
@ -43,41 +41,43 @@
</vn-one>
<vn-auto>
<h4 translate>Detail</h4>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th number>Item</vn-th>
<vn-th>Landed</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th number>Claimed</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th>
<vn-th number>Disc.</vn-th>
<vn-th number>Total</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed">
<vn-td number>
<span
ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale.itemFk)"
class="link">
{{saleClaimed.sale.itemFk | zeroFill:6}}
</span>
</vn-td>
<vn-td>{{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{saleClaimed.sale.quantity}}</vn-td>
<vn-td number>{{saleClaimed.quantity}}</vn-td>
<vn-td expand>{{saleClaimed.sale.concept}}</vn-td>
<vn-td number>{{saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{saleClaimed.sale.discount}} %</vn-td>
<vn-td number>
{{saleClaimed.sale.quantity * saleClaimed.sale.price *
((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}}
</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
<vn-data-viewer data="::$ctrl.summary.salesClaimed">
<vn-table>
<vn-thead>
<vn-tr>
<vn-th number>Item</vn-th>
<vn-th>Landed</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th number>Claimed</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th>
<vn-th number>Disc.</vn-th>
<vn-th number>Total</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed">
<vn-td number>
<span
ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale.itemFk)"
class="link">
{{::saleClaimed.sale.itemFk | zeroFill:6}}
</span>
</vn-td>
<vn-td>{{::saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{::saleClaimed.sale.quantity}}</vn-td>
<vn-td number>{{::saleClaimed.quantity}}</vn-td>
<vn-td expand>{{::saleClaimed.sale.concept}}</vn-td>
<vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{::saleClaimed.sale.discount}} %</vn-td>
<vn-td number>
{{saleClaimed.sale.quantity * saleClaimed.sale.price *
((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}}
</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
</vn-data-viewer>
</vn-auto>
<vn-auto ng-if="photos.length > 0">
<h4 translate>Photos</h4>
@ -92,78 +92,82 @@
</vn-auto>
<vn-auto>
<h4 translate>Development</h4>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th>Reason</vn-th>
<vn-th>Result</vn-th>
<vn-th>Responsible</vn-th>
<vn-th>Worker</vn-th>
<vn-th>Redelivery</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="development in $ctrl.summary.developments">
<vn-td>{{development.claimReason.description}}</vn-td>
<vn-td>{{development.claimResult.description}}</vn-td>
<vn-td>{{development.claimResponsible.description}}</vn-td>
<vn-td expand>
<span
class="link"
ng-click="$ctrl.showWorkerDescriptor($event, development.workerFk)">
{{::development.worker.user.nickname}}
</span>
</vn-td>
<vn-td>{{development.claimRedelivery.description}}</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
<vn-data-viewer data="::$ctrl.summary.developments">
<vn-table>
<vn-thead>
<vn-tr>
<vn-th>Reason</vn-th>
<vn-th>Result</vn-th>
<vn-th>Responsible</vn-th>
<vn-th>Worker</vn-th>
<vn-th>Redelivery</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="development in $ctrl.summary.developments">
<vn-td>{{::development.claimReason.description}}</vn-td>
<vn-td>{{::development.claimResult.description}}</vn-td>
<vn-td>{{::development.claimResponsible.description}}</vn-td>
<vn-td expand>
<span
class="link"
ng-click="$ctrl.showWorkerDescriptor($event, development.workerFk)">
{{::development.worker.user.nickname}}
</span>
</vn-td>
<vn-td>{{::development.claimRedelivery.description}}</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
</vn-data-viewer>
</vn-auto>
<vn-auto>
<h4 translate>Action</h4>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th number>Item</vn-th>
<vn-th number>Ticket</vn-th>
<vn-th>Destination</vn-th>
<vn-th number>Landed</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th>
<vn-th number>Disc.</vn-th>
<vn-th number>Total</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="action in $ctrl.summary.actions">
<vn-td number>
<span
ng-click="$ctrl.showItemDescriptor($event, action.sale.itemFk)"
class="link">
{{action.sale.itemFk | zeroFill:6}}
</span>
</vn-td>
<vn-td number>
<span
ng-click="$ctrl.showTicketDescriptor($event, action.sale.ticket.id)"
class="link">
{{action.sale.ticket.id | zeroFill:6}}
</span>
</vn-td>
<vn-td expand>{{action.claimBeggining.description}}</vn-td>
<vn-td number>{{action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{action.sale.quantity}}</vn-td>
<vn-td expand>{{action.sale.concept}}</vn-td>
<vn-td number>{{action.sale.price}}</vn-td>
<vn-td number>{{action.sale.discount}} %</vn-td>
<vn-td number>
{{action.sale.quantity * action.sale.price *
((100 - action.sale.discount) / 100) | currency: 'EUR':2}}
</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
<vn-data-viewer data="::$ctrl.summary.actions">
<vn-table>
<vn-thead>
<vn-tr>
<vn-th number>Item</vn-th>
<vn-th number>Ticket</vn-th>
<vn-th>Destination</vn-th>
<vn-th number>Landed</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th>
<vn-th number>Disc.</vn-th>
<vn-th number>Total</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="action in $ctrl.summary.actions">
<vn-td number>
<span
ng-click="$ctrl.showItemDescriptor($event, action.sale.itemFk)"
class="link">
{{::action.sale.itemFk | zeroFill:6}}
</span>
</vn-td>
<vn-td number>
<span
ng-click="$ctrl.showTicketDescriptor($event, action.sale.ticket.id)"
class="link">
{{::action.sale.ticket.id | zeroFill:6}}
</span>
</vn-td>
<vn-td expand>{{::action.claimBeggining.description}}</vn-td>
<vn-td number>{{::action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{::action.sale.quantity}}</vn-td>
<vn-td expand>{{::action.sale.concept}}</vn-td>
<vn-td number>{{::action.sale.price}}</vn-td>
<vn-td number>{{::action.sale.discount}} %</vn-td>
<vn-td number>
{{action.sale.quantity * action.sale.price *
((100 - action.sale.discount) / 100) | currency: 'EUR':2}}
</vn-td>
</vn-tr>
</vn-tbody>
</vn-table>
</vn-data-viewer>
</vn-auto>
</vn-horizontal>
</vn-card>

View File

@ -9,6 +9,26 @@ class Controller {
this.accessToken = vnToken.token;
}
get claim() {
return this._claim;
}
set claim(value) {
this._claim = value;
// Get DMS on summary load
/* if (value)
this.$.$applyAsync(() => this.loadDms()); */
}
loadDms() {
this.$.model.where = {
claimFk: this.claim.id
};
this.$.model.refresh();
}
getSummary() {
this.$http.get(`/claim/api/Claims/${this.claim.id}/getSummary`).then(response => {
this.summary = response.data;

View File

@ -1,4 +1,5 @@
import './index.js';
import crudModel from 'core/mocks/crud-model';
describe('Claim', () => {
describe('Component summary', () => {
@ -13,6 +14,7 @@ describe('Claim', () => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnClaimSummary');
controller.claim = {id: 1};
controller.$.model = crudModel;
}));
describe('getSummary()', () => {

View File

@ -88,7 +88,7 @@
ng-if="!log.newProperties"
id="description">
<div>
<span>{{log.description}}</span>
<span>{{::log.description}}</span>
</div>
</vn-one>
</vn-td>