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 {
background-color: $color-bg;
overflow: auto;
height: 100%
}
vn-app {
height: inherit;

View File

@ -14,3 +14,4 @@ import './summary.scss';
import './descriptor.scss';
import './list.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}}">
<span
class="link"
ng-click="$ctrl.showDescriptor($event, saleClaimed.sale.itemFk)">
ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale.itemFk)">
{{::saleClaimed.sale.concept}}
</span>
</vn-td>
@ -87,7 +87,6 @@
<vn-table>
<vn-thead>
<vn-tr>
<vn-th number>Id</vn-th>
<vn-th number>Landed</vn-th>
<vn-th number>Quantity</vn-th>
<vn-th number>Description</vn-th>
@ -98,10 +97,15 @@
</vn-thead>
<vn-tbody>
<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.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.discount}} %</vn-td>
<vn-td number>

View File

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

View File

@ -3,6 +3,7 @@ import crudModel from 'core/mocks/crud-model';
describe('claim', () => {
describe('Component vnClaimDetail', () => {
let $scope;
let controller;
let $httpBackend;
let $state;
@ -12,12 +13,16 @@ describe('claim', () => {
$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.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({});
$state = _$state_;
aclService = {hasAny: () => true};
controller = $componentController('vnClaimDetail', {$state, aclService});
controller = $componentController('vnClaimDetail', {$state, aclService, $scope});
controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}];
controller.salesClaimed = [{id: 1, sale: {}}];
controller.claim = {ticketFk: 1};
@ -119,5 +124,24 @@ describe('claim', () => {
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-horizontal class="photo-list" vn-droppable="true" on-drop="$ctrl.onDrop(event)">
<section class="photo" ng-repeat="photo in $ctrl.photos">
<section class="image">
<img alt="" on-error-src
ng-src="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}"
<section class="image mdl-shadow--2dp" on-error-src
ng-style="{'background': 'url(/api/dms/' + photo.dmsFk + '/downloadFile?access_token=' + $ctrl.accessToken + ')'}"
zoom-image="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
</section>
<section class="actions">

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@
<vn-th field="agencyMode">Agency</vn-th>
<vn-th field="warehouse">Warehouse</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></vn-th>
</vn-tr>

View File

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

View File

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

View File

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