#1882 Popover::show() boilerplate code removed
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
5826099601
commit
b536c8291a
|
@ -31,6 +31,7 @@ rules:
|
||||||
curly: [error, multi-or-nest]
|
curly: [error, multi-or-nest]
|
||||||
indent: [error, 4]
|
indent: [error, 4]
|
||||||
arrow-parens: [error, as-needed]
|
arrow-parens: [error, as-needed]
|
||||||
jasmine/no-focused-tests: 0
|
|
||||||
no-multiple-empty-lines: ["error", { "max": 1, "maxEOF": 1 }]
|
no-multiple-empty-lines: ["error", { "max": 1, "maxEOF": 1 }]
|
||||||
space-in-parens: ["error", "never"]
|
space-in-parens: ["error", "never"]
|
||||||
|
jasmine/no-focused-tests: 0
|
||||||
|
jasmine/prefer-toHaveBeenCalledWith: 0
|
|
@ -63,10 +63,10 @@ export default class DescriptorPopover extends Popover {
|
||||||
this.relocate();
|
this.relocate();
|
||||||
return this.$http.get(url, options)
|
return this.$http.get(url, options)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.canceler = null;
|
|
||||||
this.$.$applyAsync(() => this.relocate());
|
this.$.$applyAsync(() => this.relocate());
|
||||||
return res;
|
return res;
|
||||||
});
|
})
|
||||||
|
.finally(() => this.canceler = null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<a ng-repeat="button in $ctrl.links"
|
<vn-spinner
|
||||||
vn-tooltip="{{::button.tooltip}}"
|
ng-if="$ctrl.canceler"
|
||||||
class="vn-button colored"
|
enable="true">
|
||||||
ui-sref="{{::button.state}}">
|
</vn-spinner>
|
||||||
<vn-icon
|
<div
|
||||||
icon="{{::button.icon}}">
|
ng-if="$ctrl.entity"
|
||||||
</vn-icon>
|
ng-transclude="body"
|
||||||
</a>
|
class="descriptor-wrapper">
|
||||||
|
</div>
|
|
@ -1,21 +1,39 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
import Component from 'core/lib/component';
|
import Component from 'core/lib/component';
|
||||||
import './quick-links';
|
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
import './quick-links';
|
||||||
|
import './quick-link';
|
||||||
|
|
||||||
export default class Descriptor extends Component {
|
export default class Descriptor extends Component {
|
||||||
set quicklinks(value = {}) {
|
get entity() {
|
||||||
this._quicklinks = Object.assign(value, this._quicklinks);
|
return this._entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
set entity(value) {
|
||||||
|
this._entity = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get quicklinks() {
|
get quicklinks() {
|
||||||
return this._quicklinks;
|
return this._quicklinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set quicklinks(value = {}) {
|
||||||
|
this._quicklinks = Object.assign(value, this._quicklinks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Descriptor.$inject = ['$element', '$scope'/* , '$transclude'*/];
|
||||||
|
|
||||||
ngModule.vnComponent('vnDescriptor', {
|
ngModule.vnComponent('vnDescriptor', {
|
||||||
|
template: require('./index.html'),
|
||||||
controller: Descriptor,
|
controller: Descriptor,
|
||||||
bindings: {
|
bindings: {
|
||||||
|
entity: '<?',
|
||||||
quicklinks: '<'
|
quicklinks: '<'
|
||||||
},
|
},
|
||||||
|
transclude: {
|
||||||
|
body: '?slotBody',
|
||||||
|
btnOne: '?btnOne',
|
||||||
|
btnTwo: '?btnTwo',
|
||||||
|
btnThree: '?btnThree'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<a
|
||||||
|
ui-sref="{{$ctrl.state}}"
|
||||||
|
vn-tooltip="{{::$ctrl.tooltip}}"
|
||||||
|
class="vn-button colored">
|
||||||
|
<vn-icon
|
||||||
|
icon="{{::$ctrl.icon}}">
|
||||||
|
</vn-icon>
|
||||||
|
</a>
|
|
@ -0,0 +1,13 @@
|
||||||
|
import ngModule from '../../module';
|
||||||
|
|
||||||
|
export default class QuickLink {}
|
||||||
|
|
||||||
|
ngModule.component('vnQuickLink', {
|
||||||
|
template: require('./quick-link.html'),
|
||||||
|
controller: QuickLink,
|
||||||
|
bindings: {
|
||||||
|
state: '@?',
|
||||||
|
icon: '@?',
|
||||||
|
tooltip: '@?'
|
||||||
|
}
|
||||||
|
});
|
|
@ -2,7 +2,9 @@
|
||||||
@import "./effects";
|
@import "./effects";
|
||||||
@import "./variables";
|
@import "./variables";
|
||||||
|
|
||||||
.vn-descriptor {
|
.vn-descriptor,
|
||||||
|
.vn-descriptor slot-body {
|
||||||
|
display: block;
|
||||||
box-shadow: 0 1px 3px $color-shadow;
|
box-shadow: 0 1px 3px $color-shadow;
|
||||||
|
|
||||||
& > .header {
|
& > .header {
|
||||||
|
@ -65,7 +67,11 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
& > a {
|
& > a,
|
||||||
|
vn-quick-link > a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
padding: 0 $spacing-md;
|
padding: 0 $spacing-md;
|
||||||
margin: 0 $spacing-sm;
|
margin: 0 $spacing-sm;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<vn-crud-model vn-id="model" auto-load="true"
|
<vn-crud-model
|
||||||
|
vn-id="model"
|
||||||
|
auto-load="true"
|
||||||
url="ClaimDms"
|
url="ClaimDms"
|
||||||
link="{claimFk: $ctrl.$params.id}"
|
link="{claimFk: $ctrl.$params.id}"
|
||||||
limit="20"
|
limit="20"
|
||||||
|
@ -17,7 +19,7 @@
|
||||||
<section class="actions">
|
<section class="actions">
|
||||||
<vn-button
|
<vn-button
|
||||||
class="round"
|
class="round"
|
||||||
ng-click="$ctrl.showDeleteConfirm($index)"
|
ng-click="confirm.show($index)"
|
||||||
title="{{'Remove file' | translate}}"
|
title="{{'Remove file' | translate}}"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
icon="delete">
|
icon="delete">
|
||||||
|
@ -25,19 +27,16 @@
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
||||||
<vn-worker-descriptor-popover
|
|
||||||
vn-id="workerDescriptor">
|
|
||||||
</vn-worker-descriptor-popover>
|
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This file will be deleted"
|
message="This file will be deleted"
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
on-response="$ctrl.deleteDms($response)">
|
on-accept="$ctrl.deleteDms($data)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
<vn-float-button fixed-bottom-right
|
<vn-float-button
|
||||||
icon="add"
|
icon="add"
|
||||||
vn-tooltip="Select photo"
|
vn-tooltip="Select photo"
|
||||||
vn-bind="+"
|
vn-bind="+"
|
||||||
ng-click="$ctrl.openUploadDialog()">
|
ng-click="$ctrl.openUploadDialog()"
|
||||||
|
fixed-bottom-right>
|
||||||
</vn-float-button>
|
</vn-float-button>
|
||||||
|
|
|
@ -3,28 +3,13 @@ import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
showWorkerDescriptor(event, workerFk) {
|
deleteDms(index) {
|
||||||
event.preventDefault();
|
const dmsFk = this.photos[index].dmsFk;
|
||||||
event.stopImmediatePropagation();
|
return this.$http.post(`ClaimDms/${dmsFk}/removeFile`)
|
||||||
this.$.workerDescriptor.parent = event.target;
|
.then(() => {
|
||||||
this.$.workerDescriptor.workerFk = workerFk;
|
this.$.model.remove(index);
|
||||||
this.$.workerDescriptor.show();
|
this.vnApp.showSuccess(this.$t('Photo deleted'));
|
||||||
}
|
|
||||||
|
|
||||||
showDeleteConfirm(index) {
|
|
||||||
this.dmsIndex = index;
|
|
||||||
this.$.confirm.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteDms(response) {
|
|
||||||
if (response === 'accept') {
|
|
||||||
const dmsFk = this.photos[this.dmsIndex].dmsFk;
|
|
||||||
const query = `claimDms/${dmsFk}/removeFile`;
|
|
||||||
this.$http.post(query).then(() => {
|
|
||||||
this.$.model.remove(this.dmsIndex);
|
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Photo deleted'));
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onDrop($event) {
|
onDrop($event) {
|
||||||
|
@ -36,10 +21,10 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaultParams() {
|
setDefaultParams() {
|
||||||
const params = {filter: {
|
const filter = {
|
||||||
where: {code: 'claim'}
|
where: {code: 'claim'}
|
||||||
}};
|
};
|
||||||
return this.$http.get('DmsTypes/findOne', {params}).then(res => {
|
return this.$http.get('DmsTypes/findOne', {filter}).then(res => {
|
||||||
const dmsTypeId = res.data && res.data.id;
|
const dmsTypeId = res.data && res.data.id;
|
||||||
const companyId = this.vnConfig.companyFk;
|
const companyId = this.vnConfig.companyFk;
|
||||||
const warehouseId = this.vnConfig.warehouseFk;
|
const warehouseId = this.vnConfig.warehouseFk;
|
||||||
|
@ -50,7 +35,7 @@ class Controller extends Section {
|
||||||
warehouseId: warehouseId,
|
warehouseId: warehouseId,
|
||||||
companyId: companyId,
|
companyId: companyId,
|
||||||
dmsTypeId: dmsTypeId,
|
dmsTypeId: dmsTypeId,
|
||||||
description: this.$translate.instant('FileDescription', {
|
description: this.$t('FileDescription', {
|
||||||
claimId: this.claim.id,
|
claimId: this.claim.id,
|
||||||
clientId: this.claim.client.id,
|
clientId: this.claim.client.id,
|
||||||
clientName: this.claim.client.name
|
clientName: this.claim.client.name
|
||||||
|
@ -91,7 +76,7 @@ class Controller extends Section {
|
||||||
data: this.dms.files
|
data: this.dms.files
|
||||||
};
|
};
|
||||||
this.$http(options).then(() => {
|
this.$http(options).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Photo uploaded!'));
|
this.vnApp.showSuccess(this.$t('Photo uploaded!'));
|
||||||
this.$.model.refresh();
|
this.$.model.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,13 @@ describe('Claim', () => {
|
||||||
let $scope;
|
let $scope;
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
let controller;
|
let controller;
|
||||||
let $httpParamSerializer;
|
|
||||||
|
|
||||||
beforeEach(ngModule('claim'));
|
beforeEach(ngModule('claim'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||||
$httpParamSerializer = _$httpParamSerializer_;
|
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
const $element = angular.element('<vn-claim-photos></vn-claim-photos>');
|
controller = $componentController('vnClaimPhotos', {$element: null, $scope});
|
||||||
controller = $componentController('vnClaimPhotos', {$element, $scope});
|
|
||||||
controller.$.model = crudModel;
|
controller.$.model = crudModel;
|
||||||
controller.claim = {
|
controller.claim = {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
@ -25,31 +22,25 @@ describe('Claim', () => {
|
||||||
|
|
||||||
describe('deleteDms()', () => {
|
describe('deleteDms()', () => {
|
||||||
it('should make an HTTP Post query', () => {
|
it('should make an HTTP Post query', () => {
|
||||||
const dmsId = 1;
|
|
||||||
const dmsIndex = 0;
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
jest.spyOn(controller.$.model, 'remove');
|
jest.spyOn(controller.$.model, 'remove');
|
||||||
controller.photos = [{dmsFk: 1}];
|
|
||||||
controller.dmsIndex = dmsIndex;
|
|
||||||
|
|
||||||
$httpBackend.when('POST', `claimDms/${dmsId}/removeFile`).respond({});
|
const dmsId = 1;
|
||||||
$httpBackend.expect('POST', `claimDms/${dmsId}/removeFile`);
|
const dmsIndex = 0;
|
||||||
controller.deleteDms('accept');
|
controller.photos = [{dmsFk: 1}];
|
||||||
|
|
||||||
|
$httpBackend.expectPOST(`ClaimDms/${dmsId}/removeFile`).respond();
|
||||||
|
controller.deleteDms(dmsIndex);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Photo deleted');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('setDefaultParams()', () => {
|
describe('setDefaultParams()', () => {
|
||||||
it('should make an HTTP GET query, then set all dms properties', () => {
|
it('should make an HTTP GET query, then set all dms properties', () => {
|
||||||
const params = {filter: {
|
$httpBackend.expectRoute('GET', `DmsTypes/findOne`).respond({});
|
||||||
where: {code: 'claim'}
|
|
||||||
}};
|
|
||||||
let serializedParams = $httpParamSerializer(params);
|
|
||||||
$httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({});
|
|
||||||
$httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`);
|
|
||||||
controller.setDefaultParams();
|
controller.setDefaultParams();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
@ -67,13 +58,12 @@ describe('Claim', () => {
|
||||||
controller.dmsIndex = dmsIndex;
|
controller.dmsIndex = dmsIndex;
|
||||||
controller.dms = {files: []};
|
controller.dms = {files: []};
|
||||||
|
|
||||||
$httpBackend.when('POST', `claims/${claimId}/uploadFile`).respond({});
|
$httpBackend.expectPOST(`claims/${claimId}/uploadFile`).respond({});
|
||||||
$httpBackend.expect('POST', `claims/${claimId}/uploadFile`);
|
|
||||||
controller.create();
|
controller.create();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$.model.refresh).toHaveBeenCalledWith();
|
expect(controller.$.model.refresh).toHaveBeenCalled();
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Photo uploaded!');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
<div class="vn-descriptor">
|
<slot-body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<a translate-attr="{title: 'Return to module index'}" ui-sref="client.index">
|
<a
|
||||||
|
translate-attr="{title: 'Return to module index'}"
|
||||||
|
ui-sref="client.index">
|
||||||
<vn-icon icon="chevron_left"></vn-icon>
|
<vn-icon icon="chevron_left"></vn-icon>
|
||||||
</a>
|
</a>
|
||||||
<a translate-attr="{title: 'Preview'}" ui-sref="client.card.summary({id: $ctrl.client.id})">
|
<a
|
||||||
|
translate-attr="{title: 'Preview'}"
|
||||||
|
ui-sref="client.card.summary({id: $ctrl.client.id})">
|
||||||
<vn-icon icon="desktop_windows"></vn-icon>
|
<vn-icon icon="desktop_windows"></vn-icon>
|
||||||
</a>
|
</a>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
|
@ -62,17 +66,23 @@
|
||||||
ng-class="{bright: $ctrl.client.isTaxDataChecked == false}">
|
ng-class="{bright: $ctrl.client.isTaxDataChecked == false}">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="quicklinks">
|
<div class="quicklinks" >
|
||||||
<a class="vn-button colored"
|
<div ng-transclude="btnOne">
|
||||||
vn-tooltip="Client ticket list"
|
<vn-quick-link
|
||||||
ui-sref="ticket.index({q: $ctrl.filter})">
|
tooltip="Client ticket list"
|
||||||
<vn-icon icon="icon-ticket"></vn-icon>
|
state="ticket.index({ q: '{{ {clientFk: $ctrl.client.id} }}' })"
|
||||||
</a>
|
icon="icon-ticket">
|
||||||
<a class="vn-button colored"
|
</vn-quick-link>
|
||||||
vn-tooltip="New order"
|
</div>
|
||||||
ui-sref="order.create({clientFk: $ctrl.client.id})">
|
<div ng-transclude="btnTwo">
|
||||||
<vn-icon icon="icon-basketadd"></vn-icon>
|
<vn-quick-link
|
||||||
</a>
|
tooltip="New order"
|
||||||
|
state="order.create({ clientFk: {{ $ctrl.client.id }} })"
|
||||||
|
icon="icon-basketadd">
|
||||||
|
</vn-quick-link>
|
||||||
|
</div>
|
||||||
|
<div ng-transclude="btnThree">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
<!--
|
||||||
<vn-quick-links
|
<vn-quick-links
|
||||||
|
@ -80,61 +90,61 @@
|
||||||
</vn-quick-links>
|
</vn-quick-links>
|
||||||
-->
|
-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<vn-menu vn-id="menu">
|
||||||
<vn-menu vn-id="menu">
|
<ul class="vn-list">
|
||||||
<ul class="vn-list">
|
<li>
|
||||||
<li>
|
<a class="vn-item"
|
||||||
<a class="vn-item"
|
ui-sref="ticket.create({clientFk: $ctrl.client.id})"
|
||||||
ui-sref="ticket.create({clientFk: $ctrl.client.id})"
|
translate>
|
||||||
translate>
|
Simple ticket
|
||||||
Simple ticket
|
</a>
|
||||||
</a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<div class="vn-item"
|
||||||
<div class="vn-item"
|
ng-click="$ctrl.showSMSDialog()"
|
||||||
ng-click="$ctrl.showSMSDialog()"
|
translate>
|
||||||
translate>
|
Send SMS
|
||||||
Send SMS
|
</div>
|
||||||
</div>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<div class="vn-item"
|
||||||
<div class="vn-item"
|
ng-click="consumerReportDialog.show()"
|
||||||
ng-click="consumerReportDialog.show()"
|
translate>
|
||||||
translate>
|
Send consumer report
|
||||||
Send consumer report
|
</div>
|
||||||
</div>
|
</li>
|
||||||
</li>
|
</ul>
|
||||||
</ul>
|
</vn-menu>
|
||||||
</vn-menu>
|
<vn-client-sms
|
||||||
<vn-client-sms
|
vn-id="sms"
|
||||||
vn-id="sms"
|
sms="$ctrl.newSMS">
|
||||||
sms="$ctrl.newSMS">
|
</vn-client-sms>
|
||||||
</vn-client-sms>
|
<vn-dialog
|
||||||
<vn-dialog
|
vn-id="consumerReportDialog"
|
||||||
vn-id="consumerReportDialog"
|
on-accept="$ctrl.onConsumerReportAccept()">
|
||||||
on-accept="$ctrl.onConsumerReportAccept()">
|
<tpl-body>
|
||||||
<tpl-body>
|
<div>
|
||||||
<div>
|
<h5 style="text-align: center">
|
||||||
<h5 style="text-align: center">
|
<span translate>Send consumer report</span>
|
||||||
<span translate>Send consumer report</span>
|
</h5>
|
||||||
</h5>
|
<vn-date-picker
|
||||||
<vn-date-picker
|
vn-id="from"
|
||||||
vn-id="from"
|
vn-one
|
||||||
vn-one
|
ng-model="$ctrl.from"
|
||||||
ng-model="$ctrl.from"
|
label="From date"
|
||||||
label="From date"
|
vn-focus>
|
||||||
vn-focus>
|
</vn-date-picker>
|
||||||
|
<vn-date-picker
|
||||||
|
vn-id="to"
|
||||||
|
vn-one
|
||||||
|
ng-model="$ctrl.to"
|
||||||
|
label="To date">
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
<vn-date-picker
|
</div>
|
||||||
vn-id="to"
|
</tpl-body>
|
||||||
vn-one
|
<tpl-buttons>
|
||||||
ng-model="$ctrl.to"
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
label="To date">
|
<button response="accept" translate>Accept</button>
|
||||||
</vn-date-picker>
|
</tpl-buttons>
|
||||||
</div>
|
</vn-dialog>
|
||||||
</tpl-body>
|
</slot-body>
|
||||||
<tpl-buttons>
|
|
||||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
|
||||||
<button response="accept" translate>Accept</button>
|
|
||||||
</tpl-buttons>
|
|
||||||
</vn-dialog>
|
|
|
@ -2,17 +2,17 @@ import ngModule from '../module';
|
||||||
import Descriptor from 'salix/components/descriptor';
|
import Descriptor from 'salix/components/descriptor';
|
||||||
|
|
||||||
class Controller extends Descriptor {
|
class Controller extends Descriptor {
|
||||||
constructor($element, $, $httpParamSerializer) {
|
constructor($element, $, $transclude, $httpParamSerializer) {
|
||||||
super($element, $);
|
super($element, $, $transclude);
|
||||||
this.$httpParamSerializer = $httpParamSerializer;
|
this.$httpParamSerializer = $httpParamSerializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
get client() {
|
get client() {
|
||||||
return this._client;
|
return this.entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
set client(value) {
|
set client(value) {
|
||||||
this._client = value;
|
this.entity = value;
|
||||||
if (!value) return;
|
if (!value) return;
|
||||||
|
|
||||||
if (this.$params.sendSMS)
|
if (this.$params.sendSMS)
|
||||||
|
@ -33,7 +33,7 @@ class Controller extends Descriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
get filter() {
|
get filter() {
|
||||||
return this.client ? JSON.stringify({clientFk: this.client.id}) : null;
|
return JSON.stringify({clientFk: this.client.id});
|
||||||
}
|
}
|
||||||
|
|
||||||
showSMSDialog() {
|
showSMSDialog() {
|
||||||
|
@ -56,11 +56,10 @@ class Controller extends Descriptor {
|
||||||
window.open(`api/report/campaign-metrics?${params}`);
|
window.open(`api/report/campaign-metrics?${params}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Controller.$inject = ['$element', '$scope', '$transclude', '$httpParamSerializer'];
|
||||||
Controller.$inject = ['$element', '$scope', '$httpParamSerializer'];
|
|
||||||
|
|
||||||
ngModule.vnComponent('vnClientDescriptor', {
|
ngModule.vnComponent('vnClientDescriptor', {
|
||||||
template: require('./index.html'),
|
slotTemplate: require('./index.html'),
|
||||||
bindings: {
|
bindings: {
|
||||||
client: '<'
|
client: '<'
|
||||||
},
|
},
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<span class="link"
|
<span class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, document.dms.workerFk)">
|
ng-click="workerDescriptor.show($event, document.dms.workerFk)">
|
||||||
{{::document.dms.worker.user.nickname | dashIfEmpty}}
|
{{::document.dms.worker.user.nickname | dashIfEmpty}}
|
||||||
</span></vn-td>
|
</span></vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="delete"
|
icon="delete"
|
||||||
ng-click="$ctrl.showDeleteConfirm($index)"
|
ng-click="confirm.show($index)"
|
||||||
title="{{'Remove file' | translate}}"
|
title="{{'Remove file' | translate}}"
|
||||||
tabindex="-1">
|
tabindex="-1">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
|
@ -109,5 +109,5 @@
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This file will be deleted"
|
message="This file will be deleted"
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
on-response="$ctrl.deleteDms($response)">
|
on-accept="$ctrl.deleteDms($data)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -24,8 +24,7 @@ class Controller extends Section {
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['name']
|
fields: ['name']
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['userFk'],
|
||||||
|
@ -42,28 +41,13 @@ class Controller extends Section {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
showWorkerDescriptor(event, workerFk) {
|
deleteDms(index) {
|
||||||
event.preventDefault();
|
const dmsFk = this.clientDms[index].dmsFk;
|
||||||
event.stopImmediatePropagation();
|
return this.$http.post(`ClientDms/${dmsFk}/removeFile`)
|
||||||
this.$.workerDescriptor.parent = event.target;
|
.then(() => {
|
||||||
this.$.workerDescriptor.workerFk = workerFk;
|
this.$.model.remove(index);
|
||||||
this.$.workerDescriptor.show();
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||||
}
|
|
||||||
|
|
||||||
showDeleteConfirm(index) {
|
|
||||||
this.dmsIndex = index;
|
|
||||||
this.$.confirm.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteDms(response) {
|
|
||||||
if (response === 'accept') {
|
|
||||||
const dmsFk = this.clientDms[this.dmsIndex].dmsFk;
|
|
||||||
const query = `clientDms/${dmsFk}/removeFile`;
|
|
||||||
this.$http.post(query).then(() => {
|
|
||||||
this.$.model.remove(this.dmsIndex);
|
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,27 +12,25 @@ describe('Client', () => {
|
||||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
const $element = angular.element('<vn-client-dms-index></vn-client-dms-index>');
|
controller = $componentController('vnClientDmsIndex', {$element: null, $scope});
|
||||||
controller = $componentController('vnClientDmsIndex', {$element, $scope});
|
|
||||||
controller.$.model = crudModel;
|
controller.$.model = crudModel;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('deleteDms()', () => {
|
describe('deleteDms()', () => {
|
||||||
it('should make an HTTP Post query', () => {
|
it('should make an HTTP Post query', () => {
|
||||||
const dmsId = 1;
|
|
||||||
const dmsIndex = 0;
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
jest.spyOn(controller.$.model, 'remove');
|
jest.spyOn(controller.$.model, 'remove');
|
||||||
controller.clientDms = [{dmsFk: 1}];
|
|
||||||
controller.dmsIndex = dmsIndex;
|
|
||||||
|
|
||||||
$httpBackend.when('POST', `clientDms/${dmsId}/removeFile`).respond({});
|
const dmsId = 1;
|
||||||
$httpBackend.expect('POST', `clientDms/${dmsId}/removeFile`);
|
const dmsIndex = 0;
|
||||||
controller.deleteDms('accept');
|
controller.clientDms = [{dmsFk: 1}];
|
||||||
|
|
||||||
|
$httpBackend.expectPOST(`ClientDms/${dmsId}/removeFile`).respond();
|
||||||
|
controller.deleteDms(dmsIndex);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,9 +29,10 @@
|
||||||
{{::sample.type.description}}
|
{{::sample.type.description}}
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span class="link"
|
<span
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, sample.worker.id)">
|
ng-click="workerDescriptor.show($event, sample.worker.id)"
|
||||||
{{::sample.worker.user.nickname}}
|
class="link">
|
||||||
|
{{::sample.worker.user.nickname}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>{{::sample.company.code}}</vn-td>
|
<vn-td>{{::sample.company.code}}</vn-td>
|
||||||
|
|
|
@ -11,8 +11,7 @@ class Controller extends Section {
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['code', 'description']
|
fields: ['code', 'description']
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['userFk'],
|
||||||
|
@ -23,8 +22,7 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
relation: 'company',
|
relation: 'company',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['code']
|
fields: ['code']
|
||||||
|
@ -33,20 +31,8 @@ class Controller extends Section {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
showWorkerDescriptor(event, workerFk) {
|
|
||||||
if (event.defaultPrevented) return;
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopImmediatePropagation();
|
|
||||||
|
|
||||||
this.selectedWorker = workerFk;
|
|
||||||
this.$.workerDescriptor.parent = event.target;
|
|
||||||
this.$.workerDescriptor.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$element', '$scope'];
|
|
||||||
|
|
||||||
ngModule.component('vnClientSampleIndex', {
|
ngModule.component('vnClientSampleIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<vn-td center>
|
<vn-td center>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showTravelDescriptor($event, entry.travelFk)">
|
vn-click-stop="travelDescriptor.show($event, entry.travelFk)">
|
||||||
{{::entry.landed | date:'dd/MM/yyyy'}}
|
{{::entry.landed | date:'dd/MM/yyyy'}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -64,15 +64,8 @@
|
||||||
</a>
|
</a>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
</vn-table>
|
</vn-table>
|
||||||
</vn-data-viewer>
|
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
</vn-data-viewer>
|
||||||
<vn-travel-descriptor-popover
|
<vn-travel-descriptor-popover
|
||||||
vn-id="travelDescriptor"
|
vn-id="travelDescriptor">
|
||||||
travel-id="$ctrl.selectedTravel">
|
|
||||||
</vn-travel-descriptor-popover>
|
</vn-travel-descriptor-popover>
|
||||||
<vn-popup vn-id="summary">
|
|
||||||
<vn-entry-summary
|
|
||||||
entry="$ctrl.entrySelected">
|
|
||||||
</vn-entry-summary>
|
|
||||||
</vn-popup>
|
|
||||||
<vn-scroll-up></vn-scroll-up>
|
|
|
@ -1,17 +1,8 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
export default class Controller extends Section {
|
|
||||||
showTravelDescriptor(event, travelFk) {
|
|
||||||
if (event.defaultPrevented) return;
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
this.selectedTravel = travelFk;
|
export default class Controller extends Section {}
|
||||||
this.$.travelDescriptor.parent = event.target;
|
|
||||||
this.$.travelDescriptor.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ngModule.component('vnEntryIndex', {
|
ngModule.component('vnEntryIndex', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
@import "variables";
|
@import "variables";
|
||||||
|
|
||||||
vn-icon[icon=insert_drive_file]{
|
vn-icon[icon=insert_drive_file] {
|
||||||
color: $color-font-secondary;
|
color: $color-font-secondary;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,18 +3,18 @@
|
||||||
url="TicketRequests/filter"
|
url="TicketRequests/filter"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="requests"
|
data="requests"
|
||||||
order="shipped DESC, isOk ASC">
|
order="shipped DESC, isOk ASC"
|
||||||
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-portal slot="topbar">
|
<vn-portal slot="topbar">
|
||||||
<vn-searchbar vn-focus
|
<vn-searchbar
|
||||||
panel="vn-request-search-panel"
|
panel="vn-request-search-panel"
|
||||||
suggested-filter="$ctrl.filter.where"
|
suggested-filter="$ctrl.filter.where"
|
||||||
info="Search request by id or alias">
|
info="Search request by id or alias"
|
||||||
|
model="model"
|
||||||
|
auto-state="false">
|
||||||
</vn-searchbar>
|
</vn-searchbar>
|
||||||
</vn-portal>
|
</vn-portal>
|
||||||
<vn-auto-search
|
|
||||||
on-search="$ctrl.onSearch($params)">
|
|
||||||
</vn-auto-search>
|
|
||||||
<vn-data-viewer model="model">
|
<vn-data-viewer model="model">
|
||||||
<vn-card>
|
<vn-card>
|
||||||
<vn-table model="model">
|
<vn-table model="model">
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<vn-tr ng-repeat="request in requests">
|
<vn-tr ng-repeat="request in requests">
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span class="link"
|
<span class="link"
|
||||||
ng-click="$ctrl.showTicketDescriptor($event, request.ticketFk)">
|
ng-click="ticketDescriptor.show($event, request.ticketFk)">
|
||||||
{{request.ticketFk}}
|
{{request.ticketFk}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, request.attenderFk)">
|
ng-click="workerDescriptor.show($event, request.attenderFk)">
|
||||||
{{::request.atenderNickname}}
|
{{::request.atenderNickname}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showItemDescriptor($event, request.itemFk)"
|
ng-click="itemDescriptor.show($event, request.itemFk)"
|
||||||
title="{{request.itemDescription}}">
|
title="{{request.itemDescription}}">
|
||||||
{{request.itemDescription}}
|
{{request.itemDescription}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -111,16 +111,17 @@
|
||||||
vn-id="itemDescriptor">
|
vn-id="itemDescriptor">
|
||||||
</vn-item-descriptor-popover>
|
</vn-item-descriptor-popover>
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="deny-dialog"
|
vn-id="denyDialog"
|
||||||
on-accept="$ctrl.onDenyAccept($data)"
|
on-accept="$ctrl.onDenyAccept($data)"
|
||||||
on-close="$ctrl.onDenyClose()">
|
on-close="$ctrl.denyObservation = null">
|
||||||
|
<tpl-title translate>
|
||||||
|
Specify the reasons to deny this request
|
||||||
|
</tpl-title>
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<h5 class="vn-pa-md" translate>Specify the reasons to deny this request</h5>
|
<vn-textarea
|
||||||
<vn-horizontal class="vn-pa-md">
|
ng-model="$ctrl.denyObservation"
|
||||||
<vn-textarea vn-focus
|
vn-focus>
|
||||||
ng-model="$ctrl.denyObservation">
|
</vn-textarea>
|
||||||
</vn-textarea>
|
|
||||||
</vn-horizontal>
|
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
|
|
|
@ -25,11 +25,6 @@ export default class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$postLink() {
|
|
||||||
if (this.filter)
|
|
||||||
this.onSearch(this.filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
getState(isOk) {
|
getState(isOk) {
|
||||||
if (isOk === null)
|
if (isOk === null)
|
||||||
return 'Nueva';
|
return 'Nueva';
|
||||||
|
@ -62,11 +57,11 @@ export default class Controller extends Section {
|
||||||
quantity: request.saleQuantity
|
quantity: request.saleQuantity
|
||||||
};
|
};
|
||||||
|
|
||||||
let endpoint = `Sales/${request.saleFk}/`;
|
let endpoint = `Sales/${request.saleFk}`;
|
||||||
|
|
||||||
this.$http.patch(endpoint, params).then(() => {
|
this.$http.patch(endpoint, params)
|
||||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
|
||||||
}).then(() => this.confirmRequest(request));
|
.then(() => this.confirmRequest(request));
|
||||||
} else
|
} else
|
||||||
this.confirmRequest(request);
|
this.confirmRequest(request);
|
||||||
}
|
}
|
||||||
|
@ -85,69 +80,20 @@ export default class Controller extends Section {
|
||||||
return 'success';
|
return 'success';
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearch(params) {
|
|
||||||
if (params)
|
|
||||||
this.$.model.applyFilter(null, params);
|
|
||||||
else
|
|
||||||
this.$.model.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
showDenyReason(event, requestId) {
|
|
||||||
this.selectedRequest = requestId;
|
|
||||||
this.$.denyReason.parent = event.target;
|
|
||||||
this.$.denyReason.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
clear() {
|
|
||||||
delete this.denyRequestId;
|
|
||||||
}
|
|
||||||
|
|
||||||
onDenyAccept(request) {
|
onDenyAccept(request) {
|
||||||
let params = {
|
let params = {
|
||||||
observation: this.denyObservation
|
observation: this.denyObservation
|
||||||
};
|
};
|
||||||
|
|
||||||
let query = `TicketRequests/${request.id}/deny`;
|
return this.$http.post(`TicketRequests/${request.id}/deny`, params)
|
||||||
return this.$http.post(query, params).then(res => {
|
.then(res => {
|
||||||
const newRequest = res.data;
|
const newRequest = res.data;
|
||||||
request.isOk = newRequest.isOk;
|
request.isOk = newRequest.isOk;
|
||||||
request.attenderFk = newRequest.attenderFk;
|
request.attenderFk = newRequest.attenderFk;
|
||||||
request.response = newRequest.response;
|
request.response = newRequest.response;
|
||||||
|
|
||||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
onDenyClose() {
|
|
||||||
this.denyObservation = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
showTicketDescriptor(event, ticketFk) {
|
|
||||||
this.$.ticketDescriptor.ticketFk = ticketFk;
|
|
||||||
this.$.ticketDescriptor.parent = event.target;
|
|
||||||
this.$.ticketDescriptor.show();
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopImmediatePropagation();
|
|
||||||
}
|
|
||||||
|
|
||||||
showItemDescriptor(event, itemFk) {
|
|
||||||
this.$.itemDescriptor.itemFk = itemFk;
|
|
||||||
this.$.itemDescriptor.parent = event.target;
|
|
||||||
this.$.itemDescriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
showWorkerDescriptor(event, workerFk) {
|
|
||||||
this.$.workerDescriptor.workerFk = workerFk;
|
|
||||||
this.$.workerDescriptor.parent = event.target;
|
|
||||||
this.$.workerDescriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
|
|
||||||
preventNavigation(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import './index.js';
|
import './index.js';
|
||||||
import crudModel from 'core/mocks/crud-model';
|
|
||||||
|
|
||||||
describe('Item', () => {
|
describe('Item', () => {
|
||||||
describe('Component vnItemRequest', () => {
|
describe('Component vnItemRequest', () => {
|
||||||
|
@ -12,10 +11,7 @@ describe('Item', () => {
|
||||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
$scope.model = crudModel;
|
controller = $componentController('vnItemRequest', {$element: null, $scope});
|
||||||
$scope.denyReason = {hide: () => {}};
|
|
||||||
const $element = angular.element('<vn-item-request></vn-item-request>');
|
|
||||||
controller = $componentController('vnItemRequest', {$element, $scope});
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
@ -49,23 +45,20 @@ describe('Item', () => {
|
||||||
|
|
||||||
controller.confirmRequest(request);
|
controller.confirmRequest(request);
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).not.toHaveBeenCalledWith();
|
expect(controller.vnApp.showSuccess).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should perform a query and call vnApp.showSuccess() and refresh if the conditions are met', () => {
|
it('should perform a query and call vnApp.showSuccess() and refresh if the conditions are met', () => {
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
let model = controller.$.model;
|
|
||||||
jest.spyOn(model, 'refresh');
|
|
||||||
|
|
||||||
const expectedResult = {concept: 'Melee Weapon'};
|
const expectedResult = {concept: 'Melee Weapon'};
|
||||||
let request = {itemFk: 1, saleQuantity: 1, id: 1};
|
let request = {itemFk: 1, saleQuantity: 1, id: 1};
|
||||||
|
|
||||||
$httpBackend.when('POST', `TicketRequests/${request.id}/confirm`).respond(expectedResult);
|
$httpBackend.expectPOST(`TicketRequests/${request.id}/confirm`).respond(expectedResult);
|
||||||
$httpBackend.expect('POST', `TicketRequests/${request.id}/confirm`).respond(expectedResult);
|
|
||||||
controller.confirmRequest(request);
|
controller.confirmRequest(request);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -83,19 +76,17 @@ describe('Item', () => {
|
||||||
let request = {saleFk: 1, saleQuantity: 1};
|
let request = {saleFk: 1, saleQuantity: 1};
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
||||||
$httpBackend.when('PATCH', `Sales/${request.saleFk}/`).respond();
|
$httpBackend.expectPATCH(`Sales/${request.saleFk}`).respond();
|
||||||
$httpBackend.expect('PATCH', `Sales/${request.saleFk}/`).respond();
|
|
||||||
controller.changeQuantity(request);
|
controller.changeQuantity(request);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('compareDate()', () => {
|
describe('compareDate()', () => {
|
||||||
it(`should return "success" if receives a future date`, () => {
|
it(`should return "success" if receives a future date`, () => {
|
||||||
let date = '3019-02-18T11:00:00.000Z';
|
let date = '3019-02-18T11:00:00.000Z';
|
||||||
|
|
||||||
let result = controller.compareDate(date);
|
let result = controller.compareDate(date);
|
||||||
|
|
||||||
expect(result).toEqual('success');
|
expect(result).toEqual('success');
|
||||||
|
@ -103,7 +94,6 @@ describe('Item', () => {
|
||||||
|
|
||||||
it(`should return "warning" if date is today`, () => {
|
it(`should return "warning" if date is today`, () => {
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
|
|
||||||
let result = controller.compareDate(date);
|
let result = controller.compareDate(date);
|
||||||
|
|
||||||
expect(result).toEqual('warning');
|
expect(result).toEqual('warning');
|
||||||
|
@ -117,9 +107,8 @@ describe('Item', () => {
|
||||||
response: 'new'
|
response: 'new'
|
||||||
};
|
};
|
||||||
|
|
||||||
const url = `TicketRequests/:id/deny`;
|
$httpBackend.expectPOST(`TicketRequests/${request.id}/deny`)
|
||||||
$httpBackend.expectRoute('POST', url).respond({response: 'denied'});
|
.respond({response: 'denied'});
|
||||||
|
|
||||||
controller.onDenyAccept(request);
|
controller.onDenyAccept(request);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
on-error-src/>
|
on-error-src/>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span ng-click="$ctrl.showDescriptor($event, row.itemFk)"
|
<span ng-click="descriptor.show($event, row.itemFk)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::row.itemFk | zeroFill:6}}
|
{{::row.itemFk | zeroFill:6}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -48,13 +48,6 @@ class Controller extends Section {
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, itemFk) {
|
|
||||||
let descriptor = this.$.descriptor;
|
|
||||||
descriptor.itemFk = itemFk;
|
|
||||||
descriptor.parent = event.target;
|
|
||||||
descriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
this.$http.post(`Orders/${this.$params.id}/confirm`).then(() => {
|
this.$http.post(`Orders/${this.$params.id}/confirm`).then(() => {
|
||||||
this.vnApp.showSuccess(this.$t('Order confirmed'));
|
this.vnApp.showSuccess(this.$t('Order confirmed'));
|
||||||
|
|
|
@ -6,7 +6,8 @@ describe('Order', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
|
|
||||||
let rows = [
|
const vat = 10.5;
|
||||||
|
const rows = [
|
||||||
{
|
{
|
||||||
quantity: 4,
|
quantity: 4,
|
||||||
price: 10.5
|
price: 10.5
|
||||||
|
@ -23,11 +24,10 @@ describe('Order', () => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
|
|
||||||
$state.params.id = 1;
|
$state.params.id = 1;
|
||||||
$httpBackend.whenRoute('GET', `OrderRows`).respond(rows);
|
$httpBackend.whenGET(`OrderRows`).respond(rows);
|
||||||
$httpBackend.whenRoute('GET', `Orders/:id/getVAT`).respond(200, 10.5);
|
$httpBackend.whenRoute('GET', `Orders/:id/getVAT`).respond(200, vat);
|
||||||
|
|
||||||
let $element = angular.element('<div></div>');
|
controller = $componentController('vnOrderLine', {$element: null});
|
||||||
controller = $componentController('vnOrderLine', {$element});
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('getRows()', () => {
|
describe('getRows()', () => {
|
||||||
|
@ -35,7 +35,7 @@ describe('Order', () => {
|
||||||
controller.getRows();
|
controller.getRows();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.rows).toBeDefined();
|
expect(controller.rows).toEqual(rows);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ describe('Order', () => {
|
||||||
controller.getVAT();
|
controller.getVAT();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.VAT).toBeDefined();
|
expect(controller.VAT).toBe(vat);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ describe('Order', () => {
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.rows.length).toBe(1);
|
expect(controller.rows.length).toBe(1);
|
||||||
expect(controller.card.reload).toHaveBeenCalledWith();
|
expect(controller.card.reload).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<span
|
<span
|
||||||
ng-click="$ctrl.showDescriptor($event, row.itemFk)"
|
ng-click="descriptor.show($event, row.itemFk)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::row.itemFk | zeroFill:6}}
|
{{::row.itemFk | zeroFill:6}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -4,10 +4,8 @@ import './style.scss';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
setSummary() {
|
setSummary() {
|
||||||
this.$http.get(`Orders/${this.order.id}/summary`).then(res => {
|
this.$http.get(`Orders/${this.order.id}/summary`)
|
||||||
if (res && res.data)
|
.then(res => this.summary = res.data);
|
||||||
this.summary = res.data;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get formattedAddress() {
|
get formattedAddress() {
|
||||||
|
@ -23,16 +21,6 @@ class Controller extends Section {
|
||||||
if (this.order && this.order.id)
|
if (this.order && this.order.id)
|
||||||
this.setSummary();
|
this.setSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, itemFk) {
|
|
||||||
this.$.descriptor.itemFk = itemFk;
|
|
||||||
this.$.descriptor.parent = event.target;
|
|
||||||
this.$.descriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnOrderSummary', {
|
ngModule.component('vnOrderSummary', {
|
||||||
|
|
|
@ -16,14 +16,15 @@ describe('Order', () => {
|
||||||
|
|
||||||
describe('getSummary()', () => {
|
describe('getSummary()', () => {
|
||||||
it('should now perform a GET query and define the summary property', () => {
|
it('should now perform a GET query and define the summary property', () => {
|
||||||
let res = {id: 1, nickname: 'Batman'};
|
let res = {
|
||||||
$httpBackend.when('GET', `Orders/1/summary`).respond(200, res);
|
id: 1,
|
||||||
$httpBackend.expect('GET', `Orders/1/summary`);
|
nickname: 'Batman'
|
||||||
|
};
|
||||||
|
$httpBackend.expectGET(`Orders/1/summary`).respond(res);
|
||||||
controller.setSummary();
|
controller.setSummary();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.summary).toBeDefined();
|
expect(controller.summary).toEqual(res);
|
||||||
expect(controller.summary.nickname).toEqual('Batman');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<vn-tr ng-repeat="row in rows">
|
<vn-tr ng-repeat="row in rows">
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-click="$ctrl.showDescriptor($event, row.itemFk)"
|
ng-click="descriptor.show($event, row.itemFk)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::row.itemFk}}
|
{{::row.itemFk}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -16,27 +16,15 @@ class Controller extends Section {
|
||||||
|
|
||||||
onDataChange() {
|
onDataChange() {
|
||||||
this.$http.get(`Orders/${this.$params.id}/getVolumes`)
|
this.$http.get(`Orders/${this.$params.id}/getVolumes`)
|
||||||
.then(response => {
|
.then(res => {
|
||||||
if (response.data) {
|
this.$.model.data.forEach(order => {
|
||||||
this.$.model.data.forEach(order => {
|
res.data.volumes.forEach(volume => {
|
||||||
response.data.volumes.forEach(volume => {
|
if (order.itemFk === volume.itemFk)
|
||||||
if (order.itemFk === volume.itemFk)
|
order.volume = volume.volume;
|
||||||
order.volume = volume.volume;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, itemFk) {
|
|
||||||
this.$.descriptor.itemFk = itemFk;
|
|
||||||
this.$.descriptor.parent = event.target;
|
|
||||||
this.$.descriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnOrderVolume', {
|
ngModule.component('vnOrderVolume', {
|
||||||
|
|
|
@ -4,58 +4,39 @@ describe('Order', () => {
|
||||||
describe('Component vnOrderVolume', () => {
|
describe('Component vnOrderVolume', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
let $state;
|
|
||||||
let $scope;
|
let $scope;
|
||||||
|
|
||||||
beforeEach(ngModule('order'));
|
beforeEach(ngModule('order'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => {
|
beforeEach(angular.mock.inject(($componentController, $state, _$httpBackend_, $rootScope) => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
$scope.model = {data: [{itemFk: 1}, {itemFk: 2}], accept: () => {
|
$scope.model = {
|
||||||
return {
|
data: [
|
||||||
then: () => {}
|
{itemFk: 1},
|
||||||
};
|
{itemFk: 2}
|
||||||
}};
|
]
|
||||||
$scope.descriptor = {show: () => {}};
|
};
|
||||||
$scope.popover = {relocate: () => {}};
|
|
||||||
$state = _$state_;
|
|
||||||
$state.params.id = 1;
|
$state.params.id = 1;
|
||||||
const $element = angular.element('<vn-order-volume></vn-order-volume>');
|
const $element = angular.element('<vn-order-volume></vn-order-volume>');
|
||||||
controller = $componentController('vnOrderVolume', {$element, $scope});
|
controller = $componentController('vnOrderVolume', {$element, $scope});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should join the sale volumes to its respective sale', () => {
|
it('should join the sale volumes to its respective sale', () => {
|
||||||
let response = {volumes: [{itemFk: 1, volume: 0.008}, {itemFk: 2, volume: 0.003}]};
|
let response = {
|
||||||
$httpBackend.whenGET(`Orders/1/getVolumes`).respond(response);
|
volumes: [
|
||||||
$httpBackend.expectGET(`Orders/1/getVolumes`);
|
{itemFk: 1, volume: 0.008},
|
||||||
|
{itemFk: 2, volume: 0.003}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
$httpBackend.expectGET(`Orders/1/getVolumes`).respond(response);
|
||||||
controller.onDataChange();
|
controller.onDataChange();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$.model.data[0].volume).toBe(0.008);
|
expect(controller.$.model.data[0].volume).toBe(0.008);
|
||||||
expect(controller.$.model.data[1].volume).toBe(0.003);
|
expect(controller.$.model.data[1].volume).toBe(0.003);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('showDescriptor()', () => {
|
|
||||||
it('should set $scope.descriptor.itemFk, $scope.descriptor.parent and call $scope.descriptor.show()', () => {
|
|
||||||
let event = {target: 1};
|
|
||||||
let itemFk = 1;
|
|
||||||
jest.spyOn(controller.$.descriptor, 'show');
|
|
||||||
controller.showDescriptor(event, itemFk);
|
|
||||||
|
|
||||||
expect(controller.$.descriptor.itemFk).toBe(1);
|
|
||||||
expect(controller.$.descriptor.parent).toBe(1);
|
|
||||||
expect(controller.$.descriptor.show).toHaveBeenCalledWith();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('onDescriptorLoad()', () => {
|
|
||||||
it('should call $scope.popover.relocate()', () => {
|
|
||||||
jest.spyOn(controller.$.popover, 'relocate');
|
|
||||||
controller.onDescriptorLoad();
|
|
||||||
|
|
||||||
expect(controller.$.popover.relocate).toHaveBeenCalledWith();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, route.workerFk)">
|
vn-click-stop="workerDescriptor.show($event, route.workerFk)">
|
||||||
{{::route.workerNickname}}
|
{{::route.workerNickname}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<vn-td>{{::route.description | dashIfEmpty}}</vn-td>
|
<vn-td>{{::route.description | dashIfEmpty}}</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
ng-click="$ctrl.preview($event, route)"
|
vn-click-stop="$ctrl.preview(route)"
|
||||||
vn-tooltip="Preview"
|
vn-tooltip="Preview"
|
||||||
icon="desktop_windows">
|
icon="desktop_windows">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
|
@ -61,4 +61,3 @@
|
||||||
fixed-bottom-right>
|
fixed-bottom-right>
|
||||||
<vn-float-button icon="add"></vn-float-button>
|
<vn-float-button icon="add"></vn-float-button>
|
||||||
</a>
|
</a>
|
||||||
<vn-scroll-up></vn-scroll-up>
|
|
|
@ -2,21 +2,7 @@ import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
export default class Controller extends Section {
|
export default class Controller extends Section {
|
||||||
showWorkerDescriptor(event, workerFk) {
|
preview(route) {
|
||||||
if (event.defaultPrevented) return;
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
this.selectedWorker = workerFk;
|
|
||||||
this.$.workerDescriptor.parent = event.target;
|
|
||||||
this.$.workerDescriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
preview(event, route) {
|
|
||||||
if (event.defaultPrevented) return;
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
this.routeSelected = route;
|
this.routeSelected = route;
|
||||||
this.$.summary.show();
|
this.$.summary.show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@ class Controller extends Section {
|
||||||
order: 'concept ASC',
|
order: 'concept ASC',
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'item',
|
relation: 'item',
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
relation: 'components',
|
relation: 'components',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['componentFk', 'value'],
|
fields: ['componentFk', 'value'],
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<span class="link"
|
<span class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, document.dms.workerFk)">
|
ng-click="workerDescriptor.show($event, document.dms.workerFk)">
|
||||||
{{::document.dms.worker.user.nickname | dashIfEmpty}}
|
{{::document.dms.worker.user.nickname | dashIfEmpty}}
|
||||||
</span></vn-td>
|
</span></vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<vn-icon-button icon="delete"
|
<vn-icon-button icon="delete"
|
||||||
ng-click="$ctrl.showDeleteConfirm($index)"
|
ng-click="confirm.show($index)"
|
||||||
title="{{'Remove file' | translate}}"
|
title="{{'Remove file' | translate}}"
|
||||||
tabindex="-1">
|
tabindex="-1">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
|
@ -106,5 +106,5 @@
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This file will be deleted"
|
message="This file will be deleted"
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
on-response="$ctrl.deleteDms($response)">
|
on-accept="$ctrl.deleteDms($data)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -42,28 +42,13 @@ class Controller extends Section {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
showWorkerDescriptor(event, workerFk) {
|
deleteDms(index) {
|
||||||
event.preventDefault();
|
const dmsFk = this.ticketDms[index].dmsFk;
|
||||||
event.stopImmediatePropagation();
|
this.$http.post(`ticketDms/${dmsFk}/removeFile`)
|
||||||
this.$.workerDescriptor.parent = event.target;
|
.then(() => {
|
||||||
this.$.workerDescriptor.workerFk = workerFk;
|
this.$.model.remove(index);
|
||||||
this.$.workerDescriptor.show();
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||||
}
|
|
||||||
|
|
||||||
showDeleteConfirm(index) {
|
|
||||||
this.dmsIndex = index;
|
|
||||||
this.$.confirm.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteDms(response) {
|
|
||||||
if (response === 'accept') {
|
|
||||||
const dmsFk = this.ticketDms[this.dmsIndex].dmsFk;
|
|
||||||
const query = `ticketDms/${dmsFk}/removeFile`;
|
|
||||||
this.$http.post(query).then(() => {
|
|
||||||
this.$.model.remove(this.dmsIndex);
|
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,27 +10,25 @@ describe('Ticket', () => {
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
const $element = angular.element('<vn-ticket-dms-index></vn-ticket-dms-index>');
|
controller = $componentController('vnTicketDmsIndex', {$element: null});
|
||||||
controller = $componentController('vnTicketDmsIndex', {$element});
|
|
||||||
controller.$.model = crudModel;
|
controller.$.model = crudModel;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('deleteDms()', () => {
|
describe('deleteDms()', () => {
|
||||||
it('should make an HTTP Post query', () => {
|
it('should make an HTTP Post query', () => {
|
||||||
const dmsId = 1;
|
|
||||||
const dmsIndex = 0;
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
jest.spyOn(controller.$.model, 'remove');
|
jest.spyOn(controller.$.model, 'remove');
|
||||||
controller.ticketDms = [{dmsFk: 1}];
|
|
||||||
controller.dmsIndex = dmsIndex;
|
|
||||||
|
|
||||||
$httpBackend.when('POST', `ticketDms/${dmsId}/removeFile`).respond({});
|
const dmsId = 1;
|
||||||
$httpBackend.expect('POST', `ticketDms/${dmsId}/removeFile`);
|
const dmsIndex = 0;
|
||||||
controller.deleteDms('accept');
|
controller.ticketDms = [{dmsFk: 1}];
|
||||||
|
|
||||||
|
$httpBackend.expectPOST(`ticketDms/${dmsId}/removeFile`).respond({});
|
||||||
|
controller.deleteDms(dmsIndex);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<vn-tr ng-repeat="expedition in expeditions">
|
<vn-tr ng-repeat="expedition in expeditions">
|
||||||
<vn-td class="vn-px-md" style="width:30px; color:#FFA410;">
|
<vn-td class="vn-px-md" style="width:30px; color:#FFA410;">
|
||||||
<vn-icon-button icon="delete"
|
<vn-icon-button icon="delete"
|
||||||
ng-click="$ctrl.deleteExpedition(expedition)"
|
ng-click="deleteExpedition.show(expedition.id)"
|
||||||
vn-tooltip="Delete expedition">
|
vn-tooltip="Delete expedition">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, expedition.workerFk)">
|
ng-click="workerDescriptor.show($event, expedition.workerFk)">
|
||||||
{{::expedition.userNickname | dashIfEmpty}}
|
{{::expedition.userNickname | dashIfEmpty}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -66,8 +66,8 @@
|
||||||
vn-id="workerDescriptor">
|
vn-id="workerDescriptor">
|
||||||
</vn-worker-descriptor-popover>
|
</vn-worker-descriptor-popover>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="delete-expedition"
|
vn-id="deleteExpedition"
|
||||||
on-response="$ctrl.returnDialog($response)"
|
on-accept="$ctrl.onDialogAccept($data)"
|
||||||
question="Delete expedition"
|
question="Delete expedition"
|
||||||
message="Are you sure you want to delete this expedition?">
|
message="Are you sure you want to delete this expedition?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -2,17 +2,9 @@ import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
deleteExpedition(expedition) {
|
onDialogAccept(id) {
|
||||||
this.expeditionId = expedition.id;
|
return this.$http.delete(`Expeditions/${id}`)
|
||||||
this.$.deleteExpedition.show();
|
.then(() => this.$.model.refresh());
|
||||||
}
|
|
||||||
|
|
||||||
returnDialog(response) {
|
|
||||||
if (response === 'accept') {
|
|
||||||
this.$http.delete(`Expeditions/${this.expeditionId}`).then(
|
|
||||||
() => this.$.model.refresh()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showItemDescriptor(event, itemFk) {
|
showItemDescriptor(event, itemFk) {
|
||||||
|
@ -32,18 +24,6 @@ class Controller extends Section {
|
||||||
this.$.itemDescriptor.parent = event.target;
|
this.$.itemDescriptor.parent = event.target;
|
||||||
this.$.itemDescriptor.show();
|
this.$.itemDescriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
showWorkerDescriptor(event, workerFk) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopImmediatePropagation();
|
|
||||||
this.selectedWorker = workerFk;
|
|
||||||
this.$.workerDescriptor.parent = event.target;
|
|
||||||
this.$.workerDescriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnTicketExpedition', {
|
ngModule.component('vnTicketExpedition', {
|
||||||
|
|
|
@ -14,20 +14,17 @@ describe('Ticket', () => {
|
||||||
$scope.model = {
|
$scope.model = {
|
||||||
refresh: () => {}
|
refresh: () => {}
|
||||||
};
|
};
|
||||||
const $element = angular.element('<vn-ticket-expedition></vn-ticket-expedition>');
|
controller = $componentController('vnTicketExpedition', {$element: null, $scope});
|
||||||
controller = $componentController('vnTicketExpedition', {$element, $scope});
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('returnDialog()', () => {
|
describe('onDialogAccept()', () => {
|
||||||
it('should perform a DELETE query', () => {
|
it('should perform a DELETE query', () => {
|
||||||
jest.spyOn($scope.model, 'refresh');
|
jest.spyOn($scope.model, 'refresh');
|
||||||
|
|
||||||
let response = 'accept';
|
const id = 1;
|
||||||
controller.expeditionId = 1;
|
|
||||||
|
|
||||||
$httpBackend.when('DELETE', `Expeditions/1`).respond(200);
|
$httpBackend.expectDELETE(`Expeditions/${id}`).respond(200);
|
||||||
$httpBackend.expect('DELETE', `Expeditions/1`);
|
controller.onDialogAccept(id);
|
||||||
controller.returnDialog(response);
|
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect($scope.model.refresh).toHaveBeenCalledWith();
|
expect($scope.model.refresh).toHaveBeenCalledWith();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<h3>
|
<h3>
|
||||||
<span class="link" ng-click="$ctrl.showDescriptor($event, sale.item.id)">
|
<span class="link" ng-click="descriptor.show($event, sale.item.id)">
|
||||||
{{::sale.item.name}}
|
{{::sale.item.name}}
|
||||||
</span>
|
</span>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
|
@ -13,16 +13,6 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
showDescriptor(event, itemFk) {
|
|
||||||
this.$.descriptor.itemFk = itemFk;
|
|
||||||
this.$.descriptor.parent = event.target;
|
|
||||||
this.$.descriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnTicketPicture', {
|
ngModule.component('vnTicketPicture', {
|
||||||
|
|
|
@ -43,14 +43,14 @@
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, request.requesterFk)">
|
ng-click="workerDescriptor.show($event, request.requesterFk)">
|
||||||
{{::request.requester.user.nickname | dashIfEmpty}}
|
{{::request.requester.user.nickname | dashIfEmpty}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, request.attenderFk)">
|
ng-click="workerDescriptor.show($event, request.attenderFk)">
|
||||||
{{::request.atender.user.nickname | dashIfEmpty}}
|
{{::request.atender.user.nickname | dashIfEmpty}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
|
@ -16,8 +16,7 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
relation: 'requester',
|
relation: 'requester',
|
||||||
scope: {
|
scope: {
|
||||||
include: {
|
include: {
|
||||||
|
@ -27,8 +26,7 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
relation: 'sale'
|
relation: 'sale'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -60,14 +58,6 @@ class Controller extends Section {
|
||||||
this.$.itemDescriptor.show();
|
this.$.itemDescriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
showWorkerDescriptor(event, workerFk) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopImmediatePropagation();
|
|
||||||
this.selectedWorker = workerFk;
|
|
||||||
this.$.workerDescriptor.parent = event.target;
|
|
||||||
this.$.workerDescriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
getRequestState(state) {
|
getRequestState(state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case null:
|
case null:
|
||||||
|
|
|
@ -6,9 +6,8 @@ describe('Ticket', () => {
|
||||||
|
|
||||||
beforeEach(ngModule('ticket'));
|
beforeEach(ngModule('ticket'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject($componentController => {
|
beforeEach(inject($componentController => {
|
||||||
const $element = angular.element('<vn-ticket-request-index></vn-ticket-request-index>');
|
controller = $componentController('vnTicketRequestIndex', {$element: null});
|
||||||
controller = $componentController('vnTicketRequestIndex', {$element});
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('getRequestState()', () => {
|
describe('getRequestState()', () => {
|
||||||
|
|
|
@ -33,10 +33,6 @@ class Controller extends Section {
|
||||||
this.$.descriptor.parent = event.target;
|
this.$.descriptor.parent = event.target;
|
||||||
this.$.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnTicketSaleChecked', {
|
ngModule.component('vnTicketSaleChecked', {
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, sale.workerFk)">
|
ng-click="workerDescriptor.show($event, sale.workerFk)">
|
||||||
{{::sale.userNickname | dashIfEmpty}}
|
{{::sale.userNickname | dashIfEmpty}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
|
@ -18,18 +18,6 @@ class Controller extends Section {
|
||||||
this.$.itemDescriptor.parent = event.target;
|
this.$.itemDescriptor.parent = event.target;
|
||||||
this.$.itemDescriptor.show();
|
this.$.itemDescriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
showWorkerDescriptor(event, workerFk) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopImmediatePropagation();
|
|
||||||
this.selectedWorker = workerFk;
|
|
||||||
this.$.workerDescriptor.parent = event.target;
|
|
||||||
this.$.workerDescriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnTicketSaleTracking', {
|
ngModule.component('vnTicketSaleTracking', {
|
||||||
|
|
|
@ -9,176 +9,175 @@
|
||||||
</vn-watcher>
|
</vn-watcher>
|
||||||
<vn-vertical class="vn-w-xl">
|
<vn-vertical class="vn-w-xl">
|
||||||
<vn-card class="vn-pa-lg">
|
<vn-card class="vn-pa-lg">
|
||||||
<vn-vertical>
|
<vn-horizontal class="header">
|
||||||
<vn-horizontal class="header">
|
<vn-tool-bar class="vn-mb-md">
|
||||||
<vn-tool-bar class="vn-mb-md">
|
<vn-button
|
||||||
<vn-button
|
disabled="!$ctrl.isEditable"
|
||||||
disabled="!$ctrl.isEditable"
|
label="Ok"
|
||||||
label="Ok"
|
vn-http-click="$ctrl.onStateOkClick()"
|
||||||
vn-http-click="$ctrl.onStateOkClick()"
|
vn-tooltip="Change ticket state to 'Ok'">
|
||||||
vn-tooltip="Change ticket state to 'Ok'">
|
</vn-button>
|
||||||
</vn-button>
|
<vn-button-menu
|
||||||
<vn-button-menu
|
disabled="!$ctrl.isEditable"
|
||||||
disabled="!$ctrl.isEditable"
|
label="State"
|
||||||
label="State"
|
value-field="id"
|
||||||
value-field="id"
|
url="States/editableStates"
|
||||||
url="States/editableStates"
|
on-change="$ctrl.onStateChange(value)">
|
||||||
on-change="$ctrl.onStateChange(value)">
|
</vn-button-menu>
|
||||||
</vn-button-menu>
|
<vn-button-menu
|
||||||
<vn-button-menu
|
ng-show="$ctrl.isChecked"
|
||||||
ng-show="$ctrl.isChecked"
|
vn-id="more-button"
|
||||||
vn-id="more-button"
|
label="More"
|
||||||
label="More"
|
show-filter="false"
|
||||||
show-filter="false"
|
value-field="callback"
|
||||||
value-field="callback"
|
translate-fields="['name']"
|
||||||
translate-fields="['name']"
|
on-change="$ctrl.onMoreChange(value)"
|
||||||
on-change="$ctrl.onMoreChange(value)"
|
on-open="$ctrl.onMoreOpen()">
|
||||||
on-open="$ctrl.onMoreOpen()">
|
</vn-button-menu>
|
||||||
</vn-button-menu>
|
<vn-button
|
||||||
<vn-button
|
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
|
||||||
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
|
ng-click="deleteLines.show()"
|
||||||
ng-click="$ctrl.showRemoveLinesDialog()"
|
vn-tooltip="Remove lines"
|
||||||
vn-tooltip="Remove lines"
|
icon="delete">
|
||||||
icon="delete">
|
</vn-button>
|
||||||
</vn-button>
|
<vn-button
|
||||||
<vn-button
|
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
|
||||||
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
|
ng-click="transfer.show()"
|
||||||
ng-click="$ctrl.showTransferPopover($event);"
|
vn-tooltip="Transfer lines"
|
||||||
vn-tooltip="Transfer lines"
|
icon="call_split">
|
||||||
icon="call_split">
|
</vn-button>
|
||||||
</vn-button>
|
</vn-tool-bar>
|
||||||
</vn-tool-bar>
|
<vn-one class="taxes" ng-if="$ctrl.sales.length > 0">
|
||||||
<vn-one class="taxes" ng-if="$ctrl.sales.length > 0">
|
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.subtotal | currency: 'EUR':2}}</p>
|
||||||
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.subtotal | currency: 'EUR':2}}</p>
|
<p><vn-label translate>VAT</vn-label> {{$ctrl.VAT | currency: 'EUR':2}}</p>
|
||||||
<p><vn-label translate>VAT</vn-label> {{$ctrl.VAT | currency: 'EUR':2}}</p>
|
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.total | currency: 'EUR':2}}</strong></p>
|
||||||
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.total | currency: 'EUR':2}}</strong></p>
|
</vn-one>
|
||||||
</vn-one>
|
</vn-horizontal>
|
||||||
</vn-horizontal>
|
<vn-table model="model">
|
||||||
<vn-table model="model">
|
<vn-thead>
|
||||||
<vn-thead>
|
<vn-tr>
|
||||||
<vn-tr>
|
<vn-th shrink>
|
||||||
<vn-th shrink>
|
<vn-multi-check
|
||||||
<vn-multi-check
|
model="model">
|
||||||
model="model">
|
</vn-multi-check>
|
||||||
</vn-multi-check>
|
</vn-th>
|
||||||
</vn-th>
|
<vn-th shrink></vn-th>
|
||||||
<vn-th shrink></vn-th>
|
<vn-th shrink></vn-th>
|
||||||
<vn-th shrink></vn-th>
|
<vn-th number>Id</vn-th>
|
||||||
<vn-th number>Id</vn-th>
|
<vn-th>Quantity</vn-th>
|
||||||
<vn-th>Quantity</vn-th>
|
<vn-th>Item</vn-th>
|
||||||
<vn-th>Item</vn-th>
|
<vn-th number>Price</vn-th>
|
||||||
<vn-th number>Price</vn-th>
|
<vn-th number>Disc</vn-th>
|
||||||
<vn-th number>Disc</vn-th>
|
<vn-th number>Amount</vn-th>
|
||||||
<vn-th number>Amount</vn-th>
|
|
||||||
</vn-tr>
|
|
||||||
</vn-thead>
|
|
||||||
<vn-tbody>
|
|
||||||
<vn-tr ng-repeat="sale in $ctrl.sales">
|
|
||||||
<vn-td shrink>
|
|
||||||
<vn-check
|
|
||||||
ng-model="sale.checked">
|
|
||||||
</vn-check>
|
|
||||||
</vn-td>
|
|
||||||
<vn-td shrink>
|
|
||||||
<a ui-sref="claim.card.basicData({id: sale.claim.claimFk})">
|
|
||||||
<vn-icon
|
|
||||||
ng-show="sale.claim.claimFk"
|
|
||||||
icon="icon-claims"
|
|
||||||
vn-tooltip="{{::$ctrl.$translate.instant('Claim')}}: {{::sale.claim.claimFk}}">
|
|
||||||
</vn-icon>
|
|
||||||
</a>
|
|
||||||
<vn-icon
|
|
||||||
ng-show="sale.visible < 0 || sale.available < 0"
|
|
||||||
color-main
|
|
||||||
icon="warning"
|
|
||||||
vn-tooltip="Visible: {{::sale.visible || 0}} <br> {{::$ctrl.$translate.instant('Available')}}: {{::sale.available || 0}}">
|
|
||||||
</vn-icon>
|
|
||||||
<vn-icon ng-show="sale.reserved"
|
|
||||||
icon="icon-reserve"
|
|
||||||
vn-tooltip="{{::$ctrl.$translate.instant('Reserved')}}">
|
|
||||||
</vn-icon>
|
|
||||||
</vn-td>
|
|
||||||
<vn-td shrink>
|
|
||||||
<img
|
|
||||||
ng-src="{{::$root.imagePath}}/50x50/{{sale.image}}"
|
|
||||||
zoom-image="{{::$root.imagePath}}/1600x900/{{sale.image}}"
|
|
||||||
on-error-src/>
|
|
||||||
</vn-td>
|
|
||||||
<vn-td vn-focus number>
|
|
||||||
<span class="link" ng-if="sale.id"
|
|
||||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
|
|
||||||
{{sale.itemFk}}
|
|
||||||
</span>
|
|
||||||
<vn-autocomplete
|
|
||||||
ng-if="!sale.id"
|
|
||||||
vn-focus
|
|
||||||
vn-one
|
|
||||||
url="Items"
|
|
||||||
ng-model="sale.itemFk"
|
|
||||||
show-field="name"
|
|
||||||
value-field="id"
|
|
||||||
search-function="$ctrl.itemSearchFunc($search)"
|
|
||||||
on-change="$ctrl.onChangeQuantity(sale)"
|
|
||||||
order="id DESC"
|
|
||||||
tabindex="1">
|
|
||||||
<tpl-item>
|
|
||||||
{{id}} - {{name}}
|
|
||||||
</tpl-item>
|
|
||||||
</vn-autocomplete>
|
|
||||||
</vn-td>
|
|
||||||
<vn-td-editable ng-if="sale.id" disabled="!$ctrl.isEditable" number>
|
|
||||||
<text>{{sale.quantity}}</text>
|
|
||||||
<field>
|
|
||||||
<vn-input-number class="dense"
|
|
||||||
vn-focus
|
|
||||||
ng-model="sale.quantity"
|
|
||||||
on-change="$ctrl.onChangeQuantity(sale)">
|
|
||||||
</vn-input-number>
|
|
||||||
</field>
|
|
||||||
</vn-td-editable>
|
|
||||||
<vn-td ng-if="!sale.id" number>
|
|
||||||
<vn-input-number
|
|
||||||
ng-model="sale.quantity"
|
|
||||||
on-change="$ctrl.onChangeQuantity(sale)"
|
|
||||||
tabindex="2">
|
|
||||||
</vn-input-number>
|
|
||||||
</vn-td>
|
|
||||||
<vn-td-editable disabled="!sale.id || !$ctrl.isEditable" expand>
|
|
||||||
<text>
|
|
||||||
<vn-fetched-tags
|
|
||||||
max-length="6"
|
|
||||||
item="sale.item"
|
|
||||||
name="sale.concept"
|
|
||||||
sub-name="sale.subName">
|
|
||||||
</vn-fetched-tags>
|
|
||||||
</text>
|
|
||||||
<field>
|
|
||||||
<vn-textfield class="dense"
|
|
||||||
vn-id="concept"
|
|
||||||
ng-model="sale.concept"
|
|
||||||
on-change="$ctrl.updateConcept(sale)">
|
|
||||||
</vn-textfield>
|
|
||||||
</field>
|
|
||||||
</vn-td-editable>
|
|
||||||
<vn-td number>
|
|
||||||
<span ng-class="{'link': $ctrl.isEditable}"
|
|
||||||
title="{{$ctrl.isEditable ? 'Edit price' : ''}}"
|
|
||||||
ng-click="$ctrl.showEditPricePopover($event, sale)">
|
|
||||||
{{sale.price | currency: 'EUR':2}}
|
|
||||||
</span>
|
|
||||||
</vn-td>
|
|
||||||
<vn-td number>
|
|
||||||
<span ng-class="{'link': !$ctrl.isLocked}"
|
|
||||||
title="{{!$ctrl.isLocked ? 'Edit discount' : ''}}"
|
|
||||||
ng-click="$ctrl.showEditDiscountPopover($event, sale)"
|
|
||||||
ng-if="sale.id">
|
|
||||||
{{(sale.discount / 100) | percentage}}
|
|
||||||
</span>
|
|
||||||
</vn-td>
|
|
||||||
<vn-td number>
|
|
||||||
{{$ctrl.getSaleTotal(sale) | currency: 'EUR':2}}
|
|
||||||
</vn-td>
|
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
|
</vn-thead>
|
||||||
|
<vn-tbody>
|
||||||
|
<vn-tr ng-repeat="sale in $ctrl.sales">
|
||||||
|
<vn-td shrink>
|
||||||
|
<vn-check
|
||||||
|
ng-model="sale.checked">
|
||||||
|
</vn-check>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td shrink>
|
||||||
|
<a ui-sref="claim.card.basicData({id: sale.claim.claimFk})">
|
||||||
|
<vn-icon
|
||||||
|
ng-show="sale.claim.claimFk"
|
||||||
|
icon="icon-claims"
|
||||||
|
vn-tooltip="{{::$ctrl.$translate.instant('Claim')}}: {{::sale.claim.claimFk}}">
|
||||||
|
</vn-icon>
|
||||||
|
</a>
|
||||||
|
<vn-icon
|
||||||
|
ng-show="sale.visible < 0 || sale.available < 0"
|
||||||
|
color-main
|
||||||
|
icon="warning"
|
||||||
|
vn-tooltip="Visible: {{::sale.visible || 0}} <br> {{::$ctrl.$translate.instant('Available')}}: {{::sale.available || 0}}">
|
||||||
|
</vn-icon>
|
||||||
|
<vn-icon ng-show="sale.reserved"
|
||||||
|
icon="icon-reserve"
|
||||||
|
vn-tooltip="{{::$ctrl.$translate.instant('Reserved')}}">
|
||||||
|
</vn-icon>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td shrink>
|
||||||
|
<img
|
||||||
|
ng-src="{{::$root.imagePath}}/50x50/{{sale.image}}"
|
||||||
|
zoom-image="{{::$root.imagePath}}/1600x900/{{sale.image}}"
|
||||||
|
on-error-src/>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td vn-focus number>
|
||||||
|
<span class="link" ng-if="sale.id"
|
||||||
|
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
|
||||||
|
{{sale.itemFk}}
|
||||||
|
</span>
|
||||||
|
<vn-autocomplete
|
||||||
|
ng-if="!sale.id"
|
||||||
|
vn-focus
|
||||||
|
vn-one
|
||||||
|
url="Items"
|
||||||
|
ng-model="sale.itemFk"
|
||||||
|
show-field="name"
|
||||||
|
value-field="id"
|
||||||
|
search-function="$ctrl.itemSearchFunc($search)"
|
||||||
|
on-change="$ctrl.onChangeQuantity(sale)"
|
||||||
|
order="id DESC"
|
||||||
|
tabindex="1">
|
||||||
|
<tpl-item>
|
||||||
|
{{id}} - {{name}}
|
||||||
|
</tpl-item>
|
||||||
|
</vn-autocomplete>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td-editable ng-if="sale.id" disabled="!$ctrl.isEditable" number>
|
||||||
|
<text>{{sale.quantity}}</text>
|
||||||
|
<field>
|
||||||
|
<vn-input-number class="dense"
|
||||||
|
vn-focus
|
||||||
|
ng-model="sale.quantity"
|
||||||
|
on-change="$ctrl.onChangeQuantity(sale)">
|
||||||
|
</vn-input-number>
|
||||||
|
</field>
|
||||||
|
</vn-td-editable>
|
||||||
|
<vn-td ng-if="!sale.id" number>
|
||||||
|
<vn-input-number
|
||||||
|
ng-model="sale.quantity"
|
||||||
|
on-change="$ctrl.onChangeQuantity(sale)"
|
||||||
|
tabindex="2">
|
||||||
|
</vn-input-number>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td-editable disabled="!sale.id || !$ctrl.isEditable" expand>
|
||||||
|
<text>
|
||||||
|
<vn-fetched-tags
|
||||||
|
max-length="6"
|
||||||
|
item="sale.item"
|
||||||
|
name="sale.concept"
|
||||||
|
sub-name="sale.subName">
|
||||||
|
</vn-fetched-tags>
|
||||||
|
</text>
|
||||||
|
<field>
|
||||||
|
<vn-textfield class="dense"
|
||||||
|
vn-id="concept"
|
||||||
|
ng-model="sale.concept"
|
||||||
|
on-change="$ctrl.updateConcept(sale)">
|
||||||
|
</vn-textfield>
|
||||||
|
</field>
|
||||||
|
</vn-td-editable>
|
||||||
|
<vn-td number>
|
||||||
|
<span ng-class="{'link': $ctrl.isEditable}"
|
||||||
|
title="{{$ctrl.isEditable ? 'Edit price' : ''}}"
|
||||||
|
ng-click="$ctrl.showEditPricePopover($event, sale)">
|
||||||
|
{{sale.price | currency: 'EUR':2}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td number>
|
||||||
|
<span ng-class="{'link': !$ctrl.isLocked}"
|
||||||
|
title="{{!$ctrl.isLocked ? 'Edit discount' : ''}}"
|
||||||
|
ng-click="$ctrl.showEditDiscountPopover($event, sale)"
|
||||||
|
ng-if="sale.id">
|
||||||
|
{{(sale.discount / 100) | percentage}}
|
||||||
|
</span>
|
||||||
|
</vn-td>
|
||||||
|
<vn-td number>
|
||||||
|
{{$ctrl.getSaleTotal(sale) | currency: 'EUR':2}}
|
||||||
|
</vn-td>
|
||||||
|
</vn-tr>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
</vn-table>
|
</vn-table>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
|
@ -200,7 +199,6 @@
|
||||||
vn-bind="+"
|
vn-bind="+"
|
||||||
fixed-bottom-right>
|
fixed-bottom-right>
|
||||||
</vn-float-button>
|
</vn-float-button>
|
||||||
|
|
||||||
<vn-item-descriptor-popover
|
<vn-item-descriptor-popover
|
||||||
vn-id="descriptor"
|
vn-id="descriptor"
|
||||||
quicklinks="$ctrl.quicklinks">
|
quicklinks="$ctrl.quicklinks">
|
||||||
|
|
|
@ -228,16 +228,6 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showRemoveLinesDialog() {
|
|
||||||
this.$.deleteLines.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
showTransferPopover(event) {
|
|
||||||
this.setTransferParams();
|
|
||||||
this.$.transfer.parent = event.target;
|
|
||||||
this.$.transfer.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
setTransferParams() {
|
setTransferParams() {
|
||||||
const checkedSales = JSON.stringify(this.checkedLines());
|
const checkedSales = JSON.stringify(this.checkedLines());
|
||||||
const sales = JSON.parse(checkedSales);
|
const sales = JSON.parse(checkedSales);
|
||||||
|
@ -312,10 +302,6 @@ class Controller extends Section {
|
||||||
this.$.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
|
|
||||||
showEditPricePopover(event, sale) {
|
showEditPricePopover(event, sale) {
|
||||||
if (!this.isEditable) return;
|
if (!this.isEditable) return;
|
||||||
this.sale = sale;
|
this.sale = sale;
|
||||||
|
|
|
@ -61,10 +61,6 @@ class Controller extends Section {
|
||||||
this.$.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
|
|
||||||
get isEditable() {
|
get isEditable() {
|
||||||
try {
|
try {
|
||||||
return !this.ticket.state.state.alertLevel;
|
return !this.ticket.state.state.alertLevel;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, tracking.worker.user.id)">
|
ng-click="workerDescriptor.show($event, tracking.worker.user.id)">
|
||||||
{{::tracking.worker.user.nickname | dashIfEmpty}}
|
{{::tracking.worker.user.nickname | dashIfEmpty}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
|
@ -17,8 +17,7 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
relation: 'state',
|
relation: 'state',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['name']
|
fields: ['name']
|
||||||
|
@ -27,14 +26,6 @@ class Controller extends Section {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
showWorkerDescriptor(event, workerFk) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopImmediatePropagation();
|
|
||||||
this.selectedWorker = workerFk;
|
|
||||||
this.$.workerDescriptor.parent = event.target;
|
|
||||||
this.$.workerDescriptor.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnTicketTrackingIndex', {
|
ngModule.component('vnTicketTrackingIndex', {
|
||||||
|
|
|
@ -60,10 +60,6 @@ class Controller extends Section {
|
||||||
this.$.descriptor.parent = event.target;
|
this.$.descriptor.parent = event.target;
|
||||||
this.$.descriptor.show();
|
this.$.descriptor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptorLoad() {
|
|
||||||
this.$.popover.relocate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnTicketVolume', {
|
ngModule.component('vnTicketVolume', {
|
||||||
|
|
|
@ -66,16 +66,21 @@ describe('ticket', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/* it('should join the sale volumes to its respective sale', () => {
|
/*
|
||||||
|
it('should join the sale volumes to its respective sale', () => {
|
||||||
controller.ticket = {id: 1};
|
controller.ticket = {id: 1};
|
||||||
let response = {volumes: [{saleFk: 1, m3: 0.008}, {saleFk: 2, m3: 0.003}]};
|
let response = {volumes: [
|
||||||
$httpBackend.whenGET(`tickets/1/getVolume`).respond(response);
|
{saleFk: 1, m3: 0.008},
|
||||||
$httpBackend.expectGET(`tickets/1/getVolume`);
|
{saleFk: 2, m3: 0.003}
|
||||||
|
]};
|
||||||
|
|
||||||
|
$httpBackend.expectGET(`tickets/1/getVolume`).respond(response);
|
||||||
controller.onDataChange();
|
controller.onDataChange();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect($scope.model.data[0].volume.m3).toBe(0.008);
|
expect($scope.model.data[0].volume.m3).toBe(0.008);
|
||||||
expect($scope.model.data[1].volume.m3).toBe(0.003);
|
expect($scope.model.data[1].volume.m3).toBe(0.003);
|
||||||
}); */
|
});
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</a>
|
</a>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<vn-icon-button ui-sref="worker.card.edit({dmsId: {{::document.dmsFk}}})"
|
<vn-icon-button ui-sref="worker.card.edit({dmsId: {{::document.dmsFk}}})"
|
||||||
icon="edit"
|
icon="edit"
|
||||||
title="{{'Edit file' | translate}}">
|
title="{{'Edit file' | translate}}">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="delete"
|
icon="delete"
|
||||||
ng-click="$ctrl.showDeleteConfirm($index)"
|
ng-click="confirm.show($index)"
|
||||||
title="{{'Remove file' | translate}}"
|
title="{{'Remove file' | translate}}"
|
||||||
tabindex="-1">
|
tabindex="-1">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
|
@ -74,10 +74,7 @@
|
||||||
</vn-table>
|
</vn-table>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</vn-data-viewer>
|
</vn-data-viewer>
|
||||||
<vn-worker-descriptor-popover
|
<a ui-sref="worker.card.dms.create"
|
||||||
vn-id="workerDescriptor">
|
|
||||||
</vn-worker-descriptor-popover>
|
|
||||||
<a ui-sref="worker.card.create"
|
|
||||||
vn-tooltip="Upload file"
|
vn-tooltip="Upload file"
|
||||||
vn-bind="+"
|
vn-bind="+"
|
||||||
fixed-bottom-right>
|
fixed-bottom-right>
|
||||||
|
@ -87,5 +84,5 @@
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This file will be deleted"
|
message="This file will be deleted"
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
on-response="$ctrl.deleteDms($response)">
|
on-accept="$ctrl.deleteDms($data)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
|
@ -19,51 +19,37 @@ class Controller extends Component {
|
||||||
'file',
|
'file',
|
||||||
'created',
|
'created',
|
||||||
],
|
],
|
||||||
include: [{
|
include: [
|
||||||
relation: 'dmsType',
|
{
|
||||||
scope: {
|
relation: 'dmsType',
|
||||||
fields: ['name']
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
relation: 'worker',
|
||||||
|
scope: {
|
||||||
|
fields: ['userFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'user',
|
||||||
|
scope: {
|
||||||
|
fields: ['nickname']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
]
|
||||||
{
|
|
||||||
relation: 'worker',
|
|
||||||
scope: {
|
|
||||||
fields: ['userFk'],
|
|
||||||
include: {
|
|
||||||
relation: 'user',
|
|
||||||
scope: {
|
|
||||||
fields: ['nickname']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
showWorkerDescriptor(event, workerFk) {
|
deleteDms(index) {
|
||||||
event.preventDefault();
|
const workerDmsId = this.workerDms[index].dmsFk;
|
||||||
event.stopImmediatePropagation();
|
return this.$http.post(`WorkerDms/${workerDmsId}/removeFile`)
|
||||||
this.$.workerDescriptor.parent = event.target;
|
.then(() => {
|
||||||
this.$.workerDescriptor.workerFk = workerFk;
|
this.$.model.remove(index);
|
||||||
this.$.workerDescriptor.show();
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||||
}
|
|
||||||
|
|
||||||
showDeleteConfirm(index) {
|
|
||||||
this.dmsIndex = index;
|
|
||||||
this.$.confirm.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteDms(response) {
|
|
||||||
if (response === 'accept') {
|
|
||||||
const workerDmsId = this.workerDms[this.dmsIndex].id;
|
|
||||||
const query = `WorkerDms/${workerDmsId}/removeFile`;
|
|
||||||
this.$http.post(query).then(() => {
|
|
||||||
this.$.model.remove(this.dmsIndex);
|
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,36 +4,33 @@ import crudModel from 'core/mocks/crud-model';
|
||||||
describe('Worker', () => {
|
describe('Worker', () => {
|
||||||
describe('Component vnWorkerDmsIndex', () => {
|
describe('Component vnWorkerDmsIndex', () => {
|
||||||
let $scope;
|
let $scope;
|
||||||
let $element;
|
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
let controller;
|
let controller;
|
||||||
|
|
||||||
beforeEach(ngModule('worker'));
|
beforeEach(ngModule('worker'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
$element = angular.element(`<vn-worker-dms-index></vn-worker-dms-index`);
|
controller = $componentController('vnWorkerDmsIndex', {$element: null, $scope});
|
||||||
controller = $componentController('vnWorkerDmsIndex', {$element, $scope});
|
|
||||||
controller.$.model = crudModel;
|
controller.$.model = crudModel;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('deleteDms()', () => {
|
describe('deleteDms()', () => {
|
||||||
it('should make an HTTP Post query', () => {
|
it('should make an HTTP Post query', () => {
|
||||||
const workerDmsId = 1;
|
|
||||||
const dmsIndex = 0;
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
jest.spyOn(controller.$.model, 'remove');
|
jest.spyOn(controller.$.model, 'remove');
|
||||||
controller.workerDms = [{id: 1, dmsFk: 4}];
|
|
||||||
controller.dmsIndex = dmsIndex;
|
|
||||||
|
|
||||||
$httpBackend.when('POST', `WorkerDms/${workerDmsId}/removeFile`).respond({});
|
const workerDmsId = 4;
|
||||||
$httpBackend.expect('POST', `WorkerDms/${workerDmsId}/removeFile`);
|
const dmsIndex = 0;
|
||||||
controller.deleteDms('accept');
|
controller.workerDms = [{id: 1, dmsFk: 4}];
|
||||||
|
|
||||||
|
$httpBackend.expectPOST(`WorkerDms/${workerDmsId}/removeFile`).respond();
|
||||||
|
controller.deleteDms(dmsIndex);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
expect(controller.$.model.remove).toHaveBeenCalledWith(dmsIndex);
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<span translate class="label">Changed by</span><span class="label">: </span>
|
<span translate class="label">Changed by</span><span class="label">: </span>
|
||||||
<span
|
<span
|
||||||
ng-class="{'link': log.user.worker.id, 'value': !log.user.worker.id}"
|
ng-class="{'link': log.user.worker.id, 'value': !log.user.worker.id}"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, log.user.worker.id)"
|
ng-click="workerDescriptor.show($event, log.user.id)"
|
||||||
translate>{{::log.user.name | dashIfEmpty}}
|
translate>{{::log.user.name | dashIfEmpty}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
<vn-td class="expendable">
|
<vn-td class="expendable">
|
||||||
<span
|
<span
|
||||||
ng-class="{'link': log.user.worker.id, 'value': !log.user.worker.id}"
|
ng-class="{'link': log.user.worker.id, 'value': !log.user.worker.id}"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, log.user.worker.id)"
|
ng-click="workerDescriptor.show($event, log.user.id)"
|
||||||
translate>{{::log.user.name | dashIfEmpty}}
|
translate>{{::log.user.name | dashIfEmpty}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
|
@ -42,18 +42,6 @@ export default class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showWorkerDescriptor(event, workerFk) {
|
|
||||||
if (event.defaultPrevented) return;
|
|
||||||
if (!workerFk) return;
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
this.selectedWorker = workerFk;
|
|
||||||
this.$.workerDescriptor.parent = event.target;
|
|
||||||
this.$.workerDescriptor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
getInstance(instance) {
|
getInstance(instance) {
|
||||||
const properties = [];
|
const properties = [];
|
||||||
let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/;
|
let validDate = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/;
|
||||||
|
|
Loading…
Reference in New Issue