INSERT INTO `form` (`id`, `nazov`, `code`) VALUES (262, 'Osoba', 'osoba');

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`) VALUES (26200, 262, 'Základné informácie', 'osoba_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 (26200, 26200, 1, 'osoba', 'titul_pred_menom', NULL, NULL, 'Titul pred menom', 30, 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 (26201, 26200, 1, 'osoba', 'meno', NULL, NULL, 'Meno', 40, NULL, NULL, NULL, NULL, NULL, 1, 1, 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 (26202, 26200, 1, 'osoba', 'priezvisko', NULL, NULL, 'Priezvisko', 50, NULL, NULL, NULL, NULL, NULL, 1, 1, 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 (26203, 26200, 1, 'osoba', 'titul_za_menom', NULL, NULL, 'Titul za menom', 60, 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 (26204, 26200, 5, 'osoba', 'oslovenie_id', 'oslovenie', NULL, 'Oslovenie', 20, NULL, NULL, NULL, NULL, NULL, 1, NULL, 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 (26205, 26200, 1, 'osoba', 'pozicia', NULL, NULL, 'Pozícia', 70, 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 (26206, 26200, 1, 'osoba', 'telefon', NULL, NULL, 'Telefón', 80, 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 (26207, 26200, 1, 'osoba', 'telefon_vo_firme', NULL, NULL, 'Telefón vo firme', 90, 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 (26208, 26200, 1, 'osoba', 'mobil', NULL, NULL, 'Mobil', 100, 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 (26209, 26200, 1, 'osoba', 'email', NULL, NULL, 'E-mail', 110, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, 1, 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 (26210, 26200, 5, 'osoba', 'obchodny_partner_id', 'obchodny_partner', NULL, 'Obchodný partner', 10, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL);

INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (26200, 'Pridanie osoby', 'osoba_pridaj', NULL);
INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (26201, 'Editovanie osoby', 'osoba_edituj', NULL);
INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (26202, 'Zmazanie osoby', 'osoba_zmaz', NULL);

CREATE TABLE `oslovenie` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`nazov` VARCHAR(255) NULL DEFAULT NULL,
	`code` VARCHAR(50) NULL DEFAULT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=3
;

INSERT INTO `oslovenie` (`id`, `nazov`, `code`) VALUES (1, 'Pán', 'pan');
INSERT INTO `oslovenie` (`id`, `nazov`, `code`) VALUES (2, 'Pani', 'pani');

CREATE TABLE `osoba` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`nazov` VARCHAR(255) NULL DEFAULT NULL,
	`titul_pred_menom` VARCHAR(45) NULL DEFAULT NULL,
	`meno` VARCHAR(255) NULL DEFAULT NULL,
	`priezvisko` VARCHAR(255) NULL DEFAULT NULL,
	`titul_za_menom` VARCHAR(45) NULL DEFAULT NULL,
	`pozicia` VARCHAR(50) NULL DEFAULT NULL,
	`telefon` VARCHAR(50) NULL DEFAULT NULL,
	`telefon_vo_firme` VARCHAR(50) NULL DEFAULT NULL,
	`mobil` VARCHAR(50) NULL DEFAULT NULL,
	`email` VARCHAR(255) NULL DEFAULT NULL,
	`obchodny_partner_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`oslovenie_id` INT(10) UNSIGNED NULL DEFAULT NULL,
	`visibility_type` TINYINT(1) NULL DEFAULT NULL,
	PRIMARY KEY (`id`),
	INDEX `fk_kontaktna_osoba_zakaznik1_idx` (`obchodny_partner_id`),
	INDEX `fk_osoba_oslovenie1_idx` (`oslovenie_id`),
	CONSTRAINT `fk_kontaktna_osoba_zakaznik1` FOREIGN KEY (`obchodny_partner_id`) REFERENCES `obchodny_partner` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION,
	CONSTRAINT `fk_osoba_oslovenie1` FOREIGN KEY (`oslovenie_id`) REFERENCES `oslovenie` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=12
;

INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (26200, NULL, 'Osoby', 'osoba', 30, 1, 1);
INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (26201, 26200, 'Pridanie osoby', 'osoba_pridaj', 10, 2, 1);
INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (26202, 26200, 'Výpis osôb', 'osoba_vypis', 20, 2, 1);
INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (26203, 26202, 'Detail osoby', 'osoba_view', 10, 3, 1);
INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (26204, 26202, 'Editovanie osoby', 'osoba_edituj', 20, 3, 1);
INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (26205, 26202, 'Zmazanie osoby', 'osoba_zmaz', 30, 3, NULL);
