feat(JavaScript): Updated architecture for TableBasePage object with static row ID attribute attached for adding ID against each row added to DOM

This commit is contained in:
2024-10-18 22:25:07 +01:00
parent 8fcfcf0ef4
commit 002551c0a9
112 changed files with 7280 additions and 3608 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -16,29 +16,42 @@ DROP TABLE IF EXISTS tmp_Price;
DROP TABLE IF EXISTS tmp_Shop_User;
DROP TABLE IF EXISTS tmp_Shop_Order;
DROP TABLE IF EXISTS tmp_Shop_Product;
DROP TABLE IF EXISTS tmp_Product;
DROP TABLE IF EXISTS tmp_Product_Permutation;
DROP TABLE IF EXISTS tmp_Permutation;
DROP TABLE IF EXISTS tmp_Shop_Product_p_shop_calc_user;
DROP TABLE IF EXISTS tmp_Shop_Product_p_Shop_Calc_User;
DROP TABLE IF EXISTS tmp_Shop_Image;
DROP TABLE IF EXISTS tmp_Image;
DROP TABLE IF EXISTS tmp_Product_Image;
DROP TABLE IF EXISTS tmp_Shop_Variation;
DROP TABLE IF EXISTS tmp_Variation;
DROP TABLE IF EXISTS tmp_Variation_Type;
DROP TABLE IF EXISTS tmp_Shop_Discount;
DROP TABLE IF EXISTS tmp_Discount;
DROP TABLE IF EXISTS tmp_Shop_Category;
DROP TABLE IF EXISTS tmp_Category;
DROP TABLE IF EXISTS tmp_Shop_Product_Category;
DROP TABLE IF EXISTS tmp_Product_Category;
DROP TABLE IF EXISTS tmp_Shop_Product_Currency_Region_Link;
DROP TABLE IF EXISTS tmp_Shop_Product_Currency_Link;
DROP TABLE IF EXISTS tmp_User_Role_Link;
DROP TABLE IF EXISTS tmp_Shop_Basket;
DROP TABLE IF EXISTS tmp_Shop_Supplier_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Supplier_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Shop_Supplier_Purchase_Order;
DROP TABLE IF EXISTS tmp_Supplier_Purchase_Order;
DROP TABLE IF EXISTS tmp_Shop_Supplier;
DROP TABLE IF EXISTS tmp_Supplier;
DROP TABLE IF EXISTS tmp_Shop_Manufacturing_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Manufacturing_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Shop_Manufacturing_Purchase_Order;
DROP TABLE IF EXISTS tmp_Manufacturing_Purchase_Order;
DROP TABLE IF EXISTS tmp_Shop_Customer;
DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order;
# Delete old tables
DROP TABLE IF EXISTS Split_Temp;
DROP TABLE IF EXISTS Split_Key_Value_Pair_Csv_Temp;
@@ -62,6 +75,7 @@ DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Audit;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Temp;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Audit;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order;
@@ -69,9 +83,14 @@ DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Product_Link_Temp;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Product_Link_Audit;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Temp;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Audit;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order;
DROP TABLE IF EXISTS Shop_Supplier_Address_Temp;
DROP TABLE IF EXISTS Shop_Supplier_Address_Audit;
DROP TABLE IF EXISTS Shop_Supplier_Address;
DROP TABLE IF EXISTS Shop_Supplier_Temp;
DROP TABLE IF EXISTS Shop_Supplier_Audit;
DROP TABLE IF EXISTS Shop_Supplier;

View File

@@ -5,18 +5,27 @@
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Address';
CREATE TABLE Shop_Address (
id_address INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_region INT NOT NULL,
postcode VARCHAR(20) NOT NULL,
address_line_1 VARCHAR(256) NOT NULL,
address_line_2 VARCHAR(256) NOT NULL,
city VARCHAR(256) NOT NULL,
county VARCHAR(256) NOT NULL,
active BIT NOT NULL DEFAULT 1,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Address_id_change_set
id_address INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_region INT NOT NULL
, CONSTRAINT FK_Shop_Address_id_region
FOREIGN KEY (id_region)
REFERENCES partsltd_prod.Shop_Region(id_region)
/*
, id_supplier INT NULL
, CONSTRAINT FK_Shop_Address_id_supplier
FOREIGN KEY (id_supplier)
REFERENCES partsltd_prod.Shop_Supplier(id_supplier)
*/
, postcode VARCHAR(20) NOT NULL
, address_line_1 VARCHAR(256) NOT NULL
, address_line_2 VARCHAR(256) NOT NULL
, city VARCHAR(256) NOT NULL
, county VARCHAR(256) NOT NULL
, active BIT NOT NULL DEFAULT 1
, created_on DATETIME
, created_by INT
, id_change_set INT
, CONSTRAINT FK_Shop_Address_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
REFERENCES partsltd_prod.Shop_User_Change_Set(id_change_set)
);

View File

@@ -1,8 +1,6 @@
# Address Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Address_Audit';
CREATE TABLE IF NOT EXISTS Shop_Address_Audit (

View File

@@ -8,10 +8,12 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier (
name_company VARCHAR(255) NOT NULL,
name_contact VARCHAR(255) NULL,
department_contact VARCHAR(255) NULL,
/*
id_address INT NOT NULL,
CONSTRAINT FK_Shop_Supplier_id_address
FOREIGN KEY (id_address)
REFERENCES Shop_Address(id_address),
*/
phone_number VARCHAR(50) NULL,
fax VARCHAR(50) NULL,
email VARCHAR(255) NOT NULL,

View File

@@ -8,11 +8,12 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Temp (
name_company VARCHAR(255) NOT NULL,
name_contact VARCHAR(255) NULL,
department_contact VARCHAR(255) NULL,
id_address INT NOT NULL,
-- id_address INT NOT NULL,
phone_number VARCHAR(50) NULL,
fax VARCHAR(50) NULL,
email VARCHAR(255) NOT NULL,
website VARCHAR(255) NULL,
id_currency INT NOT NULL,
active BIT NULL
active BIT NULL,
GUID BINARY(36) NOT NULL
);

View File

@@ -0,0 +1,29 @@
# Supplier Addresses
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Supplier_Address';
CREATE TABLE Shop_Supplier_Address (
id_address INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_supplier INT NOT NULL
, CONSTRAINT FK_Shop_Supplier_Address_id_supplier
FOREIGN KEY (id_supplier)
REFERENCES partsltd_prod.Shop_Supplier(id_supplier)
ON UPDATE RESTRICT
, id_region INT NOT NULL
, CONSTRAINT FK_Shop_Supplier_Address_id_region
FOREIGN KEY (id_region)
REFERENCES partsltd_prod.Shop_Region(id_region)
, postcode VARCHAR(20) NOT NULL
, address_line_1 VARCHAR(256) NOT NULL
, address_line_2 VARCHAR(256) NOT NULL
, city VARCHAR(256) NOT NULL
, county VARCHAR(256) NOT NULL
, active BIT NOT NULL DEFAULT 1
, created_on DATETIME
, created_by INT
, id_change_set INT
, CONSTRAINT FK_Shop_Supplier_Address_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.Shop_User_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,21 @@
# Supplier Address Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Supplier_Address_Audit';
CREATE TABLE IF NOT EXISTS Shop_Supplier_Address_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_address INT NOT NULL,
CONSTRAINT FK_Shop_Supplier_Address_Audit_id_address
FOREIGN KEY (id_address)
REFERENCES Shop_Supplier_Address(id_address)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Supplier_Address_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -0,0 +1,17 @@
# Supplier Addresses Staging
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Supplier_Address_Temp';
CREATE TABLE Shop_Supplier_Address_Temp (
id_address INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_supplier INT NOT NULL
, id_region INT NOT NULL
, postcode VARCHAR(20) NOT NULL
, address_line_1 VARCHAR(256) NOT NULL
, address_line_2 VARCHAR(256) NOT NULL
, city VARCHAR(256) NOT NULL
, county VARCHAR(256) NOT NULL
, active BIT NOT NULL DEFAULT 1
, GUID BINARY(36) NOT NULL
);

View File

@@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier_Purchase_Order_Product_Link (
CONSTRAINT FK_Shop_Supplier_Purchase_Order_Product_Link_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation),
id_currency_cost INT NOT NULL,
-- id_currency_cost INT NOT NULL,
id_unit_quantity INT NOT NULL,
CONSTRAINT FK_Shop_Supplier_Purchase_Order_Product_Link_id_unit_quantity
FOREIGN KEY (id_unit_quantity)

View File

@@ -1,16 +1,22 @@
# Manufacturing Purchase Order
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Manufacturing_Purchase_Order';
CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order (
id_order INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
/*
cost_total_local FLOAT NOT NULL,
id_currency_cost INT NOT NULL,
value_produced_total_local FLOAT NOT NULL,
*/
id_currency INT NOT NULL,
CONSTRAINT FK_Manufacturing_Purchase_Order_id_currency
FOREIGN KEY (id_currency)
REFERENCES Shop_Currency(id_currency),
cost_total_local_VAT_excl FLOAT NOT NULL,
cost_total_local_VAT_incl FLOAT NOT NULL,
price_total_local_VAT_excl FLOAT NOT NULL,
price_total_local_VAT_incl FLOAT NOT NULL,
/*
latency_delivery INT NOT NULL,
quantity_ordered FLOAT NOT NULL,

View File

@@ -0,0 +1,28 @@
# Manufacturing Purchase Order Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Manufacturing_Purchase_Order_Temp';
CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Temp (
id_order INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
/*
cost_total_local FLOAT NOT NULL,
*/
id_currency_cost INT NOT NULL,
cost_total_local_VAT_excl FLOAT NOT NULL,
cost_total_local_VAT_incl FLOAT NOT NULL,
price_total_local_VAT_excl FLOAT NOT NULL,
price_total_local_VAT_incl FLOAT NOT NULL,
/*
latency_delivery INT NOT NULL,
quantity_ordered FLOAT NOT NULL,
id_unit_quantity INT NOT NULL,
CONSTRAINT FK_Shop_Manufacturing_Purchase_Order_id_unit_quantity
FOREIGN KEY (id_unit_quantity)
REFERENCES Shop_Unit_Measurement(id_unit),
quantity_received INT NULL,
display_order INT NOT NULL,
*/
active BIT NOT NULL DEFAULT 1,
GUID BINARY(36) NOT NULL
);

View File

@@ -15,16 +15,17 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link (
CONSTRAINT FK_Manufacturing_Purchase_Order_Product_Link_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation),
cost_total_local FLOAT NOT NULL,
id_currency_cost INT NOT NULL,
value_produced_total_local FLOAT NOT NULL,
quantity_used FLOAT NOT NULL,
cost_unit_local_VAT_excl FLOAT NOT NULL,
cost_unit_local_VAT_incl FLOAT NOT NULL,
price_unit_local_VAT_excl FLOAT NOT NULL,
price_unit_local_VAT_incl FLOAT NOT NULL,
id_unit_quantity INT NOT NULL,
CONSTRAINT FK_Manufacturing_Purchase_Order_id_unit_quantity
FOREIGN KEY (id_unit_quantity)
REFERENCES Shop_Unit_Measurement(id_unit_measurement),
latency_manufacture_days INT NOT NULL,
quantity_used FLOAT NOT NULL,
quantity_produced FLOAT NOT NULL,
latency_manufacture_days INT NOT NULL,
display_order INT NOT NULL,
active BIT NOT NULL,
created_on DATETIME,

View File

@@ -1,8 +1,6 @@
# Manufacturing Purchase Order Product Link Temp
-- DROP TABLE Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
-- SELECT * FROM Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
@@ -10,26 +8,17 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
id_link INT NOT NULL PRIMARY KEY,
GUID BINARY(36) NOT NULL,
id_order INT NOT NULL,
/*
CONSTRAINT FK_Manuf_Purch_Order_Product_Link_Temp_id_order
FOREIGN KEY (id_order)
REFERENCES Shop_Manufacturing_Purchase_Order(id_order),
*/
id_permutation INT NOT NULL,
CONSTRAINT FK_Manuf_Purch_Order_Product_Link_Temp_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation),
cost_total_local FLOAT NOT NULL,
id_currency_cost INT NOT NULL,
quantity_used FLOAT NOT NULL,
id_unit_quantity INT NOT NULL,
CONSTRAINT FK_Manuf_Purch_Order_Product_Link_Temp_id_unit_quantity
FOREIGN KEY (id_unit_quantity)
REFERENCES Shop_Unit_Measurement(id_unit_measurement),
quantity_produced FLOAT NULL,
quantity_used FLOAT NOT NULL,
latency_manufacture_days INT NOT NULL,
quantity_produced FLOAT NOT NULL,
display_order INT NOT NULL,
active BIT NOT NULL
active BIT NOT NULL,
cost_unit_local_VAT_excl FLOAT NULL,
cost_unit_local_VAT_incl FLOAT NULL,
price_unit_local_VAT_excl FLOAT NULL,
price_unit_local_VAT_incl FLOAT NULL,
GUID BINARY(36) NOT NULL
);

View File

@@ -47,10 +47,12 @@ BEGIN
SELECT NEW.id_supplier, 'department_contact', OLD.department_contact, NEW.department_contact, NEW.id_change_set
WHERE NOT OLD.department_contact <=> NEW.department_contact
UNION
/*
# Changed id_address
SELECT NEW.id_supplier, 'id_address', OLD.id_address, NEW.id_address, NEW.id_change_set
WHERE NOT OLD.id_address <=> NEW.id_address
UNION
*/
# Changed phone_number
SELECT NEW.id_supplier, 'phone_number', OLD.phone_number, NEW.phone_number, NEW.id_change_set
WHERE NOT OLD.phone_number <=> NEW.phone_number

View File

@@ -0,0 +1,65 @@
# Shop Supplier Address
DROP TRIGGER IF EXISTS before_insert_Shop_Supplier_Address;
DROP TRIGGER IF EXISTS before_update_Shop_Supplier_Address;
DELIMITER //
CREATE TRIGGER before_insert_Shop_Supplier_Address
BEFORE INSERT ON Shop_Supplier_Address
FOR EACH ROW
BEGIN
SET NEW.created_on := IFNULL(NEW.created_on, NOW());
SET NEW.created_by := IFNULL(NEW.created_by, IFNULL((SELECT id_user FROM Shop_User WHERE firstname = CURRENT_USER()), -1));
END //
DELIMITER ;;
DELIMITER //
CREATE TRIGGER before_update_Shop_Supplier_Address
BEFORE UPDATE ON Shop_Supplier_Address
FOR EACH ROW
BEGIN
IF OLD.id_change_set <=> NEW.id_change_set THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'New change Set ID must be provided.';
END IF;
INSERT INTO Shop_Supplier_Address_Audit (
id_address,
name_field,
value_prev,
value_new,
id_change_set
)
# Changed region
SELECT NEW.id_address, 'id_region', OLD.id_region, NEW.id_region, NEW.id_change_set
WHERE NOT OLD.id_region <=> NEW.id_region
UNION
# Changed postcode
SELECT NEW.id_address, 'postcode', OLD.postcode, NEW.postcode, NEW.id_change_set
WHERE NOT OLD.postcode <=> NEW.postcode
UNION
# Changed address_line_1
SELECT NEW.id_address, 'address_line_1', OLD.address_line_1, NEW.address_line_1, NEW.id_change_set
WHERE NOT OLD.address_line_1 <=> NEW.address_line_1
UNION
# Changed address_line_2
SELECT NEW.id_address, 'address_line_2', OLD.address_line_2, NEW.address_line_2, NEW.id_change_set
WHERE NOT OLD.address_line_2 <=> NEW.address_line_2
UNION
# Changed city
SELECT NEW.id_address, 'city', OLD.city, NEW.city, NEW.id_change_set
WHERE NOT OLD.city <=> NEW.city
UNION
# Changed county
SELECT NEW.id_address, 'county', OLD.county, NEW.county, NEW.id_change_set
WHERE NOT OLD.county <=> NEW.county
UNION
# Changed active
SELECT NEW.id_address, 'active', CONVERT(CONVERT(OLD.active, SIGNED), CHAR), CONVERT(CONVERT(NEW.active, SIGNED), CHAR), NEW.id_change_set
WHERE NOT (OLD.active <=> NEW.active)
;
END //
DELIMITER ;;

View File

@@ -38,14 +38,18 @@ BEGIN
# Changed id_supplier_ordered
SELECT NEW.id_order, 'id_supplier_ordered', OLD.id_supplier_ordered, NEW.id_supplier_ordered, NEW.id_change_set
WHERE NOT OLD.id_supplier_ordered <=> NEW.id_supplier_ordered
UNION
# Changed cost_total_local
SELECT NEW.id_order, 'cost_total_local', OLD.cost_total_local, NEW.cost_total_local, NEW.id_change_set
WHERE NOT OLD.cost_total_local <=> NEW.cost_total_local
UNION
# Changed id_currency_cost
SELECT NEW.id_order, 'id_currency_cost', OLD.id_currency_cost, NEW.id_currency_cost, NEW.id_change_set
WHERE NOT OLD.id_currency_cost <=> NEW.id_currency_cost
UNION
# Changed cost_total_local_VAT_excl
SELECT NEW.id_order, 'cost_total_local_VAT_excl', OLD.cost_total_local_VAT_excl, NEW.cost_total_local_VAT_excl, NEW.id_change_set
WHERE NOT OLD.cost_total_local_VAT_excl <=> NEW.cost_total_local_VAT_excl
UNION
# Changed cost_total_local_VAT_incl
SELECT NEW.id_order, 'cost_total_local_VAT_incl', OLD.cost_total_local_VAT_incl, NEW.cost_total_local_VAT_incl, NEW.id_change_set
WHERE NOT OLD.cost_total_local_VAT_incl <=> NEW.cost_total_local_VAT_incl
/*
UNION
# Changed latency_delivery

View File

@@ -43,15 +43,13 @@ BEGIN
SELECT NEW.id_link, 'id_permutation', OLD.id_permutation, NEW.id_permutation, NEW.id_change_set
WHERE NOT OLD.id_permutation <=> NEW.id_permutation
UNION
# Changed cost_total_local
SELECT NEW.id_link, 'cost_total_local', OLD.cost_total_local, NEW.cost_total_local, NEW.id_change_set
WHERE NOT OLD.cost_total_local <=> NEW.cost_total_local
UNION
/*
# Changed id_currency_cost
SELECT NEW.id_link, 'id_currency_cost', OLD.id_currency_cost, NEW.id_currency_cost, NEW.id_change_set
WHERE NOT OLD.id_currency_cost <=> NEW.id_currency_cost
UNION
# Changed quantity_ordered
*/
# Changed quantity_ordered
SELECT NEW.id_link, 'quantity_ordered', OLD.quantity_ordered, NEW.quantity_ordered, NEW.id_change_set
WHERE NOT OLD.quantity_ordered <=> NEW.quantity_ordered
UNION
@@ -74,6 +72,22 @@ BEGIN
# Changed active
SELECT NEW.id_link, 'active', OLD.active, NEW.active, NEW.id_change_set
WHERE NOT OLD.active <=> NEW.active
UNION
# Changed cost_total_local_VAT_excl
SELECT NEW.id_link, 'cost_total_local_VAT_excl', OLD.cost_total_local_VAT_excl, NEW.cost_total_local_VAT_excl, NEW.id_change_set
WHERE NOT OLD.cost_total_local_VAT_excl <=> NEW.cost_total_local_VAT_excl
UNION
# Changed cost_total_local_VAT_incl
SELECT NEW.id_link, 'cost_total_local_VAT_incl', OLD.cost_total_local_VAT_incl, NEW.cost_total_local_VAT_incl, NEW.id_change_set
WHERE NOT OLD.cost_total_local_VAT_incl <=> NEW.cost_total_local_VAT_incl
UNION
# Changed cost_unit_local_VAT_excl
SELECT NEW.id_link, 'cost_unit_local_VAT_excl', OLD.cost_unit_local_VAT_excl, NEW.cost_unit_local_VAT_excl, NEW.id_change_set
WHERE NOT OLD.cost_unit_local_VAT_excl <=> NEW.cost_unit_local_VAT_excl
UNION
# Changed cost_unit_local_VAT_incl
SELECT NEW.id_link, 'cost_unit_local_VAT_incl', OLD.cost_unit_local_VAT_incl, NEW.cost_unit_local_VAT_incl, NEW.id_change_set
WHERE NOT OLD.cost_unit_local_VAT_incl <=> NEW.cost_unit_local_VAT_incl
;
END //
DELIMITER ;;

View File

@@ -35,17 +35,25 @@ BEGIN
value_new,
id_change_set
)
# Changed cost_total_local
SELECT NEW.id_order, 'cost_total_local', OLD.cost_total_local, NEW.cost_total_local, NEW.id_change_set
WHERE NOT OLD.cost_total_local <=> NEW.cost_total_local
# Changed id_currency
SELECT NEW.id_order, 'id_currency', OLD.id_currency, NEW.id_currency, NEW.id_change_set
WHERE NOT OLD.id_currency <=> NEW.id_currency
UNION
# Changed value_produced_total_local
SELECT NEW.id_order, 'value_produced_total_local', OLD.value_produced_total_local, NEW.value_produced_total_local, NEW.id_change_set
WHERE NOT OLD.value_produced_total_local <=> NEW.value_produced_total_local
# Changed cost_total_local_VAT_excl
SELECT NEW.id_order, 'cost_total_local_VAT_excl', OLD.cost_total_local_VAT_excl, NEW.cost_total_local_VAT_excl, NEW.id_change_set
WHERE NOT OLD.cost_total_local_VAT_excl <=> NEW.cost_total_local_VAT_excl
UNION
# Changed id_currency_cost
SELECT NEW.id_order, 'id_currency_cost', OLD.id_currency_cost, NEW.id_currency_cost, NEW.id_change_set
WHERE NOT OLD.id_currency_cost <=> NEW.id_currency_cost
# Changed cost_total_local_VAT_incl
SELECT NEW.id_order, 'cost_total_local_VAT_incl', OLD.cost_total_local_VAT_incl, NEW.cost_total_local_VAT_incl, NEW.id_change_set
WHERE NOT OLD.cost_total_local_VAT_incl <=> NEW.cost_total_local_VAT_incl
UNION
# Changed price_total_local_VAT_excl
SELECT NEW.id_order, 'price_total_local_VAT_excl', OLD.price_total_local_VAT_excl, NEW.price_total_local_VAT_excl, NEW.id_change_set
WHERE NOT OLD.price_total_local_VAT_excl <=> NEW.price_total_local_VAT_excl
UNION
# Changed price_total_local_VAT_incl
SELECT NEW.id_order, 'price_total_local_VAT_incl', OLD.price_total_local_VAT_incl, NEW.price_total_local_VAT_incl, NEW.id_change_set
WHERE NOT OLD.price_total_local_VAT_incl <=> NEW.price_total_local_VAT_incl
UNION
# Changed active
SELECT NEW.id_order, 'active', OLD.active, NEW.active, NEW.id_change_set

View File

@@ -43,25 +43,33 @@ BEGIN
SELECT NEW.id_link, 'id_permutation', OLD.id_permutation, NEW.id_permutation, NEW.id_change_set
WHERE NOT OLD.id_permutation <=> NEW.id_permutation
UNION
# Changed cost_total_local
SELECT NEW.id_link, 'cost_total_local', OLD.cost_total_local, NEW.cost_total_local, NEW.id_change_set
WHERE NOT OLD.cost_total_local <=> NEW.cost_total_local
UNION
# Changed id_currency_cost
SELECT NEW.id_link, 'id_currency_cost', OLD.id_currency_cost, NEW.id_currency_cost, NEW.id_change_set
WHERE NOT OLD.id_currency_cost <=> NEW.id_currency_cost
# Changed id_unit_quantity
SELECT NEW.id_link, 'id_unit_quantity', OLD.id_unit_quantity, NEW.id_unit_quantity, NEW.id_change_set
WHERE NOT OLD.id_unit_quantity <=> NEW.id_unit_quantity
UNION
# Changed quantity_used
SELECT NEW.id_link, 'quantity_used', OLD.quantity_used, NEW.quantity_used, NEW.id_change_set
WHERE NOT OLD.quantity_used <=> NEW.quantity_used
UNION
# Changed id_unit_quantity
SELECT NEW.id_link, 'id_unit_quantity', OLD.id_unit_quantity, NEW.id_unit_quantity, NEW.id_change_set
WHERE NOT OLD.id_unit_quantity <=> NEW.id_unit_quantity
UNION
# Changed quantity_produced
SELECT NEW.id_link, 'quantity_produced', OLD.quantity_produced, NEW.quantity_produced, NEW.id_change_set
WHERE NOT OLD.quantity_produced <=> NEW.quantity_produced
UNION
# Changed cost_unit_local_VAT_excl
SELECT NEW.id_order, 'cost_unit_local_VAT_excl', OLD.cost_unit_local_VAT_excl, NEW.cost_unit_local_VAT_excl, NEW.id_change_set
WHERE NOT OLD.cost_unit_local_VAT_excl <=> NEW.cost_unit_local_VAT_excl
UNION
# Changed cost_unit_local_VAT_incl
SELECT NEW.id_order, 'cost_unit_local_VAT_incl', OLD.cost_unit_local_VAT_incl, NEW.cost_unit_local_VAT_incl, NEW.id_change_set
WHERE NOT OLD.cost_unit_local_VAT_incl <=> NEW.cost_unit_local_VAT_incl
UNION
# Changed price_unit_local_VAT_excl
SELECT NEW.id_order, 'price_unit_local_VAT_excl', OLD.price_unit_local_VAT_excl, NEW.price_unit_local_VAT_excl, NEW.id_change_set
WHERE NOT OLD.price_unit_local_VAT_excl <=> NEW.price_unit_local_VAT_excl
UNION
# Changed price_unit_local_VAT_incl
SELECT NEW.id_order, 'price_unit_local_VAT_incl', OLD.price_unit_local_VAT_incl, NEW.price_unit_local_VAT_incl, NEW.id_change_set
WHERE NOT OLD.price_unit_local_VAT_incl <=> NEW.price_unit_local_VAT_incl
UNION
# Changed latency_manufacture_days
SELECT NEW.id_link, 'latency_manufacture_days', OLD.latency_manufacture_days, NEW.latency_manufacture_days, NEW.id_change_set

View File

@@ -17,27 +17,25 @@ BEGIN
SET v_time_end := CURRENT_TIMESTAMP(6);
SELECT
a_time_start
, UNIX_DATETIME(a_time_start)
, UNIX_TIMESTAMP(a_time_start)
, MICROSECOND(a_time_start) / 1000
, v_time_end
, UNIX_DATETIME(v_time_end)
, UNIX_TIMESTAMP(v_time_end)
, MICROSECOND(v_time_end) / 1000
, v_time_end - a_time_start AS timestamp_delta
, UNIX_DATETIME(v_time_end - a_time_start) AS UNIX_DATETIME_timestamp_delta
, UNIX_TIMESTAMP(v_time_end - a_time_start) AS UNIX_TIMESTAMP_timestamp_delta
, MICROSECOND(v_time_end - a_time_start) AS MICROSECOND_timestamp_delta
-- , TIME_FORMAT(TIMEDIFF(v_time_end, a_time_start), '%H:%i:%s') AS time_difference
, CONCAT(
TIME_FORMAT(TIMEDIFF(v_time_end, a_time_start), '%H hours, %i minutes, %s seconds'),
', ',
DATETIMEDIFF(MICROSECOND, a_time_start, v_time_end) % 1000000 / 1000, ' milliseconds'
TIMESTAMPDIFF(MICROSECOND, a_time_start, v_time_end) % 1000000 / 1000, ' milliseconds'
) AS time_difference
;
END //
DELIMITER ;;
/*
CALL partsltd_prod.p_debug_timing_reporting (
CURRENT_TIMESTAMP(6)

View File

@@ -373,8 +373,8 @@ BEGIN
)
)
AND (
a_get_products_quantity_stock_below_min = 1
AND PP.quantity_stock < PP.quantity_min
a_get_products_quantity_stock_below_min = 0
OR PP.quantity_stock < PP.quantity_min
)
AND (
a_get_inactive_permutation = 1

View File

@@ -447,8 +447,13 @@ BEGIN
-- WHERE guid = v_guid
;
IF a_debug = 1 THEN
SELECT * FROM tmp_Category;
SELECT * FROM tmp_Product;
SELECT * FROM tmp_Permutation;
SELECT * FROM tmp_Image;
END IF;
-- Clean up
DROP TEMPORARY TABLE IF EXISTS tmp_Split;
DROP TEMPORARY TABLE IF EXISTS tmp_Image;
DROP TEMPORARY TABLE IF EXISTS tmp_Category;
@@ -481,7 +486,7 @@ CALL partsltd_prod.p_shop_get_many_product (
, 0 # a_get_inactive_image
, '' # a_ids_image
, 0 # a_get_products_quantity_stock_below_minimum
, 0 # a_debug
, 1 # a_debug
);
select * FROM partsltd_prod.Shop_Calc_User_Temp;

View File

@@ -45,9 +45,11 @@ BEGIN
, msg
)
SELECT
NULL
id_type
, @errno
, @text
FROM partsltd_prod.Shop_Msg_Error_Type MET
WHERE code = 'MYSQL_ERROR'
;
SELECT *
FROM tmp_Msg_Error;
@@ -55,12 +57,12 @@ BEGIN
END;
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_code_type_error_bad_data := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'BAD_DATA');
SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data);
SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION');
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission);
SET v_id_permission_supplier = (SELECT id_permission FROM partsltd_prod.Shop_Permission WHERE code = 'STORE_SUPPLIER' LIMIT 1);
SET v_id_access_level_EDIT = (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'EDIT');
SET v_code_type_error_bad_data := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION' LIMIT 1);
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission LIMIT 1);
SET v_id_permission_supplier := (SELECT id_permission FROM partsltd_prod.Shop_Permission WHERE code = 'STORE_SUPPLIER' LIMIT 1);
SET v_id_access_level_EDIT := (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
CALL p_validate_guid ( a_guid );
SET a_comment := TRIM(IFNULL(a_comment, ''));
@@ -84,6 +86,18 @@ BEGIN
, is_new BIT NOT NULL
);
CREATE TEMPORARY TABLE tmp_Supplier_Address (
id_address INT NOT NULL
, id_supplier INT NOT NULL
, id_region INT NOT NULL
, postcode VARCHAR(20) NOT NULL
, address_line_1 VARCHAR(256) NOT NULL
, address_line_2 VARCHAR(256) NOT NULL
, city VARCHAR(256) NOT NULL
, county VARCHAR(256) NOT NULL
, active BIT NOT NULL
);
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_type INT NOT NULL
@@ -125,7 +139,38 @@ BEGIN
WHERE GUID = a_guid
;
INSERT INTO tmp_Supplier_Address (
id_address
, id_supplier
, id_region
, postcode
, address_line_1
, address_line_2
, city
, county
, active
, name_error
, is_new
)
SELECT
SA_T.id_address
, SA_T.id_supplier
, SA_T.id_region
, SA_T.postcode
, SA_T.address_line_1
, SA_T.address_line_2
, SA_T.city
, SA_T.county
, SA_T.active
, IFNULL(SA_T.postcode, IFNULL(SA_T.city, IFNULL(SA_T.county, IFNULL(SA_T.address_line_1, IFNULL(SA_T.address_line_2, '(No Supplier)'))))) AS name_error
, IFNULL(SA_T.id_address, 0) < 1 AS is_new
FROM partsltd_prod.Shop_Supplier_Address_Temp SA_T
WHERE GUID = a_guid
;
-- Validation
-- Suppliers
/*
# id_address
IF EXISTS (
SELECT *
@@ -159,6 +204,7 @@ BEGIN
)
;
END IF;
*/
# id_currency
IF EXISTS (
SELECT *
@@ -222,6 +268,106 @@ BEGIN
WHERE ISNULL(t_S.email)
;
END IF;
# duplicate
IF EXISTS (SELECT COUNT(*) FROM tmp_Supplier t_S WHERE COUNT(*) > 1 GROUP BY t_S.id_supplier) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following supplier(s) are duplicates: ', GROUP_CONCAT(IFNULL(t_S.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Supplier t_S
WHERE COUNT(*) > 1
GROUP BY t_S.id_supplier
;
END IF;
-- Addresses
# id_supplier
IF EXISTS (
SELECT *
FROM tmp_Supplier_Address t_SA
LEFT JOIN partsltd_prod.Shop_Supplier S ON t_SA.id_supplier = S.id_supplier
WHERE 1=1
AND (
t_SA.id_supplier = 0
OR S.active = 0
)
LIMIT 1
) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT(
'The following supplier address(es) have an invalid or inactive Supplier: '
, GROUP_CONCAT(t_S.name_error SEPARATOR ', ')
) AS msg
FROM tmp_Supplier t_S
LEFT JOIN partsltd_prod.Shop_Supplier S ON t_SA.id_supplier = S.id_supplier
WHERE 1=1
AND (
t_SA.id_supplier = 0
OR S.active = 0
)
;
END IF;
# id_region
IF EXISTS (
SELECT *
FROM tmp_Supplier_Address t_SA
LEFT JOIN partsltd_prod.Shop_Region R ON t_SA.id_region = R.id_region
WHERE 1=1
AND (
t_SA.id_region = 0
OR R.active = 0
)
LIMIT 1
) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT(
'The following supplier address(es) have an invalid or inactive Supplier: '
, GROUP_CONCAT(t_S.name_error SEPARATOR ', ')
) AS msg
FROM tmp_Supplier t_S
LEFT JOIN partsltd_prod.Shop_Region R ON t_SA.id_region = R.id_region
WHERE 1=1
AND (
t_SA.id_region = 0
OR R.active = 0
)
;
END IF;
# duplicate
IF EXISTS (SELECT COUNT(*) FROM tmp_Supplier_Address t_SA WHERE COUNT(*) > 1 GROUP BY t_SA.id_address) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following supplier address(es) are duplicates: ', GROUP_CONCAT(IFNULL(t_S.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Supplier_Address t_SA
WHERE COUNT(*) > 1
GROUP BY t_SA.id_address
;
END IF;
-- Permissions
IF a_debug = 1 THEN
@@ -262,7 +408,7 @@ BEGIN
VALUES (
v_id_type_error_no_permission
, v_code_type_error_no_permission
CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1))
, CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1))
)
;
END IF;
@@ -291,7 +437,6 @@ BEGIN
SET v_id_change_set := LAST_INSERT_ID();
INSERT INTO partsltd_prod.Shop_Supplier (
-- id_supplier,
id_address
, id_currency
, name_company
@@ -350,6 +495,47 @@ BEGIN
S.id_change_set = v_id_change_set
*/
;
INSERT INTO partsltd_prod.Shop_Supplier_Address (
id_address
, id_supplier
, id_region
, postcode
, address_line_1
, address_line_2
, city
, county
, active
)
SELECT
t_SA.id_address
, t_SA.id_supplier
, t_SA.id_region
, t_SA.postcode
, t_SA.address_line_1
, t_SA.address_line_2
, t_SA.city
, t_SA.county
, t_SA.active
FROM tmp_Supplier_Address t_SA
WHERE t_SA.is_new = 1
;
UPDATE partsltd_prod.Shop_Supplier_Address SA
INNER JOIN tmp_Supplier_Address t_SA
ON SA.id_address = t_SA.id_address
AND t_SA.is_new = 0
SET
SA.id_address = t_SA.id_address
, SA.id_supplier = t_SA.id_supplier
, SA.id_region = t_SA.id_region
, SA.postcode = t_SA.postcode
, SA.address_line_1 = t_SA.address_line_1
, SA.address_line_2 = t_SA.address_line_2
, SA.city = t_SA.city
, SA.county = t_SA.county
, SA.active = t_SA.active
;
COMMIT;
END IF;

View File

@@ -23,24 +23,26 @@ BEGIN
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_guid := UUID();
SET v_id_access_level_view := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'VIEW' LIMIT 1);
SET v_code_type_error_bad_data := (SELECT code FROM Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION');
SET v_id_type_error_no_permission := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission);
SET v_id_permission_supplier := (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_SUPPLIER' LIMIT 1);
SET v_id_access_level_view := (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'VIEW' LIMIT 1);
SET v_code_type_error_bad_data := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION');
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission);
SET v_id_permission_supplier := (SELECT id_permission FROM partsltd_prod.Shop_Permission WHERE code = 'STORE_SUPPLIER' LIMIT 1);
SET a_get_all_supplier := IFNULL(a_get_all_supplier, 0);
SET a_get_inactive_supplier := IFNULL(a_get_inactive_supplier, 0);
SET a_ids_supplier := TRIM(IFNULL(a_ids_supplier, ''));
DROP TEMPORARY TABLE IF EXISTS tmp_Supplier;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
DROP TEMPORARY TABLE IF EXISTS tmp_Split;
CREATE TEMPORARY TABLE tmp_Supplier (
id_supplier INT NOT NULL
);
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
id_type INT NOT NULL,
code VARCHAR(50) NOT NULL,
@@ -94,7 +96,7 @@ BEGIN
OR ISNULL(S.id_supplier)
OR (
S.active = 0
AND v_get_inactive_supplier = 0
AND a_get_inactive_supplier = 0
)
) THEN
INSERT INTO tmp_Msg_Error (
@@ -113,7 +115,7 @@ BEGIN
OR ISNULL(S.id_supplier)
OR (
S.active = 0
AND v_get_inactive_supplier = 0
AND a_get_inactive_supplier = 0
)
;
ELSE
@@ -173,14 +175,14 @@ BEGIN
DELETE FROM tmp_Msg_Error;
INSERT INTO tmp_Msg_Error (
, id_type
id_type
, code
, msg
)
VALUES (
v_id_type_error_no_permission
, v_code_type_error_no_permission
CONCAT('You do not have view permissions for ', (SELECT name FROM Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1))
, CONCAT('You do not have view permissions for ', (SELECT name FROM Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1))
)
;
END IF;
@@ -193,8 +195,9 @@ BEGIN
# Suppliers
SELECT
t_S.id_supplier,
S.id_address,
S.id_currency,
C.symbol AS symbol_currency,
C.code AS code_currency,
S.name_company,
S.name_contact,
S.department_contact,
@@ -204,14 +207,32 @@ BEGIN
S.website,
S.active
FROM tmp_Supplier t_S
INNER JOIN Shop_Supplier S
ON t_S.id_supplier = S.id_supplier
INNER JOIN partsltd_prod.Shop_Supplier S ON t_S.id_supplier = S.id_supplier
LEFT JOIN partsltd_prod.Shop_Currency C ON S.id_currency = C.id_currency
;
# Supplier Addresses
SELECT
t_S.id_supplier
, SA.id_address
, SA.id_region
, R.name AS name_region
, SA.postcode
, SA.address_line_1
, SA.address_line_2
, SA.city
, SA.county
, SA.active
FROM tmp_Supplier t_S
INNER JOIN partsltd_prod.Shop_Supplier S ON t_S.id_supplier = S.id_supplier
INNER JOIN partsltd_prod.Shop_Supplier_Address SA ON S.id_supplier = SA.id_supplier
LEFT JOIN partsltd_prod.Shop_Region R ON SA.id_region = R.id_region
;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME
INNER JOIN Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
;
IF a_debug = 1 THEN
@@ -220,6 +241,7 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp_Supplier;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
DROP TEMPORARY TABLE IF EXISTS tmp_Split;
IF a_debug = 1 THEN
CALL p_debug_timing_reporting( v_time_start );
@@ -228,6 +250,7 @@ END //
DELIMITER ;;
/*
CALL p_shop_get_many_supplier (
1 -- 'auth0|6582b95c895d09a70ba10fef' # a_id_user
@@ -237,5 +260,4 @@ CALL p_shop_get_many_supplier (
, 0 # a_debug
);
/*
*/

View File

@@ -21,7 +21,7 @@ BEGIN
DECLARE v_code_type_error_warning VARCHAR(50);
DECLARE v_id_access_level_edit INT;
DECLARE v_id_change_set INT;
DECLARE v_id_permission_supplier_purchase_order INT;
DECLARE v_id_permission_supplier_purchase_order VARCHAR(100);
DECLARE v_id_type_error_bad_data INT;
DECLARE v_id_type_error_no_permission INT;
DECLARE v_id_type_error_warning INT;
@@ -66,8 +66,8 @@ BEGIN
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission);
SET v_code_type_error_warning := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'WARNING');
SET v_id_type_error_warning := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_warning);
SET v_id_permission_supplier_purchase_order = (SELECT id_permission FROM partsltd_prod.Shop_Permission WHERE code = 'STORE_SUPPLIER_PURCHASE_ORDER' LIMIT 1);
SET v_id_access_level_edit = (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'EDIT');
SET v_id_permission_supplier_purchase_order := (SELECT GROUP_CONCAT(id_permission SEPARATOR ',') FROM partsltd_prod.Shop_Permission WHERE code IN ('STORE_SUPPLIER', 'STORE_SUPPLIER_PURCHASE_ORDER', 'STORE_PRODUCT') LIMIT 1);
SET v_id_access_level_edit := (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
CALL p_validate_guid ( a_guid );
SET a_comment := TRIM(IFNULL(a_comment, ''));
@@ -81,13 +81,14 @@ BEGIN
, id_supplier_ordered INT NOT NULL
, id_currency_cost INT NOT NULL
-- , cost_total_local FLOAT NOT NULL
, active BIT NOT NULL
);
CREATE TEMPORARY TABLE tmp_Supplier_Purchase_Order_Product_Link (
id_link INT NOT NULL PRIMARY KEY
, id_order INT NOT NULL
, id_permutation INT NOT NULL
, id_currency_cost INT NOT NULL
-- , id_currency_cost INT NOT NULL
, quantity_ordered FLOAT NOT NULL
, id_unit_quantity INT NOT NULL
, quantity_received FLOAT NULL
@@ -127,9 +128,9 @@ BEGIN
id_link
, id_order
, id_permutation
, id_currency_cost
, quantity_ordered
-- , id_currency_cost
, id_unit_quantity
, quantity_ordered
, quantity_received
, latency_delivery_days
, display_order
@@ -144,14 +145,14 @@ BEGIN
)
SELECT
IFNULL(SPOPL_T.id_link, 0) AS id_link
, IFNULL(IFNULL(SPOPL_T.id_order, SPOPL.id_order) 0) AS id_order
, IFNULL(IFNULL(SPOPL_T.id_order, SPOPL.id_order), 0) AS id_order
, IFNULL(IFNULL(SPOPL_T.id_permutation, SPOPL.id_permutation), 0) AS id_permutation
, IFNULL(IFNULL(SPOPL_T.id_currency_cost, SPOPL.id_currency_cost) 0) AS id_currency_cost
, IFNULL(IFNULL(SPOPL_T.quantity_ordered, SPOPL.quantity_ordered), 0) AS quantity_ordered
-- , IFNULL(IFNULL(SPOPL_T.id_currency_cost, SPOPL.id_currency_cost), 0) AS id_currency_cost
, IFNULL(IFNULL(SPOPL_T.id_unit_quantity, SPOPL.id_unit_quantity), 0) AS id_unit_quantity
, IFNULL(IFNULL(SPOPL_T.quantity_ordered, SPOPL.quantity_ordered), 0) AS quantity_ordered
, IFNULL(SPOPL_T.quantity_received, SPOPL.quantity_received) AS quantity_received
, IFNULL(SPOPL_T.latency_delivery_days, SPOPL.latency_delivery_days) AS latency_delivery_days
, RANK() OVER (PARTITION BY IFNULL(IFNULL(SPOPL_T.id_order, SPOPL.id_order) 0) ORDER BY IFNULL(IFNULL(SPOPL_T.display_order, SPOPL.display_order), 0)) AS display_order
, RANK() OVER (PARTITION BY IFNULL(IFNULL(SPOPL_T.id_order, SPOPL.id_order), 0) ORDER BY IFNULL(IFNULL(SPOPL_T.display_order, SPOPL.display_order), 0)) AS display_order
, IFNULL(IFNULL(SPOPL_T.active, SPOPL.active), 1) AS active
, CONCAT(
fn_shop_get_product_permutation_name(SPOPL_T.id_permutation)
@@ -285,8 +286,8 @@ BEGIN
# id_unit_quantity
IF EXISTS (
SELECT *
FROM tmp_Supplier_Purchase_Order t_SPO
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_SPO.id_unit_quantity = UM.id_unit_measurement
FROM tmp_Supplier_Purchase_Order_Product_Link t_SPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_SPOPL.id_unit_quantity = UM.id_unit_measurement
WHERE 1=1
AND (
ISNULL(UM.id_unit_measurement)
@@ -306,8 +307,8 @@ BEGIN
'A valid unit measurement of quantity is required for the following Supplier Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)'), ' - ', t_SPO.id_currency_cost) SEPARATOR ', ')
) AS msg
FROM tmp_Stock_Item t_SPO
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_SPO.id_unit_quantity = UM.id_unit_measurement
FROM tmp_Supplier_Purchase_Order_Product_Link t_SPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_SPOPL.id_unit_quantity = UM.id_unit_measurement
WHERE 1=1
AND (
ISNULL(UM.id_unit_measurement)
@@ -318,7 +319,7 @@ BEGIN
# Invalid quantity ordered
IF EXISTS (
SELECT *
FROM tmp_Supplier_Purchase_Order_Product_Link
FROM tmp_Supplier_Purchase_Order_Product_Link t_SPOPL
WHERE
ISNULL(t_SPOPL.quantity_ordered)
OR t_SPOPL.quantity_ordered <= 0
@@ -342,7 +343,7 @@ BEGIN
# Invalid quantity received
IF EXISTS (
SELECT *
FROM tmp_Supplier_Purchase_Order_Product_Link
FROM tmp_Supplier_Purchase_Order_Product_Link t_SPOPL
WHERE t_SPOPL.quantity_received < 0
) THEN
INSERT INTO tmp_Msg_Error (
@@ -362,7 +363,7 @@ BEGIN
# Invalid delivery latency
IF EXISTS (
SELECT *
FROM tmp_Supplier_Purchase_Order_Product_Link
FROM tmp_Supplier_Purchase_Order_Product_Link t_SPOPL
WHERE t_SPOPL.latency_delivery_days < 0
) THEN
INSERT INTO tmp_Msg_Error (
@@ -494,7 +495,7 @@ BEGIN
VALUES (
v_id_type_error_no_permission
, v_code_type_error_no_permission
CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1))
, CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1))
)
;
END IF;
@@ -513,8 +514,30 @@ BEGIN
INNER JOIN partsltd_prod.Shop_Stock_Item SI ON SPOPL.id_permutation = SI.id_permutation
WHERE
t_SPOPL.is_new = 0
AND t_SPOPL.quantity_received < SPOPL.quantity_received
)
AND t_SPOPL.quantity_received <> SPOPL.quantity_received
) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_warning
, v_code_type_error_warning
, CONCAT(
'The quantity received has changed on the following orders. Please update the stock items appropriately.'
, GROUP_CONCAT(
CONCAT(
t_SPOPL.name_error
, ' - from '
, SPOPL.quantity_received
, ' to '
, t_SPOPL.quantity_received
) SEPARATOR ', '
)
) AS msg
;
END IF;
-- Transaction
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
@@ -559,7 +582,7 @@ BEGIN
INSERT INTO Shop_Supplier_Purchase_Order_Product_Link (
id_order
, id_permutation
, id_currency_cost
-- , id_currency_cost
, id_unit_quantity
, quantity_ordered
, quantity_received
@@ -574,7 +597,7 @@ BEGIN
SELECT
t_SPOPL.id_order
, t_SPOPL.id_permutation
, t_SPOPL.id_currency_cost
-- , t_SPOPL.id_currency_cost
, t_SPOPL.id_unit_quantity
, t_SPOPL.quantity_ordered
, t_SPOPL.quantity_received
@@ -583,8 +606,8 @@ BEGIN
, t_SPOPL.active
, t_SPOPL.cost_total_local_VAT_excl
, t_SPOPL.cost_total_local_VAT_incl
a_id_user
v_id_change_set
, a_id_user
, v_id_change_set
FROM tmp_Supplier_Purchase_Order_Product_Link t_SPOPL
WHERE t_SPOPL.is_new = 1
;
@@ -610,7 +633,7 @@ BEGIN
SET
SPOPL.id_order = t_SPOPL.id_order,
SPOPL.id_permutation = t_SPOPL.id_permutation,
SPOPL.id_currency_cost = t_SPOPL.id_currency_cost,
-- SPOPL.id_currency_cost = t_SPOPL.id_currency_cost,
SPOPL.id_unit_quantity = t_SPOPL.id_unit_quantity,
SPOPL.quantity_ordered = t_SPOPL.quantity_ordered,
SPOPL.quantity_received = t_SPOPL.quantity_received,
@@ -632,6 +655,7 @@ BEGIN
;
COMMIT;
END IF;
# Errors
SELECT *

View File

@@ -26,19 +26,19 @@ BEGIN
DECLARE v_has_filter_date_from BIT;
DECLARE v_has_filter_date_to BIT;
DECLARE v_id_access_level_view INT;
DECLARE v_ids_permission_supplier_purchase_order INT;
DECLARE v_ids_permission_supplier_purchase_order VARCHAR(100);
DECLARE v_id_type_error_bad_data INT;
DECLARE v_id_type_error_no_permission INT;
DECLARE v_time_start TIMESTAMP(6);
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_guid := UUID();
SET v_id_access_level_view := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'VIEW' LIMIT 1);
SET v_code_type_error_bad_data := (SELECT code FROM Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION');
SET v_id_type_error_no_permission := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission);
SET v_ids_permission_supplier_purchase_order := (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_SUPPLIER_PURCHASE_ORDER' LIMIT 1);
SET v_id_access_level_view := (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'VIEW' LIMIT 1);
SET v_code_type_error_bad_data := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION' LIMIT 1);
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission LIMIT 1);
SET v_ids_permission_supplier_purchase_order := (SELECT GROUP_CONCAT(id_permission SEPARATOR ',') FROM partsltd_prod.Shop_Permission WHERE code IN ('STORE_SUPPLIER', 'STORE_SUPPLIER_PURCHASE_ORDER', 'STORE_PRODUCT'));
SET a_get_all_supplier := IFNULL(a_get_all_supplier, 1);
SET a_get_inactive_supplier := IFNULL(a_get_inactive_supplier, 0);
@@ -51,32 +51,38 @@ BEGIN
SET a_date_to := IFNULL(a_date_to, NULL);
SET a_debug := IFNULL(a_debug, 0);
DROP TABLE IF EXISTS tmp_Supplier_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Supplier_Purchase_Order;
DROP TABLE IF EXISTS tmp_Supplier;
DROP TABLE IF EXISTS tmp_Product;
DROP TEMPORARY TABLE IF EXISTS tmp_Supplier_Purchase_Order_Product_Link;
DROP TEMPORARY TABLE IF EXISTS tmp_Supplier_Purchase_Order;
DROP TEMPORARY TABLE IF EXISTS tmp_Supplier;
DROP TEMPORARY TABLE IF EXISTS tmp_Permutation;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
DROP TEMPORARY TABLE IF EXISTS tmp_Split;
CREATE TABLE tmp_Supplier (
CREATE TEMPORARY TABLE tmp_Supplier (
id_supplier INT NOT NULL PRIMARY KEY
);
CREATE TABLE tmp_Supplier_Purchase_Order (
CREATE TEMPORARY TABLE tmp_Supplier_Purchase_Order (
id_order INT NOT NULL PRIMARY KEY
);
CREATE TABLE tmp_Supplier_Purchase_Order_Product_Link (
id_link INT NOT NULL PRIMARY KEY,
id_order INT NOT NULL,
id_permutation INT NOT NULL
CREATE TEMPORARY TABLE tmp_Permutation (
id_permutation INT NOT NULL PRIMARY KEY
);
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
id_type INT NOT NULL,
code VARCHAR(50) NOT NULL,
msg VARCHAR(4000) NOT NULL
);
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Split (
substring VARCHAR(4000) NOT NULL
, as_int INT NULL
);
DELETE FROM tmp_Split;
SET v_has_filter_supplier = CASE WHEN a_ids_supplier = '' THEN 0 ELSE 1 END;
SET v_has_filter_order = CASE WHEN a_ids_order = '' THEN 0 ELSE 1 END;
SET v_has_filter_permutation = CASE WHEN a_ids_permutation = '' THEN 0 ELSE 1 END;
@@ -189,7 +195,7 @@ BEGIN
OR ISNULL(S.id_supplier)
OR (
S.active = 0
AND v_get_inactive_supplier = 0
AND a_get_inactive_supplier = 0
)
) THEN
INSERT INTO tmp_Msg_Error (
@@ -208,7 +214,7 @@ BEGIN
OR ISNULL(S.id_supplier)
OR (
S.active = 0
AND v_get_inactive_supplier = 0
AND a_get_inactive_supplier = 0
)
;
ELSE
@@ -267,7 +273,7 @@ BEGIN
OR ISNULL(SPO.id_order)
OR (
SPO.active = 0
AND v_get_inactive_order = 0
AND a_get_inactive_order = 0
)
) THEN
INSERT INTO tmp_Msg_Error (
@@ -286,7 +292,7 @@ BEGIN
OR ISNULL(SPO.id_order)
OR (
SPO.active = 0
AND v_get_inactive_order = 0
AND a_get_inactive_order = 0
)
;
ELSE
@@ -340,40 +346,40 @@ BEGIN
v_guid
, a_id_user
, FALSE -- get inactive users
, v_id_permission_supplier_purchase_order
, v_ids_permission_supplier_purchase_order
, v_id_access_level_view
, '' -- ids_product
, 0 -- a_debug
;
SELECT * from Shop_Calc_User_Temp;
SELECT * from partsltd_prod.Shop_Calc_User_Temp;
END IF;
CALL p_shop_calc_user(
v_guid
, a_id_user
, FALSE -- get inactive users
, v_id_permission_supplier_purchase_order
, v_ids_permission_supplier_purchase_order
, v_id_access_level_view
, '' -- ids_product
, 0 -- a_debug
);
IF a_debug = 1 THEN
SELECT * from Shop_Calc_User_Temp;
SELECT * from partsltd_prod.Shop_Calc_User_Temp;
END IF;
IF NOT EXISTS (SELECT can_view FROM Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = v_guid) THEN
IF NOT EXISTS (SELECT can_view FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = v_guid) THEN
DELETE FROM tmp_Msg_Error;
INSERT INTO tmp_Msg_Error (
, id_type
id_type
, code
, msg
)
VALUES (
v_id_type_error_no_permission
, v_code_type_error_no_permission
CONCAT('You do not have view permissions for ', (SELECT name FROM Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1))
, CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1))
)
;
END IF;
@@ -399,7 +405,7 @@ BEGIN
S.id_currency,
t_S.active
FROM tmp_Supplier t_S
INNER JOIN Shop_Supplier S
INNER JOIN partsltd_prod.Shop_Supplier S
ON t_S.id_supplier = S.id_supplier
;
*/
@@ -412,6 +418,12 @@ BEGIN
, SPO.cost_total_local_VAT_excl
, SPO.cost_total_local_VAT_incl
, SPO.active
, SPO.created_on
, CONCAT(
SPO.cost_total_local_VAT_excl
, ' on '
, SPO.created_on
) AS name
FROM tmp_Supplier_Purchase_Order t_SPO
INNER JOIN partsltd_prod.Shop_Supplier_Purchase_Order SPO ON SPO.id_order = t_SPO.id_order
;
@@ -422,23 +434,25 @@ BEGIN
, SPOPL.id_order
, SPOPL.id_permutation
, fn_shop_get_product_permutation_name(SPOPL.id_permutation) AS name_permutation
, SPOPL.id_currency_cost
-- , SPOPL.id_currency_cost
, SPOPL.id_unit_quantity
, SPOPL.quantity_ordered
, SPOPL.quantity_received
, SPOPL.latency_delivery_days
, SPOPL.display_order
, SPO.cost_total_local_VAT_excl
, SPO.cost_total_local_VAT_incl
FROM tmp_Supplier_Purchase_Order_Product_Link t_SPOPL
INNER JOIN partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link SPOPL ON t_SPOPL.id_link = SPOPL.id_link
INNER JOIN tmp_Supplier_Purchase_Order t_SPO ON SPOPL.id_order = t_SPO.id_order
, SPOPL.cost_total_local_VAT_excl
, SPOPL.cost_total_local_VAT_incl
, SPOPL.cost_unit_local_VAT_excl
, SPOPL.cost_unit_local_VAT_incl
, SPOPL.active
FROM tmp_Supplier_Purchase_Order t_SPO
INNER JOIN partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link SPOPL ON t_SPO.id_order = SPOPL.id_order
;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME
INNER JOIN Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
;
IF a_debug = 1 THEN
@@ -450,7 +464,9 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp_Supplier_Purchase_Order_Product_Link;
DROP TEMPORARY TABLE IF EXISTS tmp_Supplier_Purchase_Order;
DROP TEMPORARY TABLE IF EXISTS tmp_Supplier;
DROP TEMPORARY TABLE IF EXISTS tmp_Permutation;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
DROP TEMPORARY TABLE IF EXISTS tmp_Split;
IF a_debug = 1 THEN
CALL p_debug_timing_reporting( v_time_start );
@@ -459,15 +475,14 @@ END //
DELIMITER ;;
/*
CALL p_shop_get_many_supplier_purchase_order (
'', # a_id_user
1, # a_id_user
1, # a_get_all_supplier
0, # a_get_inactive_supplier
'', # a_ids_supplier
1, # a_get_all_order
-- 0, # a_get_inactive_order
0, # a_get_inactive_order
'', # a_ids_order
'', # a_ids_permutation
NULL, # a_date_from
@@ -475,4 +490,5 @@ CALL p_shop_get_many_supplier_purchase_order (
, 0 # a_debug
);
/*
*/

View File

@@ -20,7 +20,7 @@ BEGIN
DECLARE v_code_type_error_no_permission VARCHAR(50);
DECLARE v_id_access_level_edit INT;
DECLARE v_id_change_set INT;
DECLARE v_id_permission_manufacturing_purchase_order INT;
DECLARE v_ids_permission_manufacturing_purchase_order VARCHAR(100);
DECLARE v_id_type_error_bad_data INT;
DECLARE v_id_type_error_no_permission INT;
DECLARE v_ids_product_permission TEXT;
@@ -58,12 +58,12 @@ BEGIN
END;
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_code_type_error_bad_data := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'BAD_DATA');
SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data);
SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION');
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission);
SET v_id_permission_manufacturing_purchase_order = (SELECT id_permission FROM partsltd_prod.Shop_Permission WHERE code = 'STORE_SUPPLIER_PURCHASE_ORDER' LIMIT 1);
SET v_id_access_level_edit = (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'EDIT');
SET v_code_type_error_bad_data := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION' LIMIT 1);
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission LIMIT 1);
SET v_ids_permission_manufacturing_purchase_order := (SELECT GROUP_CONCAT(id_permission SEPARATOR ',') FROM partsltd_prod.Shop_Permission WHERE code IN ('STORE_MANUFACTURING_PURCHASE_ORDER', 'STORE_PRODUCT'));
SET v_id_access_level_edit := (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
CALL p_validate_guid ( a_guid );
SET a_comment := TRIM(IFNULL(a_comment, ''));
@@ -136,14 +136,14 @@ BEGIN
)
SELECT
IFNULL(SPOPL_T.id_link, 0) AS id_link
, IFNULL(IFNULL(SPOPL_T.id_order, MPOPL.id_order) 0) AS id_order
, IFNULL(IFNULL(SPOPL_T.id_order, MPOPL.id_order), 0) AS id_order
, IFNULL(IFNULL(SPOPL_T.id_permutation, MPOPL.id_permutation), 0) AS id_permutation
, IFNULL(IFNULL(SPOPL_T.id_currency_cost, MPOPL.id_currency_cost) 0) AS id_currency_cost
, IFNULL(IFNULL(SPOPL_T.id_currency_cost, MPOPL.id_currency_cost), 0) AS id_currency_cost
, IFNULL(IFNULL(SPOPL_T.quantity_ordered, MPOPL.quantity_ordered), 0) AS quantity_ordered
, IFNULL(IFNULL(SPOPL_T.id_unit_quantity, MPOPL.id_unit_quantity), 0) AS id_unit_quantity
, IFNULL(SPOPL_T.quantity_received, MPOPL.quantity_received) AS quantity_received
, IFNULL(SPOPL_T.latency_delivery_days, MPOPL.latency_delivery_days) AS latency_delivery_days
, RANK() OVER (PARTITION BY IFNULL(IFNULL(SPOPL_T.id_order, MPOPL.id_order) 0) ORDER BY IFNULL(IFNULL(SPOPL_T.display_order, MPOPL.display_order), 0)) AS display_order
, RANK() OVER (PARTITION BY IFNULL(IFNULL(SPOPL_T.id_order, MPOPL.id_order), 0) ORDER BY IFNULL(IFNULL(SPOPL_T.display_order, MPOPL.display_order), 0)) AS display_order
, IFNULL(IFNULL(SPOPL_T.active, MPOPL.active), 1) AS active
, CONCAT(
fn_shop_get_product_permutation_name(SPOPL_T.id_permutation)
@@ -418,7 +418,7 @@ BEGIN
v_guid
, a_id_user
, FALSE -- get inactive users
, v_id_permission_manufacturing_purchase_order
, v_ids_permission_manufacturing_purchase_order
, v_id_access_level_edit
, v_ids_product_permission -- ids_product
, 0 -- a_debug
@@ -430,7 +430,7 @@ BEGIN
v_guid
, a_id_user
, FALSE -- get inactive users
, v_id_permission_manufacturing_purchase_order
, v_ids_permission_manufacturing_purchase_order
, v_id_access_level_edit
, v_ids_product_permission -- ids_product
, 0 -- a_debug
@@ -451,7 +451,7 @@ BEGIN
VALUES (
v_id_type_error_no_permission
, v_code_type_error_no_permission
CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_manufacturing LIMIT 1))
, CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_manufacturing LIMIT 1))
)
;
END IF;
@@ -527,8 +527,8 @@ BEGIN
, t_MPOPL.active
, t_MPOPL.cost_total_local_VAT_excl
, t_MPOPL.cost_total_local_VAT_incl
a_id_user
v_id_change_set
, a_id_user
, v_id_change_set
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.is_new = 1
;
@@ -575,6 +575,7 @@ BEGIN
;
COMMIT;
END IF;
# Errors
SELECT *

View File

@@ -5,9 +5,6 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_manufacturing_purchase_order;
DELIMITER //
CREATE PROCEDURE p_shop_get_many_manufacturing_purchase_order (
IN a_id_user INT,
IN a_get_all_manufacturing BIT,
IN a_get_inactive_manufacturing BIT,
IN a_ids_manufacturing TEXT,
IN a_get_all_order BIT,
IN a_get_inactive_order BIT,
IN a_ids_order TEXT,
@@ -25,19 +22,19 @@ BEGIN
DECLARE v_has_filter_date_from BIT;
DECLARE v_has_filter_date_to BIT;
DECLARE v_id_access_level_view INT;
DECLARE v_ids_permission_manufacturing_purchase_order INT;
DECLARE v_ids_permission_manufacturing_purchase_order VARCHAR(100);
DECLARE v_id_type_error_bad_data INT;
DECLARE v_id_type_error_no_permission INT;
DECLARE v_time_start TIMESTAMP(6);
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_guid := UUID();
SET v_id_access_level_view := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'VIEW' LIMIT 1);
SET v_code_type_error_bad_data := (SELECT code FROM Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION');
SET v_id_type_error_no_permission := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission);
SET v_ids_permission_manufacturing_purchase_order := (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_SUPPLIER_PURCHASE_ORDER' LIMIT 1);
SET v_id_access_level_view := (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'VIEW' LIMIT 1);
SET v_code_type_error_bad_data := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'BAD_DATA' LIMIT 1);
SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION');
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission);
SET v_ids_permission_manufacturing_purchase_order := (SELECT GROUP_CONCAT(id_permission SEPARATOR ',') FROM partsltd_prod.Shop_Permission WHERE code IN ('STORE_MANUFACTURING_PURCHASE_ORDER', 'STORE_PRODUCT'));
SET a_get_all_order := IFNULL(a_get_all_order, 1);
SET a_get_inactive_order := IFNULL(a_get_inactive_order, 0);
@@ -47,27 +44,33 @@ BEGIN
SET a_date_to := IFNULL(a_date_to, NULL);
SET a_debug := IFNULL(a_debug, 0);
DROP TABLE IF EXISTS tmp_Manufacturing_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Manufacturing_Purchase_Order;
DROP TABLE IF EXISTS tmp_Product;
DROP TEMPORARY TABLE IF EXISTS tmp_Manufacturing_Purchase_Order_Product_Link;
DROP TEMPORARY TABLE IF EXISTS tmp_Manufacturing_Purchase_Order;
DROP TEMPORARY TABLE IF EXISTS tmp_Permutation;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
DROP TEMPORARY TABLE IF EXISTS tmp_Split;
CREATE TABLE tmp_Manufacturing_Purchase_Order (
CREATE TEMPORARY TABLE tmp_Manufacturing_Purchase_Order (
id_order INT NOT NULL PRIMARY KEY
);
CREATE TABLE tmp_Manufacturing_Purchase_Order_Product_Link (
id_link INT NOT NULL PRIMARY KEY,
id_order INT NOT NULL,
id_permutation INT NOT NULL
CREATE TEMPORARY TABLE tmp_Permutation (
id_permutation INT NOT NULL PRIMARY KEY
);
CREATE TABLE IF NOT EXISTS tmp_Msg_Error (
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
id_type INT NOT NULL,
code VARCHAR(50) NOT NULL,
msg VARCHAR(4000) NOT NULL
);
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Split (
substring VARCHAR(4000) NOT NULL
, as_int INT NULL
);
DELETE FROM tmp_Split;
SET v_has_filter_order = CASE WHEN a_ids_order = '' THEN 0 ELSE 1 END;
SET v_has_filter_permutation = CASE WHEN a_ids_permutation = '' THEN 0 ELSE 1 END;
SET v_has_filter_date_from = CASE WHEN ISNULL(a_date_from) THEN 0 ELSE 1 END;
@@ -172,13 +175,13 @@ BEGIN
IF EXISTS (
SELECT *
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order SPO ON t_S.as_int = SPO.id_order
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_S.as_int = MPO.id_order
WHERE
ISNULL(t_S.as_int)
OR ISNULL(SPO.id_order)
OR ISNULL(MPO.id_order)
OR (
SPO.active = 0
AND v_get_inactive_order = 0
MPO.active = 0
AND a_get_inactive_order = 0
)
) THEN
INSERT INTO tmp_Msg_Error (
@@ -191,13 +194,13 @@ BEGIN
v_code_type_error_bad_data,
CONCAT('Invalid or inactive Manufacturing Purchase Order IDs: ', IFNULL(GROUP_CONCAT(t_S.substring SEPARATOR ', '), 'NULL'))
FROM tmp_Split t_S
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order SPO ON t_S.as_int = SPO.id_order
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_S.as_int = MPO.id_order
WHERE
ISNULL(t_S.as_int)
OR ISNULL(SPO.id_order)
OR ISNULL(MPO.id_order)
OR (
SPO.active = 0
AND v_get_inactive_order = 0
MPO.active = 0
AND a_get_inactive_order = 0
)
;
ELSE
@@ -205,11 +208,11 @@ BEGIN
id_order
)
SELECT
SPO.id_order
MPO.id_order
FROM tmp_Split t_S
RIGHT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order SPO ON t_S.as_int = SPO.id_order
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link SPOPL ON SPO.id_order = SPOPL.id_order
INNER JOIN tmp_Permutation t_PP ON SPOPL.id_permutation = t_PP.id_permutation
RIGHT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_S.as_int = MPO.id_order
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON MPO.id_order = MPOPL.id_order
INNER JOIN tmp_Permutation t_PP ON MPOPL.id_permutation = t_PP.id_permutation
WHERE (
a_get_all_order = 1
OR (
@@ -223,15 +226,15 @@ BEGIN
)
AND (
a_get_inactive_order = 1
OR SPO.active = 1
OR MPO.active = 1
)
AND (
v_has_filter_date_from = 0
OR SPO.created_on > a_date_from
OR MPO.created_on > a_date_from
)
AND (
v_has_filter_date_to = 0
OR SPO.created_on < a_date_to
OR MPO.created_on < a_date_to
)
;
@@ -246,40 +249,40 @@ BEGIN
v_guid
, a_id_user
, FALSE -- get inactive users
, v_id_permission_manufacturing_purchase_order
, v_ids_permission_manufacturing_purchase_order
, v_id_access_level_view
, '' -- ids_product
, 0 -- a_debug
;
SELECT * from Shop_Calc_User_Temp;
SELECT * FROM partsltd_prod.Shop_Calc_User_Temp;
END IF;
CALL p_shop_calc_user(
v_guid
, a_id_user
, FALSE -- get inactive users
, v_id_permission_manufacturing_purchase_order
, v_ids_permission_manufacturing_purchase_order
, v_id_access_level_view
, '' -- ids_product
, 0 -- a_debug
);
IF a_debug = 1 THEN
SELECT * from Shop_Calc_User_Temp;
SELECT * FROM partsltd_prod.Shop_Calc_User_Temp;
END IF;
IF NOT EXISTS (SELECT can_view FROM Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = v_guid) THEN
IF NOT EXISTS (SELECT can_view FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = v_guid) THEN
DELETE FROM tmp_Msg_Error;
INSERT INTO tmp_Msg_Error (
, id_type
id_type
, code
, msg
)
VALUES (
v_id_type_error_no_permission
, v_code_type_error_no_permission
CONCAT('You do not have view permissions for ', (SELECT name FROM Shop_Permission WHERE id_permission = v_id_permission_manufacturing LIMIT 1))
, CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_manufacturing LIMIT 1))
)
;
END IF;
@@ -305,60 +308,66 @@ BEGIN
S.id_currency,
t_S.active
FROM tmp_Manufacturing t_S
INNER JOIN Shop_Manufacturing S
INNER JOIN partsltd_prod.Shop_Manufacturing S
ON t_S.id_manufacturing = S.id_manufacturing
;
*/
# Manufacturing Purchase Order
SELECT
t_SPO.id_order
, SPO.id_manufacturing_ordered
, SPO.id_currency_cost
, SPO.cost_total_local_VAT_excl
, SPO.cost_total_local_VAT_incl
, SPO.active
FROM tmp_Manufacturing_Purchase_Order t_SPO
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order SPO ON SPO.id_order = t_SPO.id_order
t_MPO.id_order
, MPO.id_currency
, MPO.cost_total_local_VAT_excl
, MPO.cost_total_local_VAT_incl
, MPO.price_total_local_VAT_excl
, MPO.price_total_local_VAT_incl
, MPO.active
, MPO.created_on
, CONCAT(
MPO.cost_total_local_VAT_excl
, ' on '
, MPO.created_on
) AS name
FROM tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON MPO.id_order = t_MPO.id_order
;
# Manufacturing Purchase Order Product Link
SELECT
SPOPL.id_link
, SPOPL.id_order
, SPOPL.id_permutation
, fn_shop_get_product_permutation_name(SPOPL.id_permutation) AS name_permutation
, SPOPL.id_currency_cost
, SPOPL.id_unit_quantity
, SPOPL.quantity_ordered
, SPOPL.quantity_received
, SPOPL.latency_delivery_days
, SPOPL.display_order
, SPO.cost_total_local_VAT_excl
, SPO.cost_total_local_VAT_incl
, SPO.cost_unit_local_VAT_excl
, SPO.cost_unit_local_VAT_incl
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_SPOPL
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link SPOPL ON t_SPOPL.id_link = SPOPL.id_link
INNER JOIN tmp_Manufacturing_Purchase_Order t_SPO ON SPOPL.id_order = t_SPO.id_order
MPOPL.id_link
, MPOPL.id_order
, MPOPL.id_permutation
, fn_shop_get_product_permutation_name(MPOPL.id_permutation) AS name_permutation
, MPOPL.id_unit_quantity
, MPOPL.quantity_used
, MPOPL.quantity_produced
, MPOPL.latency_manufacture_days
, MPOPL.display_order
, MPOPL.cost_unit_local_VAT_excl
, MPOPL.cost_unit_local_VAT_incl
, MPOPL.price_unit_local_VAT_excl
, MPOPL.price_unit_local_VAT_incl
, MPOPL.active
FROM tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON t_MPO.id_order = MPOPL.id_order
;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME
INNER JOIN Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
;
IF a_debug = 1 THEN
SELECT * from tmp_Manufacturing_Purchase_Order_Product_Link;
SELECT * from tmp_Manufacturing_Purchase_Order;
SELECT * from tmp_Manufacturing;
SELECT * from tmp_Permutation;
END IF;
DROP TEMPORARY TABLE IF EXISTS tmp_Manufacturing_Purchase_Order_Product_Link;
DROP TEMPORARY TABLE IF EXISTS tmp_Manufacturing_Purchase_Order;
DROP TEMPORARY TABLE IF EXISTS tmp_Manufacturing;
DROP TEMPORARY TABLE IF EXISTS tmp_Permutation;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
DROP TEMPORARY TABLE IF EXISTS tmp_Split;
IF a_debug = 1 THEN
CALL p_debug_timing_reporting( v_time_start );
@@ -367,20 +376,17 @@ END //
DELIMITER ;;
/*
CALL p_shop_get_many_manufacturing_purchase_order (
'', # a_id_user
1, # a_get_all_manufacturing
0, # a_get_inactive_manufacturing
'', # a_ids_manufacturing
1, # a_get_all_order
-- 0, # a_get_inactive_order
'', # a_ids_order
'', # a_ids_permutation
NULL, # a_date_from
NULL # a_date_to
1 # a_id_user
, 1 # a_get_all_order
, 0 # a_get_inactive_order
, '' # a_ids_order
, '' # a_ids_permutation
, NULL # a_date_from
, NULL # a_date_to
, 0 # a_debug
);
/*
*/

View File

@@ -690,10 +690,28 @@ VALUES
# Supplier
INSERT INTO Shop_Supplier (
name_company, name_contact, department_contact, id_address, phone_number, fax, email, website, id_currency
name_company
, name_contact
, department_contact
-- , id_address
, phone_number
, fax
, email
, website
, id_currency
)
VALUES
('Precision And Research Technology Systems Limited', 'Teddy Middleton-Smith', 'Executive Management', 1, '07375571430', '', 'teddy@partsltd.co.uk', 'www.partsltd.co.uk', 1)
(
'Precision And Research Technology Systems Limited'
, 'Teddy Middleton-Smith'
, 'Executive Management'
-- , 1
, '07375571430'
, ''
, 'teddy@partsltd.co.uk'
, 'www.partsltd.co.uk'
, 1
)
;
# Suppliers
@@ -701,7 +719,7 @@ INSERT INTO Shop_Supplier (
name_company
, name_contact
, department_contact
, id_address
-- , id_address
, phone_number
, fax
, email
@@ -709,7 +727,51 @@ INSERT INTO Shop_Supplier (
, id_currency
)
VALUES
('Malt Kiln Farm Shop', NULL, NULL, 1, '01788 832640', NULL, 'farmshop@maltkilnfarmshop.co.uk', 'https://www.maltkilnfarmshop.co.uk/', 1)
(
'Malt Kiln Farm Shop'
, NULL
, NULL
-- , 1
, '01788 832640'
, NULL
, 'farmshop@maltkilnfarmshop.co.uk'
, 'https://www.maltkilnfarmshop.co.uk/'
, 1
)
;
# Supplier Addresses
INSERT INTO Shop_Supplier_Address (
id_supplier
, id_region
, postcode
, address_line_1
, address_line_2
, city
, county
, active
)
VALUES
(
1
, 1
, 'CV22 6DN'
, '53 Alfred Green Close'
, ''
, 'Rugby'
, 'Warwickshire'
, 1
),
(
2
, 1
, 'CV22 6DN'
, '53 Alfred Green Close'
, ''
, 'Rugby'
, 'Warwickshire'
, 1
)
;
/*

View File

@@ -91,13 +91,19 @@
1398_tbl_Shop_Order_Status_Audit.sql
1400_tbl_Shop_Supplier.sql
1401_tbl_Shop_Supplier_Audit.sql
1402_tbl_Shop_Supplier_Temp.sql
1403_tbl_Shop_Supplier_Address.sql
1403_tbl_Shop_Supplier_Address_Temp.sql
1404_tbl_Shop_Supplier_Address.sql
1409_tbl_Shop_Supplier_Purchase_Order.sql
1410_tbl_Shop_Supplier_Purchase_Order_Audit.sql
1411_tbl_Shop_Supplier_Purchase_Order_Temp.sql
1412_tbl_Shop_Supplier_Purchase_Order_Product_Link.sql
1413_tbl_Shop_Supplier_Purchase_Order_Product_Link_Audit.sql
1414_tbl_Shop_Supplier_Purchase_Order_Product_Link_Temp.sql
1415_tbl_Shop_Manufacturing_Purchase_Order.sql
1416_tbl_Shop_Manufacturing_Purchase_Order_Audit.sql
1417_tbl_Shop_Manufacturing_Purchase_Order_Temp.sql
1418_tbl_Shop_Manufacturing_Purchase_Order_Product_Link.sql
1419_tbl_Shop_Manufacturing_Purchase_Order_Product_Link_Audit.sql
1420_tbl_Shop_Manufacturing_Purchase_Order_Product_Link_Temp.sql
@@ -146,6 +152,7 @@
3321_tri_Shop_User_Basket.sql
3324_tri_Shop_User_Order_Status.sql
3400_tri_Shop_Supplier.sql
3403_tri_Shop_Supplier_Address.sql
3403_tri_Shop_Unit_Measurement.sql
3406_tri_Shop_Unit_Of_Measurement_Conversion.sql
3409_tri_Shop_Supplier_Purchase_Order.sql
@@ -162,6 +169,7 @@
6003_p_split_key_value_pair_csv.sql
6004_p_clear_split_key_value_pair_csv_temp.sql
6206_fn_shop_get_product_permutation_name.sql
6210_fn_shop_get_id_product_permutation_from_variation_csv_list.sql
6500_p_shop_calc_user.sql
6501_p_shop_clear_calc_user.sql
7003_p_shop_get_many_access_level.sql
@@ -179,7 +187,6 @@
7204_p_shop_get_many_product.sql
7205_p_shop_get_many_stripe_product_new.sql
7206_p_shop_save_product_permutation.sql
7210_fn_shop_get_id_product_permutation_from_variation_csv_list.sql
7210_p_shop_get_many_product_variation.sql
7219_p_shop_get_many_stock_item.sql
7220_p_shop_save_stock_item.sql

View File

@@ -1,4 +1,8 @@
#formFilters .container {
max-width: fit-content;
}
thead, tbody {
padding-top: 0px !important;
padding-bottom: 0px !important;
@@ -44,4 +48,13 @@ table select {
table input {
width: 90% !important;
}
table button {
margin: 0.25vh;
padding: 0.5vh 1vh;
}
tr.delete {
background-color: red;
}

View File

@@ -500,10 +500,6 @@ button:hover, input[type="submit"]:hover, #overlayHamburger .row *:hover {
text-decoration: none;
}
.delete {
text-decoration: underline;
}
/* Overlay modal */
.overlay {

View File

@@ -0,0 +1,38 @@
#formFilters {
width: 50vh;
}
#formFilters .container-input.filter.active {
width: 8vh;
}
#formFilters .container-input.filter.date_from,
#formFilters .container-input.filter.date_to {
width: 8vh;
}
#tableMain thead tr th.currency.collapsed, #tableMain tbody tr td.currency.collapsed {
width: 9vh;
min-width: 9vh;
}
#tableMain thead tr th.currency, #tableMain tbody tr td.currency {
width: 11vh;
min-width: 11vh;
}
#tableMain tbody tr td.cost_total_local_vat_excl, #tableMain thead tr th.cost_total_local_vat_excl,
#tableMain tbody tr td.cost_total_local_vat_incl, #tableMain thead tr th.cost_total_local_vat_incl,
#tableMain tbody tr td.price_total_local_vat_excl, #tableMain thead tr th.price_total_local_vat_excl,
#tableMain tbody tr td.price_total_local_vat_incl, #tableMain thead tr th.price_total_local_vat_incl {
width: 5vh;
min-width: 5vh;
}
#tableMain tbody tr td.items, #tableMain thead tr th.items {
width: 40vh;
min-width: 40vh;
}
#tableMain tbody tr td.active, #tableMain thead tr th.active {
width: 5vh;
min-width: 5vh;
}

View File

@@ -25,14 +25,15 @@
display: table-cell !important;
}
#tableMain thead tr th.product_variations, #tableMain tbody tr td.product_variations {
width: 20vh;
min-width: 20vh;
width: 24vh;
min-width: 24vh;
}
#tableMain tbody tr td.product_variations table thead tr th, #tableMain tbody tr td.product_variations table tbody tr td {
#tableMain tbody tr td.product_variations table thead tr th.product_variation_type, #tableMain tbody tr td.product_variations table tbody tr td.product_variation_type,
#tableMain tbody tr td.product_variations table thead tr th.product_variation, #tableMain tbody tr td.product_variations table tbody tr td.product_variation {
width: 8vh;
min-width: 8vh;
}
#tableMain tbody tr td.product_variations table thead tr th:last-of-type, #tableMain tbody tr td.product_variations table tbody tr td:last-of-type {
#tableMain tbody tr td.product_variations table thead tr th.add, #tableMain tbody tr td.product_variations table tbody tr td.delete {
width: 4vh;
min-width: 4vh;
}

View File

@@ -0,0 +1,59 @@
#formFilters {
width: 50vh;
}
#formFilters .container-input.filter.active {
width: 8vh;
}
#tableMain tbody tr td.name_company, #tableMain thead tr th.name_company,
#tableMain tbody tr td.name_contact, #tableMain thead tr th.name_contact,
#tableMain tbody tr td.department_contact, #tableMain thead tr th.department_contact,
#tableMain tbody tr td.phone_number, #tableMain thead tr th.phone_number {
width: 10vh;
min-width: 10vh;
}
#tableMain tbody tr td.email, #tableMain thead tr th.email,
#tableMain tbody tr td.website, #tableMain thead tr th.website {
width: 15vh;
min-width: 15vh;
}
#tableMain thead tr th.address.collapsed, #tableMain tbody tr td.address.collapsed {
width: 9vh;
min-width: 9vh;
display: table-cell !important;
}
#tableMain thead tr th.address, #tableMain tbody tr td.address {
width: 108vh;
min-width: 108vh;
}
#tableMain tbody tr td.address table thead tr th.postcode, #tableMain tbody tr td.address table tbody tr td.postcode,
#tableMain tbody tr td.address table thead tr th.address_line_1, #tableMain tbody tr td.address table tbody tr td.address_line_1,
#tableMain tbody tr td.address table thead tr th.address_line_2, #tableMain tbody tr td.address table tbody tr td.address_line_2,
#tableMain tbody tr td.address table thead tr th.city, #tableMain tbody tr td.address table tbody tr td.city,
#tableMain tbody tr td.address table thead tr th.county, #tableMain tbody tr td.address table tbody tr td.county,
#tableMain tbody tr td.address table thead tr th.region, #tableMain tbody tr td.address table tbody tr td.region {
width: 15vh;
min-width: 15vh;
}
#tableMain tbody tr td.address table thead tr th.active, #tableMain tbody tr td.address table tbody tr td.active,
#tableMain tbody tr td.address table thead tr th.add, #tableMain tbody tr td.address table tbody tr td.delete {
width: 5vh;
min-width: 5vh;
}
#tableMain thead tr th.currency.collapsed, #tableMain tbody tr td.currency.collapsed {
width: 9vh;
min-width: 9vh;
}
#tableMain thead tr th.currency, #tableMain tbody tr td.currency {
width: 11vh;
min-width: 11vh;
}
#tableMain tbody tr td.active, #tableMain thead tr th.active {
width: 5vh;
min-width: 5vh;
}

View File

@@ -0,0 +1,40 @@
#formFilters {
width: 100vh;
}
#formFilters .container-input.filter.active {
width: 8vh;
}
#formFilters .container-input.filter.date_from,
#formFilters .container-input.filter.date_to {
width: 8vh;
}
#tableMain tbody tr td.supplier, #tableMain thead tr th.supplier {
width: 15vh;
min-width: 15vh;
}
#tableMain thead tr th.currency.collapsed, #tableMain tbody tr td.currency.collapsed {
width: 9vh;
min-width: 9vh;
}
#tableMain thead tr th.currency, #tableMain tbody tr td.currency {
width: 11vh;
min-width: 11vh;
}
#tableMain tbody tr td.cost_total_local_vat_excl, #tableMain thead tr th.cost_total_local_vat_excl,
#tableMain tbody tr td.cost_total_local_vat_incl, #tableMain thead tr th.cost_total_local_vat_incl {
width: 10vh;
min-width: 10vh;
}
#tableMain tbody tr td.items, #tableMain thead tr th.items {
width: 40vh;
min-width: 40vh;
}
#tableMain tbody tr td.active, #tableMain thead tr th.active {
width: 5vh;
min-width: 5vh;
}

View File

@@ -500,10 +500,6 @@ button:hover, input[type="submit"]:hover, #overlayHamburger .row *:hover {
text-decoration: none;
}
.delete {
text-decoration: underline;
}
/* Overlay modal */
.overlay {
@@ -609,6 +605,10 @@ td.dirty {
height: 50vh;
}
#formFilters .container {
max-width: fit-content;
}
thead, tbody {
padding-top: 0px !important;
padding-bottom: 0px !important;
@@ -656,6 +656,15 @@ table input {
width: 90% !important;
}
table button {
margin: 0.25vh;
padding: 0.5vh 1vh;
}
tr.delete {
background-color: red;
}
button.collapsed {
display: block;

View File

@@ -78,14 +78,15 @@
display: table-cell !important;
}
#tableMain thead tr th.product_variations, #tableMain tbody tr td.product_variations {
width: 20vh;
min-width: 20vh;
width: 24vh;
min-width: 24vh;
}
#tableMain tbody tr td.product_variations table thead tr th, #tableMain tbody tr td.product_variations table tbody tr td {
#tableMain tbody tr td.product_variations table thead tr th.product_variation_type, #tableMain tbody tr td.product_variations table tbody tr td.product_variation_type,
#tableMain tbody tr td.product_variations table thead tr th.product_variation, #tableMain tbody tr td.product_variations table tbody tr td.product_variation {
width: 8vh;
min-width: 8vh;
}
#tableMain tbody tr td.product_variations table thead tr th:last-of-type, #tableMain tbody tr td.product_variations table tbody tr td:last-of-type {
#tableMain tbody tr td.product_variations table thead tr th.add, #tableMain tbody tr td.product_variations table tbody tr td.delete {
width: 4vh;
min-width: 4vh;
}

File diff suppressed because one or more lines are too long

View File

@@ -139,6 +139,51 @@ export default class API {
dataRequest[flagComment] = comment;
return await API.request(hashSaveStoreStockItem, 'POST', dataRequest);
}
// suppliers
static async getSuppliers() {
return await API.request(hashGetStoreSupplier);
}
static async getSuppliersByFilters(filtersJson) {
API.goToHash(hashPageStoreSuppliers, filtersJson);
}
static async saveSuppliers(suppliers, formFilters, comment) {
let dataRequest = {};
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
dataRequest[flagSupplier] = suppliers;
dataRequest[flagComment] = comment;
return await API.request(hashSaveStoreSupplier, 'POST', dataRequest);
}
// supplier purchase orders
static async getSupplierPurchaseOrders() {
return await API.request(hashGetStoreSupplierPurchaseOrder);
}
static async getSupplierPurchaseOrdersByFilters(filtersJson) {
API.goToHash(hashPageStoreSupplierPurchaseOrders, filtersJson);
}
static async saveSupplierPurchaseOrders(supplierPurchaseOrders, formFilters, comment) {
let dataRequest = {};
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
dataRequest[flagSupplierPurchaseOrder] = supplierPurchaseOrders;
dataRequest[flagComment] = comment;
return await API.request(hashSaveStoreSupplierPurchaseOrder, 'POST', dataRequest);
}
// manufacturing purchase orders
static async getManufacturingPurchaseOrders() {
return await API.request(hashGetStoreManufacturingPurchaseOrder);
}
static async getManufacturingPurchaseOrdersByFilters(filtersJson) {
API.goToHash(hashPageStoreManufacturingPurchaseOrders, filtersJson);
}
static async saveManufacturingPurchaseOrders(manufacturingPurchaseOrders, formFilters, comment) {
let dataRequest = {};
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
dataRequest[flagManufacturingPurchaseOrder] = manufacturingPurchaseOrders;
dataRequest[flagComment] = comment;
return await API.request(hashSaveStoreManufacturingPurchaseOrder, 'POST', dataRequest);
}
}
/*

View File

@@ -91,6 +91,10 @@ export default class DOM {
if (container == null) return false;
return container.querySelector('.' + flagDirty) != null;
}
static hasDirtyChildrenNotDeletedContainer(container) {
if (container == null) return false;
return container.querySelector('.' + flagDirty + ':not(.' + flagDelete + ')') != null;
}
static getElementValueCurrent(element) {
let returnVal = '';
@@ -117,6 +121,7 @@ export default class DOM {
return returnVal;
}
static getElementAttributeValueCurrent(element) {
if (Validation.isEmpty(element)) return null;
return element.getAttribute(attrValueCurrent);
if (!Validation.isEmpty(value) && element.type === "checkbox") {
value = (value === 'true');
@@ -124,6 +129,7 @@ export default class DOM {
return value;
}
static getElementAttributeValuePrevious(element) {
if (Validation.isEmpty(element)) return null;
return element.getAttribute(attrValuePrevious);
if (!Validation.isEmpty(value) && element.type === "checkbox") {
value = (value === 'true');
@@ -134,13 +140,13 @@ export default class DOM {
static updateAndCheckIsTableElementDirty(element) {
let wasDirty = DOM.isElementDirty(element);
let row = DOM.getRowFromElement(element);
let wasDirtyRow = DOM.hasDirtyChildrenContainer(row);
let wasDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row);
let isDirty = DOM.updateAndCheckIsElementDirty(element);
let cell = DOM.getCellFromElement(element);
console.log({element, row, cell, isDirty, wasDirty});
if (isDirty != wasDirty) {
DOM.handleDirtyElement(cell, isDirty);
let isDirtyRow = DOM.hasDirtyChildrenContainer(row);
let isDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row);
console.log({isDirtyRow, wasDirtyRow});
if (isDirtyRow != wasDirtyRow) {
DOM.handleDirtyElement(row, isDirtyRow);

View File

@@ -45,6 +45,7 @@ export default class BasePage {
// hookupVideos();
this.hookupNavigation();
this.hookupImagesLogo();
this.hookupOverlays();
}
hookupNavigation() {
@@ -75,8 +76,11 @@ export default class BasePage {
this.hookupButtonsNavUserLogout();
this.hookupButtonsNavUserLogin();
this.hookupButtonsNavStoreHome();
this.hookupButtonsNavStoreManufacturingPurchaseOrders();
this.hookupButtonsNavStoreProductPermutations();
this.hookupButtonsNavStoreStockItems();
this.hookupButtonsNavStoreSuppliers();
this.hookupButtonsNavStoreSupplierPurchaseOrders();
this.hookupButtonsNavAdminHome();
}
hookupEventHandler(eventType, selector, callback) {
@@ -131,6 +135,9 @@ export default class BasePage {
hookupButtonsNavStoreHome() {
this.hookupButtonsNav('.' + flagNavStoreHome, hashPageStoreHome);
}
hookupButtonsNavStoreManufacturingPurchaseOrders() {
this.hookupButtonsNav('.' + flagNavStoreManufacturingPurchaseOrders, hashPageStoreManufacturingPurchaseOrders);
}
hookupButtonsNavStoreProductCategories() {
this.hookupButtonsNav('.' + flagNavStoreProductCategories, hashPageStoreProductCategories);
}
@@ -152,14 +159,25 @@ export default class BasePage {
hookupButtonsNavAdminHome() {
this.hookupButtonsNav('.' + flagNavAdminHome, hashPageAdminHome);
}
hookupButtonsNavStoreSuppliers() {
this.hookupButtonsNav('.' + flagNavStoreSuppliers, hashPageStoreSuppliers);
}
hookupButtonsNavStoreSupplierPurchaseOrders() {
this.hookupButtonsNav('.' + flagNavStoreSupplierPurchaseOrders, hashPageStoreSupplierPurchaseOrders);
}
hookupImagesLogo() {
this.hookupButtonsNav("img." + flagImageLogo, hashPageHome);
}
hookupOverlays() {
this.hookupOverlayFromId(idOverlayConfirm);
this.hookupOverlayFromId(idOverlayError);
}
hookupOverlayFromId(idOverlay) {
Events.initialiseEventHandler(idOverlay, flagInitialised, (overlay) => {
overlay.querySelector('button.' + flagClose).addEventListener("click", (event) => {
overlay.querySelector('button.' + flagCancel).addEventListener("click", (event) => {
event.stopPropagation();
overlay.css('display', 'none');
});

View File

@@ -168,10 +168,10 @@ export default class TableBasePage extends BasePage {
.catch(error => console.error('Error:', error));
}
getTableRecords(dirtyOnly = false) {
let table = this.getTableMain();
// let table = this.getTableMain();
let records = [];
let record;
table.querySelectorAll('tbody tr').forEach((row) => {
document.querySelectorAll(idTableMain + ' > tbody > tr').forEach((row) => {
if (dirtyOnly && !row.classList.contains(flagDirty)) return;
record = this.getJsonRow(row);
records.push(record);
@@ -221,6 +221,8 @@ export default class TableBasePage extends BasePage {
row.querySelectorAll('.' + flagInitialised).forEach(function(element) {
element.classList.remove(flagInitialised);
});
let countRows = document.querySelectorAll(idTableMain + ' > tbody > tr').length;
row.setAttribute(this.constructor.attrIdRowObject, -1 - countRows);
/* Shared nethods
let newDisplayOrder = parseInt(tbody.querySelector('tr:last-child').querySelector('td.' + flagDisplayOrder + ' .' + flagSlider).getAttribute(attrValueCurrent)) + 1;
let slider = tbody.querySelector('tr:last-child').querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
@@ -285,19 +287,19 @@ export default class TableBasePage extends BasePage {
input.addEventListener("change", (event) => {
handler(event, input);
});
this.handleChangeElementCellTable(null, input);
handler(null, input);
});
// this.hookupEventHandler("change", inputSelector, handler);
}
handleChangeElementCellTable(event, element) {
let row = DOM.getRowFromElement(element);
let td = DOM.getCellFromElement(element);
let wasDirtyRow = DOM.hasDirtyChildrenContainer(row);
let wasDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row);
let wasDirtyElement = element.classList.contains(flagDirty);
let isDirtyElement = DOM.updateAndCheckIsElementDirty(element);
if (isDirtyElement != wasDirtyElement) {
DOM.handleDirtyElement(td, isDirtyElement);
let isNowDirtyRow = DOM.hasDirtyChildrenContainer(row);
let isNowDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row);
if (isNowDirtyRow != wasDirtyRow) {
DOM.handleDirtyElement(row, isNowDirtyRow);
let rows = this.getTableRecords(true);
@@ -419,7 +421,7 @@ export default class TableBasePage extends BasePage {
let row = DOM.getRowFromElement(ddl);
let td = DOM.getCellFromElement(ddl);
console.log("td: ", td);
let wasDirtyRow = DOM.hasDirtyChildrenContainer(row);
let wasDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row);
let wasDirtyElement = ddl.classList.contains(flagDirty);
let isDirtyElement = DOM.updateAndCheckIsElementDirty(ddl);
console.log("isDirtyElement: ", isDirtyElement);
@@ -428,7 +430,7 @@ export default class TableBasePage extends BasePage {
DOM.handleDirtyElement(td, isDirtyElement);
let optionSelected = ddl.options[ddl.selectedIndex];
DOM.setElementAttributeValueCurrent(td, optionSelected.value);
let isNowDirtyRow = DOM.hasDirtyChildrenContainer(row);
let isNowDirtyRow = DOM.hasDirtyChildrenNotDeletedContainer(row);
console.log("isNowDirtyRow: ", isNowDirtyRow);
console.log("wasDirtyRow: ", wasDirtyRow);
if (isNowDirtyRow != wasDirtyRow) {
@@ -460,13 +462,16 @@ export default class TableBasePage extends BasePage {
let thead = document.createElement("thead");
let tr = document.createElement("tr");
let thVariationType = document.createElement("th");
thVariationType.classList.add(flagProductVariationType);
thVariationType.textContent = 'Type';
let thNameVariation = document.createElement("th");
thNameVariation.classList.add(flagProductVariation);
thNameVariation.textContent = 'Name';
let buttonAdd = document.createElement("button");
buttonAdd.classList.add(flagAdd);
buttonAdd.textContent = '+';
let thAddDelete = document.createElement("th");
thAddDelete.classList.add(flagAdd);
thAddDelete.appendChild(buttonAdd);
tr.appendChild(thVariationType);
tr.appendChild(thNameVariation);
@@ -484,9 +489,10 @@ export default class TableBasePage extends BasePage {
});
}
tblVariations.appendChild(tbody);
let parent = element.parentElement;
parent.innerHTML = '';
parent.appendChild(tblVariations);
let cellParent = element.closest(idTableMain + ' tbody tr td.' + flagProductVariations);
cellParent.innerHTML = '';
cellParent.appendChild(tblVariations);
console.log("tblVariations: ", tblVariations);
let selectorButtonAdd = idTableMain + ' td.' + flagProductVariations + ' button.' + flagAdd;
this.hookupEventHandler("click", selectorButtonAdd, this.handleClickButtonProductPermutationVariationsAdd);
@@ -496,6 +502,9 @@ export default class TableBasePage extends BasePage {
toggleColumnCollapsed(flagColumn, isCollapsed) {
this.toggleColumnHasClassnameFlag(flagColumn, isCollapsed, flagCollapsed);
}
toggleColumnHeaderCollapsed(flagColumn, isCollapsed) {
this.toggleColumnHasClassnameFlag(flagColumn, isCollapsed, flagCollapsed);
}
getElementProductVariations(element) {
let permutationVariations = element.getAttribute(attrValueCurrent);
let objVariations = [];
@@ -636,6 +645,10 @@ export default class TableBasePage extends BasePage {
return variationPairsString;
}
hookupCurrencyFields() {
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagCurrency, Utils.getListFromDict(currencies));
}
leave() {
if (this.constructor === TableBasePage) {
throw new Error("Must implement leave() method.");
@@ -653,12 +666,17 @@ export default class TableBasePage extends BasePage {
let columnTh = table.querySelector('th.' + columnFlag);
let columnThHasFlag = columnTh.classList.contains(classnameFlag);
if (isRequiredFlag == columnThHasFlag) return;
let columnTds = table.querySelectorAll('td.' + columnFlag);
DOM.toggleElementHasClassnameFlag(columnTh, isRequiredFlag, classnameFlag);
let columnTds = table.querySelectorAll('td.' + columnFlag);
columnTds.forEach((columnTd) => {
DOM.toggleElementHasClassnameFlag(columnTd, isRequiredFlag, classnameFlag);
});
}
toggleColumnHeaderHasClassnameFlag(columnFlag, isRequiredFlag, classnameFlag) {
let table = this.getTableMain();
let columnTh = table.querySelector('th.' + columnFlag);
DOM.toggleElementHasClassnameFlag(columnTh, isRequiredFlag, classnameFlag);
}
}
@@ -669,7 +687,9 @@ import DOM from "../dom.js";
export class PageStoreProductCategories extends TableBasePage {
static hash = hashPageStoreProductCategories;
static attrIdRowObject = attrIdProductCategory;
callFilterTableContent = API.getCategoriesByFilters;
callSaveTableContent = API.saveCategories;
constructor() {}
initialize() {}

View File

@@ -0,0 +1,82 @@
import API from "../../api.js";
import BusinessObjects from "../../lib/business_objects.js";
import DOM from "../../dom.js";
import Events from "../../lib/events.js";
import TableBasePage from "../base_table.js";
import Utils from "../../lib/utils.js";
import Validation from "../../lib/validation.js";
import StoreTableMixinPage from "./mixin_table.js";
export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
static hash = hashPageStoreSupplierPurchaseOrders;
static attrIdRowObject = attrIdSupplierPurchaseOrder;
callFilterTableContent = API.getSupplierPurchaseOrdersByFilters;
callSaveTableContent = API.saveSupplierPurchaseOrders;
constructor(router) {
super(router);
this.storeMixin = new StoreTableMixinPage(this);
}
initialize() {
this.sharedInitialize();
}
hookupFilters() {
this.sharedHookupFilters();
this.hookupFilterActive();
}
loadRowTable(rowJson) {
}
getJsonRow(row) {
if (row == null) return;
let tdCurrency = row.querySelector('td.' + flagCurrency);
let inputCostTotalLocalVatExcl = row.querySelector('td.' + flagCostTotalLocalVatExcl + ' input');
let inputCostTotalLocalVatIncl = row.querySelector('td.' + flagCostTotalLocalVatIncl + ' input');
let inputPriceTotalLocalVatExcl = row.querySelector('td.' + flagPriceTotalLocalVatExcl + ' input');
let inputPriceTotalLocalVatIncl = row.querySelector('td.' + flagPriceTotalLocalVatIncl + ' input');
let tdItems = row.querySelector('td.' + flagItems);
let checkboxActive = row.querySelector('td.' + flagActive + ' textarea');
let jsonRow = {};
jsonRow[attrIdSupplierPurchaseOrder] = row.getAttribute(attrIdSupplierPurchaseOrder);
jsonRow[attrIdCurrency] = DOM.getElementAttributeValueCurrent(tdCurrency);
jsonRow[flagCostTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatExcl);
jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl);
jsonRow[flagPriceTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatExcl);
jsonRow[flagPriceTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatIncl);
jsonRow[flagItems] = DOM.getElementAttributeValueCurrent(tdItems);
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
return jsonRow;
}
initialiseRowNew(row) {
super.initialiseRowNew(row);
}
hookupTableMain() {
super.hookupTableMain();
this.hookupCurrencyFields();
this.hookupCostInputs();
this.hookupOrderItemsFields();
this.hookupActiveCheckboxes();
}
hookupCostInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatExcl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatIncl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPriceTotalLocalVatExcl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPriceTotalLocalVatIncl + ' input');
}
hookupOrderItemsFields() {
}
hookupActiveCheckboxes(){
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagActive + ' input');
}
leave() {
super.leave();
}
}

View File

@@ -7,6 +7,7 @@ import StoreTableMixinPage from "./mixin_table.js";
export default class PageStoreProductCategories extends TableBasePage {
static hash = hashPageStoreProductCategories;
static attrIdRowObject = attrIdProductCategory;
callFilterTableContent = API.getCategoriesByFilters;
callSaveTableContent = API.saveCategories;

View File

@@ -10,6 +10,7 @@ import StoreTableMixinPage from "./mixin_table.js";
export default class PageStoreProductPermutations extends TableBasePage {
static hash = hashPageStoreProductPermutations;
static attrIdRowObject = attrIdProductPermutation;
callFilterTableContent = API.getProductPermutationsByFilters;
callSaveTableContent = API.saveProductPermutations;

View File

@@ -8,6 +8,7 @@ import Utils from "../../lib/utils.js";
export default class PageStoreProducts extends TableBasePage {
static hash = hashPageStoreProducts;
static attrIdRowObject = attrIdProduct;
callFilterTableContent = API.getProductsByFilters;
callSaveTableContent = API.saveProducts;

View File

@@ -10,6 +10,7 @@ import StoreTableMixinPage from "./mixin_table.js";
export default class PageStoreStockItems extends TableBasePage {
static hash = hashPageStoreStockItems;
static attrIdRowObject = attrIdStockItem;
callFilterTableContent = API.getStockItemsByFilters;
callSaveTableContent = API.saveStockItems;
@@ -73,8 +74,8 @@ export default class PageStoreStockItems extends TableBasePage {
let tdProduct = row.querySelector('td.' + flagProduct);
let tdProductVariations = row.querySelector('td.' + flagProductVariations);
let tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost);
let inputCostLocalVatExcl = row.querySelector('td.' + flagCostLocalVatExcl + ' input');
let inputCostLocalVatIncl = row.querySelector('td.' + flagCostLocalVatIncl + ' input');
let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input');
let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input');
let inputDatePurchased = row.querySelector('td.' + flagDatePurchased + ' input');
let inputDateReceived = row.querySelector('td.' + flagDateReceived + ' input');
let tdStorageLocation = row.querySelector('td.' + flagStorageLocation);
@@ -93,8 +94,8 @@ export default class PageStoreStockItems extends TableBasePage {
jsonRow[flagProductVariations] = DOM.getElementAttributeValueCurrent(tdProductVariations);
jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != '';
jsonRow[flagCurrencyCost] = DOM.getElementAttributeValueCurrent(tdCurrencyCost);
jsonRow[flagCostLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputCostLocalVatExcl);
jsonRow[flagCostLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostLocalVatIncl);
jsonRow[flagCostUnitLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputCostLocalVatExcl);
jsonRow[flagCostUnitLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostLocalVatIncl);
jsonRow[flagDatePurchased] = DOM.getElementAttributeValueCurrent(inputDatePurchased);
jsonRow[flagDateReceived] = DOM.getElementAttributeValueCurrent(inputDateReceived);
jsonRow[attrIdStorageLocation] = DOM.getElementAttributeValueCurrent(tdStorageLocation);
@@ -189,8 +190,8 @@ export default class PageStoreStockItems extends TableBasePage {
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagCurrencyCost, Utils.getListFromDict(currencies));
}
hookupCostInputs(){
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostLocalVatExcl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostLocalVatIncl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostUnitLocalVatExcl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostUnitLocalVatIncl + ' input');
}
hookupOrderDateInputs(){
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagDatePurchased + ' input');

View File

@@ -0,0 +1,82 @@
import API from "../../api.js";
import BusinessObjects from "../../lib/business_objects.js";
import DOM from "../../dom.js";
import Events from "../../lib/events.js";
import TableBasePage from "../base_table.js";
import Utils from "../../lib/utils.js";
import Validation from "../../lib/validation.js";
import StoreTableMixinPage from "./mixin_table.js";
export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
static hash = hashPageStoreSupplierPurchaseOrders;
static attrIdRowObject = attrIdSupplierPurchaseOrder;
callFilterTableContent = API.getSupplierPurchaseOrdersByFilters;
callSaveTableContent = API.saveSupplierPurchaseOrders;
constructor(router) {
super(router);
this.storeMixin = new StoreTableMixinPage(this);
}
initialize() {
this.sharedInitialize();
}
hookupFilters() {
this.sharedHookupFilters();
this.hookupFilterActive();
}
loadRowTable(rowJson) {
}
getJsonRow(row) {
if (row == null) return;
let tdSupplier = row.querySelector('td.' + flagSupplier);
let tdCurrency = row.querySelector('td.' + flagCurrency);
let inputCostTotalLocalVatExcl = row.querySelector('td.' + flagCostTotalLocalVatExcl + ' input');
let inputCostTotalLocalVatIncl = row.querySelector('td.' + flagCostTotalLocalVatIncl + ' input');
let tdItems = row.querySelector('td.' + flagItems);
let checkboxActive = row.querySelector('td.' + flagActive + ' textarea');
let jsonRow = {};
jsonRow[attrIdSupplierPurchaseOrder] = row.getAttribute(attrIdSupplierPurchaseOrder);
jsonRow[attrIdSupplier] = DOM.getElementAttributeValueCurrent(tdSupplier);
jsonRow[attrIdCurrency] = DOM.getElementAttributeValueCurrent(tdCurrency);
jsonRow[flagCostTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatExcl);
jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl);
jsonRow[flagItems] = DOM.getElementAttributeValueCurrent(tdItems);
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
return jsonRow;
}
initialiseRowNew(row) {
super.initialiseRowNew(row);
}
hookupTableMain() {
super.hookupTableMain();
this.hookupSupplierFields();
this.hookupCurrencyFields();
this.hookupCostInputs();
this.hookupOrderItemsFields();
this.hookupActiveCheckboxes();
}
hookupSupplierFields() {
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagSupplier, Utils.getListFromDict(suppliers));
}
hookupCostInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatExcl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatIncl + ' input');
}
hookupOrderItemsFields() {
}
hookupActiveCheckboxes(){
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagActive + ' input');
}
leave() {
super.leave();
}
}

View File

@@ -0,0 +1,388 @@
import API from "../../api.js";
import BusinessObjects from "../../lib/business_objects.js";
import DOM from "../../dom.js";
import Events from "../../lib/events.js";
import TableBasePage from "../base_table.js";
import Utils from "../../lib/utils.js";
import Validation from "../../lib/validation.js";
import StoreTableMixinPage from "./mixin_table.js";
export default class PageStoreSuppliers extends TableBasePage {
static hash = hashPageStoreSuppliers;
static attrIdRowObject = attrIdSupplier;
callFilterTableContent = API.getSuppliersByFilters;
callSaveTableContent = API.saveSuppliers;
constructor(router) {
super(router);
this.storeMixin = new StoreTableMixinPage(this);
}
initialize() {
this.sharedInitialize();
}
hookupFilters() {
this.sharedHookupFilters();
this.hookupFilterActive();
}
loadRowTable(rowJson) {
}
getJsonRow(row) {
if (row == null) return;
let textareaNameCompany = row.querySelector('td.' + flagNameCompany + ' textarea');
let textareaNameContact = row.querySelector('td.' + flagNameContact + ' textarea');
let textareaDepartmentContact = row.querySelector('td.' + flagDepartmentContact + ' textarea');
let tdAddress = row.querySelector('td.' + flagAddress);
let textareaPhoneNumber = row.querySelector('td.' + flagPhoneNumber + ' textarea');
let textareaFax = row.querySelector('td.' + flagFax + ' textarea');
let textareaEmail = row.querySelector('td.' + flagEmail + ' textarea');
let textareaWebsite = row.querySelector('td.' + flagWebsite + ' textarea');
let tdCurrency = row.querySelector('td.' + flagCurrency);
let checkboxActive = row.querySelector('td.' + flagActive + ' input[type="checkbox"]');
let jsonRow = {};
jsonRow[attrIdSupplier] = row.getAttribute(attrIdSupplier);
jsonRow[flagNameCompany] = DOM.getElementAttributeValueCurrent(textareaNameCompany);
jsonRow[flagNameContact] = DOM.getElementAttributeValueCurrent(textareaNameContact);
jsonRow[flagDepartmentContact] = DOM.getElementAttributeValueCurrent(textareaDepartmentContact);
jsonRow[attrIdSupplierAddress] = DOM.getElementAttributeValueCurrent(tdAddress);
jsonRow[flagSupplierAddress] = this.getSupplierAddressesFromRow(row);
jsonRow[flagPhoneNumber] = DOM.getElementAttributeValueCurrent(textareaPhoneNumber);
jsonRow[flagFax] = DOM.getElementAttributeValueCurrent(textareaFax);
jsonRow[flagEmail] = DOM.getElementAttributeValueCurrent(textareaEmail);
jsonRow[flagWebsite] = DOM.getElementAttributeValueCurrent(textareaWebsite);
jsonRow[attrIdCurrency] = DOM.getElementAttributeValueCurrent(tdCurrency);
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
return jsonRow;
}
getSupplierAddressesFromRow(row) {
let supplierAddresses = [];
let trs = row.querySelectorAll('td.' + flagAddress + ' tr');
let address, inputPostcode, inputAddressLine1, inputAddressLine2, inputCity, inputCounty, ddlRegion, inputActive;
trs.forEach((tr) => {
inputPostcode = tr.querySelector('td.' + flagPostcode + ' textarea');
inputAddressLine1 = tr.querySelector('td.' + flagAddressLine1 + ' textarea');
inputAddressLine2 = tr.querySelector('td.' + flagAddressLine2 + ' textarea');
inputCity = tr.querySelector('td.' + flagCity + ' textarea');
inputCounty = tr.querySelector('td.' + flagCounty + ' textarea');
ddlRegion = tr.querySelector('td.' + flagRegion + ' select');
inputActive = tr.querySelector('td.' + flagActive + ' input');
address = {
[attrIdSupplierAddress]: tr.getAttribute(attrIdSupplierAddress),
[flagPostcode]: DOM.getElementAttributeValueCurrent(inputPostcode),
[flagAddressLine1]: DOM.getElementAttributeValueCurrent(inputAddressLine1),
[flagAddressLine2]: DOM.getElementAttributeValueCurrent(inputAddressLine2),
[flagCity]: DOM.getElementAttributeValueCurrent(inputCity),
[flagCounty]: DOM.getElementAttributeValueCurrent(inputCounty),
[attrIdRegion]: DOM.getElementAttributeValueCurrent(ddlRegion),
[flagActive]: DOM.getElementAttributeValueCurrent(inputActive),
};
supplierAddresses.push(address);
});
return supplierAddresses;
}
initialiseRowNew(row) {
super.initialiseRowNew(row);
}
hookupTableMain() {
super.hookupTableMain();
this.hookupNameCompanyInputs();
this.hookupNameContactInputs();
this.hookupDepartmentContactInputs();
this.hookupAddressFields();
this.hookupPhoneNumberInputs();
this.hookupFaxInputs();
this.hookupEmailInputs();
this.hookupWebsiteInputs();
this.hookupCurrencyFields();
this.hookupActiveCheckboxes();
}
hookupNameCompanyInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagNameCompany + ' textarea');
}
hookupNameContactInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagNameContact + ' textarea');
}
hookupDepartmentContactInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagDepartmentContact + ' textarea');
}
hookupAddressFields() {
this.hookupAddressPreviews();
this.hookupAddressPostcodeInputs();
this.hookupAddressLine1Inputs();
this.hookupAddressLine2Inputs();
this.hookupAddressCityInputs();
this.hookupAddressCountyInputs();
this.hookupAddressRegionDdls();
this.hookupAddressActiveCheckboxes();
this.hookupAddressDeleteButtons();
this.hookupAddressUndeleteButtons();
this.hookupAddressAddButtons();
}
hookupAddressPreviews() {
this.hookupEventHandler("click", idTableMain + ' td.' + flagAddress, (event, td) => {
if (!td.classList.contains(flagCollapsed)) return;
this.handleClickAddressPreview(event, td);
});
}
handleClickAddressPreview(event, element) {
console.log("click address preview");
this.toggleColumnHeaderCollapsed(flagAddress, false);
element.classList.remove(flagCollapsed);
let row = DOM.getRowFromElement(element);
let idSupplier = row.getAttribute(attrIdSupplier);
let supplierAddressList = idSupplier > 0 ? supplierAddresses[idSupplier] : [];
let tblAddresses = document.createElement("table");
tblAddresses.classList.add(flagAddress);
let thead = document.createElement("thead");
let tr = document.createElement("tr");
let thPostcode = document.createElement("th");
thPostcode.classList.add(flagPostcode);
thPostcode.textContent = 'Postcode';
let thAddressLine1 = document.createElement("th");
thAddressLine1.classList.add(flagAddressLine1);
thAddressLine1.textContent = 'Address Line 1';
let thAddressLine2 = document.createElement("th");
thAddressLine2.classList.add(flagAddressLine2);
thAddressLine2.textContent = 'Address Line 2';
let thCity = document.createElement("th");
thCity.classList.add(flagCity);
thCity.textContent = 'City';
let thCounty = document.createElement("th");
thCounty.classList.add(flagCounty);
thCounty.textContent = 'County';
let thRegion = document.createElement("th");
thRegion.classList.add(flagRegion);
thRegion.textContent = 'Region';
let thActive = document.createElement("th");
thActive.classList.add(flagActive);
thActive.textContent = 'Active';
let thAddDelete = document.createElement("th");
thAddDelete.classList.add(flagAdd);
let buttonAdd = document.createElement("button");
buttonAdd.classList.add(flagAdd);
buttonAdd.textContent = '+';
thAddDelete.appendChild(buttonAdd);
tr.appendChild(thPostcode);
tr.appendChild(thAddressLine1);
tr.appendChild(thAddressLine2);
tr.appendChild(thCity);
tr.appendChild(thCounty);
tr.appendChild(thRegion);
tr.appendChild(thActive);
tr.appendChild(thAddDelete);
thead.appendChild(tr);
tblAddresses.appendChild(thead);
let tbody = document.createElement("tbody");
let regionOptions = Utils.getListFromDict(regions);
supplierAddressList.forEach((supplierAddress, index) => {
this.addRowSupplierAddress(tbody, supplierAddress, regionOptions);
});
tblAddresses.appendChild(tbody);
let cell = DOM.getCellFromElement(element);
let cellNew = cell.cloneNode(false);
cellNew.appendChild(tblAddresses);
row.replaceChild(cellNew, cell);
console.log("tblAddresses: ", tblAddresses);
this.hookupAddressFields();
}
addRowSupplierAddress(tbody, supplierAddress, regionOptions) {
console.log("addRowSupplierAddress: ", supplierAddress);
let tdPostcode = document.createElement("td");
tdPostcode.classList.add(flagPostcode);
let textareaPostcode = document.createElement("textarea");
textareaPostcode.classList.add(flagPostcode);
DOM.setElementValuesCurrentAndPrevious(textareaPostcode, supplierAddress[flagPostcode]);
tdPostcode.appendChild(textareaPostcode);
let tdAddressLine1 = document.createElement("td");
tdAddressLine1.classList.add(flagAddressLine1);
let textareaAddressLine1 = document.createElement("textarea");
textareaAddressLine1.classList.add(flagAddressLine1);
DOM.setElementValuesCurrentAndPrevious(textareaAddressLine1, supplierAddress[flagAddressLine1]);
tdAddressLine1.appendChild(textareaAddressLine1);
let tdAddressLine2 = document.createElement("td");
tdAddressLine2.classList.add(flagAddressLine2);
let textareaAddressLine2 = document.createElement("textarea");
textareaAddressLine2.classList.add(flagAddressLine2);
DOM.setElementValuesCurrentAndPrevious(textareaAddressLine2, supplierAddress[flagAddressLine2]);
tdAddressLine2.appendChild(textareaAddressLine2);
let tdCity = document.createElement("td");
tdCity.classList.add(flagCity);
let textareaCity = document.createElement("textarea");
textareaCity.classList.add(flagCity);
DOM.setElementValuesCurrentAndPrevious(textareaCity, supplierAddress[flagCity]);
tdCity.appendChild(textareaCity);
let tdCounty = document.createElement("td");
tdCounty.classList.add(flagCounty);
let textareaCounty = document.createElement("textarea");
textareaCounty.classList.add(flagCounty);
DOM.setElementValuesCurrentAndPrevious(textareaCounty, supplierAddress[flagCounty]);
tdCounty.appendChild(textareaCounty);
let region = supplierAddress[flagRegion];
if (!region) region = {[attrIdRegion]: ''};
let tdRegion = document.createElement("td");
tdRegion.classList.add(flagRegion);
DOM.setElementAttributesValuesCurrentAndPrevious(tdRegion, region[attrIdRegion]);
let ddlRegion = document.createElement("select");
ddlRegion.classList.add(flagRegion);
let optionJson, option;
regionOptions.forEach((regionOption) => {
optionJson = BusinessObjects.getOptionJsonFromObjectJson(regionOption);
option = DOM.createOption(optionJson);
ddlRegion.appendChild(option);
});
DOM.setElementValuesCurrentAndPrevious(ddlRegion, region[attrIdRegion]);
tdRegion.appendChild(ddlRegion);
let tdActive = document.createElement("td");
tdActive.classList.add(flagActive);
let checkboxActive = document.createElement("input");
checkboxActive.classList.add(flagActive);
checkboxActive.type = 'checkbox';
DOM.setElementValuesCurrentAndPrevious(checkboxActive, supplierAddress[flagActive]);
tdActive.appendChild(checkboxActive);
let tdDelete = document.createElement("td");
tdDelete.classList.add(flagDelete);
let buttonDelete = document.createElement("button");
buttonDelete.classList.add(flagDelete);
buttonDelete.textContent = 'x';
tdDelete.appendChild(buttonDelete);
let tr = document.createElement("tr");
tr.setAttribute(attrIdSupplierAddress, supplierAddress[attrIdSupplierAddress]);
tr.appendChild(tdPostcode);
tr.appendChild(tdAddressLine1);
tr.appendChild(tdAddressLine2);
tr.appendChild(tdCity);
tr.appendChild(tdCounty);
tr.appendChild(tdRegion);
tr.appendChild(tdActive);
tr.appendChild(tdDelete);
tbody.appendChild(tr);
}
hookupAddressPostcodeInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagPostcode);
}
hookupAddressLine1Inputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine1);
}
hookupAddressLine2Inputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine2);
}
hookupAddressCityInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCity);
}
hookupAddressCountyInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCounty);
}
hookupAddressRegionDdls() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' select.' + flagRegion);
}
hookupAddressActiveCheckboxes() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' input.' + flagActive, (event, element) => {
let rowSupplierAddress = element.closest('tr');
let idAddress = rowSupplierAddress.getAttribute(attrIdSupplierAddress);
DOM.setElementAttributeValueCurrent(rowSupplierAddress, idAddress);
let rowSupplier = rowSupplierAddress.closest(idTableMain + ' > tbody > tr');
let checkboxesActive = rowSupplier.querySelectorAll('td.' + flagAddress + ' input.' + flagActive);
let isActive = element.checked;
if (isActive) {
checkboxesActive.forEach((checkbox) => {
if (checkbox == element) return;
DOM.setElementValueCurrent(checkbox, false);
});
}
/*
else if (checkboxesActive.length > 0) {
DOM.setElementValueCurrent(checkboxesActive[0], false);
}
*/
});
}
hookupAddressDeleteButtons() {
this.hookupEventHandler("click", idTableMain + ' td.' + flagAddress + ' button.' + flagDelete, (event, element) => {
let row = DOM.getRowFromElement(element);
row.classList.add(flagDelete);
let buttonAdd = document.createElement("button");
buttonAdd.classList.add(flagAdd);
buttonAdd.textContent = '+';
element.replaceWith(buttonAdd);
this.hookupAddressUndeleteButtons();
});
}
hookupAddressUndeleteButtons() {
this.hookupEventHandler("click", idTableMain + ' td.' + flagAddress + ' td button.' + flagAdd, (event, element) => {
let row = DOM.getRowFromElement(element);
row.classList.remove(flagDelete);
let buttonDelete = document.createElement("button");
buttonDelete.classList.add(flagDelete);
buttonDelete.textContent = 'x';
element.replaceWith(buttonDelete);
this.hookupAddressDeleteButtons();
});
}
hookupAddressAddButtons() {
this.hookupEventHandler("click", idTableMain + ' td.' + flagAddress + ' th button.' + flagAdd, (event, element) => {
let row = element.closest(idTableMain + ' > tbody > tr');
let idSupplier = row.getAttribute(attrIdSupplier);
let hasActiveAddress = row.querySelectorAll('td.' + flagAddress + ' input.' + flagActive + ':checked').length > 0;
let countSupplierAddresses = row.querySelectorAll('td.' + flagAddress + ' td.' + flagAddress).length;
let supplierAddress = {
[attrIdSupplier]: idSupplier,
[attrIdSupplierAddress]: -1 - countSupplierAddresses,
[flagPostcode]: '',
[flagAddressLine1]: '',
[flagAddressLine2]: '',
[flagCity]: '',
[flagCounty]: '',
[attrIdRegion]: '',
[flagActive]: !hasActiveAddress,
};
let tbody = row.querySelector('td.' + flagAddress + ' table tbody');
this.addRowSupplierAddress(tbody, supplierAddress, Utils.getListFromDict(regions));
if (!hasActiveAddress) {
let tdAddress = row.querySelector('td.' + flagAddress);
// tdAddress.setAttribute(attrIdSupplierAddress, supplierAddress[attrIdSupplierAddress]);
DOM.setElementAttributeValueCurrent(tdAddress, supplierAddress[attrIdSupplierAddress]);
}
this.hookupAddressFields();
});
}
hookupPhoneNumberInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPhoneNumber + ' textarea');
}
hookupFaxInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagFax + ' textarea');
}
hookupEmailInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagEmail + ' textarea');
}
hookupWebsiteInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagWebsite + ' textarea');
}
hookupActiveCheckboxes(){
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagActive + ' input');
}
leave() {
super.leave();
}
}

View File

@@ -12,12 +12,15 @@ import PageLicense from './pages/legal/license.js';
// Store
import PageStoreBasket from './pages/store/basket.js';
import PageStoreHome from './pages/store/home.js';
import PageStoreManufacturingPurchaseOrders from './pages/store/manufacturing_purchase_orders.js';
import PageStoreProductCategories from './pages/store/product_categories.js';
import PageStoreProductPermutations from './pages/store/product_permutations.js';
// import PageStoreProductPrices from './pages/store/product_prices.js';
import PageStoreProducts from './pages/store/products.js';
// import PageStoreProductVariations from './pages/store/product_variations.js';
import PageStoreStockItems from './pages/store/stock_items.js';
import PageStoreSuppliers from './pages/store/suppliers.js';
import PageStoreSupplierPurchaseOrders from './pages/store/supplier_purchase_orders.js';
// User
// import PageUserLogin from './pages/user/login.js';
// import PageUserLogout from './pages/user/logout.js';
@@ -77,12 +80,15 @@ export default class Router {
this.pages[hashPageLicense] = { name: 'PageLicense', module: PageLicense }; // pathModule: './pages/legal/license.js' };
this.pages[hashPagePrivacyPolicy] = { name: 'PagePrivacyPolicy', module: PagePrivacyPolicy }; // pathModule: './pages/legal/privacy_policy.js' }; // importModule: () => {return import(/* webpackChunkName: "page_privacy_policy" */ './pages/legal/privacy_policy.js'); }
// Store
this.pages[hashPageStoreManufacturingPurchaseOrders] = { name: 'PageManufacturingPurchaseOrders', module: PageStoreManufacturingPurchaseOrders }; // pathModule
this.pages[hashPageStoreProductCategories] = { name: 'PageStoreProductCategories', module: PageStoreProductCategories }; // pathModule: './pages/store/product_categories.js' };
this.pages[hashPageStoreProductPermutations] = { name: 'PageStoreProductPermutations', module: PageStoreProductPermutations }; // pathModule: './pages/store/product_permutations.js' };
// this.pages[hashPageStoreProductPrices] = { name: 'PageStoreProductPrices', module: PageStoreProductPrices }; // pathModule: './pages/store/product_prices.js' };
this.pages[hashPageStoreProducts] = { name: 'PageStoreProducts', module: PageStoreProducts }; // pathModule: './pages/store/products.js' };
// this.pages[hashPageStoreProductVariations] = { name: 'PageStoreProductVariations', module: PageStoreProductVariations }; // pathModule: './pages/store/product_variations.js' };
this.pages[hashPageStoreStockItems] = { name: 'PageStoreStockItems', module: PageStoreStockItems };
this.pages[hashPageStoreSuppliers] = { name: 'PageStoreSuppliers', module: PageStoreSuppliers };
this.pages[hashPageStoreSupplierPurchaseOrders] = { name: 'PageSupplierPurchaseOrders', module: PageStoreSupplierPurchaseOrders };
// User
// this.pages[hashPageUserLogin] = { name: 'PageUserLogin', module: PageUserLogin }; // pathModule: './pages/user/login.js' };
// this.pages[hashPageUserLogout] = { name: 'PageUserLogout', module: PageUserLogout }; // pathModule: './pages/user/logout.js' };
@@ -101,12 +107,15 @@ export default class Router {
this.routes[hashPageLicense] = (isPopState = false) => this.navigateToHash(hashPageLicense, isPopState);
this.routes[hashPagePrivacyPolicy] = (isPopState = false) => this.navigateToHash(hashPagePrivacyPolicy, isPopState);
// Store
this.routes[hashPageStoreManufacturingPurchaseOrders] = (isPopState = false) => this.navigateToHash(hashPageStoreManufacturingPurchaseOrders, isPopState);
this.routes[hashPageStoreProductCategories] = (isPopState = false) => this.navigateToHash(hashPageStoreProductCategories, isPopState);
this.routes[hashPageStoreProductPermutations] = (isPopState = false) => this.navigateToHash(hashPageStoreProductPermutations, isPopState);
// this.routes[hashPageStoreProductPrices] = (isPopState = false) => this.navigateToHash(hashPageStoreProductPrices, isPopState);
this.routes[hashPageStoreProducts] = (isPopState = false) => this.navigateToHash(hashPageStoreProducts, isPopState);
// this.routes[hashPageStoreProductVariations] = (isPopState = false) => this.navigateToHash(hashPageStoreProductVariations, isPopState);
this.routes[hashPageStoreStockItems] = (isPopState = false) => this.navigateToHash(hashPageStoreStockItems, isPopState);
this.routes[hashPageStoreSuppliers] = (isPopState = false) => this.navigateToHash(hashPageStoreSuppliers, isPopState);
this.routes[hashPageStoreSupplierPurchaseOrders] = (isPopState = false) => this.navigateToHash(hashPageStoreSupplierPurchaseOrders, isPopState);
// User
// this.routes[hashPageUserLogin] = (isPopState = false) => this.navigateToHash(hashPageUserLogin, isPopState);
// this.routes[hashPageUserLogout] = (isPopState = false) => this.navigateToHash(hashPageUserLogout, isPopState);