INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`)
VALUES
    (36, NULL, 'CRM', 'crm', 35, 1, 1);

INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`)
VALUES
    (28001, 36, 'Cenové ponuky', 'cenova_ponuka_vypis', 10, 2, 1),
    (28002, 36, 'Pridanie cenovej ponuky', 'cenova_ponuka_pridaj', 20, 2, 3),
    (40001, 36, 'Objednávky', 'objednavka_vypis', 20, 2, 1),
    (40002, 36, 'Pridanie objednávky', 'objednavka_pridaj', 20, 2, 3);

INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`)
VALUES
    (28003, 28001, 'Detail cenovej ponuky', 'cenova_ponuka_view', 10, 3, 1),
    (28004, 28001, 'Editovanie cenovej ponuky', 'cenova_ponuka_edituj', 20, 3, 1),
    (28005, 28001, 'Zmazanie cenovej ponuky', 'cenova_ponuka_zmaz', NULL, 3, NULL),
    (28006, 28001, 'Súbory cenovej ponuky', 'cenova_ponuka_subor', 40, 3, 1),
    (28007, 28001, 'Archív', 'cenova_ponuka_archiv', 50, 3, 1),
    (28008, 28001, 'Foto k cenovej ponuke', 'cenova_ponuka_foto', 30, 3, 1),
    (28100, 28001, 'Pridanie položky cenovej ponuky', 'polozka_cenovej_ponuky_pridaj', NULL, 3, NULL),
    (28101, 28001, 'Editovanie položky cenovej ponuky', 'polozka_cenovej_ponuky_edituj', NULL, 3, NULL),
    (28102, 28001, 'Zmazanie položky cenovej ponuky', 'polozka_cenovej_ponuky_zmaz', NULL, 3, NULL);

INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`)
VALUES
    (40003, 40001, 'Detail objednávky', 'objednavka_view', 10, 3, 1),
    (40004, 40001, 'Editovanie objednávky', 'objednavka_edituj', 20, 3, 1),
    (40005, 40001, 'Zmazanie objednávky', 'objednavka_zmaz', NULL, 3, NULL),
    (40006, 40001, 'Súbory objednávky', 'objednavka_subor', 40, 3, 1),
    (40008, 40001, 'Foto k objednávke', 'objednavka_foto', 30, 3, 1),
    (40100, 40001, 'Pridanie položky objednávky', 'polozka_objednavky_pridaj', NULL, 3, NULL),
    (40101, 40001, 'Editovanie položky objednávky', 'polozka_objednavky_edituj', NULL, 3, NULL),
    (40102, 40001, 'Zmazanie položky objednávky', 'polozka_objednavky_zmaz', NULL, 3, NULL);

INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`)
VALUES
    (28000, 'Pridanie cenovej ponuky', 'cenova_ponuka_pridaj', NULL),
    (28001, 'Editovanie cenovej ponuky', 'cenova_ponuka_edituj', NULL),
    (28002, 'Zmazanie cenovej ponuky', 'cenova_ponuka_zmaz', NULL),
    (28003, 'Vytvorenie zákazky z cenovej ponuky', 'cenova_ponuka_zakazka', NULL),
    (28004, 'Zmena stavu cenovej ponuky', 'zmena_stavu_cenovej_ponuky', NULL),
    (28005, 'Nová verzia cenovej ponuky', 'cenova_ponuka_nova_verzia', NULL),
    (28100, 'Pridanie položky cenovej ponuky', 'polozka_cenovej_ponuky_pridaj', NULL),
    (28101, 'Editovanie položky cenovej ponuky', 'polozka_cenovej_ponuky_edituj', NULL),
    (28102, 'Zmazanie položky cenovej ponuky', 'polozka_cenovej_ponuky_zmaz', NULL),
    (40000, 'Pridanie objednávky', 'objednavka_pridaj', NULL),
    (40001, 'Editovanie objednávky', 'objednavka_edituj', NULL),
    (40002, 'Zmazanie objednávky', 'objednavka_zmaz', NULL),
    (40003, 'Vytvorenie zákazky z objednávky', 'objednavka_zakazka', NULL),
    (40004, 'Zmena stavu objednávky', 'zmena_stavu_objednavky', NULL),
    (40100, 'Pridanie položky objednávky', 'polozka_objednavky_pridaj', NULL),
    (40101, 'Editovanie položky objednávky', 'polozka_objednavky_edituj', NULL),
    (40102, 'Zmazanie položky objednávky', 'polozka_objednavky_zmaz', NULL);

INSERT INTO `form` (`id`, `nazov`, `code`)
VALUES
    (280, 'Cenová ponuka', 'cenova_ponuka'),
    (400, 'Objednávka', 'objednavka');

INSERT INTO `form` (`id`, `nazov`, `code`)
VALUES
    (281, 'Položka cenovej ponuky', 'polozka_cenovej_ponuky'),
    (401, 'Položka objednávky', 'polozka_objednavky');

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`)
VALUES
    (28000, 280, 'Základné informácie', 'cenova_ponuka_zakladne_informacie', 10, NULL, 1),
    (28001, 280, 'Ďalšie informácie', 'cenova_ponuka_dalsie_informacie', 20, NULL, 1),
    (28002, 280, 'Texty', 'cenova_ponuka_texty', 30, NULL, 1);

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

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`)
VALUES
    (40000, 400, 'Základné informácie', 'objednavka_zakladne_informacie', 10, NULL, 1),
    (40001, 400, 'Ďalšie informácie', 'objednavka_dalsie_informacie', 20, NULL, 1),
    (40002, 400, 'Texty', 'objednavka_texty', 30, NULL, 1);

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`)
VALUES
    (40100, 401, 'Základné informácie', 'polozka_cenovej_ponuky_zakladne_informacie', 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
    (28000, 28000, 1, 'cenova_ponuka', '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),
    (28001, 28000, 11, 'cenova_ponuka', '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),
    (28002, 28001, 4, 'cenova_ponuka', 'predpokladany_datum_dodania', NULL, NULL, 'Predpokladný dátum dodania', 20, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (28003, 28000, 5, 'cenova_ponuka', '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, NULL, NULL, NULL),
    (28004, 28000, 5, 'cenova_ponuka', 'stav_cenovej_ponuky_id', 'stav_cenovej_ponuky', NULL, 'Stav cenovej ponuky', 70, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (28005, 28002, 10, 'cenova_ponuka', '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),
    (28006, 28000, 5, 'cenova_ponuka', '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),
    (28007, 28001, 1, 'cenova_ponuka', 'pocet_dni_splatnosti', NULL, NULL, 'Počet dní splatnosti', 40, NULL, NULL, NULL, NULL, NULL, 1, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '14', NULL, NULL, NULL, NULL, NULL),
    (28008, 28001, 1, 'cenova_ponuka', 'pocet_dni_platnosti', NULL, NULL, 'Počet dní platnosti', 50, NULL, NULL, NULL, NULL, NULL, 1, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '30', NULL, NULL, NULL, NULL, NULL),
    (28010, 28000, 5, 'cenova_ponuka', 'obchodny_partner_id', 'obchodny_partner', NULL, 'Obchodný partner', 40, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
    (28011, 28002, 10, 'cenova_ponuka', '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),
    (28014, 28000, 1, 'cenova_ponuka', 'verzia', NULL, NULL, 'Verzia', 15, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL),
    (28015, 28001, 11, 'cenova_ponuka', 'datum_pripomienky', NULL, NULL, 'Dátum pripomienky', 100, '{\"datetime_format\":\"d.m.Y H:i\",\"step\":15}', NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (28017, 28002, 10, 'cenova_ponuka', 'dolny_text', NULL, NULL, 'Dolný text', 30, NULL, 600, 300, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (28018, 28002, 1, 'cenova_ponuka', 'nadpis', NULL, NULL, 'Nadpis', 5, NULL, 600, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (28022, 28002, 10, 'cenova_ponuka', 'referencie_text', NULL, NULL, 'Referencie', 20, NULL, 600, 300, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (28023, 28000, 5, 'cenova_ponuka', 'typ_cenovej_ponuky_id', 'typ_cenovej_ponuky', NULL, 'Typ', 5, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, 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
    (40000, 40000, 1, 'objednavka', '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),
    (40001, 40000, 11, 'objednavka', '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),
    (40002, 40001, 4, 'objednavka', 'predpokladany_datum_dodania', NULL, NULL, 'Predpokladný dátum dodania', 20, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (40003, 40000, 5, 'objednavka', '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, NULL, NULL, NULL),
    (40004, 40000, 5, 'objednavka', 'stav_objednavky_id', 'stav_objednavky', NULL, 'Stav objednávky', 70, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (40005, 40002, 10, 'objednavka', '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),
    (40006, 40000, 5, 'objednavka', '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),
    (40007, 40001, 1, 'objednavka', 'pocet_dni_splatnosti', NULL, NULL, 'Počet dní splatnosti', 40, NULL, NULL, NULL, NULL, NULL, 1, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '14', NULL, NULL, NULL, NULL, NULL),
    (40010, 40000, 5, 'objednavka', 'obchodny_partner_id', 'obchodny_partner', NULL, 'Obchodný partner', 40, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
    (40011, 40002, 10, 'objednavka', '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),
    (40017, 40002, 10, 'objednavka', 'dolny_text', NULL, NULL, 'Poznámka', 30, NULL, 600, 300, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (40023, 40000, 5, 'objednavka', 'typ_objednavky_id', 'typ_objednavky', NULL, 'Typ', 5, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, 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
    (40100, 40100, 1, 'polozka_objednavky', '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),
    (40101, 40100, 13, 'polozka_objednavky', 'objednavka_id', 'objednavka', 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),
    (40104, 40100, 1, 'polozka_objednavky', '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),
    (40106, 40100, 1, 'polozka_objednavky', '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),
    (40109, 40100, 2, 'polozka_objednavky', '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),
    (40110, 40100, 5, 'polozka_objednavky', '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),
    (40112, 40100, 1, 'polozka_objednavky', '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);

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
    (28100, 28100, 1, 'polozka_cenovej_ponuky', '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),
    (28101, 28100, 13, 'polozka_cenovej_ponuky', 'cenova_ponuka_id', 'cenova_ponuka', NULL, 'Cenová ponuka', 1, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
    (28104, 28100, 1, 'polozka_cenovej_ponuky', '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),
    (28106, 28100, 1, 'polozka_cenovej_ponuky', '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),
    (28109, 28100, 2, 'polozka_cenovej_ponuky', '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),
    (28110, 28100, 5, 'polozka_cenovej_ponuky', '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),
    (28112, 28100, 1, 'polozka_cenovej_ponuky', '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),
    (28113, 28100, 1, 'polozka_cenovej_ponuky', '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),
    (28114, 28100, 1, 'polozka_cenovej_ponuky', 'cena_info', NULL, NULL, 'Informácia k cene', 60, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

CREATE TABLE `stav_cenovej_ponuky` (
                                       `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                                       `nazov` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL,
                                       `code` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL,
                                       `poradie` int(11) NOT NULL,
                                       PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

INSERT INTO `stav_cenovej_ponuky` (`id`, `nazov`, `code`, `poradie`)
VALUES
    (1, 'Rozpracovaná', 'rozpracovana', 10),
    (2, 'Rozpracovaná (čaká sa na zákazníka)', 'rozpravcovana_zakaznik', 20),
    (3, 'Odložená', 'odlozena', 40),
    (4, 'Úspešná', 'uspesna', 50),
    (5, 'Neúspešná', 'neuspesna', 60),
    (7, 'Archív', 'archiv', 70);


CREATE TABLE `typ_cenovej_ponuky` (
                                      `id` int(11) NOT NULL AUTO_INCREMENT,
                                      `nazov` varchar(50) DEFAULT NULL,
                                      PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3;

INSERT INTO `typ_cenovej_ponuky` (`id`, `nazov`)
VALUES
    (1, 'Bežné služby'),
    (2, 'Koordinátor BOZP'),
    (3, 'Typ 3'),
    (4, 'Typ 4');

CREATE TABLE `cenova_ponuka` (
                                 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                                 `visibility_type` int(11) DEFAULT NULL,
                                 `cislo` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                 `nazov` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                 `nadpis` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                 `cena_s_dph` double(10,2) DEFAULT NULL,
                                 `cena_bez_dph` double(10,2) DEFAULT NULL,
                                 `hash` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT '',
                                 `pocet_dni_splatnosti` int(11) DEFAULT NULL,
                                 `pocet_dni_platnosti` int(11) DEFAULT NULL,
                                 `interna_poznamka` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                 `text_pre_zakaznika` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                 `dolny_text` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                 `obchodny_partner_id` int(10) unsigned DEFAULT NULL,
                                 `osoba_id` int(10) unsigned DEFAULT NULL,
                                 `projekt_id` int(10) unsigned DEFAULT NULL,
                                 `vytvoril_id` int(10) unsigned DEFAULT NULL,
                                 `stav_cenovej_ponuky_id` int(10) unsigned DEFAULT NULL,
                                 `datum_odoslania` datetime DEFAULT NULL,
                                 `datum_vytvorenia` timestamp NULL DEFAULT current_timestamp(),
                                 `predpokladany_datum_dodania` date DEFAULT NULL,
                                 `referencie_text` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                 `verzia` int(11) DEFAULT NULL,
                                 `datum_pripomienky` datetime DEFAULT NULL,
                                 `datum_odoslania_pripomienky` datetime DEFAULT NULL,
                                 `cenova_ponuka_id` int(11) DEFAULT NULL,
                                 `kategoria_produktu_id` int(11) DEFAULT NULL,
                                 `typ_cenovej_ponuky_id` int(11) DEFAULT NULL,
                                 PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

CREATE TABLE `polozka_cenovej_ponuky` (
                                          `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                                          `visibility_type` int(11) DEFAULT NULL,
                                          `cenova_ponuka_id` int(10) unsigned DEFAULT NULL,
                                          `nazov` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                          `kategoria_produktu_id` int(10) unsigned DEFAULT NULL,
                                          `produkt_id` int(10) unsigned DEFAULT NULL,
                                          `cena_bez_dph` double(10,2) DEFAULT NULL,
                                          `cena_info` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                          `mnozstvo` double(8,2) DEFAULT NULL,
                                          `popis` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                          `merna_jednotka_id` int(10) unsigned DEFAULT NULL,
                                          `zaruka` int(11) DEFAULT NULL,
                                          `poradie` int(11) DEFAULT NULL,
                                          `uloha_id` int(11) DEFAULT NULL,
                                          `skupina` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                          PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

CREATE TABLE `typ_objednavky` (
                                  `id` int(11) NOT NULL AUTO_INCREMENT,
                                  `nazov` varchar(50) DEFAULT NULL,
                                  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3;

INSERT INTO `typ_objednavky` (`id`, `nazov`)
VALUES
    (1, 'Bežné služby'),
    (2, 'Koordinátor BOZP'),
    (3, 'Typ 3'),
    (4, 'Typ 4');


CREATE TABLE `stav_objednavky` (
                                   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                                   `nazov` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL,
                                   `code` varchar(255) COLLATE utf8mb3_unicode_ci NOT NULL,
                                   `poradie` int(11) NOT NULL,
                                   PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

INSERT INTO `stav_objednavky` (`id`, `nazov`, `code`, `poradie`)
VALUES
    (1, 'Rozpracovaná', 'rozpracovana', 10),
    (2, 'Rozpracovaná (čaká sa na zákazníka)', 'rozpravcovana_zakaznik', 20),
    (3, 'Uzavretá', 'uzavreta', 30);


CREATE TABLE `objednavka` (
                              `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                              `visibility_type` int(11) DEFAULT NULL,
                              `cislo` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                              `nazov` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                              `hash` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                              `pocet_dni_splatnosti` int(11) DEFAULT NULL,
                              `interna_poznamka` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                              `text_pre_zakaznika` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                              `dolny_text` text COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                              `obchodny_partner_id` int(10) unsigned DEFAULT NULL,
                              `osoba_id` int(10) unsigned DEFAULT NULL,
                              `vytvoril_id` int(10) unsigned DEFAULT NULL,
                              `stav_objednavky_id` int(10) unsigned DEFAULT NULL,
                              `datum_odoslania` datetime DEFAULT NULL,
                              `datum_vytvorenia` timestamp NULL DEFAULT current_timestamp(),
                              `predpokladany_datum_dodania` date DEFAULT NULL,
                              `cenova_ponuka_id` int(11) DEFAULT NULL,
                              `typ_objednavky_id` int(11) DEFAULT NULL,
                              PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

CREATE TABLE `polozka_objednavky` (
                                      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                                      `visibility_type` int(11) DEFAULT NULL,
                                      `objednavka_id` int(10) unsigned DEFAULT NULL,
                                      `nazov` varchar(255) COLLATE utf8mb3_unicode_ci 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 COLLATE utf8mb3_unicode_ci DEFAULT NULL,
                                      `merna_jednotka_id` int(10) unsigned DEFAULT NULL,
                                      `poradie` int(11) DEFAULT NULL,
                                      `uloha_id` int(11) DEFAULT NULL,
                                      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

CREATE TABLE `produkt` (
                           `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                           `kategoria_produktu_id` int(10) unsigned NOT NULL DEFAULT 0,
                           `nazov` varchar(255) DEFAULT NULL,
                           `nazov_web` varchar(255) DEFAULT NULL,
                           `zobrazit` int(11) DEFAULT NULL,
                           `visibility_type` tinyint(1) DEFAULT NULL,
                           `poradie` int(11) DEFAULT NULL,
                           `kratky_text` text DEFAULT NULL,
                           `text` text DEFAULT NULL,
                           `title` varchar(255) DEFAULT NULL,
                           `description` varchar(255) DEFAULT NULL,
                           `jazyk_id` int(11) NOT NULL DEFAULT 0,
                           `merna_jednotka_id` int(11) DEFAULT NULL,
                           `produkt_id` int(11) DEFAULT NULL,
                           PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

INSERT INTO `priradenie_komunikacie` (`id`, `nazov`, `code`)
VALUES
    (280, 'Cenová ponuka', 'cenova_ponuka'),
    (400, 'Objednávka', 'objednavka');


INSERT INTO `priradenie_suboru` (`id`, `nazov`, `code`)
VALUES
    (280, 'Cenová ponuka', 'cenova_ponuka'),
    (400, 'Objednávka', 'objednavka');

INSERT INTO `webmenu` (`id`, `typ_webmenu_id`, `webmenu_id`, `web_nazov`, `nazov`, `code`, `seonazov`, `poradie`, `visibility_type`, `target`, `icon`)
VALUES
    (20, NULL, NULL, 'Texty pre šablónu cenovej ponuky', 'Texty pre šablónu cenovej ponuky', 'cenova_ponuka', NULL, NULL, NULL, NULL, NULL);