
START TRANSACTION;


DROP TABLE IF EXISTS `categories`;
CREATE TABLE IF NOT EXISTS `categories` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,       
    `order` int(10) unsigned DEFAULT NULL,               
    `gender` enum('male','female','child') DEFAULT NULL,            
    `status` enum('T','F') NOT NULL DEFAULT 'T',         
    `image` varchar(255) DEFAULT NULL,                   
    PRIMARY KEY (`id`) 
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
    
DROP TABLE IF EXISTS `services_categories`;
CREATE TABLE IF NOT EXISTS `services_categories` (
  `service_id` int(10) unsigned NOT NULL DEFAULT '0',   
    `category_id` int(10) unsigned NOT NULL DEFAULT '0',  
    PRIMARY KEY (`service_id`,`category_id`)            
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
  

INSERT INTO `plugin_base_fields` VALUES (NULL, 'menuCategories', 'backend', 'Menu / Categories', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Categories', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoCategoriesTitle', 'backend', 'Info / Category List Title', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Category List', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoCategoriesDesc', 'backend', 'Info / Category List Desc', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Your menu is organized in categories. Below is a list of all categories added to the system. Use the tab above to add new category or edit one by clicking on the pencil icon of each row. You can organize categories with drag & drop.', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'btnAddCategory', 'backend', 'Button / Add Category', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Add Category', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblCategoryImage', 'backend', 'Label / Image', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Image', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblCategoryName', 'backend', 'Label / Name', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Name', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblCategoryGender', 'backend', 'Label / Gender', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Gender', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblCategoryOrder', 'backend', 'Label / Order', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Order', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'category_image_dtitle', 'backend', 'Info / Delete title', 'script', '2018-05-31 06:44:09');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Delete confirmation', 'script');
				
INSERT INTO `plugin_base_fields` VALUES (NULL, 'category_image_dbody', 'backend', 'Info / Delete body', 'script', '2018-05-31 06:44:09');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Are you sure you want to delete this picture?', 'script');


INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminCategories', 'backend', 'pjAdminCategories', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Categories Menu', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminCategories_pjActionCreateForm', 'backend', 'pjAdminCategories_pjActionCreateForm', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Add categories', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminCategories_pjActionDeleteCategory', 'backend', 'pjAdminCategories_pjActionDeleteCategory', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Delete single product', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminCategories_pjActionDeleteCategoryBulk', 'backend', 'pjAdminCategories_pjActionDeleteCategoryBulk', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Delete multiple categories', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminCategories_pjActionIndex', 'backend', 'pjAdminCategories_pjActionIndex', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Categories List', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminCategories_pjActionUpdateForm', 'backend', 'pjAdminCategories_pjActionUpdateForm', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Edit categories', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoAddCategoryDesc', 'backend', 'infoAddCategoryDesc', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Use the form below to add new category to the system.', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoAddCategoryTitle', 'backend', 'infoAddCategoryTitle', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Add new category', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoUpdateCategoryDesc', 'backend', 'infoUpdateCategoryDesc', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Edit category details and click on the ''Save'' button to update it.', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoUpdateCategoryTitle', 'backend', 'infoUpdateCategoryTitle', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Update Category', 'script');


INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, NULL, 'pjAdminCategories');
SET @level_1_id := (SELECT LAST_INSERT_ID());

  INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_1_id, 'pjAdminCategories_pjActionIndex');
  SET @level_2_id := (SELECT LAST_INSERT_ID());
  
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminCategories_pjActionCreateForm');
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminCategories_pjActionUpdateForm');
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminCategories_pjActionDeleteCategory');
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminCategories_pjActionDeleteCategoryBulk');
    
    

COMMIT;