Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Juan Ferrer 2019-10-01 11:15:25 +02:00
commit daeb4bed09
15 changed files with 97 additions and 54 deletions

View File

@ -3,6 +3,7 @@
body { body {
background-color: $color-bg; background-color: $color-bg;
overflow: auto; overflow: auto;
height: 100%
} }
vn-app { vn-app {
height: inherit; height: inherit;

View File

@ -14,3 +14,4 @@ import './summary.scss';
import './descriptor.scss'; import './descriptor.scss';
import './list.scss'; import './list.scss';
import './modal-form.scss'; import './modal-form.scss';
import './photo-list.scss';

View File

@ -0,0 +1,38 @@
@import "./variables";
.photo-list {
justify-content: center;
align-items: flex-start;
align-content: flex-start;
flex-wrap: wrap;
.photo {
box-sizing: border-box;
transition: all 0.5s;
padding: $pad-small;
position: relative;
opacity: 0.7;
width: 28em;
.image {
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),
0 3px 1px -2px rgba(0,0,0,.2),
0 1px 5px 0 rgba(0,0,0,.12);
overflow: hidden;
cursor: zoom-in;
height: 100%;
img {
max-width: 100%
}
}
.actions {
position: absolute;
right: 1em;
top: 1em
}
}
.photo:hover {
opacity: 1
}
}

View File

@ -45,7 +45,7 @@
<vn-td expand title="{{::saleClaimed.sale.concept}}"> <vn-td expand title="{{::saleClaimed.sale.concept}}">
<span <span
class="link" class="link"
ng-click="$ctrl.showDescriptor($event, saleClaimed.sale.itemFk)"> ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale.itemFk)">
{{::saleClaimed.sale.concept}} {{::saleClaimed.sale.concept}}
</span> </span>
</vn-td> </vn-td>
@ -87,7 +87,6 @@
<vn-table> <vn-table>
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th number>Id</vn-th>
<vn-th number>Landed</vn-th> <vn-th number>Landed</vn-th>
<vn-th number>Quantity</vn-th> <vn-th number>Quantity</vn-th>
<vn-th number>Description</vn-th> <vn-th number>Description</vn-th>
@ -98,10 +97,15 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="sale in $ctrl.salesToClaim" class="clickable" ng-click="$ctrl.addClaimedSale($index)"> <vn-tr ng-repeat="sale in $ctrl.salesToClaim" class="clickable" ng-click="$ctrl.addClaimedSale($index)">
<vn-td number>{{sale.saleFk}}</vn-td>
<vn-td number>{{sale.landed | dateTime: 'dd/MM/yyyy'}}</vn-td> <vn-td number>{{sale.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{sale.quantity}}</vn-td> <vn-td number>{{sale.quantity}}</vn-td>
<vn-td number>{{sale.concept}}</vn-td> <vn-td expand title="{{::sale.concept}}">
<span
class="link"
ng-click="$ctrl.showItemDescriptor($event, sale.itemFk)">
{{sale.concept}}
</span>
</vn-td>
<vn-td number>{{sale.price | currency: 'EUR':2}}</vn-td> <vn-td number>{{sale.price | currency: 'EUR':2}}</vn-td>
<vn-td number>{{sale.discount}} %</vn-td> <vn-td number>{{sale.discount}} %</vn-td>
<vn-td number> <vn-td number>

View File

@ -111,8 +111,8 @@ class Controller {
return total; return total;
} }
// Item Descriptor showItemDescriptor(event, itemFk) {
showDescriptor(event, itemFk) { event.stopImmediatePropagation();
this.$.descriptor.itemFk = itemFk; this.$.descriptor.itemFk = itemFk;
this.$.descriptor.parent = event.target; this.$.descriptor.parent = event.target;
this.$.descriptor.show(); this.$.descriptor.show();

View File

@ -3,6 +3,7 @@ import crudModel from 'core/mocks/crud-model';
describe('claim', () => { describe('claim', () => {
describe('Component vnClaimDetail', () => { describe('Component vnClaimDetail', () => {
let $scope;
let controller; let controller;
let $httpBackend; let $httpBackend;
let $state; let $state;
@ -12,12 +13,16 @@ describe('claim', () => {
$translateProvider.translations('en', {}); $translateProvider.translations('en', {});
})); }));
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => { beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => {
$scope = $rootScope.$new();
$scope.descriptor = {
show: () => {}
};
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
$httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({}); $httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({});
$state = _$state_; $state = _$state_;
aclService = {hasAny: () => true}; aclService = {hasAny: () => true};
controller = $componentController('vnClaimDetail', {$state, aclService}); controller = $componentController('vnClaimDetail', {$state, aclService, $scope});
controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}]; controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}];
controller.salesClaimed = [{id: 1, sale: {}}]; controller.salesClaimed = [{id: 1, sale: {}}];
controller.claim = {ticketFk: 1}; controller.claim = {ticketFk: 1};
@ -119,5 +124,24 @@ describe('claim', () => {
expect(controller.$.model.refresh).toHaveBeenCalledWith(); expect(controller.$.model.refresh).toHaveBeenCalledWith();
}); });
}); });
describe('showItemDescriptor()', () => {
it('should configure the descriptor then show it', () => {
const itemId = 500;
const event = {
stopImmediatePropagation: () => {},
target: 'the target element'
};
spyOn(event, 'stopImmediatePropagation');
spyOn(controller.$.descriptor, 'show');
controller.showItemDescriptor(event, itemId);
expect(event.stopImmediatePropagation).toHaveBeenCalledWith();
expect(controller.$.descriptor.itemFk).toEqual(itemId);
expect(controller.$.descriptor.parent).toEqual(event.target);
expect(controller.$.descriptor.show).toHaveBeenCalledWith();
});
});
}); });
}); });

View File

@ -6,9 +6,8 @@
</vn-crud-model> </vn-crud-model>
<vn-horizontal class="photo-list" vn-droppable="true" on-drop="$ctrl.onDrop(event)"> <vn-horizontal class="photo-list" vn-droppable="true" on-drop="$ctrl.onDrop(event)">
<section class="photo" ng-repeat="photo in $ctrl.photos"> <section class="photo" ng-repeat="photo in $ctrl.photos">
<section class="image"> <section class="image mdl-shadow--2dp" on-error-src
<img alt="" on-error-src ng-style="{'background': 'url(/api/dms/' + photo.dmsFk + '/downloadFile?access_token=' + $ctrl.accessToken + ')'}"
ng-src="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}"
zoom-image="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}"> zoom-image="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
</section> </section>
<section class="actions"> <section class="actions">

View File

@ -10,6 +10,7 @@ vn-claim-dms-index {
.photo { .photo {
width: 32em; width: 32em;
height: 18em;
} }
} }

View File

@ -83,9 +83,8 @@
<h4 translate>Photos</h4> <h4 translate>Photos</h4>
<vn-horizontal class="photo-list"> <vn-horizontal class="photo-list">
<section class="photo" ng-repeat="photo in photos"> <section class="photo" ng-repeat="photo in photos">
<section class="image"> <section class="image" on-error-src
<img alt="" on-error-src ng-style="{'background': 'url(/api/dms/' + photo.dmsFk + '/downloadFile?access_token=' + $ctrl.accessToken + ')'}"
ng-src="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}"
zoom-image="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}"> zoom-image="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
</section> </section>
</section> </section>

View File

@ -1,36 +1,12 @@
@import "./variables"; @import "./variables";
.photo-list { vn-claim-summary {
justify-content: center;
align-items: flex-start;
align-content: flex-start;
flex-wrap: wrap;
.photo { .photo {
box-sizing: border-box; height: 15.5em;
padding: $pad-small; }
position: relative; .photo .image {
opacity: 0.7;
transition: all 0.5s;
width: 28em;
.image {
border: 2px solid $color-bg-dark; border: 2px solid $color-bg-dark;
border-radius: 0.2em; border-radius: 0.2em;
overflow: hidden;
img, video {
max-width: 100%
}
}
.actions {
position: absolute;
right: 1em;
top: 1em
}
} }
.photo:hover {
opacity: 1
}
} }

View File

@ -13,8 +13,8 @@ describe('Client index', () => {
controller = $componentController('vnClientIndex', {$scope, $state}); controller = $componentController('vnClientIndex', {$scope, $state});
})); }));
describe('x()', () => { describe('filterTickets()', () => {
it('should request to patch the propagation of tax status', () => { it('should navigate to the ticket index using params as filter', () => {
const client = {id: 101}; const client = {id: 101};
const event = {preventDefault: () => {}}; const event = {preventDefault: () => {}};
spyOn(event, 'preventDefault'); spyOn(event, 'preventDefault');

View File

@ -50,7 +50,7 @@
<vn-th field="agencyMode">Agency</vn-th> <vn-th field="agencyMode">Agency</vn-th>
<vn-th field="warehouse">Warehouse</vn-th> <vn-th field="warehouse">Warehouse</vn-th>
<vn-th field="refFk">Invoice</vn-th> <vn-th field="refFk">Invoice</vn-th>
<vn-th field="zoneLanding" shrink>Closure</vn-th> <vn-th field="zoneHour" shrink>Closure</vn-th>
<vn-th number>Total</vn-th> <vn-th number>Total</vn-th>
<vn-th></vn-th> <vn-th></vn-th>
</vn-tr> </vn-tr>

View File

@ -103,7 +103,8 @@ export default class Controller {
} }
totalPriceColor(ticket) { totalPriceColor(ticket) {
if (parseInt(ticket.total) < 50) const total = parseInt(ticket.total);
if (total > 0 && total < 50)
return 'warning'; return 'warning';
} }

View File

@ -31,10 +31,9 @@
<div> <div>
<span translate class="label">Changed by</span><span class="label">: </span> <span translate class="label">Changed by</span><span class="label">: </span>
<span <span
class="link" ng-class="{'link': log.user.worker.id, 'value': !log.user.worker.id}"
ng-click="$ctrl.showWorkerDescriptor($event, log.user.worker.id)" ng-click="$ctrl.showWorkerDescriptor($event, log.user.worker.id)"
translate translate>{{::log.user.name | dashIfEmpty}}
class="value">{{::log.user.name | dashIfEmpty}}
</span> </span>
</div> </div>
<div> <div>
@ -53,10 +52,9 @@
</vn-td> </vn-td>
<vn-td class="expendable"> <vn-td class="expendable">
<span <span
class="link" ng-class="{'link': log.user.worker.id, 'value': !log.user.worker.id}"
ng-click="$ctrl.showWorkerDescriptor($event, log.user.worker.id)" ng-click="$ctrl.showWorkerDescriptor($event, log.user.worker.id)"
translate translate>{{::log.user.name | dashIfEmpty}}
class="value">{{::log.user.name | dashIfEmpty}}
</span> </span>
</vn-td> </vn-td>
<vn-td class="expendable"> <vn-td class="expendable">

View File

@ -43,6 +43,7 @@ export default class Controller {
showWorkerDescriptor(event, workerFk) { showWorkerDescriptor(event, workerFk) {
if (event.defaultPrevented) return; if (event.defaultPrevented) return;
if (!workerFk) return;
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();