Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1972-buyer_week_waste
This commit is contained in:
commit
a702d14fa9
|
@ -34,5 +34,5 @@ COPY \
|
|||
|
||||
CMD ["pm2-runtime", "./back/process.yml"]
|
||||
|
||||
HEALTHCHECK --interval=1m --timeout=10s \
|
||||
HEALTHCHECK --interval=15s --timeout=10s \
|
||||
CMD curl -f http://localhost:3000/api/Applications/status || exit 1
|
||||
|
|
|
@ -6,20 +6,13 @@ pipeline {
|
|||
disableConcurrentBuilds()
|
||||
}
|
||||
environment {
|
||||
PROJECT_NAME = 'salix'
|
||||
REGISTRY = 'registry.verdnatura.es'
|
||||
PORT_MASTER_FRONT = '5002'
|
||||
PORT_MASTER_BACK = '3001'
|
||||
PORT_TEST_FRONT = '5001'
|
||||
PORT_TEST_BACK = '4001'
|
||||
TAG = "${env.BRANCH_NAME}"
|
||||
PROJECT_NAME = 'salix'
|
||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
script {
|
||||
env.STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
|
||||
if (!env.GIT_COMMITTER_EMAIL) {
|
||||
env.COMMITTER_EMAIL = sh(
|
||||
script: 'git --no-pager show -s --format="%ae"',
|
||||
|
@ -29,16 +22,6 @@ pipeline {
|
|||
env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL;
|
||||
}
|
||||
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'master':
|
||||
env.PORT_FRONT = PORT_MASTER_FRONT
|
||||
env.PORT_BACK = PORT_MASTER_BACK
|
||||
break
|
||||
case 'test':
|
||||
env.PORT_FRONT = PORT_TEST_FRONT
|
||||
env.PORT_BACK = PORT_TEST_BACK
|
||||
break
|
||||
}
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'master':
|
||||
env.NODE_ENV = 'production'
|
||||
|
@ -48,6 +31,14 @@ pipeline {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
configFileProvider([
|
||||
configFile(fileId: "salix.groovy",
|
||||
variable: 'GROOVY_FILE')
|
||||
]) {
|
||||
load env.GROOVY_FILE
|
||||
}
|
||||
|
||||
sh 'printenv'
|
||||
}
|
||||
}
|
||||
|
@ -57,8 +48,8 @@ pipeline {
|
|||
}
|
||||
steps {
|
||||
nodejs('node-lts') {
|
||||
sh 'npm install --no-audit'
|
||||
sh 'gulp install'
|
||||
sh 'npm install --no-audit --prefer-offline'
|
||||
sh 'gulp install --ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,4 +2,5 @@ apps:
|
|||
- script: ./loopback/server/server.js
|
||||
name: salix-back
|
||||
instances: 1
|
||||
max_restarts: 5
|
||||
max_restarts: 3
|
||||
restart_delay: 15000
|
||||
|
|
|
@ -53,20 +53,20 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
|
|||
VALUES
|
||||
(1, 978, 1, 0, 2000, 9, 0);
|
||||
|
||||
INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`,`lang`)
|
||||
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`)
|
||||
VALUES
|
||||
(101, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'),
|
||||
(102, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'),
|
||||
(103, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'),
|
||||
(104, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'),
|
||||
(105, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'),
|
||||
(106, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'),
|
||||
(107, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'),
|
||||
(108, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'),
|
||||
(109, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'),
|
||||
(110, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'),
|
||||
(111, 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'),
|
||||
(112, 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es');
|
||||
(101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'),
|
||||
(102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'),
|
||||
(103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'),
|
||||
(104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'),
|
||||
(105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'),
|
||||
(106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'es'),
|
||||
(107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'es'),
|
||||
(108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'es'),
|
||||
(109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'es'),
|
||||
(110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'es'),
|
||||
(111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'),
|
||||
(112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es');
|
||||
|
||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`)
|
||||
VALUES
|
||||
|
@ -1586,20 +1586,20 @@ INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `
|
|||
|
||||
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
||||
VALUES
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL 10 DAY)),
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL 11 DAY)),
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL 12 DAY)),
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL 20 DAY)),
|
||||
(106, 2, DATE_ADD(CURDATE(), INTERVAL -10 DAY)),
|
||||
(106, 1, DATE_ADD(CURDATE(), INTERVAL -12 DAY)),
|
||||
(106, 2, DATE_ADD(CURDATE(), INTERVAL -20 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL 15 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL 16 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL 20 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL 30 DAY)),
|
||||
(107, 2, DATE_ADD(CURDATE(), INTERVAL -10 DAY)),
|
||||
(107, 1, DATE_ADD(CURDATE(), INTERVAL -12 DAY)),
|
||||
(107, 2, DATE_ADD(CURDATE(), INTERVAL -20 DAY));
|
||||
(106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))),
|
||||
(106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))),
|
||||
(106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))),
|
||||
(106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))),
|
||||
(106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 13 DAY))),
|
||||
(106, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 14 DAY))),
|
||||
(106, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 15 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -20 DAY), DATE_ADD(CURDATE(), INTERVAL 20 DAY))),
|
||||
(107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -13 DAY), DATE_ADD(CURDATE(), INTERVAL 13 DAY))),
|
||||
(107, 1, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -14 DAY), DATE_ADD(CURDATE(), INTERVAL 14 DAY))),
|
||||
(107, 2, IF(MONTH(CURDATE()) >= 1 AND DAY(CURDATE()) > 20, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL 15 DAY)));
|
||||
|
||||
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`)
|
||||
VALUES
|
||||
|
|
|
@ -1,28 +1,45 @@
|
|||
version: '3.5'
|
||||
version: '3.7'
|
||||
services:
|
||||
front:
|
||||
image: registry.verdnatura.es/salix-front:${TAG}
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: .
|
||||
dockerfile: front/Dockerfile
|
||||
ports:
|
||||
- ${PORT_FRONT}:80
|
||||
links:
|
||||
- back
|
||||
deploy:
|
||||
replicas: 3
|
||||
back:
|
||||
image: registry.verdnatura.es/salix-back:${TAG}
|
||||
restart: unless-stopped
|
||||
build: .
|
||||
ports:
|
||||
- ${PORT_BACK}:3000
|
||||
environment:
|
||||
- NODE_ENV
|
||||
volumes:
|
||||
- /mnt/storage/containers/salix:/etc/salix
|
||||
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
||||
- /mnt/storage/dms:/var/lib/salix/dms
|
||||
deploy:
|
||||
replicas: 6
|
||||
front:
|
||||
image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: front/Dockerfile
|
||||
ports:
|
||||
- ${FRONT_PORT:?}:80
|
||||
deploy:
|
||||
replicas: 3
|
||||
back:
|
||||
image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?}
|
||||
build: .
|
||||
ports:
|
||||
- ${BACK_PORT:?}:3000
|
||||
environment:
|
||||
- NODE_ENV
|
||||
configs:
|
||||
- source: datasources
|
||||
target: /etc/salix/datasources.json
|
||||
- source: datasources_local
|
||||
target: /etc/salix/datasources.local.json
|
||||
- source: print
|
||||
target: /etc/salix/print.json
|
||||
- source: print_local
|
||||
target: /etc/salix/print.local.json
|
||||
volumes:
|
||||
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
||||
- /mnt/storage/dms:/var/lib/salix/dms
|
||||
deploy:
|
||||
replicas: 6
|
||||
configs:
|
||||
datasources:
|
||||
external: true
|
||||
name: salix_datasources
|
||||
datasources_local:
|
||||
external: true
|
||||
name: salix-${BRANCH_NAME:?}_datasources
|
||||
print:
|
||||
external: true
|
||||
name: salix_print
|
||||
print_local:
|
||||
external: true
|
||||
name: salix-${BRANCH_NAME:?}_print
|
||||
|
|
|
@ -162,7 +162,7 @@ export default {
|
|||
},
|
||||
clientBalance: {
|
||||
balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]',
|
||||
companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyFk"]',
|
||||
companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]',
|
||||
newPaymentButton: `vn-float-button`,
|
||||
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]',
|
||||
newPaymentAmountInput: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"] input',
|
||||
|
|
|
@ -34,7 +34,7 @@ describe('Route basic Data path', () => {
|
|||
.waitToGetProperty(`${selectors.routeBasicData.workerAutoComplete} input`, 'value');
|
||||
|
||||
|
||||
expect(worker).toEqual('adminBossNick');
|
||||
expect(worker).toEqual('adminBoss - adminBossNick');
|
||||
});
|
||||
|
||||
it('should confirm the vehicle was edited', async() => {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
No service for the specified zone: No hay servicio para la zona especificada
|
49
gulpfile.js
49
gulpfile.js
|
@ -101,6 +101,7 @@ async function backTestOnce() {
|
|||
gulp.src(backSpecFiles)
|
||||
.pipe(jasmine(options))
|
||||
.on('end', resolve)
|
||||
.on('error', reject)
|
||||
.resume();
|
||||
});
|
||||
|
||||
|
@ -110,27 +111,33 @@ backTestOnce.description = `Runs the backend tests once, can receive --junit arg
|
|||
|
||||
async function backTestDockerOnce() {
|
||||
let containerId = await docker();
|
||||
let err;
|
||||
|
||||
try {
|
||||
await backTestOnce();
|
||||
} catch (e) {
|
||||
throw e;
|
||||
} finally {
|
||||
if (argv['random'])
|
||||
await execP(`docker rm -fv ${containerId}`);
|
||||
err = e;
|
||||
}
|
||||
|
||||
if (argv['random'])
|
||||
await execP(`docker rm -fv ${containerId}`);
|
||||
if (err) throw err;
|
||||
}
|
||||
backTestDockerOnce.description = `Runs backend tests using in site container once`;
|
||||
|
||||
async function backTestDocker() {
|
||||
let containerId = await docker();
|
||||
let err;
|
||||
|
||||
try {
|
||||
await backTest();
|
||||
} catch (e) {
|
||||
throw e;
|
||||
} finally {
|
||||
if (argv['random'])
|
||||
await execP(`docker rm -fv ${containerId}`);
|
||||
err = e;
|
||||
}
|
||||
|
||||
if (argv['random'])
|
||||
await execP(`docker rm -fv ${containerId}`);
|
||||
if (err) throw err;
|
||||
}
|
||||
backTestDocker.description = `Runs backend tests restoring fixtures first`;
|
||||
|
||||
|
@ -240,14 +247,15 @@ function install() {
|
|||
const install = require('gulp-install');
|
||||
const print = require('gulp-print');
|
||||
|
||||
let npmArgs = [];
|
||||
if (argv.ci) npmArgs = ['--no-audit', '--prefer-offline'];
|
||||
|
||||
let packageFiles = ['front/package.json', 'print/package.json'];
|
||||
return gulp.src(packageFiles)
|
||||
.pipe(print(filepath => {
|
||||
return `Installing packages in ${filepath}`;
|
||||
}))
|
||||
.pipe(install({
|
||||
npm: ['--no-package-lock']
|
||||
}));
|
||||
.pipe(install({npm: npmArgs}));
|
||||
}
|
||||
install.description = `Installs node dependencies in all directories`;
|
||||
|
||||
|
@ -429,15 +437,22 @@ async function docker() {
|
|||
let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
|
||||
containerId = result.stdout;
|
||||
|
||||
if (argv['random']) {
|
||||
let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`);
|
||||
let netSettings = JSON.parse(inspect.stdout);
|
||||
try {
|
||||
if (argv['random']) {
|
||||
let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`);
|
||||
let netSettings = JSON.parse(inspect.stdout);
|
||||
|
||||
dbConf.host = netSettings.Gateway;
|
||||
dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
||||
dbConf.host = netSettings.Gateway;
|
||||
dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
||||
}
|
||||
|
||||
if (runChown) await dockerWait();
|
||||
} catch (err) {
|
||||
if (argv['random'])
|
||||
await execP(`docker rm -fv ${containerId}`);
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (runChown) await dockerWait();
|
||||
return containerId;
|
||||
}
|
||||
docker.description = `Builds the database image and runs a container`;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"multipleStatements": true,
|
||||
"legacyUtcDateProcessing": false,
|
||||
"timezone": "local",
|
||||
"connectTimeout": 20000,
|
||||
"connectTimeout": 40000,
|
||||
"acquireTimeout": 20000
|
||||
},
|
||||
"storage": {
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = Self => {
|
|||
description: 'The province id',
|
||||
required: true
|
||||
}, {
|
||||
arg: 'search',
|
||||
arg: 'postCode',
|
||||
type: 'String',
|
||||
description: 'The postcode'
|
||||
}, {
|
||||
|
|
|
@ -8,8 +8,14 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.data = null;
|
||||
this.$http.get(`Zones/getEvents`, {params: this.$.params})
|
||||
.then(res => this.$.data = res.data);
|
||||
.then(res => {
|
||||
let data = res.data;
|
||||
this.$.data = data;
|
||||
if (!data.events.length)
|
||||
this.vnApp.showMessage(this.$t('No service for the specified zone'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,12 +160,12 @@
|
|||
response="cancel"
|
||||
translate-attr="{value: 'Cancel'}">
|
||||
</input>
|
||||
<button
|
||||
<input
|
||||
type="button"
|
||||
ng-if="!$ctrl.isNew"
|
||||
response="delete"
|
||||
translate>
|
||||
Delete
|
||||
</button>
|
||||
translate-attr="{value: 'Delete'}">
|
||||
</input>
|
||||
<button response="accept">
|
||||
<span ng-if="$ctrl.isNew" translate>Add</span>
|
||||
<span ng-if="!$ctrl.isNew" translate>Save</span>
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
</vn-td>
|
||||
<vn-td number>{{::saleClaimed.sale.price | currency: 'EUR':2}}</vn-td>
|
||||
<vn-td number>
|
||||
<span class="link"
|
||||
vn-tooltip="Edit discount"
|
||||
<span ng-class="{'link': $ctrl.isEditable}"
|
||||
title="{{$ctrl.isEditable ? 'Edit discount' : ''}}"
|
||||
ng-click="$ctrl.showEditPopover($event, saleClaimed)">
|
||||
{{saleClaimed.sale.discount}} %
|
||||
</span>
|
||||
|
|
|
@ -29,8 +29,10 @@ class Controller {
|
|||
set salesClaimed(value) {
|
||||
this._salesClaimed = value;
|
||||
|
||||
if (value)
|
||||
if (value) {
|
||||
this.calculateTotals();
|
||||
this.isClaimEditable();
|
||||
}
|
||||
}
|
||||
|
||||
get salesClaimed() {
|
||||
|
@ -119,13 +121,14 @@ class Controller {
|
|||
}
|
||||
|
||||
showEditPopover(event, saleClaimed) {
|
||||
this.saleClaimed = saleClaimed;
|
||||
if (this.isEditable) {
|
||||
if (!this.aclService.hasAny(['salesAssistant']))
|
||||
return this.vnApp.showError(this.$translate.instant('Insuficient permisos'));
|
||||
|
||||
if (!this.aclService.hasAny(['salesAssistant']))
|
||||
return this.vnApp.showError(this.$translate.instant('Insuficient permisos'));
|
||||
|
||||
this.$.editPopover.parent = event.target;
|
||||
this.$.editPopover.show();
|
||||
this.saleClaimed = saleClaimed;
|
||||
this.$.editPopover.parent = event.target;
|
||||
this.$.editPopover.show();
|
||||
}
|
||||
}
|
||||
|
||||
getSalespersonMana() {
|
||||
|
@ -134,6 +137,12 @@ class Controller {
|
|||
});
|
||||
}
|
||||
|
||||
isClaimEditable() {
|
||||
this.$http.get(`Tickets/${this.claim.ticketFk}/isEditable`).then(res => {
|
||||
this.isEditable = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
updateDiscount() {
|
||||
const claimedSale = this.saleClaimed.sale;
|
||||
if (this.newDiscount != claimedSale.discount) {
|
||||
|
|
|
@ -17,13 +17,14 @@ describe('claim', () => {
|
|||
show: () => {}
|
||||
};
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpBackend.when('GET', 'Claims/ClaimBeginnings').respond({});
|
||||
$httpBackend.whenGET('Claims/ClaimBeginnings').respond({});
|
||||
$httpBackend.whenGET(`Tickets/1/isEditable`).respond(true);
|
||||
$state = _$state_;
|
||||
aclService = {hasAny: () => true};
|
||||
controller = $componentController('vnClaimDetail', {$state, aclService, $scope});
|
||||
controller.claim = {ticketFk: 1};
|
||||
controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}];
|
||||
controller.salesClaimed = [{id: 1, sale: {}}];
|
||||
controller.claim = {ticketFk: 1};
|
||||
controller.$.model = crudModel;
|
||||
controller.$.addSales = {
|
||||
hide: () => {},
|
||||
|
@ -36,7 +37,6 @@ describe('claim', () => {
|
|||
|
||||
describe('openAddSalesDialog()', () => {
|
||||
it('should call getClaimableFromTicket and $.addSales.show', () => {
|
||||
controller.$ = {addSales: {show: () => {}}};
|
||||
spyOn(controller, 'getClaimableFromTicket');
|
||||
spyOn(controller.$.addSales, 'show');
|
||||
controller.openAddSalesDialog();
|
||||
|
@ -146,5 +146,14 @@ describe('claim', () => {
|
|||
expect(controller.$.descriptor.show).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isClaimEditable()', () => {
|
||||
it('should check if the claim is editable', () => {
|
||||
controller.isClaimEditable();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.isEditable).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,12 +11,12 @@ module.exports = Self => {
|
|||
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'clientFk',
|
||||
arg: 'clientId',
|
||||
type: 'Number',
|
||||
description: 'The client id',
|
||||
required: true,
|
||||
}, {
|
||||
arg: 'companyFk',
|
||||
arg: 'companyId',
|
||||
type: 'Number',
|
||||
description: 'The company id',
|
||||
required: true,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<vn-autocomplete
|
||||
vn-id="company"
|
||||
class="dense"
|
||||
ng-model="$ctrl.companyFk"
|
||||
ng-model="$ctrl.companyId"
|
||||
url="Companies"
|
||||
show-field="code"
|
||||
value-field="id"
|
||||
|
|
|
@ -20,27 +20,27 @@ class Controller {
|
|||
};
|
||||
}
|
||||
|
||||
get companyFk() {
|
||||
if (!this._companyFk)
|
||||
this.companyFk = this.vnConfig.companyFk;
|
||||
get companyId() {
|
||||
if (!this._companyId)
|
||||
this.companyId = this.vnConfig.companyFk;
|
||||
|
||||
return this._companyFk;
|
||||
return this._companyId;
|
||||
}
|
||||
|
||||
set companyFk(id) {
|
||||
this._companyFk = id;
|
||||
set companyId(value) {
|
||||
this._companyId = value;
|
||||
|
||||
if (id) this.getData();
|
||||
if (value) this.getData();
|
||||
}
|
||||
|
||||
getData() {
|
||||
return this.$.model.applyFilter(null, {
|
||||
clientFk: this.$stateParams.id,
|
||||
companyFk: this.companyFk
|
||||
clientId: this.$stateParams.id,
|
||||
companyId: this.companyId
|
||||
}).then(() => this.$.riskModel.applyFilter({
|
||||
where: {
|
||||
clientFk: this.$stateParams.id,
|
||||
companyFk: this.companyFk
|
||||
companyFk: this.companyId
|
||||
}
|
||||
})).then(() => this.getBalances());
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class Controller {
|
|||
|
||||
getCurrentBalance() {
|
||||
const clientRisks = this.$.riskModel.data;
|
||||
const selectedCompany = this.companyFk;
|
||||
const selectedCompany = this.companyId;
|
||||
const currentBalance = clientRisks.find(balance => {
|
||||
return balance.companyFk === selectedCompany;
|
||||
});
|
||||
|
@ -63,7 +63,6 @@ class Controller {
|
|||
balance.balance = this.getCurrentBalance();
|
||||
if (index > 0) {
|
||||
let previousBalance = balances[index - 1];
|
||||
|
||||
balance.balance = previousBalance.balance - (previousBalance.debit - previousBalance.credit);
|
||||
}
|
||||
});
|
||||
|
@ -71,7 +70,7 @@ class Controller {
|
|||
|
||||
|
||||
openCreateDialog() {
|
||||
this.$.balanceCreateDialog.companyFk = this.companyFk;
|
||||
this.$.balanceCreateDialog.companyFk = this.companyId;
|
||||
this.$.balanceCreateDialog.onResponse = () => this.getData();
|
||||
this.$.balanceCreateDialog.show();
|
||||
}
|
||||
|
|
|
@ -11,24 +11,91 @@ describe('Client', () => {
|
|||
$componentController = _$componentController_;
|
||||
let $scope = $rootScope.$new();
|
||||
controller = $componentController('vnClientBalanceIndex', {$scope});
|
||||
controller._companyFk = 442;
|
||||
controller.$stateParams.id = 101;
|
||||
|
||||
controller.$.model = {applyFilter: () => {}};
|
||||
controller.$.riskModel = {applyFilter: () => {}};
|
||||
controller.$.riskModel = {
|
||||
applyFilter: () => {},
|
||||
data:
|
||||
[{
|
||||
clientFk: 101,
|
||||
companyFk: 442,
|
||||
amount: 713.24,
|
||||
company: {
|
||||
id: 442,
|
||||
code: 'VNL'
|
||||
}
|
||||
}]
|
||||
};
|
||||
}));
|
||||
|
||||
describe('getData()', () => {
|
||||
it('should apply the filters on he models and get the client balance', () => {
|
||||
controller._companyId = 442;
|
||||
controller.$stateParams.id = 101;
|
||||
spyOn(controller, 'getBalances');
|
||||
spyOn(controller.$.model, 'applyFilter').and.returnValue(Promise.resolve());
|
||||
spyOn(controller.$.riskModel, 'applyFilter').and.returnValue(Promise.resolve());
|
||||
|
||||
controller.getData().then(() => {
|
||||
expect(controller.$.model.applyFilter).toHaveBeenCalledWith(null, {'clientFk': 101, 'companyFk': 442});
|
||||
expect(controller.$.model.applyFilter).toHaveBeenCalledWith(null, {'clientId': 101, 'companyId': 442});
|
||||
expect(controller.$.riskModel.applyFilter).toHaveBeenCalledWith({'where': {'clientFk': 101, 'companyFk': 442}});
|
||||
expect(controller.getBalances).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('company setter/getter', () => {
|
||||
it('should return the company', () => {
|
||||
controller.companyId = null;
|
||||
|
||||
expect(controller._companyId).toEqual(jasmine.any(Object));
|
||||
});
|
||||
|
||||
it('should return the company and then call getData()', () => {
|
||||
spyOn(controller, 'getData');
|
||||
controller.companyId = 442;
|
||||
|
||||
expect(controller._companyId).toEqual(442);
|
||||
expect(controller.getData).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getCurrentBalance()', () => {
|
||||
it('should return the client balance amount', () => {
|
||||
controller._companyId = 442;
|
||||
let result = controller.getCurrentBalance();
|
||||
|
||||
expect(result).toEqual(713.24);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getBalances()', () => {
|
||||
it('should return the total client balance amount', () => {
|
||||
spyOn(controller, 'getCurrentBalance').and.callThrough();
|
||||
controller._companyId = 442;
|
||||
controller.$.model = {data:
|
||||
[{
|
||||
id: 1,
|
||||
debit: 1000,
|
||||
credit: null
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
debit: null,
|
||||
credit: 500
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
debit: null,
|
||||
credit: 300
|
||||
}
|
||||
]};
|
||||
controller.getBalances();
|
||||
const expectedBalances = controller.$.model.data;
|
||||
|
||||
expect(expectedBalances[0].balance).toEqual(713.24);
|
||||
expect(expectedBalances[1].balance).toEqual(-286.76);
|
||||
expect(expectedBalances[2].balance).toEqual(213.24);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,13 +29,24 @@ describe('Component VnClientWebAccess', () => {
|
|||
});
|
||||
|
||||
describe('isCustomer()', () => {
|
||||
it(`should perform a query if client is defined with an ID`, () => {
|
||||
it('should return a true if the password can be modified', () => {
|
||||
controller.client = {id: '1234'};
|
||||
controller.isCustomer();
|
||||
|
||||
$httpBackend.when('GET', `Clients/${controller.client.id}/hasCustomerRole`).respond('ok');
|
||||
$httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`);
|
||||
$httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`).respond({isCustomer: true});
|
||||
controller.isCustomer();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.canChangePassword).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should return a false if the password can't be modified`, () => {
|
||||
controller.client = {id: '1234'};
|
||||
|
||||
$httpBackend.expectGET(`Clients/${controller.client.id}/hasCustomerRole`).respond({isCustomer: false});
|
||||
controller.isCustomer();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.canChangePassword).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class Controller {
|
|||
}
|
||||
|
||||
showInvoiceOutPdf() {
|
||||
let url = `InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`;
|
||||
let url = `api/InvoiceOuts/${this.invoiceOut.id}/download?access_token=${this.accessToken}`;
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ export default class Controller {
|
|||
}
|
||||
|
||||
openPdf(id, event) {
|
||||
let url = `InvoiceOuts/${id}/download?access_token=${this.accessToken}`;
|
||||
let url = `api/InvoiceOuts/${id}/download?access_token=${this.accessToken}`;
|
||||
window.open(url, '_blank');
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.route.workerFk"
|
||||
url="Clients/activeWorkersWithRole"
|
||||
|
@ -17,6 +17,9 @@
|
|||
value-field="id"
|
||||
where="{role: 'employee'}"
|
||||
label="Worker">
|
||||
<tpl-item>
|
||||
<div>{{name}} - {{nickname}}</div>
|
||||
</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
// #1924 - Fix hours
|
||||
xdescribe('Worker absences()', () => {
|
||||
describe('Worker absences()', () => {
|
||||
it('should get the absence calendar for a full year contract', async() => {
|
||||
let ctx = {req: {accessToken: {userId: 106}}};
|
||||
let workerFk = 106;
|
||||
|
@ -27,8 +26,8 @@ xdescribe('Worker absences()', () => {
|
|||
let firstType = absences[0].absenceType().name;
|
||||
let sixthType = absences[5].absenceType().name;
|
||||
|
||||
expect(firstType).toEqual('Leave of absence');
|
||||
expect(sixthType).toEqual('Holidays');
|
||||
expect(firstType).toMatch(/(Holidays|Leave of absence)/);
|
||||
expect(sixthType).toMatch(/(Holidays|Leave of absence)/);
|
||||
});
|
||||
|
||||
it('should get the absence calendar for a permanent contract', async() => {
|
||||
|
@ -64,8 +63,8 @@ xdescribe('Worker absences()', () => {
|
|||
let firstType = absences[0].absenceType().name;
|
||||
let sixthType = absences[5].absenceType().name;
|
||||
|
||||
expect(firstType).toEqual('Leave of absence');
|
||||
expect(sixthType).toEqual('Holidays');
|
||||
expect(firstType).toMatch(/(Holidays|Leave of absence)/);
|
||||
expect(sixthType).toMatch(/(Holidays|Leave of absence)/);
|
||||
|
||||
// restores the contract end date
|
||||
await app.models.WorkerLabour.rawSql(
|
||||
|
@ -146,8 +145,8 @@ xdescribe('Worker absences()', () => {
|
|||
let firstType = absences[0].absenceType().name;
|
||||
let sixthType = absences[5].absenceType().name;
|
||||
|
||||
expect(firstType).toEqual('Leave of absence');
|
||||
expect(sixthType).toEqual('Holidays');
|
||||
expect(firstType).toMatch(/(Holidays|Leave of absence)/);
|
||||
expect(sixthType).toMatch(/(Holidays|Leave of absence)/);
|
||||
|
||||
// resets the holidays per year with originalHolidaysValue and the contract starting date
|
||||
await app.models.WorkCenterHoliday.updateAll(
|
||||
|
|
|
@ -19,7 +19,7 @@ vn-log {
|
|||
}
|
||||
|
||||
@media screen and (max-width: 1570px) {
|
||||
.expendable {
|
||||
vn-table .expendable {
|
||||
display: none;
|
||||
}
|
||||
.changes {
|
||||
|
|
|
@ -4,8 +4,10 @@ let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development';
|
|||
let configPath = `/etc/salix`;
|
||||
let config = require('../config/print.json');
|
||||
let configFiles = [
|
||||
`${appPath}/config/print.local.json`,
|
||||
`${appPath}/config/print.${env}.json`,
|
||||
`${configPath}/print.json`,
|
||||
`${configPath}/print.local.json`,
|
||||
`${configPath}/print.${env}.json`
|
||||
];
|
||||
|
||||
|
|
|
@ -12,4 +12,4 @@ claim: Reclamación {0}
|
|||
sections:
|
||||
agency:
|
||||
description: 'Para agilizar tu recogida, por favor, pónte en contacto con la oficina
|
||||
de integrados. <br/> Tlf: 96 166 77 88 - Ana Gómez (Ext. 2133) <em>(agomezf@integra2.es)</em>'
|
||||
de integrados. <br/> Tlf: 96 166 77 88 - Ana Gómez (Ext. 2113) <em>(agomezf@integra2.es)</em>'
|
||||
|
|
Loading…
Reference in New Issue