diff --git a/.gitignore b/.gitignore
index 168d1a5394..3e9fd51386 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@ node_modules
build
npm-debug.log
docker-compose.yml
-.eslintcache
\ No newline at end of file
+.eslintcache
+.env.json
\ No newline at end of file
diff --git a/client/claim/src/descriptor/index.html b/client/claim/src/descriptor/index.html
index 4bf70e5fea..5fc417e8a7 100644
--- a/client/claim/src/descriptor/index.html
+++ b/client/claim/src/descriptor/index.html
@@ -20,10 +20,10 @@
-
-
diff --git a/client/claim/src/detail/index.html b/client/claim/src/detail/index.html
new file mode 100644
index 0000000000..068765e2a4
--- /dev/null
+++ b/client/claim/src/detail/index.html
@@ -0,0 +1,108 @@
+
+
+
+
+
+ Detail
+
+
+
+ Id
+ Landed
+ Quantity
+ Claimed
+ Description
+ Price
+ Disc.
+ Total
+
+
+
+
+ {{saleClaimed.sale.id}}
+ {{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}
+ {{saleClaimed.sale.quantity}}
+
+
+
+
+ {{saleClaimed.sale.concept}}
+ {{saleClaimed.sale.price | currency:'€':2}}
+ {{saleClaimed.sale.discount}} %
+
+ {{(saleClaimed.sale.quantity * saleClaimed.sale.price) -
+ ((saleClaimed.sale.discount *
+ (saleClaimed.sale.quantity * saleClaimed.sale.price))/100) | currency:'€':2
+ }}
+
+
+
+
+
+
+
+
+ No results
+
+
+
+
+
+
+
+
+
+
+
+
+ Claimable sales from ticket
{{$ctrl.claim.ticketFk}}
+
+
+
+ Id
+ Landed
+ Quantity
+ Description
+ Price
+ Disc.
+ Total
+
+
+
+
+ {{sale.saleFk}}
+ {{sale.landed | dateTime: 'dd/MM/yyyy'}}
+ {{sale.quantity}}
+ {{sale.concept}}
+ {{sale.price | currency:'€':2}}
+ {{sale.discount}} %
+
+ {{(sale.quantity * sale.price) - ((sale.discount * (sale.quantity * sale.price))/100) | currency:'€':2}}
+
+
+
+
+ No results
+
+
+
+
\ No newline at end of file
diff --git a/client/claim/src/detail/index.js b/client/claim/src/detail/index.js
new file mode 100644
index 0000000000..ae353f903a
--- /dev/null
+++ b/client/claim/src/detail/index.js
@@ -0,0 +1,84 @@
+import ngModule from '../module';
+import './style.scss';
+
+class Controller {
+ constructor($state, $scope, $http, $translate, vnApp) {
+ this.$state = $state;
+ this.$ = $scope;
+ this.$http = $http;
+ this.$translate = $translate;
+ this.vnApp = vnApp;
+ this.filter = {
+ where: {claimFk: $state.params.id},
+ include: [
+ {relation: 'sale',
+ scope: {
+ fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount'],
+ include: {
+ relation: 'ticket'
+ }
+ }
+ }
+ ]
+ };
+ }
+
+ openAddSalesDialog() {
+ this.getClaimableFromTicket();
+ this.$.addSales.show();
+ }
+
+ getClaimableFromTicket() {
+ let json = encodeURIComponent(JSON.stringify(this.claim.ticketFk));
+
+ let query = `/api/Sales/getClaimableFromTicket?ticketFk=${json}`;
+ this.$http.get(query).then(res => {
+ if (res.data) {
+ this.salesToClaim = res.data;
+ }
+ });
+ }
+
+ addClaimedSale(saleFk) {
+ let saleToAdd = {saleFk: saleFk, claimFk: this.claim.id, quantity: 0};
+ let query = `claim/api/ClaimBeginnings/`;
+ this.$http.post(query, saleToAdd).then(() => {
+ this.$.model.refresh();
+ this.$.addSales.hide();
+ this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ });
+ }
+
+ deleteClaimedSale(id) {
+ let json = encodeURIComponent(JSON.stringify(id));
+ let query = `claim/api/ClaimBeginnings/${json}`;
+ this.$http.delete(query).then(() => {
+ this.$.model.refresh();
+ this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ });
+ }
+
+ focusLastInput() {
+ let inputs = document.querySelectorAll("#claimedQuantity");
+ inputs[inputs.length - 1].querySelector("input").select();
+ }
+
+ setClaimedQuantity(id, claimedQuantity) {
+ let params = {id: id, quantity: claimedQuantity};
+ let query = `claim/api/ClaimBeginnings/`;
+ this.$http.patch(query, params).then(() => {
+ this.$.model.refresh();
+ this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
+ });
+ }
+}
+
+Controller.$inject = ['$state', '$scope', '$http', '$translate', 'vnApp'];
+
+ngModule.component('vnClaimDetail', {
+ template: require('./index.html'),
+ controller: Controller,
+ bindings: {
+ claim: '<'
+ }
+});
diff --git a/client/claim/src/detail/index.spec.js b/client/claim/src/detail/index.spec.js
new file mode 100644
index 0000000000..d6769a022a
--- /dev/null
+++ b/client/claim/src/detail/index.spec.js
@@ -0,0 +1,94 @@
+import './index.js';
+
+describe('claim', () => {
+ describe('Component vnClaimDetail', () => {
+ let $componentController;
+ let controller;
+ let $httpBackend;
+ let $state;
+
+ beforeEach(() => {
+ angular.mock.module('claim');
+ });
+
+ beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_, $rootScope) => {
+ $componentController = _$componentController_;
+ $httpBackend = _$httpBackend_;
+ $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
+ $httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({});
+ $state = _$state_;
+ $state.params.id = 1;
+
+ controller = $componentController('vnClaimDetail', {$state: $state});
+ controller.claim = {ticketFk: 1};
+ controller.$.model = {refresh: () => {}};
+ controller.$.addSales = {
+ hide: () => {},
+ show: () => {}
+ };
+ }));
+
+ describe('openAddSalesDialog()', () => {
+ it('should call getClaimableFromTicket and $.addSales.show', () => {
+ controller.$ = {addSales: {show: () => {}}};
+ spyOn(controller, 'getClaimableFromTicket');
+ spyOn(controller.$.addSales, 'show');
+ controller.openAddSalesDialog();
+
+ expect(controller.getClaimableFromTicket).toHaveBeenCalledWith();
+ expect(controller.$.addSales.show).toHaveBeenCalledWith();
+ });
+ });
+
+ describe('getClaimableFromTicket()', () => {
+ it('should make a query and set salesToClaim', () => {
+ $httpBackend.expectGET(`/api/Sales/getClaimableFromTicket?ticketFk=1`).respond(200, 1);
+ controller.getClaimableFromTicket();
+ $httpBackend.flush();
+
+ expect(controller.salesToClaim).toEqual(1);
+ });
+ });
+
+ describe('addClaimedSale(saleFk)', () => {
+ it('should make a post and call refresh, hide and showSuccess', () => {
+ spyOn(controller.$.model, 'refresh');
+ spyOn(controller.$.addSales, 'hide');
+ spyOn(controller.vnApp, 'showSuccess');
+ $httpBackend.expectPOST(`claim/api/ClaimBeginnings/`).respond({});
+ controller.addClaimedSale(1);
+ $httpBackend.flush();
+
+ expect(controller.$.model.refresh).toHaveBeenCalledWith();
+ expect(controller.$.addSales.hide).toHaveBeenCalledWith();
+ expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
+ });
+ });
+
+ describe('deleteClaimedSale(id)', () => {
+ it('should make a delete and call refresh and showSuccess', () => {
+ spyOn(controller.$.model, 'refresh');
+ spyOn(controller.vnApp, 'showSuccess');
+ $httpBackend.expectDELETE(`claim/api/ClaimBeginnings/1`).respond({});
+ controller.deleteClaimedSale(1);
+ $httpBackend.flush();
+
+ expect(controller.$.model.refresh).toHaveBeenCalledWith();
+ expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
+ });
+ });
+
+ describe('setClaimedQuantity(id, claimedQuantity)', () => {
+ it('should make a patch and call refresh and showSuccess', () => {
+ spyOn(controller.$.model, 'refresh');
+ spyOn(controller.vnApp, 'showSuccess');
+ $httpBackend.expectPATCH(`claim/api/ClaimBeginnings/`).respond({});
+ controller.setClaimedQuantity(1, 1);
+ $httpBackend.flush();
+
+ expect(controller.$.model.refresh).toHaveBeenCalledWith();
+ expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
+ });
+ });
+ });
+});
diff --git a/client/claim/src/detail/locale/es.yml b/client/claim/src/detail/locale/es.yml
new file mode 100644
index 0000000000..bda82a4600
--- /dev/null
+++ b/client/claim/src/detail/locale/es.yml
@@ -0,0 +1,7 @@
+Claimed: Reclamados
+Disc.: Dto.
+Attended by: Atendida por
+Landed: Recibido
+Price: Precio
+Claimable sales from ticket: Lineas reclamables del ticket
+Detail: Detalles
\ No newline at end of file
diff --git a/client/claim/src/detail/style.scss b/client/claim/src/detail/style.scss
new file mode 100644
index 0000000000..cb66b31ab1
--- /dev/null
+++ b/client/claim/src/detail/style.scss
@@ -0,0 +1,20 @@
+vn-claim-detail {
+ vn-textfield {
+ margin: 0!important;
+ max-width: 100px;
+ }
+ vn-dialog[vn-id=addSales] {
+ tpl-body {
+ width: 950px;
+ div {
+ div.buttons {
+ display: none;
+ }
+ vn-table{
+ min-width: 950px;
+ }
+ }
+ }
+ }
+}
+
diff --git a/client/claim/src/index.js b/client/claim/src/index.js
index 54099a5ba2..e779cd5956 100644
--- a/client/claim/src/index.js
+++ b/client/claim/src/index.js
@@ -2,6 +2,7 @@ export * from './module';
import './index/';
import './card';
+import './detail';
import './descriptor';
import './basic-data';
// import './summary';
diff --git a/client/client/src/contact/index.html b/client/client/src/contact/index.html
index e4eff340ab..56c501690f 100644
--- a/client/client/src/contact/index.html
+++ b/client/client/src/contact/index.html
@@ -1,11 +1,10 @@
+ data="contacts">
-
-
+
+ ng-click="model.remove($index)">
-
+
this.$scope.model.save(true))
- .then(() => this.$scope.watcher.notifySaved());
+ this.$scope.model.save().then(() => {
+ this.$scope.watcher.notifySaved();
+ this.$scope.model.refresh();
+ });
}
}
-Controller.$inject = ['$http', '$scope', '$stateParams', '$translate', 'vnApp'];
+Controller.$inject = ['$scope', '$stateParams', '$translate'];
ngModule.component('vnClientContact', {
template: require('./index.html'),
diff --git a/client/client/src/contact/index.spec.js b/client/client/src/contact/index.spec.js
deleted file mode 100644
index c19e4e13af..0000000000
--- a/client/client/src/contact/index.spec.js
+++ /dev/null
@@ -1,80 +0,0 @@
-import './index.js';
-import {watcher} from '../helpers/watcherHelper.js';
-
-describe('Client', () => {
- describe('Component vnClientContact', () => {
- let $componentController;
- let $scope;
- let $state;
- let controller;
- let $httpBackend;
-
- beforeEach(() => {
- angular.mock.module('client');
- });
-
- beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$state_, _$httpBackend_) => {
- $componentController = _$componentController_;
- $state = _$state_;
- $httpBackend = _$httpBackend_;
- $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
- $scope = $rootScope.$new();
- $scope.form = {$invalid: false};
- $scope.model = {
- refresh: () => {},
- data: [
- {id: 1, name: 'My contact 1', phone: '123456789'},
- {id: 2, name: 'My contact 2', phone: '123456789'},
- {id: 3, name: 'My contact 3', phone: '123456789'}
- ]
- };
- $scope.watcher = watcher;
- controller = $componentController('vnClientContact', {$scope: $scope}, {$state: $state});
- controller.client = {
- id: 101
- };
- }));
-
- describe('onDataChange()', () => {
- it('should define contacts and oldInstances properties into controller', () => {
- controller.onDataChange();
-
- expect(controller.contacts).toBeDefined();
- expect(controller.contacts.length).toEqual(3);
- });
- });
-
- describe('add / remove tags', () => {
- it('should add one empty contact into controller contacts collection', () => {
- controller.contacts = [];
- controller.add();
-
- expect(controller.contacts.length).toEqual(1);
- expect(controller.contacts[0].id).toBe(undefined);
- });
-
- it('should remove a contact that occupies the position in the index', () => {
- let index = 2;
- controller.onDataChange();
- controller.remove(index);
-
- expect(controller.contacts.length).toEqual(2);
- expect(controller.contacts[index]).toBe(undefined);
- });
- });
-
- xdescribe('onSubmit()', () => {
- it("should perfom a query to delete contacts", () => {
- controller.$scope.model.data = [
- {id: 1, name: 'My contact 1', phone: '123456789'},
- {id: 2, name: 'My contact 2', phone: '123456789'}
- ];
- spyOn(controller.$scope.watcher, 'notifySaved');
-
- controller.onSubmit();
-
- expect(controller.$scope.watcher.notifySaved).toHaveBeenCalledWith();
- });
- });
- });
-});
diff --git a/client/client/src/helpers/watcherHelper.js b/client/client/src/helpers/watcherHelper.js
deleted file mode 100644
index f0a62af78d..0000000000
--- a/client/client/src/helpers/watcherHelper.js
+++ /dev/null
@@ -1,14 +0,0 @@
-module.exports.watcher = {
- realSubmit: () => {
- return {
- then: () => {}
- };
- },
- check: () => {},
- save: () => {
- return {
- then: () => {}
- };
- },
- notifySaved: () => {}
-};
diff --git a/client/core/src/components/dialog/dialog.js b/client/core/src/components/dialog/dialog.js
index c2e2085091..fb904f2f08 100644
--- a/client/core/src/components/dialog/dialog.js
+++ b/client/core/src/components/dialog/dialog.js
@@ -25,12 +25,15 @@ export default class Dialog extends Component {
}, null, 'buttons');
}
}
+
set body(value) {
this.element.querySelector('.body').appendChild(value);
}
+
set buttons(value) {
this.element.querySelector('.buttons').appendChild(value);
}
+
/**
* Displays the dialog to the user.
*/
@@ -48,6 +51,7 @@ export default class Dialog extends Component {
let firstFocusable = this.element.querySelector('input, textarea');
if (firstFocusable) firstFocusable.focus();
}
+
/**
* Hides the dialog calling the response handler.
*/
@@ -55,6 +59,7 @@ export default class Dialog extends Component {
this.fireResponse();
this.realHide();
}
+
/**
* Calls the response handler.
*
@@ -67,15 +72,16 @@ export default class Dialog extends Component {
cancel = this.onResponse({response: response});
return cancel;
}
+
realHide() {
if (!this.shown) return;
this.element.style.display = 'none';
this.document.removeEventListener('keydown', this.keyDownHandler);
this.lastEvent = null;
this.shown = false;
- this.transitionTimeout =
- setTimeout(() => this.$element.removeClass('shown'), 30);
+ this.transitionTimeout = setTimeout(() => this.$element.removeClass('shown'), 30);
}
+
onButtonClick(event) {
let buttons = this.element.querySelector('.buttons');
let tplButtons = buttons.querySelector('tpl-buttons');
@@ -89,17 +95,21 @@ export default class Dialog extends Component {
let cancel = this.fireResponse(response);
if (cancel !== false) this.realHide();
}
+
onDialogMouseDown(event) {
this.lastEvent = event;
}
+
onBackgroundMouseDown(event) {
if (event != this.lastEvent)
this.hide();
}
+
onkeyDown(event) {
if (event.keyCode == 27) // Esc
this.hide();
}
+
$onDestroy() {
clearTimeout(this.transitionTimeout);
}
diff --git a/client/core/src/components/dialog/dialog.spec.js b/client/core/src/components/dialog/dialog.spec.js
index 8cb1ad4a98..f6008d010c 100644
--- a/client/core/src/components/dialog/dialog.spec.js
+++ b/client/core/src/components/dialog/dialog.spec.js
@@ -10,44 +10,68 @@ describe('Component vnDialog', () => {
beforeEach(angular.mock.inject(_$componentController_ => {
$componentController = _$componentController_;
$element = angular.element('');
- controller = $componentController('vnDialog', {$element: $element, $transclude: null});
+ controller = $componentController('vnDialog', {$element, $transclude: null});
+ controller.onOpen = jasmine.createSpy('onOpen');
}));
describe('show()', () => {
- it(`should handle escape keypress event, define element.style.display to not none and call onOpen function`, () => {
- window.innerHeight = 600;
- window.innerWidth = 800;
- controller.dialog = {style: {display: 'none'}};
- controller.onOpen = () => {};
- spyOn(controller, 'onOpen');
+ it(`should do nothing if controller.shown is defined`, () => {
+ controller.element = {style: {display: 'none'}};
+ controller.shown = true;
controller.show();
- expect(controller.element.style.display).not.toEqual('none');
+ expect(controller.element.style.display).toEqual('none');
+ expect(controller.onOpen).not.toHaveBeenCalledWith();
+ });
+
+ it(`should set shown on the controller, set style.display on the element and call onOpen()`, () => {
+ controller.show();
+
+ expect(controller.element.style.display).toEqual('flex');
+ expect(controller.shown).toBeTruthy();
expect(controller.onOpen).toHaveBeenCalledWith();
});
});
describe('hide()', () => {
- it(`should call onResponse()`, () => {
- controller.onResponse = () => {};
- spyOn(controller, 'onResponse');
- controller.hide();
+ describe('fireResponse()', () => {
+ it(`should call onResponse() if it's defined in the controller`, () => {
+ controller.onResponse = () => {};
+ spyOn(controller, 'onResponse');
+ controller.hide();
- expect(controller.onResponse).toHaveBeenCalled();
+ expect(controller.onResponse).toHaveBeenCalledWith(jasmine.any(Object));
+ });
+
+ it(`should call onResponse() with a response`, () => {
+ let responseRes;
+ controller.onResponse = response => {
+ responseRes = response;
+ return false;
+ };
+ let responseRet = controller.fireResponse('answer');
+
+ expect(responseRes).toEqual({response: 'answer'});
+ expect(responseRet).toEqual(false);
+ });
});
- });
- describe('fireResponse()', () => {
- it(`should call onResponse()`, () => {
- let responseRes;
- controller.onResponse = response => {
- responseRes = response;
- return false;
- };
- let responseRet = controller.fireResponse('answer');
+ describe('realHide()', () => {
+ it(`should do nothing if controller.shown is not defined`, () => {
+ controller.element = {style: {display: 'not none'}};
+ controller.hide();
- expect(responseRes).toEqual({response: 'answer'});
- expect(responseRet).toEqual(false);
+ expect(controller.element.style.display).toEqual('not none');
+ });
+
+ it(`should set lastEvent, shown and element.style.display to their expected values`, () => {
+ controller.shown = true;
+ controller.hide();
+
+ expect(controller.lastEvent).toBeFalsy();
+ expect(controller.shown).toBeFalsy();
+ expect(controller.element.style.display).toEqual('none');
+ });
});
});
});
diff --git a/client/core/src/components/popover/popover.spec.js b/client/core/src/components/popover/popover.spec.js
index 3a60a57f2d..c35e4631bb 100644
--- a/client/core/src/components/popover/popover.spec.js
+++ b/client/core/src/components/popover/popover.spec.js
@@ -11,10 +11,9 @@ describe('Component vnPopover', () => {
angular.mock.module('client');
});
- beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$timeout_, _$document_) => {
+ beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_, _$timeout_) => {
$componentController = _$componentController_;
$timeout = _$timeout_;
- $timeout.cancel = () => {};
$element = angular.element(``);
$httpBackend = _$httpBackend_;
_$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
diff --git a/client/core/src/components/rest-model/crud-model.js b/client/core/src/components/rest-model/crud-model.js
index 1d71dfd611..55db63c899 100644
--- a/client/core/src/components/rest-model/crud-model.js
+++ b/client/core/src/components/rest-model/crud-model.js
@@ -132,7 +132,7 @@ export default class CrudModel extends ModelProxy {
let url = this.saveUrl ? this.saveUrl : `${this.url}/crud`;
return this.$http.post(url, changes)
- .then(() => this.resetChanges);
+ .then(() => this.resetChanges());
}
}
CrudModel.$inject = ['$http', '$q'];
diff --git a/client/core/src/components/textfield/textfield.html b/client/core/src/components/textfield/textfield.html
index 4f238c525a..3c77c2ab84 100644
--- a/client/core/src/components/textfield/textfield.html
+++ b/client/core/src/components/textfield/textfield.html
@@ -23,7 +23,6 @@
translate-attr="{title: 'Clear'}"
ng-show="!$ctrl.disabled
&& $ctrl.hasValue
- && ($ctrl.hasFocus)
&& !$ctrl.unclearable"
ng-click="$ctrl.clear()">
clear
diff --git a/client/core/src/components/watcher/watcher.js b/client/core/src/components/watcher/watcher.js
index f890a1977c..5d2f4b0961 100644
--- a/client/core/src/components/watcher/watcher.js
+++ b/client/core/src/components/watcher/watcher.js
@@ -180,17 +180,6 @@ export default class Watcher extends Component {
this.vnApp.showSuccess(this._.instant('Data saved!'));
}
- writeData(json, resolve) {
- Object.assign(this.data, json.data);
- this.updateOriginalData();
- resolve(json);
- }
-
- updateOriginalData() {
- this.orgData = this.copyInNewObject(this.data);
- this.setPristine();
- }
-
setPristine() {
if (this.form) this.form.$setPristine();
}
@@ -199,24 +188,6 @@ export default class Watcher extends Component {
if (this.form) this.form.$setDirty();
}
- copyInNewObject(data) {
- let newCopy = {};
- if (data && typeof data === 'object') {
- Object.keys(data).forEach(
- val => {
- if (!isFullEmpty(data[val])) {
- if (typeof data[val] === 'object') {
- newCopy[val] = this.copyInNewObject(data[val]);
- } else {
- newCopy[val] = data[val];
- }
- }
- }
- );
- }
- return newCopy;
- }
-
callback(transition) {
if (!this.state && this.dirty) {
this.state = transition.to().name;
@@ -236,6 +207,35 @@ export default class Watcher extends Component {
this.state = null;
}
}
+
+ writeData(json, resolve) {
+ Object.assign(this.data, json.data);
+ this.updateOriginalData();
+ resolve(json);
+ }
+
+ updateOriginalData() {
+ this.orgData = this.copyInNewObject(this.data);
+ this.setPristine();
+ }
+
+ copyInNewObject(data) {
+ let newCopy = {};
+ if (data && typeof data === 'object') {
+ Object.keys(data).forEach(
+ val => {
+ if (!isFullEmpty(data[val])) {
+ if (typeof data[val] === 'object') {
+ newCopy[val] = this.copyInNewObject(data[val]);
+ } else {
+ newCopy[val] = data[val];
+ }
+ }
+ }
+ );
+ }
+ return newCopy;
+ }
}
Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnApp', '$translate', '$attrs', '$q'];
diff --git a/client/core/src/directives/index.js b/client/core/src/directives/index.js
index 07ce5dfe23..a97c88b3c8 100644
--- a/client/core/src/directives/index.js
+++ b/client/core/src/directives/index.js
@@ -9,4 +9,4 @@ import './zoom-image';
import './visible-by';
import './bind';
import './repeat-last';
-import './title';
\ No newline at end of file
+import './title';
diff --git a/client/core/src/lib/module-loader.js b/client/core/src/lib/module-loader.js
index 57cca1753a..4ffada30c8 100644
--- a/client/core/src/lib/module-loader.js
+++ b/client/core/src/lib/module-loader.js
@@ -1,8 +1,8 @@
import ngModule from '../module';
import splitingRegister from './spliting-register';
-factory.$inject = ['$http', '$window', '$ocLazyLoad', '$translatePartialLoader', '$translate'];
-export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $translate) {
+factory.$inject = ['$http', '$window', '$ocLazyLoad', '$translatePartialLoader', '$translate', '$q'];
+export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $translate, $q) {
class ModuleLoader {
constructor() {
this._loaded = {};
@@ -15,7 +15,7 @@ export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $t
if (loaded[moduleName] instanceof Promise)
return loaded[moduleName];
if (loaded[moduleName] === false)
- return Promise.reject(
+ return $q.reject(
new Error(`Module dependency loop detected: ${moduleName}`));
loaded[moduleName] = false;
diff --git a/client/helpers/crudModelHelper.js b/client/helpers/crudModelHelper.js
new file mode 100644
index 0000000000..53fe8320c8
--- /dev/null
+++ b/client/helpers/crudModelHelper.js
@@ -0,0 +1,19 @@
+module.exports.crudModel = {
+ data: [],
+ insert: () => {
+ return new Promise(accept => {
+ accept();
+ });
+ },
+ remove: () => {
+ return new Promise(accept => {
+ accept();
+ });
+ },
+ save: () => {
+ return new Promise(accept => {
+ accept();
+ });
+ },
+ refresh: () => {}
+};
diff --git a/client/helpers/watcherHelper.js b/client/helpers/watcherHelper.js
new file mode 100644
index 0000000000..92c4084b41
--- /dev/null
+++ b/client/helpers/watcherHelper.js
@@ -0,0 +1,11 @@
+module.exports.watcher = {
+ realSubmit: () => {
+ return new Promise(accept => {
+ accept();
+ });
+ },
+ check: () => {},
+ notifySaved: () => {},
+ setDirty: () => {},
+ setPristine: () => {}
+};
diff --git a/client/item/src/barcode/index.html b/client/item/src/barcode/index.html
index 95a059a0ef..4bffdd0ff2 100644
--- a/client/item/src/barcode/index.html
+++ b/client/item/src/barcode/index.html
@@ -1,11 +1,19 @@
+
+
-
+
diff --git a/client/item/src/diary/index.js b/client/item/src/diary/index.js
index 15a012291c..675b35c5fa 100644
--- a/client/item/src/diary/index.js
+++ b/client/item/src/diary/index.js
@@ -110,6 +110,20 @@ class Controller {
if (!(today - comparedDate))
return true;
}
+
+ showDescriptor(event, sale) {
+ if (!sale.isTicket) return;
+
+ this.$scope.descriptor.ticketFk = sale.origin;
+ this.$scope.descriptor.parent = event.target;
+ this.$scope.descriptor.show();
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ }
+
+ onDescriptorLoad() {
+ this.$scope.popover.relocate();
+ }
}
Controller.$inject = ['$scope', '$http', '$state', '$window'];
diff --git a/client/item/src/item.js b/client/item/src/item.js
index 7b364c3a5a..e04eef06fb 100644
--- a/client/item/src/item.js
+++ b/client/item/src/item.js
@@ -7,6 +7,9 @@ import './diary';
import './create';
import './card';
import './descriptor';
+import './descriptor-popover';
+import './ticket-descriptor';
+import './ticket-descriptor-popover';
import './data';
import './tags';
import './tax';
@@ -16,4 +19,4 @@ import './niche';
import './botanical';
import './barcode';
import './summary';
-import './descriptor-popover';
+
diff --git a/client/item/src/niche/index.html b/client/item/src/niche/index.html
index db573091a0..5cba83f514 100644
--- a/client/item/src/niche/index.html
+++ b/client/item/src/niche/index.html
@@ -1,48 +1,46 @@
+
+
-