fixes #5063 Añadir campo doPhoto en la ficha de Item #1264

Merged
joan merged 19 commits from 5063-item-module-doPhoto into dev 2023-03-02 06:34:46 +00:00
7 changed files with 42 additions and 2 deletions

View File

@ -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);

View File

@ -146,6 +146,12 @@
},
"isLaid": {
"type": "boolean"
},
"isPhotoRequested": {
"type": "boolean",
"mysql":{
"columnName": "doPhoto"
}
}
},
"relations": {

View File

@ -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>

View File

@ -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

View File

@ -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) {

View File

@ -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();
});
});
});

View File

@ -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">