create entry.index
gitea/salix/1990-create_entry_section This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2020-01-10 11:52:35 +01:00
parent 44c611db5b
commit 6c4e25bfe3
30 changed files with 599 additions and 11 deletions

View File

@ -1,3 +1,3 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Thermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('TravelThermograph', '*', '*', 'ALLOW', 'ROLE', 'buyer');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Entry', '*', '*', 'ALLOW', 'ROLE', 'buyer');

View File

@ -23,6 +23,18 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-buyrequest:before {
content: "\e914";
}
.icon-entry:before {
content: "\e959";
}
.icon-thermometer:before {
content: "\e95a";
}
.icon-deletedTicket:before {
content: "\e958";
}
.icon-fruit:before {
content: "\e957";
}
@ -134,9 +146,6 @@
.icon-doc:before {
content: "\e913";
}
.icon-entry:before {
content: "\e914";
}
.icon-exit:before {
content: "\e947";
}
@ -287,6 +296,3 @@
.icon-worker:before {
content: "\e943";
}
.icon-deletedTicket:before {
content: "\e958";
}

View File

@ -27,7 +27,7 @@
<glyph unicode="&#xe911;" glyph-name="details" d="M908.823 844.777v-797.867h-793.6v797.867h793.6zM972.823 959.977h-921.6c-29.867 0-51.2-21.333-51.2-51.2v-921.6c0-21.333 21.333-51.2 51.2-51.2h921.6c21.333 0 51.2 29.867 51.2 51.2v921.6c0 29.867-29.867 51.2-51.2 51.2zM456.556 733.844h341.333v-115.2h-341.333v115.2zM456.556 503.444h341.333v-115.2h-341.333v115.2zM456.556 277.31h341.333v-115.2h-341.333v115.2zM226.156 733.844h115.2v-115.2h-115.2v115.2zM226.156 503.444h115.2v-115.2h-115.2v115.2zM226.156 277.31h115.2v-115.2h-115.2v115.2z" />
<glyph unicode="&#xe912;" glyph-name="fiscal" d="M140.8 520.533v-341.333h149.333v341.333h-149.333zM439.467 520.533v-341.333h149.333v341.333h-149.333zM38.4-64h942.933v145.067h-942.933v-145.067zM733.867 520.533v-341.333h149.333v341.333h-149.333zM512 960l-473.6-243.2v-98.133h942.933v98.133l-469.333 243.2z" />
<glyph unicode="&#xe913;" glyph-name="doc" d="M614.4 960h-409.6c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h614.4c55.467 0 102.4 46.933 102.4 102.4v614.4l-307.2 307.2zM716.8 140.8h-409.6v102.4h409.6v-102.4zM716.8 345.6h-409.6v102.4h409.6v-102.4zM563.2 601.6v281.6l281.6-281.6h-281.6z" />
<glyph unicode="&#xe914;" glyph-name="entry" d="M0-64h1024v430.933h-264.533v-166.4l-247.467 247.467 247.467 247.467v-166.4h264.533v430.933h-1024v-1024z" />
<glyph unicode="&#xe914;" glyph-name="buyrequest" d="M520.533 878.933c-34.133 0-55.467-25.6-55.467-55.467s25.6-55.467 55.467-55.467 55.467 25.6 55.467 55.467-21.333 55.467-55.467 55.467zM520.533 806.4c-12.8 0-17.067 8.533-17.067 17.067s8.533 17.067 17.067 17.067 17.067-8.533 17.067-17.067-4.267-17.067-17.067-17.067zM588.8 247.467l-4.267 12.8v4.267l-17.067 59.733h-273.067v-89.6h298.667zM294.4 686.933h452.267v-89.6h-452.267v89.6zM571.733 430.933c17.067 12.8 38.4 17.067 59.733 8.533l64-25.6h55.467v89.6h-456.533v-89.6h264.533c4.267 8.533 8.533 12.8 12.8 17.067zM643.985 256.128l95.27 85.478 202.299-225.473-95.27-85.478-202.299 225.473zM855.196 15.592l95.283 85.466 22.791-25.409-95.283-85.466-22.791 25.409zM1015.467 29.867l-34.133 38.4-93.867-85.333 34.133-38.4c4.267-4.267 12.8-8.533 17.067-8.533 8.533 0 12.8 0 17.067 8.533l59.733 51.2c8.533 8.533 12.8 25.6 0 34.133zM614.4 401.067c-4.267 0-8.533 0-12.8-4.267-4.267 0-4.267-8.533-4.267-12.8l34.133-119.467 93.867 85.333-110.933 51.2zM729.6 93.867h-524.8c-29.867 0-51.2 25.6-51.2 51.2v635.733c0 25.6 21.333 51.2 51.2 51.2h213.333l8.533 25.6c12.8 38.4 51.2 64 93.867 64s76.8-25.6 93.867-64l8.533-25.6h213.333c29.867 0 51.2-25.6 51.2-51.2v-541.867l38.4-42.667v584.533c0 46.933-42.667 89.6-89.6 89.6h-187.733c-17.067 51.2-68.267 89.6-128 89.6s-110.933-38.4-128-89.6h-187.733c-46.933 0-89.6-42.667-89.6-89.6v-635.733c0-46.933 42.667-89.6 89.6-89.6h554.667l-29.867 38.4z" />
<glyph unicode="&#xe915;" glyph-name="eye" d="M512 797.867c-234.667 0-430.933-145.067-512-349.867 81.067-204.8 277.333-349.867 512-349.867s430.933 145.067 512 349.867c-81.067 204.8-277.333 349.867-512 349.867zM512 213.333c-128 0-234.667 102.4-234.667 234.667s106.667 234.667 234.667 234.667 234.667-106.667 234.667-234.667-106.667-234.667-234.667-234.667zM512 588.8c-76.8 0-140.8-64-140.8-140.8s64-140.8 140.8-140.8 140.8 64 140.8 140.8-64 140.8-140.8 140.8z" />
<glyph unicode="&#xe916;" glyph-name="flower" d="M905.6 636.8c-9.6 3.2-19.2 19.2-16 25.6 6.4 89.6-25.6 163.2-99.2 214.4-76.8 51.2-156.8 54.4-236.8 9.6-19.2-9.6-28.8-9.6-48 0-76.8 48-153.6 54.4-233.6 12.8-80-44.8-118.4-112-121.6-201.6 0-19.2-6.4-28.8-25.6-38.4-83.2-41.6-124.8-108.8-128-201.6 0-80 32-150.4 102.4-192 22.4-16 38.4-28.8 28.8-57.6 3.2-89.6 38.4-160 115.2-201.6 76.8-44.8 156.8-38.4 233.6 3.2 6.4 3.2 22.4 0 32-3.2 38.4-12.8 73.6-38.4 112-38.4 140.8-9.6 243.2 89.6 246.4 233.6 0 9.6 9.6 19.2 16 25.6 28.8 25.6 70.4 48 92.8 80 86.4 112 48 259.2-70.4 329.6zM806.4 300.8c-16-3.2-28.8-3.2-48-6.4 6.4-16 9.6-32 12.8-44.8 25.6-70.4 0-140.8-64-176-64-32-134.4-12.8-179.2 51.2-6.4 12.8-16 22.4-22.4 32-22.4-22.4-41.6-44.8-64-60.8-51.2-38.4-118.4-35.2-166.4 3.2s-64 105.6-41.6 163.2c6.4 16 12.8 32 22.4 51.2-22.4 3.2-38.4 9.6-57.6 12.8-67.2 16-115.2 76.8-108.8 140.8 6.4 67.2 60.8 121.6 131.2 128 16 0 28.8 3.2 48 6.4-6.4 19.2-12.8 38.4-19.2 57.6-22.4 60.8 6.4 128 64 160s131.2 16 172.8-38.4c9.6-12.8 22.4-28.8 35.2-44.8 12.8 12.8 25.6 25.6 35.2 41.6 38.4 48 112 64 169.6 35.2s86.4-96 67.2-156.8c-6.4-22.4-16-44.8-28.8-70.4 16-3.2 32-6.4 48-9.6 73.6-12.8 118.4-67.2 118.4-140.8s-51.2-124.8-124.8-134.4zM512 624c-102.4 0-176-76.8-176-176 0-102.4 80-179.2 179.2-179.2 96 0 176 83.2 176 179.2s-80 176-179.2 176zM512 358.4c-48 0-89.6 38.4-86.4 89.6 0 48 41.6 86.4 86.4 86.4s86.4-41.6 86.4-89.6c0-48-38.4-86.4-86.4-86.4z" />
<glyph unicode="&#xe917;" glyph-name="frozen" d="M1024 499.2h-213.333l166.4 166.4-72.533 72.533-238.933-238.933h-102.4v102.4l238.933 238.933-72.533 72.533-166.4-166.4v213.333h-102.4v-213.333l-166.4 166.4-72.533-72.533 238.933-238.933v-102.4h-102.4l-238.933 238.933-72.533-72.533 166.4-166.4h-213.333v-102.4h213.333l-166.4-166.4 72.533-72.533 238.933 238.933h102.4v-102.4l-238.933-238.933 72.533-72.533 166.4 166.4v-213.333h102.4v213.333l166.4-166.4 72.533 72.533-238.933 238.933v102.4h102.4l238.933-238.933 72.533 72.533-166.4 166.4h213.333v102.4z" />
@ -96,4 +96,6 @@
<glyph unicode="&#xe956;" glyph-name="deliveryprices" d="M789.333 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM789.333 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM251.733 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM251.733 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM1006.933 537.6l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-554.667c0-29.867 25.6-51.2 51.2-51.2h68.267c8.533 64 64 115.2 132.267 115.2 64 0 123.733-51.2 132.267-115.2h268.8c8.533 64 64 115.2 132.267 115.2s128-51.2 136.533-115.2h51.2c29.867 0 51.2 25.6 51.2 51.2v260.267c0 17.067-8.533 34.133-17.067 46.933zM392.533 605.867v-38.4h-170.667c0-8.533 0-12.8 0-17.067s0-12.8 0-17.067h170.667v-42.667h-157.867c12.8-25.6 25.6-42.667 51.2-59.733 21.333-12.8 46.933-21.333 76.8-21.333 42.667 0 76.8 17.067 102.4 46.933l46.933-42.667c-17.067-21.333-38.4-38.4-68.267-46.933-25.6-12.8-55.467-17.067-89.6-17.067s-64 4.267-89.6 17.067c-25.6 12.8-51.2 29.867-68.267 51.2s-29.867 42.667-38.4 72.533h-64v38.4h55.467c0 4.267 0 8.533 0 17.067s0 12.8 0 17.067h-55.467v42.667h64c8.533 29.867 21.333 51.2 38.4 76.8s42.667 38.4 68.267 51.2c29.867 8.533 59.733 12.8 93.867 12.8 29.867 0 59.733-4.267 89.6-17.067 25.6-8.533 46.933-25.6 64-46.933l-46.933-42.667c-29.867 29.867-64 46.933-102.4 46.933-29.867 0-55.467-8.533-76.8-21.333-25.6-17.067-42.667-34.133-51.2-59.733h157.867zM921.6 529.067h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8z" />
<glyph unicode="&#xe957;" glyph-name="fruit" d="M870.4 814.933c-204.8 196.267-529.067 192-725.333-8.533-196.267-204.8-192-529.067 8.533-725.333s524.8-192 725.333 12.8c196.267 200.533 192 524.8-8.533 721.067zM840.533 128c-174.933-179.2-465.067-183.467-644.267-8.533s-179.2 465.067-4.267 644.267 465.067 183.467 644.267 8.533c179.2-174.933 179.2-460.8 4.267-644.267zM145.067 366.933c-38.4 51.2-4.267 149.333 8.533 162.133 29.867 17.067 157.867-25.6 183.467-38.4s98.133-29.867 98.133-55.467c0-29.867-64-46.933-119.467-55.467-59.733-12.8-153.6-38.4-170.667-12.8zM256 170.667c-59.733 17.067-89.6 102.4-85.333 119.467 12.8 29.867 136.533 68.267 162.133 76.8 25.6 4.267 93.867 34.133 106.667 12.8 17.067-25.6-29.867-64-64-106.667-38.4-46.933-89.6-115.2-119.467-102.4zM405.333 622.933c-25.6 51.2-72.533 128-51.2 153.6 38.4 51.2 132.267 51.2 145.067 38.4 25.6-21.333 17.067-157.867 12.8-183.467s0-102.4-25.6-106.667c-29.867-8.533-55.467 46.933-81.067 98.133zM537.6 648.533c8.533 59.733 8.533 149.333 42.667 162.133 59.733 21.333 140.8-29.867 149.333-51.2 8.533-34.133-72.533-145.067-93.867-166.4s-59.733-85.333-85.333-76.8c-29.867 12.8-17.067 76.8-12.8 132.267zM494.933 217.6c-8.533-51.2-12.8-128-38.4-136.533-51.2-17.067-119.467 25.6-123.733 42.667-8.533 29.867 68.267 123.733 85.333 140.8s51.2 72.533 72.533 64c21.333-4.267 8.533-59.733 4.267-110.933zM320 516.267c-55.467 25.6-136.533 51.2-136.533 85.333 0 64 68.267 123.733 85.333 123.733 34.133 0 110.933-110.933 128-132.267 12.8-25.6 64-76.8 46.933-98.133-17.067-29.867-72.533 0-123.733 21.333zM887.467 482.133c38.4-51.2 8.533-149.333-17.067-162.133-29.867-17.067-145.067 38.4-170.667 46.933-25.6 12.8-98.133 29.867-98.133 55.467 0 29.867 64 38.4 123.733 51.2 55.467 8.533 140.8 34.133 162.133 8.533zM785.067 686.933c55.467-17.067 89.6-98.133 85.333-115.2-8.533-29.867-132.267-64-157.867-72.533-25.6-4.267-89.6-29.867-102.4-12.8-17.067 25.6 25.6 64 64 102.4 29.867 42.667 76.8 106.667 110.933 98.133zM725.333 328.533c51.2-17.067 102.4-46.933 102.4-76.8-4.267-51.2-64-115.2-98.133-115.2-29.867 0-89.6 106.667-102.4 132.267-12.8 21.333-51.2 76.8-34.133 98.133s76.8-17.067 132.267-38.4zM610.133 238.933c21.333-46.933 59.733-110.933 38.4-132.267-34.133-42.667-115.2-42.667-128-29.867-21.333 17.067-8.533 136.533-4.267 157.867 4.267 25.6 4.267 89.6 25.6 93.867 29.867 4.267 46.933-46.933 68.267-89.6z" />
<glyph unicode="&#xe958;" glyph-name="deletedTicket" horiz-adv-x="900" d="M96.823 84.328h694.333v640.777c0 0-2.019 234.895-350.243 234.895s-344.090-234.895-344.090-234.895v-640.777zM227.684 652.223h171.244v152.494h102.496v-152.494h171.276v-102.496h-171.276v-357.519h-102.496v357.519h-171.244v102.496zM0 59.649v-123.649h900.415v123.649h-900.415z" />
<glyph unicode="&#xe959;" glyph-name="entry" d="M0 328.882l392.882-392.882 265.404 265.404-100.31 100.31-102.4-100.31v303.020h303.020l-100.31-102.4 100.31-100.31 265.404 265.404-392.882 392.882z" />
<glyph unicode="&#xe95a;" glyph-name="thermometer" d="M641.567 326.792v35.527h64.784v25.078h-64.784v119.118h64.784v25.078h-64.784v119.118h64.784v25.078h-64.784v121.208h64.784v25.078h-64.784v8.359c0 71.053-58.514 129.567-129.567 129.567s-129.567-58.514-129.567-129.567v-503.641c-54.335-39.706-87.771-104.49-87.771-173.453 0-119.118 96.131-217.339 217.339-217.339 119.118 0 217.339 96.131 217.339 217.339 0 66.873-33.437 131.657-87.771 173.453zM512-28.473c-100.31 0-179.722 81.502-179.722 179.722 0 64.784 33.437 123.298 87.771 154.645v524.539c0 50.155 41.796 91.951 91.951 91.951s91.951-41.796 91.951-91.951v-522.449c54.335-31.347 87.771-89.861 87.771-154.645 0-100.31-79.412-181.812-179.722-181.812zM652.016 435.461v25.078h35.527v-25.078h-35.527zM652.016 579.657v25.078h35.527v-25.078h-35.527zM652.016 723.853v25.078h35.527v-25.078h-35.527zM568.424 284.996v543.347c0 0 0 0 0 0s0 0 0 0v0 0c0 31.347-25.078 56.424-56.424 56.424s-56.424-25.078-56.424-56.424v0-543.347c-52.245-20.898-87.771-73.143-87.771-131.657 0-79.412 64.784-144.196 144.196-144.196s144.196 64.784 144.196 144.196c0 58.514-35.527 108.669-87.771 131.657zM470.204 824.163v4.18c0 22.988 18.808 41.796 41.796 41.796s41.796-18.808 41.796-41.796v-219.429h-85.682v215.249z" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -17,5 +17,6 @@ export default function moduleImport(moduleName) {
case 'worker' : return import('worker/front');
case 'invoiceOut' : return import('invoiceOut/front');
case 'route' : return import('route/front');
case 'entry' : return import('entry/front');
}
}

View File

@ -43,6 +43,7 @@ Workers: Trabajadores
Routes: Rutas
Locator: Localizador
Invoices out: Facturas emitidas
Entries: Entradas
# Common

View File

@ -0,0 +1,149 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
const buildFilter = require('vn-loopback/util/filter').buildFilter;
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
module.exports = Self => {
Self.remoteMethodCtx('filter', {
description: 'Find all instances of the model matched by filter from the data source.',
accessType: 'READ',
accepts: [
{
arg: 'filter',
type: 'Object',
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
http: {source: 'query'}
}, {
arg: 'search',
type: 'String',
description: 'Searchs the entry by id',
http: {source: 'query'}
}, {
arg: 'id',
type: 'Integer',
description: 'The entry id',
http: {source: 'query'}
}, {
arg: 'created',
type: 'Date',
description: 'The created date to filter',
http: {source: 'query'}
}, {
arg: 'travelFk',
type: 'Number',
description: 'The travel id to filter',
http: {source: 'query'}
}, {
arg: 'companyFk',
type: 'Number',
description: 'The company to filter',
http: {source: 'query'}
}, {
arg: 'isBooked',
type: 'Boolean',
description: 'The isBokked filter',
http: {source: 'query'}
}, {
arg: 'isConfirmed',
type: 'Boolean',
description: 'The isConfirmed filter',
http: {source: 'query'}
}, {
arg: 'isOrdered',
type: 'Boolean',
description: 'The isOrdered filter',
http: {source: 'query'}
}, {
arg: 'ref',
type: 'String',
description: 'The ref filter',
http: {source: 'query'}
}, {
arg: 'supplierFk',
type: 'Number',
description: 'The supplier id to filter',
http: {source: 'query'}
}, {
arg: 'currencyFk',
type: 'Number',
description: 'The currency id to filter',
http: {source: 'query'}
}
],
returns: {
type: ['Object'],
root: true
},
http: {
path: `/filter`,
verb: 'GET'
}
});
Self.filter = async(ctx, filter) => {
let conn = Self.dataSource.connector;
let where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
return {'e.id': value};
case 'ref':
param = `e.${param}`;
return {[param]: {like: `%${value}%`}};
case 'created':
return {'e.created': {gte: value}};
case 'id':
case 'isBooked':
case 'isConfirmed':
case 'isOrdered':
case 'companyFk':
case 'travelFk':
case 'currencyFk':
case 'supplierFk':
param = `e.${param}`;
return {[param]: value};
}
});
filter = mergeFilters(ctx.args.filter, {where});
let stmts = [];
let stmt;
stmt = new ParameterizedSQL(
`SELECT
e.id,
e.supplierFk,
e.dated,
e.ref,
e.isBooked,
e.isInventory,
e.notes,
e.isConfirmed,
e.isOrdered,
e.isRaid,
e.commission,
e.created,
e.evaNotes,
e.travelFk,
e.currencyFk,
e.companyFk,
e.gestDocFk,
e.invoiceInFk,
s.name AS supplierName,
co.code AS companyCode,
cu.code AS currencyCode
FROM vn.entry e
JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.travel t ON t.id = e.travelFk
JOIN vn.company co ON co.id = e.companyFk
JOIN vn.currency cu ON cu.id = e.currencyFk`
);
stmt.merge(conn.makeSuffix(filter));
let itemsIndex = stmts.push(stmt) - 1;
let sql = ParameterizedSQL.join(stmts, ';');
let result = await conn.executeStmt(sql);
return itemsIndex === 0 ? result : result[itemsIndex];
};
};

View File

@ -0,0 +1,77 @@
const app = require('vn-loopback/server/server');
describe('Entry filter()', () => {
it('should return the entry matching "search"', async() => {
let ctx = {
args: {
search: 1
}
};
let result = await app.models.Entry.filter(ctx);
expect(result.length).toEqual(1);
expect(result[0].id).toEqual(1);
});
it('should return the entry matching the currency', async() => {
let ctx = {
args: {
currencyFk: 1
}
};
let result = await app.models.Entry.filter(ctx);
expect(result.length).toEqual(7);
});
it('should return the entry matching the supplier', async() => {
let ctx = {
args: {
supplierFk: 2
}
};
let result = await app.models.Entry.filter(ctx);
expect(result.length).toEqual(5);
});
it('should return the entry matching the company', async() => {
let ctx = {
args: {
companyFk: 442
}
};
let result = await app.models.Entry.filter(ctx);
expect(result.length).toEqual(6);
});
it('should return the entries matching isBooked', async() => {
let ctx = {
args: {
isBooked: true,
}
};
let result = await app.models.Entry.filter(ctx);
expect(result.length).toEqual(0);
});
it('should return the routes matching the reference and travel', async() => {
let ctx = {
args: {
reference: 'movement',
travelFk: '2'
}
};
let result = await app.models.Entry.filter(ctx);
expect(result.length).toEqual(2);
});
});

View File

@ -0,0 +1,5 @@
{
"Entry": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,4 @@
module.exports = Self => {
require('../methods/entry/filter')(Self);
};

View File

@ -0,0 +1,5 @@
<vn-portal slot="menu">
<vn-entry-descriptor entry="$ctrl.entry"></vn-entry-descriptor>
<vn-left-menu source="card"></vn-left-menu>
</vn-portal>
<ui-view></ui-view>

View File

@ -0,0 +1,33 @@
import ngModule from '../module';
import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard {
reload() {
let filter = {
include: [
{
relation: 'company',
scope: {
fields: ['id', 'code']
}
}, {
relation: 'travel'
}, {
relation: 'supplier',
scope: {
fields: ['id', 'name']
}
}, {
relation: 'currency'
}
]
};
this.$http.get(`Entries/${this.$params.id}`, {filter})
.then(response => this.entry = response.data);
}
}
ngModule.component('vnEntry Card', {
template: require('./index.html'),
controller: Controller
});

View File

@ -0,0 +1,21 @@
<div class="vn-descriptor">
<div class="header">
<a translate-attr="{title: 'Return to module index'}" ui-sref="entry.index">
<vn-icon icon="chevron_left"></vn-icon>
</a>
<a translate-attr="{title: 'Preview'}" ui-sref="entry.card.summary({id: $ctrl.entry.id})">
<vn-icon icon="desktop_windows"></vn-icon>
</a>
<span></span>
</div>
<div class="body">
<div class="attributes">
<vn-label-value label="Id"
value="{{$ctrl.entry.id}}">
</vn-label-value>
<vn-label-value label="Reference"
value="{{$ctrl.entry.ref}}">
</vn-label-value>
</div>
</div>
</div>

View File

@ -0,0 +1,20 @@
import ngModule from '../module';
class Controller {
constructor($scope) {
this.$ = $scope;
}
}
Controller.$inject = ['$scope'];
ngModule.component('vnEntryDescriptor', {
template: require('./index.html'),
bindings: {
entry: '<'
},
require: {
card: '^?vnEntryCard'
},
controller: Controller
});

View File

@ -0,0 +1 @@
Reference: Referencia

View File

@ -0,0 +1,11 @@
export * from './module';
import './main';
import './index/';
import './search-panel';
import './descriptor';
import './card';
// import './summary';
// import './basic-data';
// import './log';
// import './create';

View File

@ -0,0 +1,63 @@
<vn-crud-model
vn-id="model"
url="Entries/filter"
limit="20"
params="::$ctrl.params"
data="entries"
auto-load="true">
</vn-crud-model>
<vn-auto-search
on-search="$ctrl.onSearch($params)">
</vn-auto-search>
<vn-data-viewer
model="model"
class="vn-mb-xl vn-w-xl">
<vn-card>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th field="id" number>Id</vn-th>
<vn-th field="created" center>Created</vn-th>
<vn-th field="travelFk">Travel</vn-th>
<vn-th>Notes</vn-th>
<vn-th>Reference</vn-th>
<vn-th field="isBooked" center>Booked</vn-th>
<vn-th field="isInventory" center>Is inventory</vn-th>
<vn-th field="isConfirmed" center>Confirmed</vn-th>
<vn-th field="isOrdered" center>Ordered</vn-th>
<vn-th field="isRaid" center>Is raid</vn-th>
<vn-th center>Commission</vn-th>
<vn-th field="supplierFk">Supplier</vn-th>
<vn-th field="currencyFk" center>Currency</vn-th>
<vn-th field="companyFk" center>Company</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<a ng-repeat="entry in entries"
class="clickable vn-tr search-result"
ui-sref="entry.card.summary({id: {{::entry.id}}})">
<vn-td number>{{::entry.id}}</vn-td>
<vn-td center>{{::entry.created | date:'dd/MM/yyyy'}}</vn-td>
<vn-td center expand>{{::entry.travelFk}}</vn-td>
<vn-td expand>{{::entry.notes}}</vn-td>
<vn-td expand>{{::entry.ref}}</vn-td>
<vn-td center><vn-check ng-model="entry.isBooked" disabled="true"></vn-check></vn-td>
<vn-td center><vn-check ng-model="entry.isInventory" disabled="true"></vn-check></vn-td>
<vn-td center><vn-check ng-model="entry.isConfirmed" disabled="true"></vn-check></vn-td>
<vn-td center><vn-check ng-model="entry.isOrdered" disabled="true"></vn-check></vn-td>
<vn-td center><vn-check ng-model="entry.isRaid" disabled="true"></vn-check></vn-td>
<vn-td center expand>{{::entry.commission}}</vn-td>
<vn-td expand>{{::entry.supplierName}}</vn-td>
<vn-td center expand>{{::entry.currencyCode}}</vn-td>
<vn-td center expand>{{::entry.companyCode}}</vn-td>
</a>
</vn-tbody>
</vn-table>
</vn-data-viewer>
</vn-card>
<vn-popup vn-id="summary">
<vn-entry-summary
entry="$ctrl.entrySelected">
</vn-entry-summary>
</vn-popup>
<vn-scroll-up></vn-scroll-up>

View File

@ -0,0 +1,21 @@
import ngModule from '../module';
export default class Controller {
constructor($scope) {
this.$ = $scope;
}
onSearch(params) {
if (params)
this.$.model.applyFilter(null, params);
else
this.$.model.clear();
}
}
Controller.$inject = ['$scope'];
ngModule.component('vnEntryIndex', {
template: require('./index.html'),
controller: Controller
});

View File

@ -0,0 +1,15 @@
#Ordenar alfabeticamente
Reference: Referencia
Created: Creado
Booked: Facturado
Is inventory: Inventario
Notes: Notas
Travel: Envío
Supplier: Proveedor
Currency: Moneda
Company: Empresa
Confirmed: Confirmada
Ordered: Pedida
Is raid: Redada
Commission: Comisión
# Sections

View File

@ -0,0 +1,11 @@
<vn-portal slot="topbar">
<vn-searchbar
search-state="entry.index"
panel="vn-entry-search-panel"
info="Search entrys by id">
</vn-searchbar>
</vn-portal>
<vn-portal slot="menu">
<vn-left-menu></vn-left-menu>
</vn-portal>
<ui-view></ui-view>

View File

@ -0,0 +1,9 @@
import ngModule from '../module';
import ModuleMain from 'salix/components/module-main';
export default class Entry extends ModuleMain {}
ngModule.vnComponent('vnEntry', {
controller: Entry,
template: require('./index.html')
});

View File

@ -0,0 +1,3 @@
import {ng} from 'core/vendor';
export default ng.module('entry', ['vnCore']);

View File

@ -0,0 +1,32 @@
{
"module": "entry",
"name": "Entries",
"icon": "icon-entry",
"validations": true,
"menus": {
"main": [
{"state": "entry.index", "icon": "icon-entry"}
],
"card": [
]
},
"routes": [
{
"url": "/entry",
"state": "entry",
"abstract": true,
"component": "vn-entry",
"description": "Entries"
}, {
"url": "/index?q",
"state": "entry.index",
"component": "vn-entry-index",
"description": "Entries"
}, {
"url": "/:id",
"state": "entry.card",
"abstract": true,
"component": "vn-entry-card"
}
]
}

View File

@ -0,0 +1,78 @@
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield
vn-one
label="General search"
ng-model="filter.search"
info="Search entries by id"
vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Reference"
ng-model="filter.ref">
</vn-textfield>
<vn-textfield
vn-one
label="Travel"
ng-model="filter.travelFk">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="Company"
ng-model="filter.companyFk"
url="Companies"
show-field="code"
value-field="id">
</vn-autocomplete>
<vn-autocomplete
vn-one
label="Currency"
ng-model="filter.currencyFk"
url="Currencies"
show-field="name"
value-field="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="Supplier"
ng-model="filter.supplierFk"
url="Suppliers"
show-field="name"
value-field="id">
</vn-autocomplete>
<vn-date-picker
vn-one
label="Created"
ng-model="filter.created">
</vn-date-picker>
</vn-horizontal>
<vn-horizontal>
<vn-check
vn-one
label="Booked"
ng-model="filter.isBooked">
</vn-check>
<vn-check
vn-one
label="Confirmed"
ng-model="filter.isConfirmed">
</vn-check>
<vn-check
vn-one
label="Ordered"
ng-model="filter.isOrdered">
</vn-check>
</vn-horizontal>
<vn-horizontal class="vn-mt-lg">
<vn-submit label="Search"></vn-submit>
</vn-horizontal>
</form>
</div>

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
ngModule.component('vnEntrySearchPanel', {
template: require('./index.html'),
controller: SearchPanel
});

View File

@ -0,0 +1,7 @@
Ticket id: Id ticket
Client id: Id cliente
Nickname: Alias
From: Desde
To: Hasta
Agency: Agencia
Warehouse: Almacén

View File

@ -1,8 +1,6 @@
{
"Travel": {
"dataSource": "vn"
},"Entry": {
"dataSource": "vn"
},"TravelLog": {
"dataSource": "vn"
},"Currency": {

View File

@ -21,5 +21,13 @@
"ratio": {
"type": "Number"
}
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}