Merge
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
commit
dbd70da866
|
@ -288,14 +288,17 @@ export default class Calendar extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderStyle(style) {
|
renderStyle(style) {
|
||||||
if (style) {
|
const normalizedStyle = {};
|
||||||
return {
|
|
||||||
'background-color': style.backgroundColor,
|
const properties = Object.keys(style);
|
||||||
'font-weight': style.fontWeight,
|
properties.forEach(attribute => {
|
||||||
'opacity': style.opacity,
|
const attrName = attribute.split(/(?=[A-Z])/).
|
||||||
'color': style.color
|
join('-').toLowerCase();
|
||||||
};
|
|
||||||
}
|
normalizedStyle[attrName] = style[attribute];
|
||||||
|
});
|
||||||
|
|
||||||
|
return normalizedStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasEvents() {
|
hasEvents() {
|
||||||
|
|
|
@ -68,5 +68,15 @@ describe('Component vnCalendar', () => {
|
||||||
expect(controller.emit).toHaveBeenCalledWith('selection', {values: days});
|
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');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
"url" : "/index",
|
"url" : "/index",
|
||||||
"state": "claim.card.dms.index",
|
"state": "claim.card.dms.index",
|
||||||
"component": "vn-claim-dms-index",
|
"component": "vn-claim-dms-index",
|
||||||
"description": "Pictures",
|
"description": "Photos",
|
||||||
"params": {
|
"params": {
|
||||||
"claim": "$ctrl.claim"
|
"claim": "$ctrl.claim"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
<vn-crud-model
|
||||||
|
url="/api/ClaimDms"
|
||||||
|
where="{claimFk: $ctrl.$stateParams.id}"
|
||||||
|
data="photos"
|
||||||
|
auto-load="true">
|
||||||
|
</vn-crud-model>
|
||||||
<vn-card class="summary">
|
<vn-card class="summary">
|
||||||
<h5>{{$ctrl.summary.claim.id}} - {{$ctrl.summary.claim.client.name}}</h5>
|
<h5>{{$ctrl.summary.claim.id}} - {{$ctrl.summary.claim.client.name}}</h5>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -73,6 +79,18 @@
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
</vn-table>
|
</vn-table>
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
|
<vn-auto ng-if="photos.length > 0">
|
||||||
|
<h4 translate>Photos</h4>
|
||||||
|
<vn-horizontal class="photo-list">
|
||||||
|
<section class="photo" ng-repeat="photo in photos">
|
||||||
|
<section class="image">
|
||||||
|
<img alt="" on-error-src
|
||||||
|
ng-src="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}"
|
||||||
|
zoom-image="/api/dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-auto>
|
||||||
<vn-auto>
|
<vn-auto>
|
||||||
<h4 translate>Development</h4>
|
<h4 translate>Development</h4>
|
||||||
<vn-table model="model">
|
<vn-table model="model">
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import './style.scss';
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
constructor($scope, $http) {
|
constructor($scope, $http, $stateParams, vnToken) {
|
||||||
this.$http = $http;
|
this.$http = $http;
|
||||||
this.$ = $scope;
|
this.$ = $scope;
|
||||||
|
this.$stateParams = $stateParams;
|
||||||
|
this.accessToken = vnToken.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSummary() {
|
getSummary() {
|
||||||
|
@ -36,7 +39,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$http'];
|
Controller.$inject = ['$scope', '$http', '$stateParams', 'vnToken'];
|
||||||
|
|
||||||
ngModule.component('vnClaimSummary', {
|
ngModule.component('vnClaimSummary', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -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%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,7 +26,10 @@ module.exports = Self => {
|
||||||
where: {ticketFk: id}
|
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 alertLevel = state ? state.alertLevel : null;
|
||||||
let ticket = await Self.app.models.Ticket.findById(id, {
|
let ticket = await Self.app.models.Ticket.findById(id, {
|
||||||
fields: ['isDeleted', 'clientFk', 'refFk'],
|
fields: ['isDeleted', 'clientFk', 'refFk'],
|
||||||
|
@ -42,10 +45,10 @@ module.exports = Self => {
|
||||||
|
|
||||||
const isDeleted = ticket && ticket.isDeleted;
|
const isDeleted = ticket && ticket.isDeleted;
|
||||||
const isOnDelivery = (alertLevel && alertLevel > 0);
|
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;
|
const isInvoiced = ticket && ticket.refFk;
|
||||||
|
|
||||||
if (!ticket || (isOnDelivery && isNotNormalClient && !isProductionBoss) || isInvoiced || isDeleted)
|
if (!ticket || isInvoiced || isDeleted || (isOnDelivery && isNormalClient && !isValidRole))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -29,15 +29,21 @@ describe('ticket isEditable()', () => {
|
||||||
expect(result).toEqual(true);
|
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 ctx = {req: {accessToken: {userId: 50}}};
|
||||||
let result = await app.models.Ticket.isEditable(ctx, 8);
|
let result = await app.models.Ticket.isEditable(ctx, 8);
|
||||||
|
|
||||||
expect(result).toEqual(true);
|
expect(result).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// #1719 claim.detail cambiar descuento falla con usuario nacho
|
it('should not be able to edit a deleted or invoiced ticket if the role is salesPerson', async() => {
|
||||||
xit('should not be able to edit a not deleted or invoiced ticket if the role is salesPerson', async() => {
|
|
||||||
let ctx = {req: {accessToken: {userId: 18}}};
|
let ctx = {req: {accessToken: {userId: 18}}};
|
||||||
let result = await app.models.Ticket.isEditable(ctx, 8);
|
let result = await app.models.Ticket.isEditable(ctx, 8);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ module.exports = Self => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['id', 'ticketFk', 'price'],
|
|
||||||
where: {
|
where: {
|
||||||
id: {inq: salesIds}
|
id: {inq: salesIds}
|
||||||
},
|
},
|
||||||
|
@ -102,8 +101,7 @@ module.exports = Self => {
|
||||||
value: value,
|
value: value,
|
||||||
componentFk: componentId}, options);
|
componentFk: componentId}, options);
|
||||||
|
|
||||||
const updatedSale = models.Sale.updateAll({id: sale.id},
|
const updatedSale = sale.updateAttribute('discount', newDiscount, options);
|
||||||
{discount: newDiscount}, options);
|
|
||||||
|
|
||||||
promises.push(newComponent, updatedSale);
|
promises.push(newComponent, updatedSale);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,5 +77,5 @@ Tracking: Estados
|
||||||
Sale checked: Control clientes
|
Sale checked: Control clientes
|
||||||
Components: Componentes
|
Components: Componentes
|
||||||
Sale tracking: Líneas preparadas
|
Sale tracking: Líneas preparadas
|
||||||
Pictures: Fotos
|
Photos: Fotos
|
||||||
Log: Historial
|
Log: Historial
|
Loading…
Reference in New Issue