4073-feat(user): add section privileges and remove changeRole in descriptor #1073

Merged
joan merged 2 commits from 4073-user_privileges into dev 2022-10-06 11:54:19 +00:00
20 changed files with 61 additions and 51 deletions
Showing only changes of commit cca2878716 - Show all commits

View File

@ -394,7 +394,7 @@ export default {
intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Intrastat"]',
originCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Origin"]',
buyerCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Buyer"]',
densityCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Density"]',
weightByPieceCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check[label="Weight/Piece"]',
saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button'
},
itemFixedPrice: {

View File

@ -31,7 +31,7 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
await page.waitToClick(selectors.itemsIndex.originCheckbox);
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
await page.waitToClick(selectors.itemsIndex.densityCheckbox);
await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const message = await page.waitForSnackbar();
@ -64,7 +64,7 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
await page.waitToClick(selectors.itemsIndex.originCheckbox);
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
await page.waitToClick(selectors.itemsIndex.densityCheckbox);
await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox);
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
const message = await page.waitForSnackbar();

View File

@ -52,7 +52,7 @@ module.exports = Self => {
switch (field) {
case 'size':
case 'density':
case 'weightByPiece':
case 'description':
case 'packingOut':
modelName = 'Item';

View File

@ -157,7 +157,7 @@ module.exports = Self => {
i.image,
i.id AS itemFk,
i.size,
i.density,
i.weightByPiece,
it.code,
i.typeFk,
i.family,

View File

@ -68,8 +68,8 @@
<th field="origin">
<span translate>Origin</span>
</th>
<th field="density">
<span translate>Density</span>
<th field="weightByPiece">
<span translate>Weight/Piece</span>
</th>
<th field="isActive">
<span translate>Active</span>
@ -183,7 +183,7 @@
{{::buy.intrastat}}
</td>
<td>{{::buy.origin}}</td>
<td>{{::buy.density}}</td>
<td>{{::buy.weightByPiece}}</td>
<td>
<vn-check
disabled="true"

View File

@ -80,7 +80,7 @@ export default class Controller extends Section {
{field: 'weight', displayName: this.$t('Weight')},
{field: 'description', displayName: this.$t('Description')},
{field: 'size', displayName: this.$t('Size')},
{field: 'density', displayName: this.$t('Density')},
{field: 'weightByPiece', displayName: this.$t('weight/Piece')},
{field: 'packingOut', displayName: this.$t('PackingOut')},
{field: 'landing', displayName: this.$t('Landing')}
];
@ -103,7 +103,7 @@ export default class Controller extends Section {
switch (param) {
case 'id':
case 'size':
case 'density':
case 'weightByPiece':
case 'isActive':
case 'family':
case 'minPrice':

View File

@ -160,7 +160,7 @@ module.exports = Self => {
i.subName,
i.isActive,
i.stems,
i.density,
i.weightByPiece,
i.stemMultiplier,
i.typeFk,
i.isFloramondo,

View File

@ -53,9 +53,9 @@
"type": "number",
"description": "Relevancy"
},
"density": {
"weightByPiece": {
"type": "number",
"description": "Density"
"description": "WeightByPiece"
},
"stemMultiplier": {
"type": "number",

View File

@ -124,9 +124,8 @@
<vn-input-number
vn-one
min="0"
step="0.01"
label="Density"
ng-model="$ctrl.item.density"
label="Weight/Piece"
ng-model="$ctrl.item.weightByPiece"
rule>
</vn-input-number>
<vn-autocomplete

View File

@ -45,8 +45,8 @@
<th field="buyerFk">
<span translate>Buyer</span>
</th>
<th field="density">
<span translate>Density</span>
<th field="weightByPiece">
<span translate>Weight/Piece</span>
</th>
<th field="stemMultiplier">
<span translate>Multiplier</span>
@ -117,7 +117,7 @@
{{::item.userName}}
</span>
</td>
<td>{{::item.density}}</td>
<td>{{::item.weightByPiece}}</td>
<td>{{::item.stemMultiplier}}</td>
<td>
<vn-check

View File

@ -87,7 +87,7 @@ class Controller extends Section {
case 'size':
case 'subname':
case 'isActive':
case 'density':
case 'weightByPiece':
case 'stemMultiplier':
case 'stems':
return {[`i.${param}`]: value};

View File

@ -40,7 +40,7 @@ Create: Crear
Client card: Ficha del cliente
Shipped: F. envío
stems: Tallos
Density: Densidad
Weight/Piece: Peso/tallo
Search items by id, name or barcode: Buscar articulos por identificador, nombre o codigo de barras
SalesPerson: Comercial
Concept: Concepto

View File

@ -91,8 +91,8 @@
<vn-label-value label="Relevancy"
value="{{$ctrl.summary.item.relevancy}}">
</vn-label-value>
<vn-label-value label="Density"
value="{{$ctrl.summary.item.density}}">
<vn-label-value label="Weight/Piece"
value="{{$ctrl.summary.item.weightByPiece}}">
</vn-label-value>
<vn-label-value label="Expense"
value="{{$ctrl.summary.item.expense.name}}">

View File

@ -210,6 +210,9 @@
</slot-table>
</smart-table>
</vn-card>
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -130,8 +130,8 @@ module.exports = Self => {
SUM(b.stickers) AS stickers,
s.id AS cargoSupplierFk,
s.nickname AS cargoSupplierNickname,
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
FROM travel t
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
LEFT JOIN entry e ON e.travelFk = t.id
@ -143,7 +143,8 @@ module.exports = Self => {
JOIN warehouse wo ON wo.id = t.warehouseOutFk
JOIN country c ON c.id = wo.countryFk
LEFT JOIN continent cnt ON cnt.id = c.continentFk
JOIN agencyMode am ON am.id = t.agencyModeFk`
JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN vn.volumeConfig vc`
);
stmt.merge(conn.makeWhere(filter.where));
@ -165,15 +166,16 @@ module.exports = Self => {
SUM(b.stickers) AS stickers,
e.evaNotes,
e.notes,
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedkg,
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg,
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg
FROM tmp.travel tr
JOIN entry e ON e.travelFk = tr.id
JOIN buy b ON b.entryFk = e.id
JOIN packaging pkg ON pkg.id = b.packageFk
JOIN item i ON i.id = b.itemFk
JOIN itemType it ON it.id = i.typeFk
JOIN supplier s ON s.id = e.supplierFk`
JOIN supplier s ON s.id = e.supplierFk
JOIN vn.volumeConfig vc`
);
stmt.merge(conn.makeGroupBy('e.id'));

View File

@ -29,7 +29,7 @@ module.exports = {
for (let attachment of options.attachments) {
const fileName = attachment.filename;
const filePath = attachment.path;
if (fileName.includes('.png')) return;
if (fileName.includes('.png')) continue;
if (fileName || filePath)
attachments.push(filePath ? filePath : fileName);

View File

@ -11,15 +11,17 @@ module.exports = async function(request, response, next) {
if (reqArgs.to) toDate = reqArgs.to;
const todayMinDate = new Date();
minDate.setHours(0, 0, 0, 0);
todayMinDate.setHours(0, 0, 0, 0);
const todayMaxDate = new Date();
maxDate.setHours(23, 59, 59, 59);
todayMinDate.setHours(23, 59, 59, 59);
// Prevent closure for current day
if (toDate >= todayMinDate && toDate <= todayMaxDate)
throw new Error('You cannot close tickets for today');
console.log(`Making closure up to ${toDate}...`);
const tickets = await db.rawSql(`
SELECT
t.id,

View File

@ -7,11 +7,13 @@ const storage = require('vn-print/core/storage');
module.exports = {
async start(tickets, reqArgs) {
console.log(tickets);
if (tickets.length == 0) return;
const failedtickets = [];
for (const ticket of tickets) {
try {
console.log(`Closing ticket id ${ticket.id}...`);
await db.rawSql(`CALL vn.ticket_closeByTicket(?)`, [ticket.id]);
const invoiceOut = await db.findOne(`

View File

@ -4,14 +4,15 @@ SELECT
e.ref,
s.name AS supplierName,
SUM(b.stickers) AS stickers,
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
FROM travel t
CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
FROM travel t
JOIN entry e ON e.travelFk = t.id
JOIN buy b ON b.entryFk = e.id
JOIN packaging pkg ON pkg.id = b.packageFk
JOIN item i ON i.id = b.itemFk
JOIN itemType it ON it.id = i.typeFk
JOIN supplier s ON s.id = e.supplierFk
JOIN vn.volumeConfig vc
WHERE t.id IN(?)
GROUP BY e.id
GROUP BY e.id

View File

@ -6,9 +6,10 @@ SELECT
t.kg,
am.id AS agencyModeFk,
SUM(b.stickers) AS stickers,
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
FROM travel t
JOIN volumeConfig vc
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
LEFT JOIN entry e ON e.travelFk = t.id
LEFT JOIN buy b ON b.entryFk = e.id