Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1985-apply_item_type_filter
gitea/salix/1985-apply_item_type_filter There was a failure building this commit
Details
gitea/salix/1985-apply_item_type_filter There was a failure building this commit
Details
This commit is contained in:
commit
6f3359c76e
|
@ -34,5 +34,5 @@ COPY \
|
||||||
|
|
||||||
CMD ["pm2-runtime", "./back/process.yml"]
|
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
|
CMD curl -f http://localhost:3000/api/Applications/status || exit 1
|
||||||
|
|
|
@ -7,19 +7,12 @@ pipeline {
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
PROJECT_NAME = 'salix'
|
PROJECT_NAME = 'salix'
|
||||||
REGISTRY = 'registry.verdnatura.es'
|
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||||
PORT_MASTER_FRONT = '5002'
|
|
||||||
PORT_MASTER_BACK = '3001'
|
|
||||||
PORT_TEST_FRONT = '5001'
|
|
||||||
PORT_TEST_BACK = '4001'
|
|
||||||
TAG = "${env.BRANCH_NAME}"
|
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
env.STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
|
||||||
|
|
||||||
if (!env.GIT_COMMITTER_EMAIL) {
|
if (!env.GIT_COMMITTER_EMAIL) {
|
||||||
env.COMMITTER_EMAIL = sh(
|
env.COMMITTER_EMAIL = sh(
|
||||||
script: 'git --no-pager show -s --format="%ae"',
|
script: 'git --no-pager show -s --format="%ae"',
|
||||||
|
@ -29,16 +22,6 @@ pipeline {
|
||||||
env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL;
|
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) {
|
switch (env.BRANCH_NAME) {
|
||||||
case 'master':
|
case 'master':
|
||||||
env.NODE_ENV = 'production'
|
env.NODE_ENV = 'production'
|
||||||
|
@ -48,6 +31,14 @@ pipeline {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configFileProvider([
|
||||||
|
configFile(fileId: "salix.groovy",
|
||||||
|
variable: 'GROOVY_FILE')
|
||||||
|
]) {
|
||||||
|
load env.GROOVY_FILE
|
||||||
|
}
|
||||||
|
|
||||||
sh 'printenv'
|
sh 'printenv'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +48,8 @@ pipeline {
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
nodejs('node-lts') {
|
nodejs('node-lts') {
|
||||||
sh 'npm install --no-audit'
|
sh 'npm install --no-audit --prefer-offline'
|
||||||
sh 'gulp install'
|
sh 'gulp install --ci'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,4 +2,5 @@ apps:
|
||||||
- script: ./loopback/server/server.js
|
- script: ./loopback/server/server.js
|
||||||
name: salix-back
|
name: salix-back
|
||||||
instances: 1
|
instances: 1
|
||||||
max_restarts: 5
|
max_restarts: 3
|
||||||
|
restart_delay: 15000
|
||||||
|
|
|
@ -1,28 +1,45 @@
|
||||||
version: '3.5'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
front:
|
front:
|
||||||
image: registry.verdnatura.es/salix-front:${TAG}
|
image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?}
|
||||||
restart: unless-stopped
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: front/Dockerfile
|
dockerfile: front/Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- ${PORT_FRONT}:80
|
- ${FRONT_PORT:?}:80
|
||||||
links:
|
|
||||||
- back
|
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
back:
|
back:
|
||||||
image: registry.verdnatura.es/salix-back:${TAG}
|
image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?}
|
||||||
restart: unless-stopped
|
|
||||||
build: .
|
build: .
|
||||||
ports:
|
ports:
|
||||||
- ${PORT_BACK}:3000
|
- ${BACK_PORT:?}:3000
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV
|
- 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:
|
volumes:
|
||||||
- /mnt/storage/containers/salix:/etc/salix
|
|
||||||
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
||||||
- /mnt/storage/dms:/var/lib/salix/dms
|
- /mnt/storage/dms:/var/lib/salix/dms
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 6
|
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
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
No service for the specified zone: No hay servicio para la zona especificada
|
|
@ -11,11 +11,9 @@
|
||||||
|
|
||||||
.vn-droppable,
|
.vn-droppable,
|
||||||
[vn-droppable] {
|
[vn-droppable] {
|
||||||
display: block;
|
|
||||||
|
|
||||||
&.dropping {
|
&.dropping {
|
||||||
background-color: $color-hover-cd;
|
background-color: $color-hover-cd;
|
||||||
border-color: $color-bg-dark;
|
border-color: $color-font-secondary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ vn-app {
|
||||||
ui-view {
|
ui-view {
|
||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: inherit;
|
height: 100%;
|
||||||
|
|
||||||
&.ng-enter {
|
&.ng-enter {
|
||||||
animation-name: nothing, slideIn;
|
animation-name: nothing, slideIn;
|
||||||
|
|
|
@ -87,6 +87,8 @@ vn-layout {
|
||||||
& > * {
|
& > * {
|
||||||
display: block;
|
display: block;
|
||||||
padding: $spacing-md;
|
padding: $spacing-md;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 100%
|
||||||
}
|
}
|
||||||
&.ng-enter {
|
&.ng-enter {
|
||||||
vn-side-menu {
|
vn-side-menu {
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
transition: all 0.5s;
|
transition: all 0.5s;
|
||||||
padding: $spacing-sm;
|
padding: $spacing-sm;
|
||||||
position: relative;
|
position: relative;
|
||||||
opacity: 0.7;
|
|
||||||
width: 28em;
|
width: 28em;
|
||||||
|
|
||||||
.image {
|
.image {
|
||||||
|
@ -20,6 +19,7 @@
|
||||||
0 1px 5px 0 rgba(0,0,0,.12);
|
0 1px 5px 0 rgba(0,0,0,.12);
|
||||||
background: no-repeat center center fixed;
|
background: no-repeat center center fixed;
|
||||||
background-size: cover !important;
|
background-size: cover !important;
|
||||||
|
border: 2px solid transparent;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: zoom-in;
|
cursor: zoom-in;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
top: 1em
|
top: 1em
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.photo:hover {
|
.photo:hover .image {
|
||||||
opacity: 1
|
border: 2px solid $color-primary
|
||||||
}
|
}
|
||||||
}
|
}
|
33
gulpfile.js
33
gulpfile.js
|
@ -101,6 +101,7 @@ async function backTestOnce() {
|
||||||
gulp.src(backSpecFiles)
|
gulp.src(backSpecFiles)
|
||||||
.pipe(jasmine(options))
|
.pipe(jasmine(options))
|
||||||
.on('end', resolve)
|
.on('end', resolve)
|
||||||
|
.on('error', reject)
|
||||||
.resume();
|
.resume();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -110,27 +111,33 @@ backTestOnce.description = `Runs the backend tests once, can receive --junit arg
|
||||||
|
|
||||||
async function backTestDockerOnce() {
|
async function backTestDockerOnce() {
|
||||||
let containerId = await docker();
|
let containerId = await docker();
|
||||||
|
let err;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await backTestOnce();
|
await backTestOnce();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw e;
|
err = e;
|
||||||
} finally {
|
}
|
||||||
|
|
||||||
if (argv['random'])
|
if (argv['random'])
|
||||||
await execP(`docker rm -fv ${containerId}`);
|
await execP(`docker rm -fv ${containerId}`);
|
||||||
}
|
if (err) throw err;
|
||||||
}
|
}
|
||||||
backTestDockerOnce.description = `Runs backend tests using in site container once`;
|
backTestDockerOnce.description = `Runs backend tests using in site container once`;
|
||||||
|
|
||||||
async function backTestDocker() {
|
async function backTestDocker() {
|
||||||
let containerId = await docker();
|
let containerId = await docker();
|
||||||
|
let err;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await backTest();
|
await backTest();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw e;
|
err = e;
|
||||||
} finally {
|
}
|
||||||
|
|
||||||
if (argv['random'])
|
if (argv['random'])
|
||||||
await execP(`docker rm -fv ${containerId}`);
|
await execP(`docker rm -fv ${containerId}`);
|
||||||
}
|
if (err) throw err;
|
||||||
}
|
}
|
||||||
backTestDocker.description = `Runs backend tests restoring fixtures first`;
|
backTestDocker.description = `Runs backend tests restoring fixtures first`;
|
||||||
|
|
||||||
|
@ -240,14 +247,15 @@ function install() {
|
||||||
const install = require('gulp-install');
|
const install = require('gulp-install');
|
||||||
const print = require('gulp-print');
|
const print = require('gulp-print');
|
||||||
|
|
||||||
|
let npmArgs = [];
|
||||||
|
if (argv.ci) npmArgs = ['--no-audit', '--prefer-offline'];
|
||||||
|
|
||||||
let packageFiles = ['front/package.json', 'print/package.json'];
|
let packageFiles = ['front/package.json', 'print/package.json'];
|
||||||
return gulp.src(packageFiles)
|
return gulp.src(packageFiles)
|
||||||
.pipe(print(filepath => {
|
.pipe(print(filepath => {
|
||||||
return `Installing packages in ${filepath}`;
|
return `Installing packages in ${filepath}`;
|
||||||
}))
|
}))
|
||||||
.pipe(install({
|
.pipe(install({npm: npmArgs}));
|
||||||
npm: ['--no-package-lock']
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
install.description = `Installs node dependencies in all directories`;
|
install.description = `Installs node dependencies in all directories`;
|
||||||
|
|
||||||
|
@ -429,6 +437,7 @@ async function docker() {
|
||||||
let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
|
let result = await execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
|
||||||
containerId = result.stdout;
|
containerId = result.stdout;
|
||||||
|
|
||||||
|
try {
|
||||||
if (argv['random']) {
|
if (argv['random']) {
|
||||||
let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`);
|
let inspect = await execP(`docker inspect -f "{{json .NetworkSettings}}" ${containerId}`);
|
||||||
let netSettings = JSON.parse(inspect.stdout);
|
let netSettings = JSON.parse(inspect.stdout);
|
||||||
|
@ -438,6 +447,12 @@ async function docker() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runChown) await dockerWait();
|
if (runChown) await dockerWait();
|
||||||
|
} catch (err) {
|
||||||
|
if (argv['random'])
|
||||||
|
await execP(`docker rm -fv ${containerId}`);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
return containerId;
|
return containerId;
|
||||||
}
|
}
|
||||||
docker.description = `Builds the database image and runs a container`;
|
docker.description = `Builds the database image and runs a container`;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"multipleStatements": true,
|
"multipleStatements": true,
|
||||||
"legacyUtcDateProcessing": false,
|
"legacyUtcDateProcessing": false,
|
||||||
"timezone": "local",
|
"timezone": "local",
|
||||||
"connectTimeout": 20000,
|
"connectTimeout": 40000,
|
||||||
"acquireTimeout": 20000
|
"acquireTimeout": 20000
|
||||||
},
|
},
|
||||||
"storage": {
|
"storage": {
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = Self => {
|
||||||
description: 'The province id',
|
description: 'The province id',
|
||||||
required: true
|
required: true
|
||||||
}, {
|
}, {
|
||||||
arg: 'search',
|
arg: 'postCode',
|
||||||
type: 'String',
|
type: 'String',
|
||||||
description: 'The postcode'
|
description: 'The postcode'
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -8,8 +8,14 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
this.$.data = null;
|
||||||
this.$http.get(`Zones/getEvents`, {params: this.$.params})
|
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"
|
response="cancel"
|
||||||
translate-attr="{value: 'Cancel'}">
|
translate-attr="{value: 'Cancel'}">
|
||||||
</input>
|
</input>
|
||||||
<button
|
<input
|
||||||
|
type="button"
|
||||||
ng-if="!$ctrl.isNew"
|
ng-if="!$ctrl.isNew"
|
||||||
response="delete"
|
response="delete"
|
||||||
translate>
|
translate-attr="{value: 'Delete'}">
|
||||||
Delete
|
</input>
|
||||||
</button>
|
|
||||||
<button response="accept">
|
<button response="accept">
|
||||||
<span ng-if="$ctrl.isNew" translate>Add</span>
|
<span ng-if="$ctrl.isNew" translate>Add</span>
|
||||||
<span ng-if="!$ctrl.isNew" translate>Save</span>
|
<span ng-if="!$ctrl.isNew" translate>Save</span>
|
||||||
|
|
|
@ -5,14 +5,11 @@
|
||||||
data="$ctrl.photos">
|
data="$ctrl.photos">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
|
|
||||||
<section class="drop-zone" vn-droppable="$ctrl.onDrop($event)">
|
<vn-horizontal class="photo-list drop-zone" vn-droppable="$ctrl.onDrop($event)">
|
||||||
<section><vn-icon icon="add_circle"></vn-icon></section>
|
<section class="empty-rows" ng-if="!$ctrl.photos.length">
|
||||||
<section translate>Drag & Drop files here...</section>
|
<section><vn-icon icon="image"></vn-icon></section>
|
||||||
</section>
|
<section translate>Drag & Drop photos here...</section>
|
||||||
<vn-data-viewer
|
</section>
|
||||||
model="model"
|
|
||||||
class="vn-w-xl">
|
|
||||||
<vn-horizontal class="photo-list">
|
|
||||||
<section class="photo" ng-repeat="photo in $ctrl.photos">
|
<section class="photo" ng-repeat="photo in $ctrl.photos">
|
||||||
<section class="image vn-shadow" on-error-src
|
<section class="image vn-shadow" on-error-src
|
||||||
ng-style="{'background': 'url(/api/dms/' + photo.dmsFk + '/downloadFile?access_token=' + $ctrl.accessToken + ')'}"
|
ng-style="{'background': 'url(/api/dms/' + photo.dmsFk + '/downloadFile?access_token=' + $ctrl.accessToken + ')'}"
|
||||||
|
@ -28,8 +25,8 @@
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-data-viewer>
|
|
||||||
<vn-worker-descriptor-popover
|
<vn-worker-descriptor-popover
|
||||||
vn-id="workerDescriptor">
|
vn-id="workerDescriptor">
|
||||||
</vn-worker-descriptor-popover>
|
</vn-worker-descriptor-popover>
|
||||||
|
@ -39,3 +36,9 @@
|
||||||
question="Are you sure you want to continue?"
|
question="Are you sure you want to continue?"
|
||||||
on-response="$ctrl.deleteDms($response)">
|
on-response="$ctrl.deleteDms($response)">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
<vn-float-button fixed-bottom-right
|
||||||
|
icon="add"
|
||||||
|
vn-tooltip="Select photo"
|
||||||
|
vn-bind="+"
|
||||||
|
ng-click="$ctrl.openUploadDialog()">
|
||||||
|
</vn-float-button>
|
||||||
|
|
|
@ -68,6 +68,19 @@ class Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openUploadDialog() {
|
||||||
|
const element = document.createElement('input');
|
||||||
|
element.setAttribute('type', 'file');
|
||||||
|
element.setAttribute('multiple', true);
|
||||||
|
element.click();
|
||||||
|
|
||||||
|
element.addEventListener('change', () =>
|
||||||
|
this.setDefaultParams().then(() => {
|
||||||
|
this.dms.files = element.files;
|
||||||
|
this.create();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
const query = `claims/${this.claim.id}/uploadFile`;
|
const query = `claims/${this.claim.id}/uploadFile`;
|
||||||
|
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
vn-claim-dms-index {
|
vn-claim-dms-index {
|
||||||
.drop-zone {
|
.drop-zone {
|
||||||
border: 2px dashed $color-font-secondary;
|
|
||||||
color: $color-font-secondary;
|
color: $color-font-secondary;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 2em $spacing-md;
|
|
||||||
border-radius: 0.5em;
|
border-radius: 0.5em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1.4em;
|
min-height: 100%;
|
||||||
|
|
||||||
|
.empty-rows {
|
||||||
|
padding: 5em $spacing-md;
|
||||||
|
font-size: 1.4em
|
||||||
|
}
|
||||||
|
|
||||||
vn-icon {
|
vn-icon {
|
||||||
font-size: 3em
|
font-size: 3em
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
FileDescription: Ticket id {{ticketId}} from client {{clientName}} id {{clientId}}
|
|
||||||
ContentTypesInfo: Allowed file types {{allowedContentTypes}}
|
|
|
@ -1,4 +1,5 @@
|
||||||
Are you sure you want to continue?: ¿Seguro que quieres continuar?
|
Are you sure you want to continue?: ¿Seguro que quieres continuar?
|
||||||
Drag & Drop files here...: Arrastra y suelta archivos aquí...
|
Drag & Drop photos here...: Arrastra y suelta fotos aquí...
|
||||||
Photo deleted: Foto eliminada
|
Photo deleted: Foto eliminada
|
||||||
Photo uploaded!: Foto subida!
|
Photo uploaded!: Foto subida!
|
||||||
|
Select photo: Seleccionar foto
|
|
@ -1,12 +1,10 @@
|
||||||
@import "./variables";
|
@import "./variables";
|
||||||
|
|
||||||
vn-claim-summary {
|
vn-claim-summary {
|
||||||
.photo {
|
section.photo {
|
||||||
height: 15.5em;
|
height: 15.5em
|
||||||
}
|
}
|
||||||
.photo .image {
|
.photo .image {
|
||||||
border: 2px solid $color-bg-dark;
|
border-radius: 0.2em
|
||||||
border-radius: 0.2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -53,7 +53,7 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
showInvoiceOutPdf() {
|
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');
|
window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
openPdf(id, event) {
|
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');
|
window.open(url, '_blank');
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-auto>
|
<vn-auto>
|
||||||
<h4 translate>Entries</h4>
|
<h4 translate>Entries</h4>
|
||||||
<vn-table model="model">
|
<vn-table>
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
<vn-th shrink>Confirmed</vn-th>
|
<vn-th shrink>Confirmed</vn-th>
|
||||||
|
@ -51,8 +51,8 @@
|
||||||
<vn-th shrink>Supplier</vn-th>
|
<vn-th shrink>Supplier</vn-th>
|
||||||
<vn-th shrink>Reference</vn-th>
|
<vn-th shrink>Reference</vn-th>
|
||||||
<vn-th shrink title="Half box">HB</vn-th>
|
<vn-th shrink title="Half box">HB</vn-th>
|
||||||
<vn-th shrink>Freight cost</vn-th>
|
<vn-th shrink>Freight</vn-th>
|
||||||
<vn-th shrink>Package cost</vn-th>
|
<vn-th shrink>Package</vn-th>
|
||||||
<vn-th shrink>CC</vn-th>
|
<vn-th shrink>CC</vn-th>
|
||||||
<vn-th shrink>Pallet</vn-th>
|
<vn-th shrink>Pallet</vn-th>
|
||||||
<vn-th shrink>m3</vn-th>
|
<vn-th shrink>m3</vn-th>
|
||||||
|
@ -61,16 +61,18 @@
|
||||||
</vn-thead>
|
</vn-thead>
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="entry in $ctrl.entries">
|
<vn-tr ng-repeat="entry in $ctrl.entries">
|
||||||
|
<vn-td shrink>
|
||||||
<vn-check
|
<vn-check
|
||||||
value="{{entry.isConfirmed}}"
|
value="{{entry.isConfirmed}}"
|
||||||
disabled="true">
|
disabled="true">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
|
</vn-td>
|
||||||
<vn-td shrink>{{entry.id}} </vn-td>
|
<vn-td shrink>{{entry.id}} </vn-td>
|
||||||
<vn-td shrink>{{entry.supplierName}}</vn-td>
|
<vn-td shrink>{{entry.supplierName}}</vn-td>
|
||||||
<vn-td shrink>{{entry.ref}}</vn-td>
|
<vn-td shrink>{{entry.ref}}</vn-td>
|
||||||
<vn-td shrink>{{entry.hb}}</vn-td>
|
<vn-td shrink>{{entry.hb}}</vn-td>
|
||||||
<vn-td shrink>{{entry.freightValue}}</vn-td>
|
<vn-td shrink>{{entry.freightValue | currency: 'EUR': 2}}</vn-td>
|
||||||
<vn-td shrink>{{entry.packageValue}}</vn-td>
|
<vn-td shrink>{{entry.packageValue | currency: 'EUR': 2}}</vn-td>
|
||||||
<vn-td shrink>{{entry.cc}}</vn-td>
|
<vn-td shrink>{{entry.cc}}</vn-td>
|
||||||
<vn-td shrink>{{entry.pallet}}</vn-td>
|
<vn-td shrink>{{entry.pallet}}</vn-td>
|
||||||
<vn-td shrink>{{entry.m3}}</vn-td>
|
<vn-td shrink>{{entry.m3}}</vn-td>
|
||||||
|
@ -81,13 +83,28 @@
|
||||||
icon="insert_drive_file">
|
icon="insert_drive_file">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
<vn-icon
|
<vn-icon
|
||||||
ng-if="entry.notes.length"
|
ng-if="entry.observation.length"
|
||||||
vn-tooltip="{{entry.observation}}"
|
vn-tooltip="{{entry.observation}}"
|
||||||
icon="insert_drive_file">
|
icon="insert_drive_file">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
|
<vn-tfoot>
|
||||||
|
<vn-tr>
|
||||||
|
<vn-td></vn-td>
|
||||||
|
<vn-td></vn-td>
|
||||||
|
<vn-td></vn-td>
|
||||||
|
<vn-td></vn-td>
|
||||||
|
<vn-td shrink><strong>{{$ctrl.total('hb')}}</strong></vn-td>
|
||||||
|
<vn-td shrink><strong>{{$ctrl.total('freightValue') | currency: 'EUR': 2}}</strong></vn-td>
|
||||||
|
<vn-td shrink><strong>{{$ctrl.total('packageValue') | currency: 'EUR': 2}}</strong></vn-td>
|
||||||
|
<vn-td shrink><strong>{{$ctrl.total('cc')}}</strong></vn-td>
|
||||||
|
<vn-td shrink><strong>{{$ctrl.total('pallet')}}</strong></vn-td>
|
||||||
|
<vn-td shrink><strong>{{$ctrl.total('m3')}}</strong></vn-td>
|
||||||
|
<vn-td></vn-td>
|
||||||
|
</vn-tr>
|
||||||
|
</vn-tfoot>
|
||||||
</vn-table>
|
</vn-table>
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
|
@ -5,6 +5,7 @@ class Controller {
|
||||||
constructor($scope, $http) {
|
constructor($scope, $http) {
|
||||||
this.$ = $scope;
|
this.$ = $scope;
|
||||||
this.$http = $http;
|
this.$http = $http;
|
||||||
|
this.entries = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
get travel() {
|
get travel() {
|
||||||
|
@ -31,6 +32,15 @@ class Controller {
|
||||||
this.entries = response.data;
|
this.entries = response.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
total(field) {
|
||||||
|
let total = 0;
|
||||||
|
|
||||||
|
for (let entry of this.entries)
|
||||||
|
total += entry[field];
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope', '$http'];
|
Controller.$inject = ['$scope', '$http'];
|
||||||
|
|
|
@ -58,4 +58,18 @@ describe('component vnTravelSummary', () => {
|
||||||
expect(controller.entries).toEqual('I am the entries');
|
expect(controller.entries).toEqual('I am the entries');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('total()', () => {
|
||||||
|
it('should calculate the total amount of a given property for every row', () => {
|
||||||
|
controller.entries = [
|
||||||
|
{id: 1, freightValue: 1, packageValue: 2, cc: 0.01},
|
||||||
|
{id: 2, freightValue: 1, packageValue: 2, cc: 0.01},
|
||||||
|
{id: 3, freightValue: 1, packageValue: 2, cc: 0.01}
|
||||||
|
];
|
||||||
|
|
||||||
|
expect(controller.total('freightValue')).toEqual(3);
|
||||||
|
expect(controller.total('packageValue')).toEqual(6);
|
||||||
|
expect(controller.total('cc')).toEqual(0.03);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,6 +12,6 @@ Confirmed: Confirmada
|
||||||
Entry Id: Entrada Id
|
Entry Id: Entrada Id
|
||||||
Supplier: Proveedor
|
Supplier: Proveedor
|
||||||
Pallet: Pallet
|
Pallet: Pallet
|
||||||
Freight cost: Coste porte
|
Freight: Porte
|
||||||
Package cost: Coste embalaje
|
Package: Embalaje
|
||||||
Half box: Media caja
|
Half box: Media caja
|
||||||
|
|
|
@ -4,8 +4,10 @@ let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development';
|
||||||
let configPath = `/etc/salix`;
|
let configPath = `/etc/salix`;
|
||||||
let config = require('../config/print.json');
|
let config = require('../config/print.json');
|
||||||
let configFiles = [
|
let configFiles = [
|
||||||
|
`${appPath}/config/print.local.json`,
|
||||||
`${appPath}/config/print.${env}.json`,
|
`${appPath}/config/print.${env}.json`,
|
||||||
`${configPath}/print.json`,
|
`${configPath}/print.json`,
|
||||||
|
`${configPath}/print.local.json`,
|
||||||
`${configPath}/print.${env}.json`
|
`${configPath}/print.${env}.json`
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
const Stylesheet = require(`${appPath}/core/stylesheet`);
|
||||||
|
|
||||||
|
module.exports = new Stylesheet([
|
||||||
|
`${appPath}/common/css/spacing.css`,
|
||||||
|
`${appPath}/common/css/misc.css`,
|
||||||
|
`${appPath}/common/css/layout.css`,
|
||||||
|
`${appPath}/common/css/email.css`])
|
||||||
|
.mergeStyles();
|
|
@ -0,0 +1,69 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html v-bind:lang="locale">
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
<meta name="format-detection" content="telephone=no">
|
||||||
|
<title>{{ $t('subject') }}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table class="grid">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<!-- Empty block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block empty"></div>
|
||||||
|
</div>
|
||||||
|
<!-- Header block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block">
|
||||||
|
<email-header v-bind="$props"></email-header>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block vn-pa-lg">
|
||||||
|
<h1>{{ $t('title') }}</h1>
|
||||||
|
<p>{{$t('dear')}},</p>
|
||||||
|
<p v-html="$t('description', [dated])"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block vn-pa-lg">
|
||||||
|
<table class="column-oriented">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{$t('buyer')}}</th>
|
||||||
|
<th class="number">{{$t('percentage')}}</th>
|
||||||
|
<th class="number">{{$t('dwindle')}}</th>
|
||||||
|
<th class="number">{{$t('total')}}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="waste in wastes" v-bind:key="waste.buyer">
|
||||||
|
<td class="font gray">{{waste.buyer}}</td>
|
||||||
|
<td class="number">{{(waste.percentage / 100) | percentage(4, 4, locale)}}</td>
|
||||||
|
<td class="number">{{waste.dwindle | currency('EUR', locale)}}</td>
|
||||||
|
<td class="number">{{waste.total | currency('EUR', locale)}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Footer block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block">
|
||||||
|
<email-footer v-bind="$props"></email-footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Empty block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block empty"></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,31 @@
|
||||||
|
const Component = require(`${appPath}/core/component`);
|
||||||
|
const db = require(`${appPath}/core/database`);
|
||||||
|
const emailHeader = new Component('email-header');
|
||||||
|
const emailFooter = new Component('email-footer');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'buyer-week-waste',
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.wastes = await this.fetchWastes();
|
||||||
|
|
||||||
|
if (!this.wastes)
|
||||||
|
throw new Error('Something went wrong');
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
dated: function() {
|
||||||
|
const filters = this.$options.filters;
|
||||||
|
|
||||||
|
return filters.date(new Date(), '%d-%m-%Y');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchWastes() {
|
||||||
|
return db.findOne(`CALL bs.weekWaste()`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
'email-header': emailHeader.build(),
|
||||||
|
'email-footer': emailFooter.build()
|
||||||
|
},
|
||||||
|
props: {}
|
||||||
|
};
|
|
@ -0,0 +1,8 @@
|
||||||
|
subject: Merma semanal
|
||||||
|
title: Merma semanal
|
||||||
|
dear: Hola
|
||||||
|
description: A continuación se muestra la merma semanal a fecha de <strong>{0}</strong>.
|
||||||
|
buyer: Comprador
|
||||||
|
percentage: Porcentaje
|
||||||
|
weakening: Mermas
|
||||||
|
total: Total
|
|
@ -12,4 +12,4 @@ claim: Reclamación {0}
|
||||||
sections:
|
sections:
|
||||||
agency:
|
agency:
|
||||||
description: 'Para agilizar tu recogida, por favor, pónte en contacto con la oficina
|
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