Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev There was a failure building this commit Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-09-13 16:09:27 +02:00
commit 206dec59a3
43 changed files with 758 additions and 400 deletions

View File

@ -0,0 +1,78 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `claim` AS
SELECT
`c`.`id` AS `id`,
`c`.`Fecha` AS `ticketCreated`,
`c`.`cl_est_id` AS `claimStateFk`,
`c`.`notas` AS `observation`,
`c`.`Id_Cliente` AS `clientFk`,
`c`.`Id_Trabajador` AS `workerFk`,
`c`.`sensib` AS `responsibility`,
`c`.`mana` AS `isChargedToMana`,
`c`.`ticketFk` AS `ticketFk`,
`c`.`odbc_date` AS `created`,
`c`.`cl_dep_id` AS `claimDepartmentFk`
FROM
`vn2008`.`cl_main` `c`;
/*
-- View switch
Find: `([a-zA-Z0-9 _]+)` AS `([a-zA-Z0-9 _]+)`
Repc: `$2` AS `$1`
-- Trigger table
Find: (BEFORE|AFTER) (INSERT|UPDATE|DELETE) ON `([a-zA-Z0-9 _]+)`
Repc: $1 $2 ON `buy`
-- Trigger
Find: OLD.
Find: NEW.
*/
RENAME TABLE `vn`.`claim` TO `vn`.`claim__`;
ALTER TABLE `vn2008`.`cl_main` RENAME `vn`.`claim`;
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Rename columns
ALTER TABLE `vn`.`claim`
CHANGE COLUMN `Fecha` `ticketCreated` DATE NOT NULL ,
CHANGE COLUMN `cl_dep_id` `claimDepartmentFk` TINYINT(3) UNSIGNED NULL DEFAULT NULL ,
CHANGE COLUMN `cl_est_id` `claimStateFk` INT(10) UNSIGNED NOT NULL DEFAULT '1' ,
CHANGE COLUMN `notas` `observation` TEXT NULL DEFAULT NULL ,
CHANGE COLUMN `Id_Cliente` `clientFk` INT(11) NOT NULL ,
CHANGE COLUMN `Id_Trabajador` `workerFk` INT(11) NOT NULL ,
CHANGE COLUMN `sensib` `responsibility` INT(1) UNSIGNED NOT NULL DEFAULT '3' ,
CHANGE COLUMN `mana` `isChargedToMana` TINYINT(1) NOT NULL DEFAULT '0' ,
CHANGE COLUMN `odbc_date` `created` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ;
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Replacement view
CREATE
ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn2008`.`cl_main` AS
SELECT
`c`.`id` AS `id`,
`c`.`ticketCreated` AS `Fecha`,
`c`.`claimStateFk` AS `cl_est_id`,
`c`.`observation` AS `notas`,
`c`.`clientFk` AS `Id_Cliente`,
`c`.`workerFk` AS `Id_Trabajador`,
`c`.`responsibility` AS `sensib`,
`c`.`isChargedToMana` AS `mana`,
`c`.`ticketFk` AS `ticketFk`,
`c`.`created` AS `odbc_date`,
`c`.`claimDepartmentFk` AS `cl_dep_id`
FROM
`vn`.`claim` `c`
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Triggers

View File

@ -0,0 +1,54 @@
ALTER TABLE `vn2008`.`Articles`
ADD COLUMN `hasKgPrice` TINYINT(1) NOT NULL DEFAULT '0' AFTER `upToDown`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`item` AS
SELECT
`t`.`Id_Article` AS `id`,
`t`.`Article` AS `name`,
`t`.`tipo_id` AS `typeFk`,
`t`.`Medida` AS `size`,
`t`.`Color` AS `inkFk`,
`t`.`Categoria` AS `category`,
`t`.`Tallos` AS `stems`,
`t`.`id_origen` AS `originFk`,
`t`.`description` AS `description`,
`t`.`producer_id` AS `producerFk`,
`t`.`Codintrastat` AS `intrastatFk`,
`t`.`offer` AS `isOnOffer`,
`t`.`caja` AS `box`,
`t`.`expenceFk` AS `expenceFk`,
`t`.`bargain` AS `isBargain`,
`t`.`comments` AS `comment`,
`t`.`relevancy` AS `relevancy`,
`t`.`Foto` AS `image`,
`t`.`generic` AS `generic`,
`t`.`density` AS `density`,
`t`.`iva_group_id` AS `taxClassFk`,
`t`.`PVP` AS `minPrice`,
`t`.`Min` AS `hasMinPrice`,
`t`.`isActive` AS `isActive`,
`t`.`longName` AS `longName`,
`t`.`subName` AS `subName`,
`t`.`tag5` AS `tag5`,
`t`.`value5` AS `value5`,
`t`.`tag6` AS `tag6`,
`t`.`value6` AS `value6`,
`t`.`tag7` AS `tag7`,
`t`.`value7` AS `value7`,
`t`.`tag8` AS `tag8`,
`t`.`value8` AS `value8`,
`t`.`tag9` AS `tag9`,
`t`.`value9` AS `value9`,
`t`.`tag10` AS `tag10`,
`t`.`value10` AS `value10`,
`t`.`minimum` AS `minimum`,
`t`.`upToDown` AS `upToDown`,
`t`.`compression` AS `compression`,
`t`.`hasKgPrice` AS `hasKgPrice`
FROM
`vn2008`.`Articles` `t`;

View File

@ -0,0 +1,258 @@
DROP procedure IF EXISTS `vn`.`catalog_componentCalculate`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`catalog_componentCalculate`(
vZoneFk INT,
vAddressFk INT,
vShipped DATE)
proc: BEGIN
/**
* Calcula los componentes de los articulos de tmp.ticketLot
*
* @param vZoneFk para calcular el transporte
* @param vAgencyModeFk Id del modo de agencia
* @param tmp.ticketLot (warehouseFk,available,itemFk,buyFk)
*
* @return tmp.ticketComponent(itemFk, warehouseFk, available, rate2, rate3, minPrice,
* packing, grouping, groupingMode, buyFk, typeFk)
* @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, grouping, price)
*/
DECLARE vClientFk INT;
DECLARE vGeneralInflationCoefficient INT DEFAULT 1;
DECLARE vMinimumDensityWeight INT DEFAULT 167;
DECLARE vBoxFreightItem INT DEFAULT 71;
DECLARE vBoxVolume BIGINT; -- DEFAULT 138000;
DECLARE vSpecialPriceComponent INT DEFAULT 10;
DECLARE vDeliveryComponent INT DEFAULT 15;
DECLARE vRecoveryComponent INT DEFAULT 17;
DECLARE vSellByPacketComponent INT DEFAULT 22;
DECLARE vBuyValueComponent INT DEFAULT 28;
DECLARE vMarginComponent INT DEFAULT 29;
DECLARE vDiscountLastItemComponent INT DEFAULT 32;
DECLARE vExtraBaggedComponent INT DEFAULT 38;
DECLARE vManaAutoComponent INT DEFAULT 39;
SELECT volume INTO vBoxVolume
FROM vn.packaging
WHERE id = '94';
SELECT clientFk INTO vClientFK
FROM address
WHERE id = vAddressFk;
SET @rate2 := 0;
SET @rate3 := 0;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate;
CREATE TEMPORARY TABLE tmp.ticketComponentCalculate
(PRIMARY KEY (itemFk, warehouseFk))
ENGINE = MEMORY
SELECT
tl.itemFk, tl.warehouseFk, tl.available,
IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) * 1.0 rate2,
IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) * 1.0 rate3,
IFNULL(pf.rate3, 0) AS minPrice,
IFNULL(pf.packing, b.packing) packing,
IFNULL(pf.`grouping`, b.`grouping`) grouping,
ABS(IFNULL(pf.box, b.groupingMode)) groupingMode,
tl.buyFk,
i.typeFk,
IF(i.hasKgPrice,(b.packing * b.weight) / 1000, NULL) weightPacking
FROM tmp.ticketLot tl
JOIN buy b ON b.id = tl.buyFk
JOIN item i ON i.id = tl.itemFk
JOIN itemType it ON it.id = i.typeFk
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN specialPrice sp ON sp.itemFk = i.id AND sp.clientFk = vClientFk
LEFT JOIN (
SELECT * FROM (
SELECT pf.itemFk, pf.`grouping`, pf.packing, pf.box, pf.rate2, pf.rate3, z.warehouseFk
FROM priceFixed pf
JOIN zone z ON z.warehouseFk = pf.warehouseFk OR pf.warehouseFk = 0
WHERE vShipped BETWEEN pf.started AND pf.ended ORDER BY pf.itemFk, pf.warehouseFk DESC
) tpf
GROUP BY tpf.itemFk, tpf.warehouseFk
) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk
WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.display <> 0;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
CREATE TEMPORARY TABLE tmp.ticketComponent (
`warehouseFk` INT UNSIGNED NOT NULL,
`itemFk` INT NOT NULL,
`componentFk` INT UNSIGNED NOT NULL,
`cost` DECIMAL(10,4) NOT NULL,
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
UNIQUE INDEX `itemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC));
INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
SELECT
tcc.warehouseFk,
tcc.itemFk,
vBuyValueComponent,
b.buyingValue + b.freightValue + b.packageValue + b.comissionValue
FROM tmp.ticketComponentCalculate tcc
JOIN buy b ON b.id = tcc.buyFk;
INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
SELECT
tcc.warehouseFk,
tcc.itemFk,
vMarginComponent,
tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue
FROM tmp.ticketComponentCalculate tcc
JOIN buy b ON b.id = tcc.buyFk;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase;
CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY
SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk
FROM tmp.ticketComponent tc
GROUP BY tc.itemFk, warehouseFk;
INSERT INTO tmp.ticketComponent
SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.recobro, 0.25), 3)
FROM tmp.ticketComponentBase tcb
JOIN bi.claims_ratio cr ON cr.Id_Cliente = vClientFk
WHERE cr.recobro > 0.009;
INSERT INTO tmp.ticketComponent
SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + prices_modifier_rate), 3) as manaAuto
FROM tmp.ticketComponentBase tcb
JOIN `client` c on c.id = vClientFk
JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador
WHERE ms.prices_modifier_activated
HAVING manaAuto <> 0;
INSERT INTO tmp.ticketComponent
SELECT tcb.warehouseFk,
tcb.itemFk,
cr.id,
GREATEST(IFNULL(ROUND(tcb.base * cr.tax, 4), 0), tcc.minPrice - tcc.rate3)
FROM tmp.ticketComponentBase tcb
JOIN componentRate cr
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
WHERE cr.id = vDiscountLastItemComponent AND cr.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL;
INSERT INTO tmp.ticketComponent
SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3
FROM tmp.ticketComponentCalculate tcc
JOIN buy b ON b.id = tcc.buyFk
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
WHERE sp.value IS NULL;
INSERT INTO tmp.ticketComponent
SELECT tcc.warehouseFK,
tcc.itemFk,
vDeliveryComponent,
vGeneralInflationCoefficient
* ROUND((
i.compression
* r.cm3
* IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
* IFNULL((z.price - z.bonus)
* 1/*amz.inflation*/ , 50)) / vBoxVolume, 4
) cost
FROM tmp.ticketComponentCalculate tcc
JOIN item i ON i.id = tcc.itemFk
JOIN zone z ON z.id = vZoneFk
JOIN agencyMode am ON am.id = z.agencyModeFk
LEFT JOIN bi.rotacion r ON r.warehouse_id = tcc.warehouseFk
AND r.Id_Article = tcc.itemFk
HAVING cost <> 0;
IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN
INSERT INTO tmp.ticketComponent
SELECT tcc.warehouseFk, b.itemFk, vExtraBaggedComponent, ap.packagingValue cost
FROM tmp.ticketComponentCalculate tcc
JOIN vn.addressForPackaging ap
WHERE ap.addressFk = vAddressFk;
END IF;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy;
CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY
SELECT * FROM tmp.ticketComponent;
INSERT INTO tmp.ticketComponent
SELECT tcc.warehouseFk,
tcc.itemFk,
vSpecialPriceComponent,
sp.value - SUM(tcc.cost) sumCost
FROM tmp.ticketComponentCopy tcc
JOIN componentRate cr ON cr.id = tcc.componentFk
JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk
WHERE cr.classRate IS NULL
GROUP BY tcc.itemFk, tcc.warehouseFk
HAVING ABS(sumCost) > 0.001;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum;
CREATE TEMPORARY TABLE tmp.ticketComponentSum
(INDEX (itemFk, warehouseFk))
ENGINE = MEMORY
SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, cr.classRate
FROM tmp.ticketComponent tc
JOIN componentRate cr ON cr.id = tc.componentFk
GROUP BY tc.itemFk, tc.warehouseFk, cr.classRate;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate;
CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY
SELECT tcc.warehouseFk,
tcc.itemFk,
1 rate,
IF(tcc.groupingMode = 1, tcc.`grouping`, 1) grouping,
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price,
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightPacking priceKg
FROM tmp.ticketComponentCalculate tcc
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
AND tcs.warehouseFk = tcc.warehouseFk
WHERE IFNULL(tcs.classRate, 1) = 1
AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0)
GROUP BY tcs.warehouseFk, tcs.itemFk;
INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price, priceKg)
SELECT
tcc.warehouseFk,
tcc.itemFk,
2 rate,
tcc.packing grouping,
SUM(tcs.sumCost) price,
SUM(tcs.sumCost) / weightPacking priceKg
FROM tmp.ticketComponentCalculate tcc
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
AND tcs.warehouseFk = tcc.warehouseFk
WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2
AND tcc.packing > 0 AND tcc.available >= tcc.packing)
GROUP BY tcs.warehouseFk, tcs.itemFk;
INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price, priceKg)
SELECT
tcc.warehouseFk,
tcc.itemFk,
3 rate,
tcc.available grouping,
SUM(tcs.sumCost) price,
SUM(tcs.sumCost) / weightPacking priceKg
FROM tmp.ticketComponentCalculate tcc
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
AND tcs.warehouseFk = tcc.warehouseFk
WHERE IFNULL(tcs.classRate, 3) = 3
GROUP BY tcs.warehouseFk, tcs.itemFk;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice;
CREATE TEMPORARY TABLE tmp.ticketComponentPrice ENGINE = MEMORY
SELECT * FROM (
SELECT * FROM tmp.ticketComponentRate ORDER BY price
) t
GROUP BY itemFk, warehouseFk, `grouping`;
DROP TEMPORARY TABLE
tmp.ticketComponentCalculate,
tmp.ticketComponentSum,
tmp.ticketComponentBase,
tmp.ticketComponentRate,
tmp.ticketComponentCopy;
END$$
DELIMITER ;

View File

@ -177,12 +177,12 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
VALUES
(101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(102, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(103, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(104, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
(106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1),
(107, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
(107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
(108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
(109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
(110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1),

View File

@ -62,7 +62,7 @@ describe('Client Edit fiscalData path', () => {
const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
.write(selectors.clientFiscalData.socialNameInput, 'SMASH!')
.write(selectors.clientFiscalData.socialNameInput, 'SMASH')
.clearInput(selectors.clientFiscalData.fiscalIdInput)
.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!')
.clearInput(selectors.clientFiscalData.addressInput)
@ -175,7 +175,7 @@ describe('Client Edit fiscalData path', () => {
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
expect(result).toEqual('SMASH!');
expect(result).toEqual('SMASH');
});
it('should confirm the fiscal id have been edited', async() => {

View File

@ -82,7 +82,7 @@ describe('Client lock verified data path', () => {
const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
.write(selectors.clientFiscalData.socialNameInput, 'Ant-Man and the Wasp')
.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp')
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForLastSnackbar();
@ -94,7 +94,7 @@ describe('Client lock verified data path', () => {
.reloadSection('client.card.fiscalData')
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
expect(result).toEqual('Ant-Man and the Wasp');
expect(result).toEqual('Ant man and the Wasp');
});
});
@ -188,7 +188,7 @@ describe('Client lock verified data path', () => {
.wait(selectors.clientFiscalData.socialNameInput)
.evaluate(selector => {
return document.querySelector(selector).disabled;
}, 'vn-textfield[field="$ctrl.client.socialName"] > div');
}, 'vn-textfield[model="$ctrl.client.socialName"] > div');
expect(result).toBeFalsy();
});

View File

@ -42,18 +42,18 @@ describe('Ticket diary path', () => {
expect(url.hash).toContain('/diary');
});
it(`should check the second line id is marked as counter`, async() => {
it(`should check the second line id is marked as message`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.itemDiary.secondTicketId, 'className');
expect(result).toContain('counter');
expect(result).toContain('message');
});
it(`should check the third line balance is marked as counter`, async() => {
it(`should check the third line balance is marked as message`, async() => {
const result = await nightmare
.waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className');
expect(result).toContain('counter');
expect(result).toContain('message');
});
it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => {

View File

@ -13,8 +13,8 @@ describe('Component vnInputFile', () => {
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$attrs = {};
$element = angular.element('<div><input type="file"><div class="infix"><div class="rightIcons"></div></div>');
$attrs = {field: '$ctrl.dms.file'};
$element = angular.element('<vn-input-file label="File" field="$ctrl.dms.file"><input type="file"><div class="infix"><div class="rightIcons"></div></vn-input-file>');
controller = $componentController('vnInputFile', {$element, $scope, $attrs, $timeout, $transclude: () => {}});
controller.input = $element[0].querySelector('input');
controller.validate = () => {};

View File

@ -13,8 +13,8 @@ describe('Component vnInputNumber', () => {
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$attrs = {};
$element = angular.element('<div><input type="number"><div class="infix"><div class="rightIcons"></div></div>');
$attrs = {field: '$ctrl.client.socialName'};
$element = angular.element('<vn-input-number label="SocialName" field="$ctrl.client.socialName"><input type="number"><div class="infix"><div class="rightIcons"></div></vn-input-number>');
controller = $componentController('vnInputNumber', {$element, $scope, $attrs, $timeout, $transclude: () => {}});
controller.input = $element[0].querySelector('input');
controller.validate = () => {};

View File

@ -45,6 +45,8 @@ export default class InputTime extends Input {
this.element.classList.add('not-empty');
else
this.element.classList.remove('not-empty');
this.validateValue();
}
/**
@ -83,7 +85,7 @@ export default class InputTime extends Input {
* Gets min step value
*/
get step() {
return this.input.step;
return parseInt(this.input.step);
}
/**
@ -111,6 +113,66 @@ export default class InputTime extends Input {
return date;
}
/**
* Returns native validation message
*/
get validationError() {
return this.input.validationMessage;
}
/**
* Validates a valid input value
*
* @return {Boolean} - True if has a valid value
*/
hasValidValue() {
return this.input.checkValidity();
}
/**
* Changes the input element
* if has a validation error
*/
validateValue() {
if (!this.hasValidValue()) {
this.hideError();
this.showError();
} else
this.hideError();
}
/**
* Shows the input validation error
*/
showError() {
const infixElement = this.element.querySelector('.infix');
const infixClassList = infixElement.classList;
const errorSpan = document.createElement('span');
errorSpan.className = 'mdl-textfield__error';
const errorText = document.createTextNode(this.validationError);
errorSpan.append(errorText);
infixElement.append(errorSpan);
infixClassList.add('validated', 'invalid');
}
/**
* Hides the input validation error
*/
hideError() {
const infixElement = this.element.querySelector('.infix');
const infixClassList = infixElement.classList;
const errorElement = this.element.querySelector('.infix span.mdl-textfield__error');
if (errorElement)
errorElement.remove();
infixClassList.remove('validated', 'invalid');
}
}
InputTime.$inject = ['$element', '$scope', '$attrs', 'vnTemplate', '$transclude'];

View File

@ -1,6 +1,6 @@
import './index.js';
describe('Component vnInputNumber', () => {
describe('Component vnInputTime', () => {
let $scope;
let $attrs;
let $timeout;
@ -13,18 +13,19 @@ describe('Component vnInputNumber', () => {
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$attrs = {};
$element = angular.element('<div><input><div class="infix invalid validated"><div class="rightIcons"></div></div>');
controller = $componentController('vnInputNumber', {$element, $scope, $attrs, $timeout, $transclude: () => {}});
$attrs = {field: '$ctrl.zone.hour'};
$element = angular.element('<vn-input-time label="Hour" field="$ctrl.zone.hour"><input><div class="infix invalid validated"><div class="rightIcons"></div></vn-input-time>');
controller = $componentController('vnInputTime', {$element, $scope, $attrs, $timeout, $transclude: () => {}});
}));
describe('value() setter', () => {
it(`should set _value to a given value, add the class not-empty and remove invalid and validated`, () => {
controller.value = 'pepino';
const today = new Date();
controller.value = today;
let classes = controller.element.classList.toString();
expect(classes).toContain('not-empty');
expect(controller._value).toEqual('pepino');
expect(controller._value).toEqual(today);
classes = controller.element.querySelector('.infix').classList.toString();
@ -42,15 +43,15 @@ describe('Component vnInputNumber', () => {
describe('step() setter/getter', () => {
it(`should set input.step to a given value`, () => {
controller.step = 50;
controller.step = 2;
expect(controller.input.step).toEqual('50');
expect(controller.input.step).toEqual('2');
});
it(`should return a number`, () => {
controller.step = 50;
controller.step = 2;
expect(controller.step).toEqual(50);
expect(controller.step).toEqual(2);
expect(typeof controller.step).toEqual('number');
});
});

View File

@ -8,7 +8,6 @@ export default class Controller extends Component {
this.$window = $window;
$window.addEventListener('scroll', () => {
console.log($element[0]);
if ($window.scrollY > 0)
$element[0].style.display = 'block';
else

View File

@ -118,7 +118,7 @@ vn-table {
}
& > vn-td .chip {
padding: .3em;
border-radius: .3em;
border-radius: .3em
}
& > vn-td .chip.notice {
@ -141,6 +141,11 @@ vn-table {
background-color: $color-alert-medium;
}
& > vn-td .chip.message {
color: $color-font-dark;
background-color: $color-bg-dark
}
& > vn-td vn-icon-menu {
display: inline-block;
color: $color-main;

View File

@ -12,7 +12,7 @@ describe('Component vnTextarea', () => {
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$attrs = {};
$attrs = {field: '$ctrl.claim.observation'};
$element = angular.element('<vn-textarea vn-three label="Observation" field="$ctrl.claim.observation" rows="9"><textarea></vn-textarea>');
$element[0].firstChild.MaterialTextfield = {updateClasses_: () => {}};
controller = $componentController('vnTextarea', {$scope, $element, $attrs});

View File

@ -13,8 +13,8 @@ describe('Component vnTextfield', () => {
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$attrs = {};
$element = angular.element('<div><input><div class="leftIcons"><div class="rightIcons"></div></div>');
$attrs = {field: '$ctrl.client.phone'};
$element = angular.element('<vn-textfield label="Phone" field="$ctrl.client.phone"><input><div class="leftIcons"><div class="rightIcons"></div></vn-textfield>');
controller = $componentController('vnTextfield', {$scope, $element, $attrs, $timeout, $transclude: () => {}});
}));

View File

@ -13,30 +13,32 @@ export default class Template {
return this.get(template, $attrs, defaults);
}
normalizeInputAttrs($attrs) {
if ($attrs.field) {
let split = $attrs.field.split('.');
let len = split.length;
const field = $attrs.field || $attrs.model;
const split = field.split('.');
const len = split.length;
let i = len - 1;
const fieldName = split[i--];
const entity = i >= 0 ? split[i--] : 'model';
const ctrl = i >= 0 ? split[i--] : '$ctrl';
if ($attrs.field) {
if (len == 0)
throw new Error(`Attribute 'field' can not be empty`);
if (len > 3)
throw new Error(`Attribute 'field' must have this syntax: [ctrl].[entity].[field]`);
let i = len - 1;
let field = split[i--];
let entity = i >= 0 ? split[i--] : 'model';
let ctrl = i >= 0 ? split[i--] : '$ctrl';
if ($attrs.model === undefined)
$attrs.model = `${ctrl}.${entity}.${field}`;
$attrs.model = `${ctrl}.${entity}.${fieldName}`;
if ($attrs.rule === undefined && len >= 2)
$attrs.rule = `${entity}.${field}`;
$attrs.rule = `${entity}.${fieldName}`;
if ($attrs.label === undefined && len >= 2)
$attrs.label = `${entity}.${field}`;
if ($attrs.name === undefined)
$attrs.name = field;
$attrs.label = `${entity}.${fieldName}`;
}
if ($attrs.name === undefined)
$attrs.name = fieldName;
if ($attrs.focus !== undefined)
$attrs.focus = 'vn-focus';
}

View File

@ -23,263 +23,8 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-basketadd:before {
content: "\e955";
}
.icon-catalog:before {
content: "\e952";
}
.icon-agency:before {
content: "\e910";
}
.icon-delivery:before {
content: "\e94a";
}
.icon-wand:before {
content: "\e954";
}
.icon-unavailable:before {
content: "\e953";
}
.icon-buscaman:before {
content: "\e951";
}
.icon-pbx:before {
content: "\e950";
}
.icon-calendar:before {
content: "\e94f";
}
.icon-linesplit:before {
content: "\e945";
}
.icon-invoices:before {
content: "\e91c";
}
.icon-pets:before {
content: "\e94e";
}
.icon-100:before {
content: "\e940";
}
.icon-accessory:before {
content: "\e90a";
}
.icon-actions:before {
content: "\e900";
}
.icon-addperson:before {
content: "\e901";
}
.icon-albaran:before {
content: "\e902";
}
.icon-apps:before {
content: "\e948";
}
.icon-artificial:before {
content: "\e903";
}
.icon-barcode:before {
content: "\e904";
}
.icon-basket:before {
content: "\e942";
}
.icon-bin:before {
content: "\e905";
}
.icon-botanical:before {
content: "\e906";
}
.icon-bucket:before {
content: "\e907";
}
.icon-claims:before {
content: "\e908";
}
.icon-clone:before {
content: "\e909";
}
.icon-columnadd:before {
content: "\e944";
}
.icon-columndelete:before {
content: "\e90f";
}
.icon-components:before {
content: "\e90b";
}
.icon-consignatarios:before {
content: "\e90d";
}
.icon-control:before {
content: "\e93f";
}
.icon-credit:before {
content: "\e90e";
}
.icon-details:before {
content: "\e911";
}
.icon-disabled:before {
content: "\e91b";
}
.icon-doc:before {
content: "\e913";
}
.icon-entry:before {
content: "\e914";
}
.icon-exit:before {
content: "\e947";
}
.icon-eye:before {
content: "\e915";
}
.icon-fiscal:before {
content: "\e912";
}
.icon-flower:before {
content: "\e916";
}
.icon-frozen:before {
content: "\e917";
}
.icon-greenery:before {
content: "\e93c";
}
.icon-greuge:before {
content: "\e918";
}
.icon-grid:before {
content: "\e919";
}
.icon-handmade:before {
content: "\e90c";
}
.icon-history:before {
content: "\e91a";
}
.icon-info:before {
content: "\e949";
}
.icon-item:before {
content: "\e941";
}
.icon-languaje:before {
content: "\e91d";
}
.icon-linedelete:before {
content: "\e946";
}
.icon-lines:before {
content: "\e91e";
}
.icon-linesprepaired:before {
content: "\e94b";
}
.icon-logout:before {
content: "\e91f";
}
.icon-mana:before {
content: "\e920";
}
.icon-mandatory:before {
content: "\e921";
}
.icon-niche:before {
content: "\e922";
}
.icon-no036:before {
content: "\e923";
}
.icon-notes:before {
content: "\e924";
}
.icon-noweb:before {
content: "\e925";
}
.icon-onlinepayment:before {
content: "\e926";
}
.icon-package:before {
content: "\e927";
}
.icon-payment:before {
content: "\e928";
}
.icon-person:before {
content: "\e929";
}
.icon-photo:before {
content: "\e92a";
}
.icon-plant:before {
content: "\e92b";
}
.icon-recovery:before {
content: "\e92d";
}
.icon-regentry:before {
content: "\e92e";
}
.icon-reserve:before {
content: "\e92f";
}
.icon-revision:before {
content: "\e94c";
}
.icon-risk:before {
content: "\e930";
}
.icon-services:before {
content: "\e94d";
}
.icon-settings:before {
content: "\e931";
}
.icon-sms:before {
content: "\e932";
}
.icon-solclaim:before {
content: "\e933";
}
.icon-solunion:before {
content: "\e934";
}
.icon-splur:before {
content: "\e935";
}
.icon-stowaway:before {
content: "\e92c";
}
.icon-supplier:before {
content: "\e936";
}
.icon-tags:before {
content: "\e937";
}
.icon-tax:before {
content: "\e938";
}
.icon-ticket:before {
content: "\e939";
}
.icon-traceability:before {
content: "\e93a";
}
.icon-transaction:before {
content: "\e93b";
}
.icon-volume:before {
content: "\e93d";
}
.icon-web:before {
content: "\e93e";
}
.icon-worker:before {
content: "\e943";
.icon-fruit:before {
content: "\e957";
}
.icon-deliveryprices:before {
content: "\e956";

View File

@ -94,4 +94,5 @@
<glyph unicode="&#xe954;" glyph-name="wand" d="M829.649 565.029l-18.808-50.155-50.155-18.808 50.155-18.808 18.808-50.155 18.808 50.155 50.155 18.808-50.155 18.808-18.808 50.155zM624.849 870.139l-35.527 89.861-33.437-89.861-89.861-35.527 89.861-33.437 33.437-89.861 33.437 89.861 91.951 33.437-89.861 35.527zM969.665 819.984l-20.898 54.335-20.898-54.335-52.245-20.898 52.245-20.898 20.898-52.245 20.898 52.245 54.335 20.898-54.335 20.898zM783.673 648.62l-71.053 71.053c-4.18 4.18-8.359 4.18-12.539 4.18s-8.359-2.090-12.539-4.18l-681.273-681.273c0 0 0 0 0 0v0c-6.269-6.269-6.269-18.808 0-25.078l71.053-71.053c6.269-6.269 16.718-6.269 22.988 0v0c0 0 0 0 0 0l683.363 683.363c6.269 6.269 6.269 16.718 0 22.988zM626.939 506.514l-56.424 56.424 129.567 129.567 56.424-56.424-129.567-129.567z" />
<glyph unicode="&#xe955;" glyph-name="basketadd" d="M515.2 512c-16 0-28.8-12.8-28.8-28.8v-83.2c16 22.4 35.2 41.6 57.6 60.8v22.4c0 16-12.8 28.8-28.8 28.8zM416 185.6h-259.2l-44.8 348.8h566.4c32 9.6 64 16 99.2 16 16 0 32 0 48-3.2 3.2 3.2 6.4 9.6 6.4 16v64c0 16-12.8 28.8-32 32h-140.8l-115.2 227.2c6.4 6.4 6.4 19.2 6.4 28.8-6.4 32-35.2 54.4-64 48-32-6.4-54.4-32-48-64s35.2-54.4 64-48l89.6-198.4h-355.2l89.6 198.4c32-6.4 60.8 19.2 64 48s-19.2 57.6-48 64c-32 6.4-60.8-19.2-64-48 0-9.6 3.2-19.2 6.4-28.8l-115.2-233.6h-140.8c-16 0-28.8-12.8-28.8-28.8v-64c0-16 12.8-28.8 28.8-28.8h22.4l51.2-377.6c3.2-12.8 16-22.4 28.8-22.4h288c-3.2 16-3.2 35.2-3.2 54.4zM416 512c-16 0-28.8-12.8-28.8-28.8v-259.2c0-16 12.8-28.8 28.8-28.8 0 0 0 0 0 0 0 44.8 9.6 89.6 28.8 131.2v160c0 12.8-12.8 25.6-28.8 25.6zM198.4 508.8c-16-3.2-25.6-16-25.6-32l16-262.4c0-12.8 12.8-25.6 25.6-22.4h3.2c16 3.2 25.6 16 25.6 32l-12.8 259.2c-3.2 12.8-19.2 25.6-32 25.6zM284.8 483.2v-262.4c0-19.2 12.8-28.8 28.8-28.8s28.8 12.8 28.8 28.8v262.4c0 16-12.8 28.8-28.8 28.8s-28.8-12.8-28.8-28.8zM1024 243.2v-121.6h-185.6v-185.6h-121.6v185.6h-185.6v121.6h185.6v185.6h121.6v-185.6z" />
<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" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Binary file not shown.

View File

@ -16,7 +16,7 @@ server {
listen [::]:80 default_server;
server_name _;
autoindex off;
client_max_body_size 50M;
client_max_body_size 250M;
root /salix/dist;
error_page 404 = @notfound;

View File

@ -211,6 +211,9 @@ module.exports = function(Self) {
let action = setActionType(ctx);
removeUnloggableProperties(definition, oldInstance);
removeUnloggableProperties(definition, newInstance);
let logRecord = {
originFk: originId,
userFk: userFk,
@ -223,12 +226,38 @@ module.exports = function(Self) {
};
let logsToSave = setLogsToSave(where, changedModelId, logRecord, ctx);
let logModel = definition.settings.log.model;
await ctx.Model.app.models[logModel].create(logsToSave, options);
}
/**
* Removes unwanted properties
* @param {*} definition Model definition
* @param {*} properties Modified object properties
*/
function removeUnloggableProperties(definition, properties) {
const propList = Object.keys(properties);
const propDefs = new Map();
for (let property in definition.properties) {
const propertyDef = definition.properties[property];
propDefs.set(property, propertyDef);
}
for (let property of propList) {
const propertyDef = propDefs.get(property);
if (!propertyDef) return;
if (propertyDef.log === false)
delete properties[property];
else if (propertyDef.logValue === false)
properties[property] = null;
}
}
// this function retuns all the instances changed in case this is an updateAll
function setLogsToSave(changedInstances, changedInstancesIds, logRecord, ctx) {
let promises = [];

View File

@ -53,5 +53,6 @@
"Ticket id cannot be blank": "Ticket id cannot be blank",
"Weekday cannot be blank": "Weekday cannot be blank",
"This ticket can not be modified": "This ticket can not be modified",
"You can't delete a confirmed order": "You can't delete a confirmed order"
"You can't delete a confirmed order": "You can't delete a confirmed order",
"Value has an invalid format": "Value has an invalid format"
}

View File

@ -102,5 +102,7 @@
"Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
"Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
"You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
"Can't create stowaway for this ticket": "No se puede crear un polizon para este ticket"
"Can't create stowaway for this ticket": "No se puede crear un polizon para este ticket",
"Value has an invalid format": "El valor tiene un formato incorrecto",
"Invalid quantity": "Cantidad invalida"
}

View File

@ -20,7 +20,7 @@
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./e2e/dms",
"maxFileSize": "52428800",
"maxFileSize": "262144000",
"allowedContentTypes": [
"application/x-7z-compressed",
"application/x-zip-compressed",

View File

@ -31,7 +31,7 @@ module.exports = Self => {
}
});
Self.getLeaves = async(zoneFk, parentFk = 1, filter) => {
Self.getLeaves = async(zoneFk, parentFk = null, filter) => {
let conn = Self.dataSource.connector;
let stmts = [];
@ -47,7 +47,7 @@ module.exports = Self => {
isIncluded TINYINT
) ENGINE = MEMORY`));
if (parentFk === 1) {
if (!parentFk) {
stmts.push(new ParameterizedSQL(
`INSERT INTO tmp.checkedChilds
SELECT
@ -76,23 +76,21 @@ module.exports = Self => {
FROM zoneGeo zg
JOIN tmp.checkedChilds ch
ON zg.lft <= ch.lft AND zg.rgt >= ch.rgt
AND zg.depth > 0
UNION ALL
SELECT
child.id,
child.name,
child.lft,
child.rgt,
child.depth,
child.sons,
zg.id,
zg.name,
zg.lft,
zg.rgt,
zg.depth,
zg.sons,
zi.isIncluded AS selected
FROM zoneGeo parent
JOIN zoneGeo child ON child.lft > parent.lft
AND child.rgt < parent.rgt
AND child.depth = parent.depth + 1
LEFT JOIN zoneIncluded zi ON zi.geoFk = child.id
FROM zoneGeo zg
LEFT JOIN zoneIncluded zi ON zi.geoFk = zg.id
AND zi.zoneFk = ?
WHERE parent.id = ?) AS nst`, [zoneFk, parentFk]);
WHERE (? IS NULL AND zg.parentFk IS NULL)
OR (? IS NOT NULL AND zg.parentFk = ?)) AS nst`,
[zoneFk, parentFk, parentFk, parentFk]);
// Get nodes from depth greather than Origin
stmt.merge(conn.makeSuffix(filter));

View File

@ -13,15 +13,17 @@
<vn-thead>
<vn-tr>
<vn-th field="dmsFk" default-order="DESC" shrink>Id</vn-th>
<vn-th shrink>Type</vn-th>
<vn-th shrink number>Order</vn-th>
<vn-th shrink>Reference</vn-th>
<vn-th>Description</vn-th>
<vn-th shrink>Original</vn-th>
<vn-th>File</vn-th>
<vn-th field="dmsTypeFk" shrink>Type</vn-th>
<vn-th field="hardCopyNumber" shrink number>Order</vn-th>
<vn-th field="reference" shrink>Reference</vn-th>
<vn-th expand>Description</vn-th>
<vn-th field="hasFile" shrink>Original</vn-th>
<vn-th shrink>File</vn-th>
<vn-th shrink>Employee</vn-th>
<vn-th>Created</vn-th>
<vn-th number></vn-th>
<vn-th field="created">Created</vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
@ -33,7 +35,8 @@
</span>
</vn-td>
<vn-td shrink number>
<span title="{{::document.dms.hardCopyNumber}}">
<span class="chip" title="{{::document.dms.hardCopyNumber}}"
ng-class="{'message': document.dms.hardCopyNumber}">
{{::document.dms.hardCopyNumber}}
</span>
</vn-td>
@ -42,7 +45,7 @@
{{::document.dms.reference}}
</span>
</vn-td>
<vn-td>
<vn-td expand>
<span title="{{::document.dms.description}}">
{{::document.dms.description}}
</span>
@ -52,7 +55,7 @@
field="document.dms.hasFile">
</vn-check>
</vn-td>
<vn-td>
<vn-td shrink>
<a target="_blank"
title="{{'Download file' | translate}}"
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
@ -67,7 +70,7 @@
<vn-td>
{{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}}
</vn-td>
<vn-td number>
<vn-td shrink>
<a target="_blank"
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
<vn-icon-button
@ -75,12 +78,15 @@
title="{{'Download file' | translate}}">
</vn-icon-button>
</a>
<vn-icon-button ui-sref="claim.card.dms.edit({dmsId: {{::document.dmsFk}}})"
icon="edit"
</vn-td>
<vn-td shrink>
<vn-icon-button icon="edit"
ui-sref="claim.card.dms.edit({dmsId: {{::document.dmsFk}}})"
title="{{'Edit file' | translate}}">
</vn-icon-button>
<vn-icon-button
icon="delete"
</vn-td>
<vn-td shrink>
<vn-icon-button icon="delete"
ng-click="$ctrl.showDeleteConfirm($index)"
title="{{'Remove file' | translate}}"
tabindex="-1">

View File

@ -150,6 +150,16 @@ module.exports = Self => {
done();
}
Self.validateBinded('socialName', isAlpha, {
message: 'Value has an invalid format'
});
function isAlpha(value) {
const regexp = new RegExp(/^[a-zA-Z\s]*$/);
return regexp.test(value);
}
Self.observe('before save', async function(ctx) {
let changes = ctx.data || ctx.instance;
let orgData = ctx.currentInstance;
@ -199,9 +209,9 @@ module.exports = Self => {
if (payMethodChanged || ibanChanged || dueDayChanged) {
const message = `La forma de pago del cliente con id ${instance.id} ha cambiado`;
const salesPersonFk = instance.salesPersonFk;
const salesPerson = await Self.app.models.Worker.findById(salesPersonFk);
if (salesPerson) {
if (salesPersonFk) {
const salesPerson = await Self.app.models.Worker.findById(salesPersonFk);
await Self.app.models.Message.send(ctx, {
recipientFk: salesPerson.userFk,
message: message

View File

@ -13,15 +13,17 @@
<vn-thead>
<vn-tr>
<vn-th field="dmsFk" default-order="DESC" shrink>Id</vn-th>
<vn-th shrink>Type</vn-th>
<vn-th shrink number>Order</vn-th>
<vn-th shrink>Reference</vn-th>
<vn-th>Description</vn-th>
<vn-th shrink>Original</vn-th>
<vn-th>File</vn-th>
<vn-th field="dmsTypeFk" shrink>Type</vn-th>
<vn-th field="hardCopyNumber" shrink number>Order</vn-th>
<vn-th field="reference" shrink>Reference</vn-th>
<vn-th expand>Description</vn-th>
<vn-th field="hasFile" shrink>Original</vn-th>
<vn-th shrink>File</vn-th>
<vn-th shrink>Employee</vn-th>
<vn-th>Created</vn-th>
<vn-th number></vn-th>
<vn-th field="created">Created</vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
@ -33,7 +35,8 @@
</span>
</vn-td>
<vn-td shrink number>
<span title="{{::document.dms.hardCopyNumber}}">
<span class="chip" title="{{::document.dms.hardCopyNumber}}"
ng-class="{'message': document.dms.hardCopyNumber}">
{{::document.dms.hardCopyNumber}}
</span>
</vn-td>
@ -42,7 +45,7 @@
{{::document.dms.reference}}
</span>
</vn-td>
<vn-td>
<vn-td expand>
<span title="{{::document.dms.description}}">
{{::document.dms.description}}
</span>
@ -52,7 +55,7 @@
field="document.dms.hasFile">
</vn-check>
</vn-td>
<vn-td>
<vn-td shrink>
<a target="_blank"
title="{{'Download file' | translate}}"
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">{{::document.dms.file}}
@ -66,7 +69,7 @@
<vn-td>
{{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}}
</vn-td>
<vn-td number>
<vn-td shrink>
<a target="_blank"
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
<vn-icon-button
@ -74,10 +77,14 @@
title="{{'Download file' | translate}}">
</vn-icon-button>
</a>
<vn-icon-button ui-sref="client.card.dms.edit({dmsId: {{::document.dmsFk}}})"
</vn-td>
<vn-td shrink>
<vn-icon-button ui-sref="client.card.dms.edit({dmsId: {{::document.dmsFk}}})"
icon="edit"
title="{{'Edit file' | translate}}">
</vn-icon-button>
</vn-td>
<vn-td shrink>
<vn-icon-button
icon="delete"
ng-click="$ctrl.showDeleteConfirm($index)"

View File

@ -12,7 +12,9 @@
vn-two
vn-focus
label="Social name"
field="$ctrl.client.socialName">
model="$ctrl.client.socialName"
rule="client.socialName"
info="You can use letters and spaces">
</vn-textfield>
<vn-textfield
vn-one

View File

@ -2,4 +2,5 @@ Yes, notify: Sí, notificar
You changed the equalization tax: Has cambiado el recargo de equivalencia
Do you want to spread the change?: ¿Deseas propagar el cambio a sus consignatarios?
Frozen: Congelado
In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.: Para facturar no se consulta este campo, sino el RE de consignatario. Al modificar este campo si no esta marcada la casilla Facturar por consignatario, se propagará automáticamente el cambio a todos los consignatarios, en caso contrario preguntará al usuario si quiere o no propagar.
In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.: Para facturar no se consulta este campo, sino el RE de consignatario. Al modificar este campo si no esta marcada la casilla Facturar por consignatario, se propagará automáticamente el cambio a todos los consignatarios, en caso contrario preguntará al usuario si quiere o no propagar.
You can use letters and spaces: Se pueden utilizar letras y espacios

View File

@ -97,6 +97,9 @@
},
"value10": {
"type": "String"
},
"hasKgPrice": {
"type": "Boolean"
}
},
"relations": {

View File

@ -47,10 +47,10 @@
</span>
</vn-td>
<vn-td number>
<span
<span class="chip"
ng-class="::{link: sale.isTicket}"
ng-click="$ctrl.showDescriptor($event, sale)"
class="id">
name="origin">
{{::sale.origin | dashIfEmpty}}
</span>
</vn-td>

View File

@ -104,7 +104,7 @@ class Controller {
let balance = onPreparationLine.querySelector('.balanceSpan');
balance.classList.add('counter');
balance.classList.add('message');
balance.title = this.$translate.instant('Visible quantity');
let headerOffset = body.querySelector('header').getBoundingClientRect();
@ -113,8 +113,8 @@ class Controller {
let offsetTop;
if (this.ticketFk) {
let selectedTicketLine = lines[selectedTicketLineIndex];
let id = selectedTicketLine.querySelector('.id');
id.classList.add('counter');
let id = selectedTicketLine.querySelector('[name=origin]');
id.classList.add('message');
offsetTop = selectedTicketLine.offsetTop - headerHeight;
} else
offsetTop = onPreparationLine.offsetTop - headerHeight;

View File

@ -96,6 +96,11 @@
vn-tooltip="Add">
</vn-icon-button>
</div>
<div class="footer">
<div class="price" style="font-size: 8px">
<span>asdasdd</span>
</div>
</div>
</div>
</vn-card>
</section>

View File

@ -8,6 +8,7 @@ Enter a new search: Introduce una nueva búsqueda
Plant: Planta
Flower: Flor
Handmade: Confección
Fruit: Fruta
Green: Verde
Lines: Lineas
Accessories: Complemento

View File

@ -2,7 +2,7 @@ const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethod('getPossibleStowaways', {
description: 'Returns mana of a salesperson of a ticket',
description: 'Returns a list of allowed tickets for a stowaway ticket',
accessType: 'READ',
accepts: [{
arg: 'id',

View File

@ -0,0 +1,30 @@
const app = require('vn-loopback/server/server');
let UserError = require('vn-loopback/util/user-error');
describe('ticket getPossibleStowaways()', () => {
it(`should throw an error if Can't create stowaway for this ticket`, async() => {
let error;
let ticketId = 10;
await app.models.Ticket.getPossibleStowaways(ticketId)
.catch(e => {
error = e;
});
expect(error).toEqual(new UserError(`Can't create stowaway for this ticket`));
});
it('should return an empty list of tickets for a valid ticket', async() => {
let ticketId = 12;
let possibleStowaways = await app.models.Ticket.getPossibleStowaways(ticketId);
expect(possibleStowaways.length).toEqual(0);
});
it('should return allowed list of tickets for a valid ticket', async() => {
let ticketId = 16;
let possibleStowaways = await app.models.Ticket.getPossibleStowaways(ticketId);
expect(possibleStowaways.length).toEqual(1);
});
});

View File

@ -33,6 +33,7 @@ module.exports = Self => {
});
Self.transferSales = async(ctx, id, ticketId, sales) => {
let userId = ctx.req.accessToken.userId;
const models = Self.app.models;
const isEditable = await models.Ticket.isEditable(ctx, id);
@ -61,32 +62,63 @@ module.exports = Self => {
for (const sale of originalSales)
map.set(sale.id, sale);
const promises = [];
for (const sale of sales) {
const originalSale = map.get(sale.id);
let originalSaleQuantity = originalSale.quantity;
if (sale.quantity == originalSale.quantity) {
const updatedSale = models.Sale.updateAll({
await models.Sale.updateAll({
id: sale.id
}, {ticketFk: ticketId}, options);
promises.push(updatedSale);
} else if (sale.quantity < originalSale.quantity) {
const transferedSale = await transferPartialSale(
await transferPartialSale(
ticketId, originalSale, sale, options);
promises.push(transferedSale);
}
let logTicketOrigin = {
originFk: id,
userFk: userId,
action: 'update',
changedModel: 'Ticket',
changedModelId: ticketId,
oldInstance: {item: sale.itemFk,
quantity: 0,
concept: sale.concept,
ticket: ticketId},
newInstance: {item: sale.itemFk,
quantity: sale.quantity,
concept: sale.concept,
ticket: ticketId}
};
await models.TicketLog.create(logTicketOrigin, options);
let logTicketDestination = {
originFk: ticketId,
userFk: userId,
action: 'update',
changedModel: 'Ticket',
changedModelId: ticketId,
oldInstance: {item: sale.itemFk,
quantity: originalSaleQuantity,
concept: sale.concept,
ticket: id},
newInstance: {item: sale.itemFk,
quantity: originalSaleQuantity - sale.quantity,
concept: sale.concept,
ticket: id}
};
await models.TicketLog.create(logTicketDestination, options);
}
const isTicketEmpty = await models.Ticket.isEmpty(id, options);
if (isTicketEmpty) {
originalTicket.updateAttributes({
await originalTicket.updateAttributes({
isDeleted: true
}, options);
}
await Promise.all(promises);
await tx.commit();
return {id: ticketId};
@ -127,19 +159,21 @@ module.exports = Self => {
async function transferPartialSale(ticketId, originalSale, sale, options) {
const models = Self.app.models;
if (sale.quantity > originalSale.quantity)
throw new UserError('Invalid quantity');
// Update original sale
const rest = originalSale.quantity - sale.quantity;
const updatedSale = models.Sale.updateAll({
const updatedSale = await models.Sale.updateAll({
id: sale.id
}, {quantity: rest}, options);
// Clone sale with new quantity
const newSale = originalSale;
newSale.id = undefined;
newSale.ticketFk = ticketId;
newSale.quantity = sale.quantity;
const createdSale = await models.Sale.create(newSale, options);
await models.Sale.create(newSale, options);
// Clone sale components
const saleComponents = await models.SaleComponent.find({
@ -150,9 +184,9 @@ module.exports = Self => {
return component;
});
const createdComponents = models.SaleComponent
.create(newComponents, options);
return [updatedSale, createdComponents];
await models.SaleComponent.create(newComponents, options);
return [updatedSale, createdSale];
}
};

View File

@ -80,7 +80,7 @@ module.exports = Self => {
fields: ['salesPersonFk']
}
},
});
}, options);
const salesPersonId = ticket.client().salesPersonFk;
const usesMana = await models.WorkerMana.findOne({
where: {
@ -102,10 +102,10 @@ module.exports = Self => {
value: value,
componentFk: componentId}, options);
const updatedSale = models.Sale.update({id: sale.id},
const updatedSale = models.Sale.updateAll({id: sale.id},
{discount: newDiscount}, options);
promises.push([newComponent, updatedSale]);
promises.push(newComponent, updatedSale);
}
await Promise.all(promises);

View File

@ -1,6 +1,11 @@
{
"name": "Sale",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "TicketLog",
"relation": "ticket",
"showField": "concept"
},
"options": {
"mysql": {
"table": "sale"

View File

@ -16,12 +16,14 @@
<vn-th field="dmsTypeFk" shrink>Type</vn-th>
<vn-th field="hardCopyNumber" shrink number>Order</vn-th>
<vn-th field="reference" shrink>Reference</vn-th>
<vn-th>Description</vn-th>
<vn-th expand>Description</vn-th>
<vn-th field="hasFile" shrink>Original</vn-th>
<vn-th>File</vn-th>
<vn-th shrink>File</vn-th>
<vn-th shrink>Employee</vn-th>
<vn-th field="created">Created</vn-th>
<vn-th number></vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
@ -33,7 +35,8 @@
</span>
</vn-td>
<vn-td shrink number>
<span title="{{::document.dms.hardCopyNumber}}">
<span class="chip" title="{{::document.dms.hardCopyNumber}}"
ng-class="{'message': document.dms.hardCopyNumber}">
{{::document.dms.hardCopyNumber}}
</span>
</vn-td>
@ -42,7 +45,7 @@
{{::document.dms.reference}}
</span>
</vn-td>
<vn-td>
<vn-td expand>
<span title="{{::document.dms.description}}">
{{::document.dms.description}}
</span>
@ -52,7 +55,7 @@
field="document.dms.hasFile">
</vn-check>
</vn-td>
<vn-td>
<vn-td shrink>
<a target="_blank"
title="{{'Download file' | translate}}"
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
@ -67,7 +70,7 @@
<vn-td>
{{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}}
</vn-td>
<vn-td number>
<vn-td shrink>
<a target="_blank"
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
<vn-icon-button
@ -75,12 +78,15 @@
title="{{'Download file' | translate}}">
</vn-icon-button>
</a>
<vn-icon-button ui-sref="ticket.card.dms.edit({dmsId: {{::document.dmsFk}}})"
icon="edit"
</vn-td>
<vn-td shrink>
<vn-icon-button icon="edit"
ui-sref="ticket.card.dms.edit({dmsId: {{::document.dmsFk}}})"
title="{{'Edit file' | translate}}">
</vn-icon-button>
<vn-icon-button
icon="delete"
</vn-td>
<vn-td shrink>
<vn-icon-button icon="delete"
ng-click="$ctrl.showDeleteConfirm($index)"
title="{{'Remove file' | translate}}"
tabindex="-1">

View File

@ -191,6 +191,9 @@ class Controller {
this.$http.post(`/api/TicketTrackings/changeState`, params).then(() => {
this.card.reload();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
}).finally(() => {
if (this.newInstances().length === 0)
this.$scope.watcher.updateOriginalData();
});
}
@ -245,8 +248,10 @@ class Controller {
const query = `/api/tickets/${this.ticket.id}/transferSales`;
this.$http.post(query, params).then(res => {
if (res.data)
this.goToTicket(res.data.id);
this.$scope.watcher.updateOriginalData();
this.goToTicket(res.data.id);
}).finally(() => {
this.$scope.watcher.updateOriginalData();
});
}
@ -312,9 +317,11 @@ class Controller {
if (this.editedPrice != this.sale.price) {
this.$http.post(`/api/Sales/${this.edit.id}/updatePrice`, {newPrice: this.editedPrice}).then(res => {
this.sale.price = res.data.price;
this.$scope.watcher.updateOriginalData();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
}).finally(() => {
if (this.newInstances().length === 0)
this.$scope.watcher.updateOriginalData();
});
}
@ -386,6 +393,9 @@ class Controller {
if (reservedSale)
sale.reserved = reservedSale.reserved;
});
}).finally(() => {
if (this.newInstances().length === 0)
this.$scope.watcher.updateOriginalData();
});
}
@ -450,12 +460,13 @@ class Controller {
const data = {quantity: parseInt(sale.quantity)};
const query = `/api/Sales/${sale.id}/updateQuantity`;
this.$http.post(query, data).then(() => {
this.$scope.watcher.updateOriginalData();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
}).catch(e => {
this.$scope.model.refresh();
throw e;
}).finally(() => {
if (this.newInstances().length === 0)
this.$scope.watcher.updateOriginalData();
});
}
@ -466,11 +477,13 @@ class Controller {
const data = {newConcept: sale.concept};
const query = `/api/Sales/${sale.id}/updateConcept`;
this.$http.post(query, data).then(() => {
this.$scope.watcher.updateOriginalData();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
}).catch(e => {
this.$scope.model.refresh();
throw e;
}).finally(() => {
if (this.newInstances().length === 0)
this.$scope.watcher.updateOriginalData();
});
}
@ -497,10 +510,10 @@ class Controller {
sale.price = newSale.price;
sale.item = newSale.item;
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
}).finally(() => {
if (this.newInstances().length === 0)
this.$scope.watcher.updateOriginalData();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}