diff --git a/modules/item/back/methods/item/new.js b/modules/item/back/methods/item/new.js
index 0057cb50f..d066f2c9f 100644
--- a/modules/item/back/methods/item/new.js
+++ b/modules/item/back/methods/item/new.js
@@ -57,6 +57,7 @@ module.exports = Self => {
const itemType = await models.ItemType.findById(params.typeFk, {fields: ['isLaid']}, myOptions);
params.isLaid = itemType.isLaid;
+ params.isPhotoRequested = true;
const item = await models.Item.create(params, myOptions);
diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json
index 2f58c30a9..10300f7a1 100644
--- a/modules/item/back/models/item.json
+++ b/modules/item/back/models/item.json
@@ -146,6 +146,12 @@
},
"isLaid": {
"type": "boolean"
+ },
+ "isPhotoRequested": {
+ "type": "boolean",
+ "mysql":{
+ "columnName": "doPhoto"
+ }
}
},
"relations": {
diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html
index fd21ab240..974aa37d8 100644
--- a/modules/item/front/basic-data/index.html
+++ b/modules/item/front/basic-data/index.html
@@ -182,6 +182,12 @@
ng-model="$ctrl.item.isFragile"
info="Is shown at website, app that this item cannot travel (wreath, palms, ...)">
+
+
diff --git a/modules/item/front/basic-data/locale/es.yml b/modules/item/front/basic-data/locale/es.yml
index d59752ebb..747dfe792 100644
--- a/modules/item/front/basic-data/locale/es.yml
+++ b/modules/item/front/basic-data/locale/es.yml
@@ -11,4 +11,6 @@ Identifier: Identificador
Fragile: Frágil
Is shown at website, app that this item cannot travel (wreath, palms, ...): Se muestra en la web, app que este artículo no puede viajar (coronas, palmas, ...)
Multiplier: Multiplicador
-Generic: Genérico
\ No newline at end of file
+Generic: Genérico
+This item does need a photo: Este artículo necesita una foto
+Do photo: Hacer foto
\ No newline at end of file
diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js
index 972c89ae0..5f38d08dd 100644
--- a/modules/item/front/descriptor/index.js
+++ b/modules/item/front/descriptor/index.js
@@ -91,6 +91,9 @@ class Controller extends Descriptor {
this.$.photo.setAttribute('src', newSrc);
this.$.photo.setAttribute('zoom-image', newZoomSrc);
+
+ if (this.item.isPhotoRequested)
+ this.$http.patch(`Items/${this.item.id}`, {isPhotoRequested: false});
}
getWarehouseName(warehouseFk) {
diff --git a/modules/item/front/descriptor/index.spec.js b/modules/item/front/descriptor/index.spec.js
index 23053432e..dc2a5acf7 100644
--- a/modules/item/front/descriptor/index.spec.js
+++ b/modules/item/front/descriptor/index.spec.js
@@ -8,7 +8,8 @@ describe('vnItemDescriptor', () => {
id: 1,
itemType: {
warehouseFk: 1
- }
+ },
+ isPhotoRequested: true
};
const stock = {
visible: 1,
@@ -43,4 +44,16 @@ describe('vnItemDescriptor', () => {
expect(controller.item).toEqual(item);
});
});
+
+ describe('onUploadResponse()', () => {
+ it(`should change isPhotoRequested when a new photo is uploaded`, () => {
+ controller.item = item;
+ controller.$rootScope = {imagePath: () => {}};
+ controller.$.photo = {setAttribute: () => {}};
+
+ $httpBackend.expectPATCH(`Items/${item.id}`).respond(200);
+ controller.onUploadResponse();
+ $httpBackend.flush();
+ });
+ });
});
diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html
index 40e9c5aa7..46a2baef4 100644
--- a/modules/item/front/summary/index.html
+++ b/modules/item/front/summary/index.html
@@ -75,6 +75,15 @@
{{$ctrl.summary.item.itemType.worker.user.name}}
+
+
+
+