/* 20:36:10 */ ALTER TABLE `pracovnik` ADD `created_at` DATETIME  NULL  AFTER `pracovisko`;
/* 20:36:20 */ ALTER TABLE `pracovnik` ADD `created_by` INT(10)  UNSIGNED  NOT NULL  AFTER `created_at`;
/* 20:36:26 */ ALTER TABLE `pracovnik` ADD `updated_at` DATETIME  NULL  AFTER `created_by`;

/* 20:42:30 */ ALTER TABLE `stav_pracovnika` ADD `code` VARCHAR(255)  NULL  DEFAULT NULL  AFTER `nazov`;
/* 20:42:33 */ UPDATE `stav_pracovnika` SET `code` = 'novy' WHERE `id` = '1';
/* 20:42:36 */ UPDATE `stav_pracovnika` SET `code` = 'na_spracovanie' WHERE `id` = '2';
/* 20:42:39 */ UPDATE `stav_pracovnika` SET `code` = 'aktivny' WHERE `id` = '3';
/* 20:42:41 */ UPDATE `stav_pracovnika` SET `code` = 'archivovany' WHERE `id` = '4';

INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`)
VALUES
	(15, NULL, 'Zamestnanci', 'pracovnik', 120, 1, 1),
	(16, 15, 'Výpis zamestnancov', 'pracovnik_vypis', 10, 2, 1),
	(17, 15, 'Pridanie zamestnanca', 'pracovnik_pridaj', 20, 2, 1),
	(18, 16, 'Detail zamestnanca', 'pracovnik_view', 10, 3, 1),
	(19, 16, 'Editovanie zamestnanca', 'pracovnik_edituj', 20, 3, 1),
	(20, 16, 'Zmazanie zamestnanca', 'pracovnik_zmaz', 0, 3, 0),
	(21, 16, 'Súbory zamestnanca', 'pracovnik_subor', 30, 3, 1),
	(22, 16, 'Pracovné pozície', 'pracovnik_pozicia_vypis', 40, 3, 1),
	(23, 16, 'Pridanie pracovnej pozície', 'pracovnik_pozicia_pridaj', 0, 3, 0),
	(24, 16, 'Editovanie pracovnej pozície', 'pracovnik_pozicia_edituj', 0, 3, 0),
	(25, 16, 'Zmazanie pracovnej pozície', 'pracovnik_pozicia_zmaz', 0, 3, 0);

INSERT INTO `form` (`id`, `nazov`, `code`)
VALUES
	(6, 'Pracovník', 'pracovnik'),
	(7, 'Pracovník pracovná pozícia', 'pracovnik_pozicia');

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`)
VALUES
	(14, 6, 'Osobné informácie', 'pracovnik', 10, NULL, 1),
	(15, 6, 'Pracovné informácie', 'pracovnik_pracovne_informacie', 20, NULL, 1),
	(16, 6, 'Rozšírené informácie', 'pracovnik_rozsirene_informacie', 30, NULL, 1),
	(17, 7, 'Základné informácie', 'pracovnik_pozicia', 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
	(71, 14, 1, 'pracovnik', 'meno', NULL, NULL, 'Meno', 10, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(72, 14, 1, 'pracovnik', 'priezvisko', NULL, NULL, 'Priezvisko', 20, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(73, 15, 5, 'pracovnik', 'obchodny_partner_id', 'obchodny_partner', NULL, 'Obchodný partner', 20, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
	(74, 15, 4, 'pracovnik', 'datum_nastupu', NULL, NULL, 'Dátum nástupu', 10, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(75, 14, 4, 'pracovnik', 'datum_narodenia', NULL, NULL, 'Dátum narodenia', 30, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(76, 14, 1, 'pracovnik', 'email', NULL, NULL, 'E-mail', 40, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(77, 16, 5, 'pracovnik', 'stav_pracovnika_id', 'stav_pracovnika', NULL, 'Stav', 10, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(78, 15, 5, 'pracovnik', 'prevadzka_id', 'majetok', NULL, 'Prevádzka', 30, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
	(79, 15, 1, 'pracovnik', 'pracovisko', NULL, NULL, 'Pracovisko', 40, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL),
	(80, 17, 4, 'pracovnik_pozicia', 'zaciatok', NULL, NULL, 'Začiatok', 10, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(81, 17, 4, 'pracovnik_pozicia', 'koniec', NULL, NULL, 'Koniec', 10, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(82, 17, 13, 'pracovnik_pozicia', 'pracovnik_id', NULL, NULL, 'Pracovník', 0, 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
	(83, 17, 5, 'pracovnik_pozicia', 'profesia_id', 'profesia', NULL, 'Profesia', 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
	(47, 'Pridanie pracovníka', 'pracovnik_pridaj', NULL),
	(48, 'Editovanie pracovníka', 'pracovnik_edituj', NULL),
	(49, 'Zmazanie pracovníka', 'pracovnik_zmaz', NULL),
	(50, 'Pridanie pracovnej pozície pracovníka', 'pracovnik_pozicia_pridaj', NULL),
	(51, 'Editovanie pracovnej pozície pracovníka', 'pracovnik_pozicia_edituj', NULL),
	(52, 'Zmazanie pracovnej pozície pracovníka', 'pracovnik_pozicia_zmaz', NULL);

/* 21:40:05 */ INSERT INTO `priradenie_suboru` (`id`, `nazov`, `code`) VALUES ('3', 'Pracovník', 'pracovnik');

INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`)
VALUES
	(53, 'Pridanie školenia pracovníka', 'pracovnik_skolenie_pridaj', NULL),
	(54, 'Editovanie školenia pracovníka', 'pracovnik_skolenie_edituj', NULL),
	(55, 'Zmazanie školenia pracovníka', 'pracovnik_skolenie_zmaz', NULL);

INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`)
VALUES
	(26, 16, 'Školenia a lekárske prehliadky', 'pracovnik_skolenie_vypis', 50, 3, 1),
	(27, 16, 'Pridanie školenia, lekárskej prehliadky', 'pracovnik_skolenie_pridaj', 0, 3, 0),
	(28, 16, 'Editovanie školenia, lekárskej prehliadky', 'pracovnik_skolenie_edituj', 0, 3, 0),
	(29, 16, 'Zmazanie školenia, lekárskej prehliadky', 'pracovnik_skolenie_zmaz', 0, 3, 0);

INSERT INTO `form` (`id`, `nazov`, `code`)
VALUES
	(8, 'Pracovník školenie', 'pracovnik_skolenie');

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`)
VALUES
	(18, 8, 'Základné informácie', 'pracovnik_skolenie', 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
	(84, 18, 5, 'pracovnik_skolenie', 'typ_skolenia_id', 'typ_skolenia', NULL, 'Typ', 10, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
	(85, 18, 4, 'pracovnik_skolenie', 'datum', NULL, NULL, 'Dátum', 20, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NOW', NULL, NULL, NULL, NULL, NULL),
	(86, 18, 13, 'pracovnik_skolenie', 'pracovnik_id', NULL, NULL, 'Pracovník', 0, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(87, 18, 2, 'pracovnik_skolenie', 'popis', NULL, NULL, 'Popis', 30, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

/* 23:26:02 */ RENAME TABLE `skolenie` TO `pracovnik_skolenie`;

/* 06:17:03 */ ALTER TABLE `pracovnik_kategoria_prace` CHANGE `namerane_hodnoty` `namerane_hodnoty` VARCHAR(255)  CHARACTER SET utf8  COLLATE utf8_general_ci  NULL  DEFAULT '';

INSERT INTO `form` (`id`, `nazov`, `code`)
VALUES
	(9, 'Pracovník faktor', 'pracovnik_faktor');

/* 08:22:07 */ RENAME TABLE `pracovnik_kategoria_prace` TO `pracovnik_faktor`;

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`)
VALUES
	(19, 9, NULL, 'pracovnik_faktor', 10, NULL, 1),
	(20, 7, 'Faktory pri práci', 'pracovnik_faktor', 20, NULL, 2);

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
	(88, 19, 5, 'pracovnik_faktor', 'kategoria_prace_id', 'kategoria_prace', NULL, 'Kategória práce', 20, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
	(89, 19, 5, 'pracovnik_faktor', 'faktor_pri_praci_id', 'faktor_pri_praci', NULL, 'Faktor pri práci', 10, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
	(90, 19, 1, 'pracovnik_faktor', 'namerane_hodnoty', NULL, NULL, 'Namerané hodnoty', 30, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

/* 06:17:03 */ ALTER TABLE `pracovnik_faktor` CHANGE `namerane_hodnoty` `namerane_hodnoty` VARCHAR(255)  CHARACTER SET utf8  COLLATE utf8_general_ci  NULL  DEFAULT '';
/* 06:17:26 */ UPDATE `menu` SET `nazov` = 'Zamestnanci' WHERE `id` = '21000';
/* 06:17:51 */ UPDATE `menu` SET `nazov` = 'Personalistika' WHERE `id` = '15';

UPDATE `form_element` SET `position`='20' WHERE  `id`=80;
UPDATE `form_element` SET `position`='30' WHERE  `id`=81;