diff --git a/front/core/components/calendar/index.js b/front/core/components/calendar/index.js
index 2cbbc0b51..049c6a12d 100644
--- a/front/core/components/calendar/index.js
+++ b/front/core/components/calendar/index.js
@@ -288,14 +288,17 @@ export default class Calendar extends Component {
}
renderStyle(style) {
- if (style) {
- return {
- 'background-color': style.backgroundColor,
- 'font-weight': style.fontWeight,
- 'opacity': style.opacity,
- 'color': style.color
- };
- }
+ const normalizedStyle = {};
+
+ const properties = Object.keys(style);
+ properties.forEach(attribute => {
+ const attrName = attribute.split(/(?=[A-Z])/).
+ join('-').toLowerCase();
+
+ normalizedStyle[attrName] = style[attribute];
+ });
+
+ return normalizedStyle;
}
hasEvents() {
diff --git a/front/core/components/calendar/index.spec.js b/front/core/components/calendar/index.spec.js
index dcb9ab5cf..174bc7997 100644
--- a/front/core/components/calendar/index.spec.js
+++ b/front/core/components/calendar/index.spec.js
@@ -68,5 +68,15 @@ describe('Component vnCalendar', () => {
expect(controller.emit).toHaveBeenCalledWith('selection', {values: days});
});
});
+
+ describe('renderStyle()', () => {
+ it(`should normalize CSS attributes`, () => {
+ const result = controller.renderStyle({
+ backgroundColor: 'red'
+ });
+
+ expect(result['background-color']).toEqual('red');
+ });
+ });
});
diff --git a/modules/claim/front/routes.json b/modules/claim/front/routes.json
index 885328dc4..892e21635 100644
--- a/modules/claim/front/routes.json
+++ b/modules/claim/front/routes.json
@@ -84,7 +84,7 @@
"url" : "/index",
"state": "claim.card.dms.index",
"component": "vn-claim-dms-index",
- "description": "Pictures",
+ "description": "Photos",
"params": {
"claim": "$ctrl.claim"
}
diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html
index 2d58364af..7877987d1 100644
--- a/modules/claim/front/summary/index.html
+++ b/modules/claim/front/summary/index.html
@@ -1,3 +1,9 @@
+
+
{{$ctrl.summary.claim.id}} - {{$ctrl.summary.claim.client.name}}
@@ -73,6 +79,18 @@
+
+ Photos
+
+
+
+
+
+
+
+
Development
diff --git a/modules/claim/front/summary/index.js b/modules/claim/front/summary/index.js
index 5741f2c06..257be55e0 100644
--- a/modules/claim/front/summary/index.js
+++ b/modules/claim/front/summary/index.js
@@ -1,9 +1,12 @@
import ngModule from '../module';
+import './style.scss';
class Controller {
- constructor($scope, $http) {
+ constructor($scope, $http, $stateParams, vnToken) {
this.$http = $http;
this.$ = $scope;
+ this.$stateParams = $stateParams;
+ this.accessToken = vnToken.token;
}
getSummary() {
@@ -36,7 +39,7 @@ class Controller {
}
}
-Controller.$inject = ['$scope', '$http'];
+Controller.$inject = ['$scope', '$http', '$stateParams', 'vnToken'];
ngModule.component('vnClaimSummary', {
template: require('./index.html'),
diff --git a/modules/claim/front/summary/style.scss b/modules/claim/front/summary/style.scss
new file mode 100644
index 000000000..778d91d0e
--- /dev/null
+++ b/modules/claim/front/summary/style.scss
@@ -0,0 +1,22 @@
+@import "./variables";
+
+.photo-list {
+ align-items: flex-start;
+ flex-wrap: wrap;
+
+ .photo {
+ box-sizing: border-box;
+ padding: $pad-small;
+ width: 33%;
+
+ .image {
+ border: 2px solid $color-main;
+ border-radius: 0.5em;
+ overflow: hidden;
+
+ img {
+ max-width: 100%
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/ticket/back/methods/ticket/isEditable.js b/modules/ticket/back/methods/ticket/isEditable.js
index 766933d45..3ebf15bf0 100644
--- a/modules/ticket/back/methods/ticket/isEditable.js
+++ b/modules/ticket/back/methods/ticket/isEditable.js
@@ -26,7 +26,10 @@ module.exports = Self => {
where: {ticketFk: id}
});
- let isProductionBoss = await Self.app.models.Account.hasRole(userId, 'productionBoss');
+ const isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant');
+ const isProductionBoss = await Self.app.models.Account.hasRole(userId, 'productionBoss');
+ const isValidRole = isSalesAssistant || isProductionBoss;
+
let alertLevel = state ? state.alertLevel : null;
let ticket = await Self.app.models.Ticket.findById(id, {
fields: ['isDeleted', 'clientFk', 'refFk'],
@@ -42,10 +45,10 @@ module.exports = Self => {
const isDeleted = ticket && ticket.isDeleted;
const isOnDelivery = (alertLevel && alertLevel > 0);
- const isNotNormalClient = ticket && ticket.client().type().code != 'normal';
+ const isNormalClient = ticket && ticket.client().type().code == 'normal';
const isInvoiced = ticket && ticket.refFk;
- if (!ticket || (isOnDelivery && isNotNormalClient && !isProductionBoss) || isInvoiced || isDeleted)
+ if (!ticket || isInvoiced || isDeleted || (isOnDelivery && isNormalClient && !isValidRole))
return false;
return true;
diff --git a/modules/ticket/back/methods/ticket/specs/isEditable.spec.js b/modules/ticket/back/methods/ticket/specs/isEditable.spec.js
index 3e55c5abd..a40128954 100644
--- a/modules/ticket/back/methods/ticket/specs/isEditable.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/isEditable.spec.js
@@ -29,15 +29,21 @@ describe('ticket isEditable()', () => {
expect(result).toEqual(true);
});
- it('should be able to edit a not deleted or invoiced ticket if the role is productionBoss', async() => {
+ it('should be able to edit a deleted or invoiced ticket if the role is salesAssistant', async() => {
+ let ctx = {req: {accessToken: {userId: 21}}};
+ let result = await app.models.Ticket.isEditable(ctx, 8);
+
+ expect(result).toEqual(true);
+ });
+
+ it('should be able to edit a deleted or invoiced ticket if the role is productionBoss', async() => {
let ctx = {req: {accessToken: {userId: 50}}};
let result = await app.models.Ticket.isEditable(ctx, 8);
expect(result).toEqual(true);
});
- // #1719 claim.detail cambiar descuento falla con usuario nacho
- xit('should not be able to edit a not deleted or invoiced ticket if the role is salesPerson', async() => {
+ it('should not be able to edit a deleted or invoiced ticket if the role is salesPerson', async() => {
let ctx = {req: {accessToken: {userId: 18}}};
let result = await app.models.Ticket.isEditable(ctx, 8);
diff --git a/modules/ticket/back/methods/ticket/updateDiscount.js b/modules/ticket/back/methods/ticket/updateDiscount.js
index e4a54d6ba..94ada046f 100644
--- a/modules/ticket/back/methods/ticket/updateDiscount.js
+++ b/modules/ticket/back/methods/ticket/updateDiscount.js
@@ -42,7 +42,6 @@ module.exports = Self => {
const options = {transaction: tx};
const filter = {
- fields: ['id', 'ticketFk', 'price'],
where: {
id: {inq: salesIds}
},
@@ -102,8 +101,7 @@ module.exports = Self => {
value: value,
componentFk: componentId}, options);
- const updatedSale = models.Sale.updateAll({id: sale.id},
- {discount: newDiscount}, options);
+ const updatedSale = sale.updateAttribute('discount', newDiscount, options);
promises.push(newComponent, updatedSale);
}
diff --git a/modules/ticket/front/locale/es.yml b/modules/ticket/front/locale/es.yml
index e796407d1..d90c7c707 100644
--- a/modules/ticket/front/locale/es.yml
+++ b/modules/ticket/front/locale/es.yml
@@ -77,5 +77,5 @@ Tracking: Estados
Sale checked: Control clientes
Components: Componentes
Sale tracking: LĂneas preparadas
-Pictures: Fotos
+Photos: Fotos
Log: Historial
\ No newline at end of file