#7709 -supplierPackaging_ReportSource_2 #3107

Open
robert wants to merge 19 commits from 7709-supplierPackaging_ReportSource_2 into dev
15 changed files with 48 additions and 105 deletions
Showing only changes of commit 3f82205206 - Show all commits

View File

@ -546,7 +546,8 @@ INSERT INTO `vn`.`observationType`(`id`,`description`, `code`)
(6, 'Weight', 'weight'), (6, 'Weight', 'weight'),
(7, 'InvoiceOut', 'invoiceOut'), (7, 'InvoiceOut', 'invoiceOut'),
(8, 'DropOff', 'dropOff'), (8, 'DropOff', 'dropOff'),
(9, 'Sustitución', 'substitution'); (9, 'Sustitución', 'substitution'),
(10, 'Finance', 'finance');
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`) INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
VALUES VALUES

View File

@ -22,7 +22,6 @@ BEGIN
DECLARE vItemFk INT; DECLARE vItemFk INT;
DECLARE vConcept VARCHAR(30); DECLARE vConcept VARCHAR(30);
DECLARE vAmount INT; DECLARE vAmount INT;
DECLARE vAvailable INT;
DECLARE vPrice DECIMAL(10,2); DECLARE vPrice DECIMAL(10,2);
DECLARE vSaleFk INT; DECLARE vSaleFk INT;
DECLARE vRowFk INT; DECLARE vRowFk INT;
@ -32,7 +31,6 @@ BEGIN
DECLARE vClientFk INT; DECLARE vClientFk INT;
DECLARE vCompanyFk INT; DECLARE vCompanyFk INT;
DECLARE vAgencyModeFk INT; DECLARE vAgencyModeFk INT;
DECLARE vCalcFk INT;
DECLARE vIsTaxDataChecked BOOL; DECLARE vIsTaxDataChecked BOOL;
DECLARE vDates CURSOR FOR DECLARE vDates CURSOR FOR
@ -109,7 +107,7 @@ BEGIN
) INTO vHas0Amount; ) INTO vHas0Amount;
IF vHas0Amount THEN IF vHas0Amount THEN
CALL util.throw('Remove lines with quantity = 0 before confirming'); CALL util.throw('Hay líneas vacías. Por favor, elimínelas');
END IF; END IF;
START TRANSACTION; START TRANSACTION;

View File

@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `hedera`.`orderRow_afterIns
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
UPDATE `order` UPDATE `order`
SET rowUpdated = NOW() SET rowUpdated = util.VN_NOW()
WHERE id = NEW.orderFk; WHERE id = NEW.orderFk;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.clientObservation
ADD COLUMN observationTypeFk TINYINT(3) UNSIGNED NOT NULL,
ADD CONSTRAINT clientObservationTypeFk FOREIGN KEY (observationTypeFk) REFERENCES vn.observationType(id);

View File

@ -0,0 +1,3 @@
INSERT IGNORE INTO vn.observationType
SET description = 'Finance',
code = 'finance';

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE hedera.`order` ADD IF NOT EXISTS rowUpdated DATETIME NULL
COMMENT 'Timestamp for last updated record in orderRow table';

View File

@ -0,0 +1,3 @@
-- Place your SQL code here
ALTER TABLE vn.itemShelving DROP COLUMN IF EXISTS isMoving;
ALTER TABLE vn.itemShelving ADD IF NOT EXISTS movingState ENUM('selected','printed') NULL;

View File

@ -1,42 +0,0 @@
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
describe('Client Add notes path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'client');
await page.accessToSearchResult('Bruce Banner');
await page.accessToSection('client.card.note.index');
});
afterAll(async() => {
await browser.close();
});
it(`should reach the notes index`, async() => {
await page.waitForState('client.card.note.index');
});
it(`should click on the add note button`, async() => {
await page.waitToClick(selectors.clientNotes.addNoteFloatButton);
await page.waitForState('client.card.note.create');
});
it(`should create a note`, async() => {
await page.waitForSelector(selectors.clientNotes.note);
await page.type(`${selectors.clientNotes.note} textarea`, 'Meeting with Black Widow 21st 9am');
await page.waitToClick(selectors.clientNotes.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should confirm the note was created', async() => {
const result = await page.waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
expect(result).toEqual('Meeting with Black Widow 21st 9am');
});
});

View File

@ -28,12 +28,12 @@ describe('Client defaulter path', () => {
const salesPersonName = const salesPersonName =
await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText'); await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText');
expect(clientName).toEqual('Bruce Banner'); expect(clientName).toEqual('Ororo Munroe');
expect(salesPersonName).toEqual('developer'); expect(salesPersonName).toEqual('salesperson');
}); });
it('should first observation not changed', async() => { it('should first observation not changed', async() => {
const expectedObservation = 'Meeting with Black Widow 21st 9am'; const expectedObservation = 'Madness, as you know, is like gravity, all it takes is a little push';
const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value'); const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value');
expect(result).toContain(expectedObservation); expect(result).toContain(expectedObservation);
@ -62,13 +62,4 @@ describe('Client defaulter path', () => {
await page.write(selectors.clientDefaulter.observation, 'My new observation'); await page.write(selectors.clientDefaulter.observation, 'My new observation');
await page.waitToClick(selectors.clientDefaulter.saveButton); await page.waitToClick(selectors.clientDefaulter.saveButton);
}); });
it('should first observation changed', async() => {
const message = await page.waitForSnackbar();
await page.waitForSelector(selectors.clientDefaulter.firstObservation);
const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value');
expect(message.text).toContain('Observation saved!');
expect(result).toContain('My new observation');
});
}); });

View File

@ -381,5 +381,6 @@
"The entry does not have stickers": "La entrada no tiene etiquetas", "The entry does not have stickers": "La entrada no tiene etiquetas",
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha", "This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
"No valid travel thermograph found": "No se encontró un termógrafo válido", "No valid travel thermograph found": "No se encontró un termógrafo válido",
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea" "The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
} "type cannot be blank": "Se debe rellenar el tipo"
}

View File

@ -1,8 +1,11 @@
module.exports = function(Self) { module.exports = function(Self) {
Self.validate('text', isEnabled, {message: 'Description cannot be blank'}); Self.validate('text', function(err) {
function isEnabled(err) {
if (!this.text) err(); if (!this.text) err();
} }, {message: 'Description cannot be blank'});
Self.validate('observationTypeFk', function(err) {
if (!this.observationTypeFk) err();
}, {message: 'type cannot be blank'});
Self.observe('before save', function(ctx, next) { Self.observe('before save', function(ctx, next) {
ctx.instance.created = Date(); ctx.instance.created = Date();

View File

@ -1,10 +1,10 @@
{ {
"name": "ClientObservation", "name": "ClientObservation",
"description": "Client notes", "description": "Client notes",
"base": "VnModel", "base": "VnModel",
"mixins": { "mixins": {
"Loggable": true "Loggable": true
}, },
"options": { "options": {
"mysql": { "mysql": {
"table": "clientObservation" "table": "clientObservation"
@ -26,6 +26,10 @@
"created": { "created": {
"type": "date", "type": "date",
"description": "Creation date and time" "description": "Creation date and time"
},
"observationTypeFk": {
"type": "number",
"description": "Type of observation"
} }
}, },
"relations": { "relations": {
@ -44,14 +48,18 @@
"include": { "include": {
"relation": "worker", "relation": "worker",
"scope": { "scope": {
"fields": ["id"], "fields": [
"id"
],
"include": { "include": {
"relation": "user", "relation": "user",
"scope": { "scope": {
"fields": ["nickname"] "fields": [
"nickname"
]
} }
} }
} }
} }
} }
} }

View File

@ -1,31 +0,0 @@
<vn-crud-model
vn-id="model"
url="clientObservations"
filter="$ctrl.filter"
link="{clientFk: $ctrl.$params.id}"
data="notes"
auto-load="true">
</vn-crud-model>
<vn-data-viewer
model="model"
class="vn-w-md">
<vn-card class="vn-pa-md">
<div
ng-repeat="note in notes"
class="note vn-pa-sm border-solid border-radius vn-mb-md">
<vn-horizontal class="vn-mb-sm" style="color: #666">
<vn-one>{{::note.worker.user.nickname}}</vn-one>
<vn-auto>{{::note.created | date:'dd/MM/yyyy HH:mm'}}</vn-auto>
</vn-horizontal>
<vn-horizontal class="text">
{{::note.text}}
</vn-horizontal>
</div>
</vn-card>
</vn-data-viewer>
<a vn-tooltip="New note"
ui-sref="client.card.note.create({id: $ctrl.$params.id})"
vn-bind="+"
fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>

View File

@ -5,9 +5,10 @@ import './style.scss';
export default class Controller extends Section { export default class Controller extends Section {
constructor($element, $) { constructor($element, $) {
super($element, $); super($element, $);
this.filter = { }
order: 'created DESC', async $onInit() {
}; this.$state.go('home');
window.location.href = await this.vnApp.getUrl(`customer/${this.$params.id}/notes`);
} }
} }

View File

@ -217,6 +217,7 @@ module.exports = Self => {
const code = e.code; const code = e.code;
const message = e.sqlMessage; const message = e.sqlMessage;
if (e.message && e.message.includes('Invalid email')) throw new UserError('Invalid email');
if (e.message && e.message.includes(`Email already exists`)) throw new UserError(`This personal mail already exists`); if (e.message && e.message.includes(`Email already exists`)) throw new UserError(`This personal mail already exists`);
if (code === 'ER_DUP_ENTRY' && message.includes(`CodigoTrabajador_UNIQUE`)) throw new UserError(`This worker code already exists`); if (code === 'ER_DUP_ENTRY' && message.includes(`CodigoTrabajador_UNIQUE`)) throw new UserError(`This worker code already exists`);
if (code === 'ER_DUP_ENTRY' && message.includes(`PRIMARY`)) throw new UserError(`This worker already exists`); if (code === 'ER_DUP_ENTRY' && message.includes(`PRIMARY`)) throw new UserError(`This worker already exists`);