/* 07:58:49 gmspider gmspider */ INSERT INTO `stav_objednavky` (`id`, `nazov`, `code`, `poradie`) VALUES ('4', 'Potvrdená', 'potvrdena', '30');
/* 07:58:50 gmspider gmspider */ UPDATE `stav_objednavky` SET `poradie` = '40' WHERE `id` = '3';
/* 08:03:35 gmspider gmspider */ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES ('447', '411', '1', 'dodavatelska_objednavka', 'cislo_faktury', NULL, NULL, 'Číslo faktúry', '60', NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* 08:04:06 gmspider gmspider */ ALTER TABLE `dodavatelska_objednavka` ADD `cislo_faktury` BIGINT(20)  NULL  DEFAULT NULL  AFTER `schvalil_id`;
/* 08:35:58 gmspider gmspider */ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES ('40007', '40001', 'Suma dodania', 'objednavka_graf_suma_dodania', NULL, '2', '1');
/* 08:36:21 gmspider gmspider */ UPDATE `menu` SET `menu_id` = '36' WHERE `id` = '40007';
/* 08:36:26 gmspider gmspider */ UPDATE `menu` SET `visibility_type` = NULL WHERE `id` = '40007';

/* 16:53:10 gmspider gmspider */ UPDATE `menu` SET `poradie` = '20' WHERE `id` = '80';
/* 16:53:12 gmspider gmspider */ UPDATE `menu` SET `poradie` = NULL WHERE `id` = '81';
/* 16:53:17 gmspider gmspider */ UPDATE `menu` SET `poradie` = '30' WHERE `id` = '190';
/* 16:53:21 gmspider gmspider */ UPDATE `menu` SET `poradie` = '40' WHERE `id` = '210';
/* 16:53:22 gmspider gmspider */ UPDATE `menu` SET `poradie` = '50' WHERE `id` = '200';

/* 17:05:58 gmspider gmspider */ ALTER TABLE `form_group` CHANGE `code` `code` VARCHAR(100)  CHARACTER SET utf8mb3  COLLATE utf8mb3_general_ci  NULL  DEFAULT NULL;
/* 17:03:13 gmspider gmspider */ UPDATE `form_group` SET `code` = 'polozka_objednavky_zakladne_informacie' WHERE `id` = '40100';

INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`)
VALUES
    (425, 180, 'Dodacie listy', 'dodaci_list_vypis', 60, 2, 1),
    (426, 180, 'Pridanie dodacieho listu', 'dodaci_list_pridaj', 60, 2, 0),
    (427, 425, 'Detail dodacieho listu', 'dodaci_list_view', 10, 3, 1),
    (428, 425, 'Editovanie dodacieho listu', 'dodaci_list_edituj', 20, 3, 1),
    (429, 425, 'Zmazanie dodacieho listu', 'dodaci_list_zmaz', NULL, 3, NULL),
    (430, 425, 'Súbory dodacieho listu', 'dodaci_list_subor', 40, 3, 1),
    (431, 425, 'Foto k dodaciemu listu', 'dodaci_list_foto', 30, 3, 1),
    (432, 425, 'Pridanie položky dodacieho listu', 'polozka_dodacieho_listu_pridaj', NULL, 3, NULL),
    (433, 425, 'Editovanie položky dodacieho listu', 'polozka_dodacieho_listu_edituj', NULL, 3, NULL),
    (434, 425, 'Zmazanie položky dodacieho listu', 'polozka_dodacieho_listu_zmaz', NULL, 3, NULL);

INSERT INTO `form` (`id`, `nazov`, `code`)
VALUES
    (72, 'Dodací list', 'dodaci_list'),
    (73, 'Položka dodacieho listu', 'polozka_dodacieho_listu');

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`)
VALUES
    (29, 72, 'Základné informácie', 'dodavatelska_objednavka_zakladne_informacie', 10, NULL, 1),
    (30, 72, 'Ďalšie informácie', 'dodavatelska_objednavka_dalsie_informacie', 20, NULL, 1),
    (31, 72, 'Texty', 'dodavatelska_objednavka_texty', 30, NULL, 1);

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`)
VALUES
    (32, 73, 'Základné informácie', 'polozka_dodacieho_listu_zakladne_informac', 10, NULL, 1);

INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`)
VALUES
    (448, 29, 1, 'dodaci_list', 'cislo', NULL, NULL, 'Číslo', 10, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '<vlvalidator name=\"customCislo\" type=\"custom\" function=\"vdaemonCislo\">', NULL, NULL, NULL, NULL),
    (449, 29, 11, 'dodaci_list', 'datum_vytvorenia', NULL, NULL, 'Dátum vytvorenia', 20, '{\"datetime_format\":\"d.m.Y H:i:s\",\"step\":1}', NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NOW', NULL, NULL, NULL, NULL, NULL),
    (450, 29, 5, 'dodaci_list', 'osoba_id', 'osoba', NULL, 'Kontaktná osoba', 50, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, NULL, NULL, NULL, NULL, 1, '<a class=\"btn btn-primary get-ajax-form\" href=\"osoba_pridaj_modal.php\" title=\"Pridanie osoby\" data-before-load=\"osoba.beforeLoad\" data-parent=\"osoba_id\"> <i class=\"fa fa-plus\"></i></a>', NULL, NULL),
    (451, 29, 5, 'dodaci_list', 'vytvoril_id', 'zamestnanec', NULL, 'Vytvoril', 30, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 1),
    (452, 29, 5, 'dodaci_list', 'obchodny_partner_id', 'obchodny_partner', NULL, 'Obchodný partner', 40, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, '<a class=\"btn btn-primary get-ajax-form\" href=\"obchodny_partner_pridaj_modal.php\" title=\"Pridanie obchodného partnera\" data-after_load=\"obchodnyPartner.afterLoad\" data-parent=\"obchodny_partner_id\"><i class=\"fa fa-plus\"></i></a>', NULL, NULL)
;

INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`)
VALUES
    (453, 31, 10, 'dodaci_list', 'interna_poznamka', NULL, NULL, 'Interná poznámka', 40, NULL, 600, 300, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (454, 31, 10, 'dodaci_list', 'text_pre_zakaznika', NULL, NULL, 'Text pre zákazníka', 10, NULL, 600, 300, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
;

INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`)
VALUES
    (455, 32, 1, 'polozka_dodacieho_listu', 'nazov', NULL, NULL, 'Názov', 40, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (456, 32, 13, 'polozka_dodacieho_listu', 'dodaci_list_id', 'dodaci_list', NULL, 'Objednávka', 1, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (457, 32, 1, 'polozka_dodacieho_listu', 'cena_bez_dph', NULL, NULL, 'Cena bez DPH', 50, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (458, 32, 1, 'polozka_dodacieho_listu', 'mnozstvo', NULL, NULL, 'Množstvo', 70, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (459, 32, 2, 'polozka_dodacieho_listu', 'popis', NULL, NULL, 'Popis', 100, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (460, 32, 5, 'polozka_dodacieho_listu', 'merna_jednotka_id', 'merna_jednotka', NULL, 'Merná jednotka', 80, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
    (461, 32, 1, 'polozka_dodacieho_listu', 'poradie', NULL, NULL, 'Poradie', 120, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (462, 32, 1, 'polozka_dodacieho_listu', 'skupina', NULL, NULL, 'Skupina', 130, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
;

CREATE TABLE `dodaci_list` (
                               `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                               `visibility_type` int(11) DEFAULT NULL,
                               `cislo` varchar(255) DEFAULT NULL,
                               `nazov` varchar(255) DEFAULT NULL,
                               `hash` varchar(255) DEFAULT NULL,
                               `interna_poznamka` text DEFAULT NULL,
                               `text_pre_zakaznika` text DEFAULT NULL,
                               `obchodny_partner_id` int(10) unsigned DEFAULT NULL,
                               `osoba_id` int(10) unsigned DEFAULT NULL,
                               `vytvoril_id` int(10) unsigned DEFAULT NULL,
                               `datum_odoslania` datetime DEFAULT NULL,
                               `datum_vytvorenia` timestamp NULL DEFAULT current_timestamp(),
                               `objednavka_id` int(11) DEFAULT NULL,
                               PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

CREATE TABLE `polozka_dodacieho_listu` (
                                           `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                                           `visibility_type` int(11) DEFAULT NULL,
                                           `dodaci_list_id` int(10) unsigned DEFAULT NULL,
                                           `nazov` varchar(255) DEFAULT NULL,
                                           `cena_bez_dph` double(10,2) DEFAULT NULL,
                                           `cena_s_dph` double(10,2) DEFAULT NULL,
                                           `sadzba_dph` double DEFAULT NULL,
                                           `mnozstvo` double(8,2) DEFAULT NULL,
                                           `popis` text DEFAULT NULL,
                                           `merna_jednotka_id` int(10) unsigned DEFAULT NULL,
                                           `poradie` int(11) DEFAULT NULL,
                                           `skupina` varchar(255) DEFAULT NULL,
                                           PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

/* 08:13:08 gmspider gmspider */ INSERT INTO `priradenie_komunikacie` (`id`, `nazov`, `code`) VALUES ('2', 'Dodací ilst', 'dodaci_list');
/* 08:21:20 gmspider gmspider */ DELETE FROM `form_group` WHERE `id` IN ('30');
/* 08:23:56 gmspider gmspider */ INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES 	(75, 'Pridanie dodacieho listu', 'dodaci_list_pridaj', NULL), 	(76, 'Editovanie dodacieho listu', 'dodaci_list_edituj', NULL), 	(77, 'Zmazanie dodacieho listu', 'dodaci_list_zmaz', NULL), 	(78, 'Pridanie položky dodacieho listu', 'polozka_dodacieho_listu_pridaj', NULL), 	(79, 'Editovanie položky dodacieho listu', 'polozka_dodacieho_listu_edituj', NULL), 	(80, 'Zmazanie položky dodacieho listu', 'polozka_dodacieho_listu_zmaz', NULL);
/* 08:35:48 gmspider gmspider */ INSERT INTO `priradenie_suboru` (`id`, `nazov`, `code`) VALUES ('4', 'Dodací list', 'dodaci_list');

/* 11:01:04 gmspider gmspider */ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES ('465', '29', '5', 'dodaci_list', 'objednavka_id', 'objednavka', NULL, 'Objednávka', '60', NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, 'select2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* 11:01:13 gmspider gmspider */ UPDATE `form_element` SET `form_element_type_id` = '14' WHERE `id` = '465';
/* 11:02:02 gmspider gmspider */ UPDATE `form_element` SET `direct_multi_data` = '1' WHERE `id` = '465';
/* 11:02:10 gmspider gmspider */ UPDATE `form_element` SET `direct_multi_label` = '1', `direct_multi_data` = NULL WHERE `id` = '465';

/* 13:49:17 gmspider gmspider */ ALTER TABLE `objednavka` ADD `cislo_u_zakaznika` VARCHAR(255)  NULL  DEFAULT NULL  AFTER `cislo`;
/* 13:50:18 gmspider gmspider */ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES ('40025', '40000', '1', 'objednavka', 'cislo_u_zakaznika', NULL, NULL, 'Číslo u zákazníka', '12', NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

/* 14:13:13 gmspider gmspider */ INSERT INTO `permission` (`id`, `nazov`) VALUES ('192', 'dodaci_list_all');
/* 14:13:42 gmspider gmspider */ INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES ('3', '192');

/* 14:16:21 gmspider gmspider */ INSERT INTO `permission` (`id`, `nazov`) VALUES ('193', 'polozka_dodacieho_listu_all');
/* 14:16:29 gmspider gmspider */ INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES ('3', '193');
/* 14:17:25 gmspider gmspider */ INSERT INTO `permission` (`id`, `nazov`) VALUES ('194', 'komunikacia_all');
/* 14:17:37 gmspider gmspider */ INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES ('3', '194');

