diff --git a/client/core/src/core.js b/client/core/src/core.js
index 6bc5b8bdcf..2889a690ea 100644
--- a/client/core/src/core.js
+++ b/client/core/src/core.js
@@ -1,5 +1,6 @@
import './styles/mdl-override.css';
import './styles/mdi-override.css';
+import './styles/zoom-image.css';
export * from './module';
export * from './directives/index';
diff --git a/client/core/src/directives/index.js b/client/core/src/directives/index.js
index da672b330a..9a6531b1e8 100644
--- a/client/core/src/directives/index.js
+++ b/client/core/src/directives/index.js
@@ -4,3 +4,4 @@ import './dialog';
import './validation';
import './acl';
import './on-error-src';
+import './zoom-image';
diff --git a/client/core/src/directives/specs/zoom-image.spec.js b/client/core/src/directives/specs/zoom-image.spec.js
new file mode 100644
index 0000000000..1ee7bbd797
--- /dev/null
+++ b/client/core/src/directives/specs/zoom-image.spec.js
@@ -0,0 +1,71 @@
+describe('Directive zoomImage', () => {
+ let idContainer = 'zoomImage';
+ let compile;
+ let scope;
+ let srcDefault = 'http://default.img.jpg/';
+ let srcZoom = 'http://zoom.img.jpg/';
+ let findContainer;
+
+ beforeEach(() => {
+ angular.mock.module('client');
+ });
+
+ beforeEach(angular.mock.inject(($compile, $rootScope) => {
+ compile = $compile;
+ scope = $rootScope.$new();
+ }));
+
+ afterEach(() => {
+ findContainer = document.getElementById(idContainer);
+ if (findContainer) {
+ findContainer.parentNode.removeChild(findContainer);
+ findContainer = undefined;
+ }
+ });
+
+ function getCompiledImage(imgHtml) {
+ let element = angular.element(imgHtml);
+ var compiledElement = compile(element)(scope);
+ scope.$digest();
+ return compiledElement;
+ }
+
+ it('should create zoom container when click into image', () => {
+ let image = getCompiledImage(`
`);
+ image[0].click();
+ findContainer = document.getElementById(idContainer);
+
+ expect(findContainer).not.toBeNull();
+ });
+
+ it('should detroy zoom container when click outside zoomed image', () => {
+ let image = getCompiledImage(`
`);
+ image[0].click();
+ findContainer = document.getElementById(idContainer);
+
+ let findOutsideImage = findContainer.querySelector('.zoomImage-background');
+ findOutsideImage.click();
+
+ findContainer = document.getElementById(idContainer);
+
+ expect(findContainer).toBeNull();
+ });
+
+ it('should create new image, into zoom container, with src as original image src', () => {
+ let image = getCompiledImage(`
`);
+ image[0].click();
+ findContainer = document.getElementById(idContainer);
+ let findNewImage = findContainer.querySelector('img');
+
+ expect(findNewImage.src).toEqual(srcDefault);
+ });
+
+ it('should create new image, into zoom container, with src likes zoomImage value', () => {
+ let image = getCompiledImage(`
`);
+ image[0].click();
+ findContainer = document.getElementById(idContainer);
+ let findNewImage = findContainer.querySelector('img');
+
+ expect(findNewImage.src).toEqual(srcZoom);
+ });
+});
diff --git a/client/core/src/directives/zoom-image.js b/client/core/src/directives/zoom-image.js
new file mode 100644
index 0000000000..dc75eda403
--- /dev/null
+++ b/client/core/src/directives/zoom-image.js
@@ -0,0 +1,89 @@
+import ngModule from '../module';
+
+export function directive($timeout) {
+ let idContainer = 'zoomImage';
+ let container;
+ let background;
+ let image;
+
+ function createContainers(src) {
+ if (document.getElementById(idContainer)) {
+ destroyContainers();
+ }
+ container = document.createElement('div');
+ container.id = idContainer;
+
+ background = document.createElement('div');
+ background.className = 'zoomImage-background';
+ container.appendChild(background);
+
+ image = document.createElement('img');
+ image.src = src;
+ container.appendChild(image);
+
+ document.body.appendChild(container);
+
+ $timeout(() => {
+ resizeImage();
+ container.className = 'open';
+ }, 250);
+ }
+
+ function addListeners() {
+ background.addEventListener('click', destroyContainers);
+ document.addEventListener('keydown', e => keyDownHandler(e));
+ window.addEventListener('resize', resizeImage);
+ }
+
+ function removeListeners() {
+ if (container) {
+ background.removeEventListener('click', destroyContainers);
+ document.removeEventListener('keydown', e => keyDownHandler(e));
+ window.removeEventListener('resize', resizeImage);
+ }
+ }
+
+ function keyDownHandler(event) {
+ if (event.keyCode === 27) {
+ destroyContainers();
+ }
+ }
+
+ function destroyContainers() {
+ if (document.getElementById(idContainer)) {
+ removeListeners();
+ container.parentNode.removeChild(container);
+ }
+
+ container = undefined;
+ background = undefined;
+ image = undefined;
+ }
+
+ function resizeImage() {
+ if (image) {
+ image.style.marginLeft = `-${Math.floor(image.clientWidth / 2)}px`;
+ image.style.marginTop = `-${Math.floor(image.clientHeight / 2)}px`;
+ }
+ }
+
+ return {
+ restrict: 'A',
+ priority: 9999,
+ link: function($scope, $element, $attrs) {
+ $element.on('click', function(event) {
+ let src = $attrs.zoomImage || $attrs.src;
+ if (src) {
+ createContainers(src);
+ addListeners();
+ } else
+ throw new Error('No image source detected');
+
+ event.preventDefault();
+ });
+ }
+ };
+}
+directive.$inject = ['$timeout'];
+
+ngModule.directive('zoomImage', directive);
diff --git a/client/core/src/styles/zoom-image.css b/client/core/src/styles/zoom-image.css
new file mode 100644
index 0000000000..f21db8d13a
--- /dev/null
+++ b/client/core/src/styles/zoom-image.css
@@ -0,0 +1,40 @@
+img[zoom-image]{
+ cursor: zoom-in;
+}
+
+div#zoomImage, div#zoomImage .zoomImage-background {
+ width: 100%;
+ height: 100%;
+ position: fixed;
+ top: 0;
+ z-index: 11;
+}
+div#zoomImage{
+ opacity: 0;
+ transition: visibility 0s, opacity 0.5s linear;
+}
+
+div#zoomImage .zoomImage-background{
+ background: rgba(0, 0, 0, 0.7);
+ cursor: zoom-out;
+}
+div#zoomImage img{
+ z-index: 12;
+ position: fixed;
+ max-height: 98%;
+ max-width: 98%;
+ left: 50%;
+ top: 50%;
+ opacity: 0;
+ transition: visibility 0s, opacity 1s linear;
+}
+
+div#zoomImage.open {
+ visibility: visible;
+ opacity: 1;
+}
+
+div#zoomImage.open img{
+ visibility: visible;
+ opacity: 1;
+}
\ No newline at end of file
diff --git a/client/item/src/card/item-card.js b/client/item/src/card/item-card.js
index aeb921651e..903631d428 100644
--- a/client/item/src/card/item-card.js
+++ b/client/item/src/card/item-card.js
@@ -16,7 +16,6 @@ class ItemCard {
{relation: "producer"},
{relation: "intrastat"},
{relation: "expence"},
- {relation: "taxClass"},
{relation: "itemTag", scope: {order: "priority ASC", include: {relation: "tag"}}}
]
};
diff --git a/client/item/src/card/item-card.spec.js b/client/item/src/card/item-card.spec.js
index 5447d007e8..72e09a3060 100644
--- a/client/item/src/card/item-card.spec.js
+++ b/client/item/src/card/item-card.spec.js
@@ -21,8 +21,8 @@ describe('Item', () => {
describe('$onInit()', () => {
it('should request to patch the propagation of tax status', () => {
controller.client = {id: 123, isEqualizated: false};
- $httpBackend.whenGET('/item/api/Items/undefined?filter={"include":[{"relation":"itemType"},{"relation":"origin"},{"relation":"ink"},{"relation":"producer"},{"relation":"intrastat"},{"relation":"expence"},{"relation":"taxClass"},{"relation":"itemTag","scope":{"order":"priority ASC","include":{"relation":"tag"}}}]}').respond({data: 'item'});
- $httpBackend.expectGET('/item/api/Items/undefined?filter={"include":[{"relation":"itemType"},{"relation":"origin"},{"relation":"ink"},{"relation":"producer"},{"relation":"intrastat"},{"relation":"expence"},{"relation":"taxClass"},{"relation":"itemTag","scope":{"order":"priority ASC","include":{"relation":"tag"}}}]}');
+ $httpBackend.whenGET('/item/api/Items/undefined?filter={"include":[{"relation":"itemType"},{"relation":"origin"},{"relation":"ink"},{"relation":"producer"},{"relation":"intrastat"},{"relation":"expence"},{"relation":"itemTag","scope":{"order":"priority ASC","include":{"relation":"tag"}}}]}').respond({data: 'item'});
+ $httpBackend.expectGET('/item/api/Items/undefined?filter={"include":[{"relation":"itemType"},{"relation":"origin"},{"relation":"ink"},{"relation":"producer"},{"relation":"intrastat"},{"relation":"expence"},{"relation":"itemTag","scope":{"order":"priority ASC","include":{"relation":"tag"}}}]}');
controller.$onInit();
$httpBackend.flush();
diff --git a/client/item/src/create/item-create.html b/client/item/src/create/item-create.html
index d578067155..72fd7e15a7 100644
--- a/client/item/src/create/item-create.html
+++ b/client/item/src/create/item-create.html
@@ -12,6 +12,8 @@
New item
+
+
-
-
{{$parent.$parent.item.description}}
-
-
- {{$parent.$parent.item.description}}
-
-
diff --git a/client/item/src/descriptor/item-descriptor.html b/client/item/src/descriptor/item-descriptor.html
index 286e0c733f..3837e838a0 100644
--- a/client/item/src/descriptor/item-descriptor.html
+++ b/client/item/src/descriptor/item-descriptor.html
@@ -4,7 +4,9 @@
-
+
Id: {{$ctrl.item.id}}
diff --git a/client/item/src/filter-panel/filter-panel.html b/client/item/src/filter-panel/filter-panel.html
index 607e7e7cc2..2f09c471c7 100644
--- a/client/item/src/filter-panel/filter-panel.html
+++ b/client/item/src/filter-panel/filter-panel.html
@@ -4,53 +4,42 @@
-
-
+ field="$ctrl.filter.typeFk">
-
+ field="$ctrl.filter.inkFk">
-
+ field="$ctrl.filter.originFk">
-
+ field="$ctrl.filter.producerFk">
-
-
diff --git a/services/client/common/models/observation-type.json b/services/client/common/models/observation-type.json
index b1a45e883e..ac3b84092b 100644
--- a/services/client/common/models/observation-type.json
+++ b/services/client/common/models/observation-type.json
@@ -17,6 +17,14 @@
"type": "string",
"required": true
}
- }
+ },
+ "acls": [
+ {
+ "accessType": "READ",
+ "principalType": "ROLE",
+ "principalId": "$everyone",
+ "permission": "ALLOW"
+ }
+ ]
}
\ No newline at end of file
diff --git a/services/item/common/models/item.json b/services/item/common/models/item.json
index 6944a5eeab..5598f371da 100644
--- a/services/item/common/models/item.json
+++ b/services/item/common/models/item.json
@@ -75,11 +75,6 @@
"model": "Expence",
"foreignKey": "expenceFk"
},
- "taxClass": {
- "type": "belongsTo",
- "model": "TaxClass",
- "foreignKey": "taxClassFk"
- },
"itemTag": {
"type": "hasMany",
"model": "ItemTag",