Merge pull request 'fixes #5063 Añadir campo doPhoto en la ficha de Item' (!1264) from 5063-item-module-doPhoto into dev
gitea/salix/pipeline/head Something is wrong with the build of this commit
Details
gitea/salix/pipeline/head Something is wrong with the build of this commit
Details
Reviewed-on: #1264 Reviewed-by: Juan Ferrer <juan@verdnatura.es> Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
commit
ee6d292d6a
|
@ -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);
|
||||
|
||||
|
|
|
@ -146,6 +146,12 @@
|
|||
},
|
||||
"isLaid": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isPhotoRequested": {
|
||||
"type": "boolean",
|
||||
"mysql":{
|
||||
"columnName": "doPhoto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -182,6 +182,12 @@
|
|||
ng-model="$ctrl.item.isFragile"
|
||||
info="Is shown at website, app that this item cannot travel (wreath, palms, ...)">
|
||||
</vn-check>
|
||||
<vn-check
|
||||
vn-one
|
||||
label="Do photo"
|
||||
ng-model="$ctrl.item.isPhotoRequested"
|
||||
info="This item does need a photo">
|
||||
</vn-check>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
|
|
|
@ -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
|
||||
Generic: Genérico
|
||||
This item does need a photo: Este artículo necesita una foto
|
||||
Do photo: Hacer foto
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -75,6 +75,15 @@
|
|||
{{$ctrl.summary.item.itemType.worker.user.name}}
|
||||
</span>
|
||||
</vn-label-value>
|
||||
<vn-horizontal>
|
||||
<vn-check
|
||||
label="Do photo"
|
||||
disabled="true"
|
||||
vn-one
|
||||
ng-model="$ctrl.item.isPhotoRequested"
|
||||
info="This item does need a photo">
|
||||
</vn-check>
|
||||
</vn-horizontal>
|
||||
</vn-one>
|
||||
<vn-one name="otherData">
|
||||
<h4 ng-show="$ctrl.isBuyer">
|
||||
|
|
Loading…
Reference in New Issue