-- menu groups Admission management

-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='AUTONOMOUS') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='ADMISSION_MANAGEMENT' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='AUTONOMOUS' and pmg.module='ADMISSION_MANAGEMENT');

-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='ENTERPRISE') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='ADMISSION_MANAGEMENT' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='ENTERPRISE' and pmg.module='ADMISSION_MANAGEMENT');

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='PROFESSIONAL') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='ADMISSION_MANAGEMENT' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='PROFESSIONAL' and pmg.module='ADMISSION_MANAGEMENT');

-- LMS
INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='LMS') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='ADMISSION_MANAGEMENT' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='LMS' and pmg.module='ADMISSION_MANAGEMENT');

--  ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='ENTERPRISE_SCMS') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='ADMISSION_MANAGEMENT' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='ENTERPRISE_SCMS' and pmg.module='ADMISSION_MANAGEMENT');

-- menu groups PRODUCT CONFIGURATION
-- has been removed (aug-24-2023)
-- AUTONOMOUS
-- INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='AUTONOMOUS') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='PRODUCT_CONFIGURATION' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='AUTONOMOUS' and pmg.module='PRODUCT_CONFIGURATION');

-- ENTERPRISE
-- INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='ENTERPRISE') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='PRODUCT_CONFIGURATION' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='ENTERPRISE' and pmg.module='PRODUCT_CONFIGURATION');

-- PROFESSIONAL
-- INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='PROFESSIONAL') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='PRODUCT_CONFIGURATION' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='PROFESSIONAL' and pmg.module='PRODUCT_CONFIGURATION');

-- LMS
-- INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='LMS') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='PRODUCT_CONFIGURATION' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='LMS' and pmg.module='PRODUCT_CONFIGURATION');

-- ENTERPRISE_SCMS
-- INSERT INTO `pc_product_variant_menu_groups` (`product_variant_id`,`pc_menu_group_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select `id` from `product_variant` where `code`='ENTERPRISE_SCMS') as `product_variant_id`, `id`, 1, 1, utc_timestamp(), 1, utc_timestamp() from `pc_menu_groups` where `module`='PRODUCT_CONFIGURATION' and `id` NOT IN (select pc_menu_group_id from `pc_product_variant_menu_groups` ppv inner join `product_variant` pv on pv.id=ppv.product_variant_id inner join `pc_menu_groups` pmg on pmg.id=ppv.pc_menu_group_id  where pv.code='ENTERPRISE_SCMS' and pmg.module='PRODUCT_CONFIGURATION');

-- menu items
-- ADM_ADMISSION_GENERAL_SETTINGS
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS') AND code in ("ADM_APPLICATION_FEES","ADM_APPLICATION_FEE_CATEGORY","ADM_BLOOD_GROUP","ADM_CASTE","ADM_CERTIFICATE","ADM_CONTENT_TEMPLATE","ADM_COUNTRY","ADM_COURSES_AND_SEATS","ADM_GENERAL_SETTINGS","ADM_MOTHER_TONGUE","ADM_NATIONALITY","ADM_OTHER_FIELD_DROPDOWNS","ADM_RELIGION","ADM_DASHBOARD_SETTINGS","ADM_RESERVATION_AND_FEE","ADM_SEAT_RESERVATION","ADM_STATE","ADM_STUDENT_RESERVATION","ADM_TALUK","ADM_WEIGHTAGE_QUOTA","ADM_ADMISSION_FEE_VOUCHER","ADM_ADMISSION_CHALLAN","ADM_CUSTOM_TAGS","ADM_CREATE_COURSE_GROUP","ADM_DOMICILE", "ADM_CERTIFICATE_VERIFICATION_CUSTOMIZE_UI", "ADM_ADMISSION_QUOTA");

-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS') AND code in ("ADM_APPLICATION_FEES","ADM_APPLICATION_FEE_CATEGORY","ADM_BLOOD_GROUP","ADM_CASTE","ADM_CERTIFICATE","ADM_CONTENT_TEMPLATE","ADM_COUNTRY","ADM_COURSES_AND_SEATS","ADM_GENERAL_SETTINGS","ADM_MOTHER_TONGUE","ADM_NATIONALITY","ADM_OTHER_FIELD_DROPDOWNS","ADM_RELIGION","ADM_DASHBOARD_SETTINGS","ADM_RESERVATION_AND_FEE","ADM_SEAT_RESERVATION","ADM_STATE","ADM_STUDENT_RESERVATION","ADM_TALUK","ADM_WEIGHTAGE_QUOTA","ADM_ADMISSION_FEE_VOUCHER","ADM_ADMISSION_CHALLAN","ADM_CUSTOM_TAGS","ADM_CREATE_COURSE_GROUP","ADM_DOMICILE", "ADM_CERTIFICATE_VERIFICATION_CUSTOMIZE_UI","ADM_ADMISSION_QUOTA");

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS') AND code in ("ADM_APPLICATION_FEES","ADM_APPLICATION_FEE_CATEGORY","ADM_BLOOD_GROUP","ADM_CASTE","ADM_CERTIFICATE","ADM_CONTENT_TEMPLATE","ADM_COUNTRY","ADM_COURSES_AND_SEATS","ADM_GENERAL_SETTINGS","ADM_MOTHER_TONGUE","ADM_NATIONALITY","ADM_OTHER_FIELD_DROPDOWNS","ADM_RELIGION","ADM_DASHBOARD_SETTINGS","ADM_RESERVATION_AND_FEE","ADM_SEAT_RESERVATION","ADM_STATE","ADM_STUDENT_RESERVATION","ADM_TALUK","ADM_WEIGHTAGE_QUOTA","ADM_ADMISSION_FEE_VOUCHER","ADM_ADMISSION_CHALLAN","ADM_CUSTOM_TAGS","ADM_CREATE_COURSE_GROUP","ADM_DOMICILE", "ADM_CERTIFICATE_VERIFICATION_CUSTOMIZE_UI","ADM_ADMISSION_QUOTA");


-- LMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS') AND code in ("ADM_APPLICATION_FEES","ADM_APPLICATION_FEE_CATEGORY","ADM_BLOOD_GROUP","ADM_CASTE","ADM_CERTIFICATE","ADM_CONTENT_TEMPLATE","ADM_COUNTRY","ADM_COURSES_AND_SEATS","ADM_GENERAL_SETTINGS","ADM_MOTHER_TONGUE","ADM_NATIONALITY","ADM_OTHER_FIELD_DROPDOWNS","ADM_RELIGION","ADM_DASHBOARD_SETTINGS","ADM_RESERVATION_AND_FEE","ADM_SEAT_RESERVATION","ADM_STATE","ADM_STUDENT_RESERVATION","ADM_TALUK","ADM_WEIGHTAGE_QUOTA","ADM_ADMISSION_FEE_VOUCHER","ADM_ADMISSION_CHALLAN","ADM_CUSTOM_TAGS","ADM_CREATE_COURSE_GROUP","ADM_DOMICILE", "ADM_CERTIFICATE_VERIFICATION_CUSTOMIZE_UI","ADM_ADMISSION_QUOTA");

-- ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_GENERAL_SETTINGS') AND code in ("ADM_APPLICATION_FEES","ADM_APPLICATION_FEE_CATEGORY","ADM_BLOOD_GROUP","ADM_CASTE","ADM_CERTIFICATE","ADM_CONTENT_TEMPLATE","ADM_COUNTRY","ADM_COURSES_AND_SEATS","ADM_GENERAL_SETTINGS","ADM_MOTHER_TONGUE","ADM_NATIONALITY","ADM_OTHER_FIELD_DROPDOWNS","ADM_RELIGION","ADM_DASHBOARD_SETTINGS","ADM_RESERVATION_AND_FEE","ADM_SEAT_RESERVATION","ADM_STATE","ADM_STUDENT_RESERVATION","ADM_TALUK","ADM_WEIGHTAGE_QUOTA","ADM_ADMISSION_FEE_VOUCHER","ADM_ADMISSION_CHALLAN","ADM_CUSTOM_TAGS","ADM_CREATE_COURSE_GROUP","ADM_DOMICILE", "ADM_CERTIFICATE_VERIFICATION_CUSTOMIZE_UI","ADM_ADMISSION_QUOTA");
-- -----------------------------------------------------------------------------------------

-- ADM_QUALIFICATION_SETTINGS
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_QUALIFICATION_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_QUALIFICATION_SETTINGS') AND code in ("ADM_BOARD_STREAM_TYPE","ADM_INSTITUTIONS","ADM_PREVIOUS_UNIVERSITY","ADM_SECOND_LANGUAGE","ADM_STREAMS","ADM_SUBJECTS","ADM_SUBJECT_GROUP_SUBJECT","ADM_SUBJECT_GROUP");

-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='ADM_QUALIFICATION_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='ADM_QUALIFICATION_SETTINGS') AND code in ("ADM_BOARD_STREAM_TYPE","ADM_INSTITUTIONS","ADM_PREVIOUS_UNIVERSITY","ADM_SECOND_LANGUAGE","ADM_STREAMS","ADM_SUBJECTS","ADM_SUBJECT_GROUP_SUBJECT","ADM_SUBJECT_GROUP");

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_QUALIFICATION_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_QUALIFICATION_SETTINGS') AND code in ("ADM_BOARD_STREAM_TYPE","ADM_INSTITUTIONS","ADM_PREVIOUS_UNIVERSITY","ADM_SECOND_LANGUAGE","ADM_STREAMS","ADM_SUBJECTS","ADM_SUBJECT_GROUP_SUBJECT","ADM_SUBJECT_GROUP");

-- LMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='ADM_QUALIFICATION_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='ADM_QUALIFICATION_SETTINGS') AND code in ("ADM_BOARD_STREAM_TYPE","ADM_INSTITUTIONS","ADM_PREVIOUS_UNIVERSITY","ADM_SECOND_LANGUAGE","ADM_STREAMS","ADM_SUBJECTS","ADM_SUBJECT_GROUP_SUBJECT","ADM_SUBJECT_GROUP");

-- ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_QUALIFICATION_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_QUALIFICATION_SETTINGS') AND code in ("ADM_BOARD_STREAM_TYPE","ADM_INSTITUTIONS","ADM_PREVIOUS_UNIVERSITY","ADM_SECOND_LANGUAGE","ADM_STREAMS","ADM_SUBJECTS","ADM_SUBJECT_GROUP_SUBJECT","ADM_SUBJECT_GROUP");
-- ----------------------------------------------------------------------------------------

-- ADM_ADMISSION_FORM_SETTINGS
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS') AND code in ("ADM_ADMISSION_FORM","ADM_ADMISSION_FORM_FIELD","ADM_FORM_ORDER","ADM_ADMISSION_REMARKS_FORM","ADM_ADMISSION_OFFLINE_FORM_FIELD");

-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS') AND code in ("ADM_ADMISSION_FORM","ADM_ADMISSION_FORM_FIELD","ADM_FORM_ORDER","ADM_ADMISSION_REMARKS_FORM","ADM_ADMISSION_OFFLINE_FORM_FIELD");

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS') AND code in ("ADM_ADMISSION_FORM","ADM_ADMISSION_FORM_FIELD","ADM_FORM_ORDER","ADM_ADMISSION_REMARKS_FORM","ADM_ADMISSION_OFFLINE_FORM_FIELD");


-- LMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS') AND code in ("ADM_ADMISSION_FORM","ADM_ADMISSION_FORM_FIELD","ADM_FORM_ORDER","ADM_ADMISSION_REMARKS_FORM","ADM_ADMISSION_OFFLINE_FORM_FIELD");

-- ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_FORM_SETTINGS') AND code in ("ADM_ADMISSION_FORM","ADM_ADMISSION_FORM_FIELD","ADM_FORM_ORDER","ADM_ADMISSION_REMARKS_FORM","ADM_ADMISSION_OFFLINE_FORM_FIELD");
-- -----------------------------------------------------------------------------------------

-- ADM_ADMISSION_STAGE_SETTINGS
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS') AND code in ("ADM_ADMISSION_FORM_STAGE","MANAGE_FORM_FIELDS_TO_DISPLAY","ADM_ADMISSION_STAGE","ADM_STAGE_PROCESS","ADM_STAGE_SETTINGS","ADM_ADMISSION_STAGE_ACTION","ADM_STAGE_MARK_ENTRY","ADM_ADD_STUDENTS_TO_STAGE");

-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS') AND code in ("ADM_ADMISSION_FORM_STAGE","MANAGE_FORM_FIELDS_TO_DISPLAY","ADM_ADMISSION_STAGE","ADM_STAGE_PROCESS","ADM_STAGE_SETTINGS","ADM_ADMISSION_STAGE_ACTION","ADM_STAGE_MARK_ENTRY","ADM_ADD_STUDENTS_TO_STAGE");

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS') AND code in ("ADM_ADMISSION_FORM_STAGE","MANAGE_FORM_FIELDS_TO_DISPLAY","ADM_ADMISSION_STAGE","ADM_STAGE_PROCESS","ADM_STAGE_SETTINGS","ADM_ADMISSION_STAGE_ACTION","ADM_STAGE_MARK_ENTRY","ADM_ADD_STUDENTS_TO_STAGE");

-- LMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS') AND code in ("ADM_ADMISSION_FORM_STAGE","MANAGE_FORM_FIELDS_TO_DISPLAY","ADM_ADMISSION_STAGE","ADM_STAGE_PROCESS","ADM_STAGE_SETTINGS","ADM_ADMISSION_STAGE_ACTION","ADM_STAGE_MARK_ENTRY","ADM_ADD_STUDENTS_TO_STAGE");

-- ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_STAGE_SETTINGS') AND code in ("ADM_ADMISSION_FORM_STAGE","MANAGE_FORM_FIELDS_TO_DISPLAY","ADM_ADMISSION_STAGE","ADM_STAGE_PROCESS","ADM_STAGE_SETTINGS","ADM_ADMISSION_STAGE_ACTION","ADM_STAGE_MARK_ENTRY","ADM_ADD_STUDENTS_TO_STAGE");

-- ----------------------------------------------------------------------------------------

-- ADM_APPLICANT_MANAGER
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_APPLICANT_MANAGER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_APPLICANT_MANAGER') AND code in ("ADM_RESET_STUDENT_PASSWORD","ADM_STUDENT_LIST","ADM_CUSTOM_CREATE_PRINT","ADM_CERTIFICATE_UPLOAD_REPORT","ADM_BULK_UPDATE_STUDENT_DATA","ADM_APPLIED_LIST","ADM_OFFLINE_REGISTER_STUDENT");

-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='ADM_APPLICANT_MANAGER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='ADM_APPLICANT_MANAGER') AND code in ("ADM_RESET_STUDENT_PASSWORD","ADM_STUDENT_LIST","ADM_CUSTOM_CREATE_PRINT","ADM_CERTIFICATE_UPLOAD_REPORT","ADM_BULK_UPDATE_STUDENT_DATA","ADM_APPLIED_LIST","ADM_OFFLINE_REGISTER_STUDENT");

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_APPLICANT_MANAGER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_APPLICANT_MANAGER') AND code in ("ADM_RESET_STUDENT_PASSWORD","ADM_STUDENT_LIST","ADM_CUSTOM_CREATE_PRINT","ADM_CERTIFICATE_UPLOAD_REPORT","ADM_BULK_UPDATE_STUDENT_DATA","ADM_APPLIED_LIST","ADM_OFFLINE_REGISTER_STUDENT");

-- LMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='ADM_APPLICANT_MANAGER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='ADM_APPLICANT_MANAGER') AND code in ("ADM_RESET_STUDENT_PASSWORD","ADM_STUDENT_LIST","ADM_CUSTOM_CREATE_PRINT","ADM_CERTIFICATE_UPLOAD_REPORT","ADM_BULK_UPDATE_STUDENT_DATA","ADM_APPLIED_LIST","ADM_OFFLINE_REGISTER_STUDENT");

-- ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_APPLICANT_MANAGER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_APPLICANT_MANAGER') AND code in ("ADM_RESET_STUDENT_PASSWORD","ADM_STUDENT_LIST","ADM_CUSTOM_CREATE_PRINT","ADM_CERTIFICATE_UPLOAD_REPORT","ADM_BULK_UPDATE_STUDENT_DATA","ADM_APPLIED_LIST","ADM_OFFLINE_REGISTER_STUDENT");

-- ----------------------------------------------------------------------------------------

-- ADM_ADMISSION_REPORTS
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_REPORTS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_REPORTS') AND code in ('ADM_ADMISSION_CREATE_REPORT','ADM_ADMISSION_VIEW_REPORT');

-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_REPORTS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_REPORTS') AND code in ('ADM_ADMISSION_CREATE_REPORT','ADM_ADMISSION_VIEW_REPORT');

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_REPORTS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_REPORTS') AND code in ('ADM_ADMISSION_CREATE_REPORT','ADM_ADMISSION_VIEW_REPORT');

-- LMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_REPORTS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_REPORTS') AND code in ('ADM_ADMISSION_CREATE_REPORT','ADM_ADMISSION_VIEW_REPORT');

-- ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_REPORTS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_REPORTS') AND code in ('ADM_ADMISSION_CREATE_REPORT','ADM_ADMISSION_VIEW_REPORT');
-- ------------------------------------------------------------------------------------------

-- settings menu group items

INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='SETTINGS') AND code in ("USER_PERMISSION_MANAGEMENT","ASSIGN_ROLES","MANAGE_ROLES");

INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='SETTINGS') AND code in ("USER_PERMISSION_MANAGEMENT","ASSIGN_ROLES","MANAGE_ROLES");

INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='SETTINGS') AND code in ("USER_PERMISSION_MANAGEMENT","ASSIGN_ROLES","MANAGE_ROLES");

INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='SETTINGS') AND code in ("USER_PERMISSION_MANAGEMENT","ASSIGN_ROLES","MANAGE_ROLES");


INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='SETTINGS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='SETTINGS') AND code in ("USER_PERMISSION_MANAGEMENT","ASSIGN_ROLES","MANAGE_ROLES");

-- ----------------------------------------------------------------------------------------

-- ADM_ADMIT_PROCEDURE
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMIT_PROCEDURE'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMIT_PROCEDURE') AND code in ('ADM_CERTIFICATE_VERIFICATION_APPLICATION_NO','ADM_ADMIT_STUDENT_SETTINGS','ADM_ADMIT_STUDENT_APPLICATION_NO','ADM_ADMIT_STUDENT_FROM_LIST','ADM_ADMIT_STUDENT_WEIGHTAGE','ADM_COPY_STUDENTS','ADM_REG_NO_PREFIX','ADM_UPDATE_ADMISSION_NUMBER','ADM_ADMISSION_UPDATE_ADMITTED_STUDENT_DETAILS','ADM_ADMITTED_COUNT_STATUS','ADM_RANK_LIST_FINAL_ARRANGEMENT','ADM_SHOW_ALLOTMENT_RANK_LIST','ADM_INDEX_MARK_REPORT','ADM_MANUAL_ADMIT_SETTINGS','ADM_MANUAL_ADMIT_STUDENT','ADM_DATA_MIGRATION_SETTINGS','ADM_BATCH_SETTINGS','ADM_RESERVATION_ADMIT_COUNT','ADM_ALLOTMENT_MERIT_STUDENTS','INITIATE_ALLOTMENT');

-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMIT_PROCEDURE'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMIT_PROCEDURE') AND code in ('ADM_CERTIFICATE_VERIFICATION_APPLICATION_NO','ADM_ADMIT_STUDENT_SETTINGS','ADM_ADMIT_STUDENT_APPLICATION_NO','ADM_ADMIT_STUDENT_FROM_LIST','ADM_ADMIT_STUDENT_WEIGHTAGE','ADM_COPY_STUDENTS','ADM_REG_NO_PREFIX','ADM_UPDATE_ADMISSION_NUMBER','ADM_ADMISSION_UPDATE_ADMITTED_STUDENT_DETAILS','ADM_ADMITTED_COUNT_STATUS','ADM_RANK_LIST_FINAL_ARRANGEMENT','ADM_SHOW_ALLOTMENT_RANK_LIST','ADM_INDEX_MARK_REPORT','ADM_MANUAL_ADMIT_SETTINGS','ADM_MANUAL_ADMIT_STUDENT','ADM_DATA_MIGRATION_SETTINGS','ADM_BATCH_SETTINGS','ADM_RESERVATION_ADMIT_COUNT','ADM_ALLOTMENT_MERIT_STUDENTS','INITIATE_ALLOTMENT');

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMIT_PROCEDURE'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMIT_PROCEDURE') AND code in ('ADM_CERTIFICATE_VERIFICATION_APPLICATION_NO','ADM_ADMIT_STUDENT_SETTINGS','ADM_ADMIT_STUDENT_APPLICATION_NO','ADM_ADMIT_STUDENT_FROM_LIST','ADM_ADMIT_STUDENT_WEIGHTAGE','ADM_COPY_STUDENTS','ADM_REG_NO_PREFIX','ADM_UPDATE_ADMISSION_NUMBER','ADM_ADMISSION_UPDATE_ADMITTED_STUDENT_DETAILS','ADM_ADMITTED_COUNT_STATUS','ADM_RANK_LIST_FINAL_ARRANGEMENT','ADM_SHOW_ALLOTMENT_RANK_LIST','ADM_INDEX_MARK_REPORT','ADM_MANUAL_ADMIT_SETTINGS','ADM_MANUAL_ADMIT_STUDENT','ADM_DATA_MIGRATION_SETTINGS','ADM_BATCH_SETTINGS','ADM_RESERVATION_ADMIT_COUNT','ADM_ALLOTMENT_MERIT_STUDENTS','INITIATE_ALLOTMENT');

-- LMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='ADM_ADMIT_PROCEDURE'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='ADM_ADMIT_PROCEDURE') AND code in ('ADM_CERTIFICATE_VERIFICATION_APPLICATION_NO','ADM_ADMIT_STUDENT_SETTINGS','ADM_ADMIT_STUDENT_APPLICATION_NO','ADM_ADMIT_STUDENT_FROM_LIST','ADM_ADMIT_STUDENT_WEIGHTAGE','ADM_COPY_STUDENTS','ADM_REG_NO_PREFIX','ADM_UPDATE_ADMISSION_NUMBER','ADM_ADMISSION_UPDATE_ADMITTED_STUDENT_DETAILS','ADM_ADMITTED_COUNT_STATUS','ADM_RANK_LIST_FINAL_ARRANGEMENT','ADM_SHOW_ALLOTMENT_RANK_LIST','ADM_INDEX_MARK_REPORT','ADM_MANUAL_ADMIT_SETTINGS','ADM_MANUAL_ADMIT_STUDENT','ADM_DATA_MIGRATION_SETTINGS','ADM_BATCH_SETTINGS','ADM_RESERVATION_ADMIT_COUNT','ADM_ALLOTMENT_MERIT_STUDENTS','INITIATE_ALLOTMENT');

-- ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMIT_PROCEDURE'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMIT_PROCEDURE') AND code in ('ADM_CERTIFICATE_VERIFICATION_APPLICATION_NO','ADM_ADMIT_STUDENT_SETTINGS','ADM_ADMIT_STUDENT_APPLICATION_NO','ADM_ADMIT_STUDENT_FROM_LIST','ADM_ADMIT_STUDENT_WEIGHTAGE','ADM_COPY_STUDENTS','ADM_REG_NO_PREFIX','ADM_UPDATE_ADMISSION_NUMBER','ADM_ADMISSION_UPDATE_ADMITTED_STUDENT_DETAILS','ADM_ADMITTED_COUNT_STATUS','ADM_RANK_LIST_FINAL_ARRANGEMENT','ADM_SHOW_ALLOTMENT_RANK_LIST','ADM_INDEX_MARK_REPORT','ADM_MANUAL_ADMIT_SETTINGS','ADM_MANUAL_ADMIT_STUDENT','ADM_DATA_MIGRATION_SETTINGS','ADM_BATCH_SETTINGS','ADM_RESERVATION_ADMIT_COUNT','ADM_ALLOTMENT_MERIT_STUDENTS','INITIATE_ALLOTMENT');

-- menu items
-- ADM_ADMISSION_INDEX_MARK_RULES
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_INDEX_MARK_RULES'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_INDEX_MARK_RULES') AND code in ("ADM_CREATE_INDEX_MARK_RULE","ADM_STUDENT_INDEX_MARK_REPORT");

-- -----------------------------------------------------------------------------------------
-- ----------------------------------------------------------------------------------------

-- ADM_ADMISSION_EMAIL_AND_SMS
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS') AND code in ('ADM_LOG_REPORT');


-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS') AND code in ('ADM_LOG_REPORT');

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS') AND code in ('ADM_LOG_REPORT');

-- LMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS') AND code in ('ADM_LOG_REPORT');

-- ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMISSION_EMAIL_AND_SMS') AND code in ('ADM_LOG_REPORT');


-- ADM_ADMIT_REGISTER
-- AUTONOMOUS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMIT_REGISTER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='AUTONOMOUS' AND pmg.code='ADM_ADMIT_REGISTER') AND code in ('ADM_ADMISSION_ADMIT_REGISTER');


-- ENTERPRISE
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMIT_REGISTER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE' AND pmg.code='ADM_ADMIT_REGISTER') AND code in ('ADM_ADMISSION_ADMIT_REGISTER');

-- PROFESSIONAL
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMIT_REGISTER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='PROFESSIONAL' AND pmg.code='ADM_ADMIT_REGISTER') AND code in ('ADM_ADMISSION_ADMIT_REGISTER');

-- LMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='LMS' AND pmg.code='ADM_ADMIT_REGISTER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='LMS' AND pmg.code='ADM_ADMIT_REGISTER') AND code in ('ADM_ADMISSION_ADMIT_REGISTER');

-- ENTERPRISE_SCMS
INSERT INTO `pc_product_variant_menu_group_items` (`product_variant_menu_group_id`,`pc_menu_item_id`,`is_active`,`created_by`,`created_date`,`updated_by`,`updated_date`) select (select pvg.id from `pc_product_variant_menu_groups` pvg inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMIT_REGISTER'), id, 1, 1, utc_timestamp(),1,utc_timestamp() from `pc_menu_items` where id not in (select pmi.id from `pc_menu_items` pmi inner join `pc_product_variant_menu_group_items` ppv ON ppv.pc_menu_item_id=pmi.id inner join `pc_product_variant_menu_groups` pvg ON pvg.id=ppv.product_variant_menu_group_id inner join `product_variant` pv on pv.id=pvg.product_variant_id inner join `pc_menu_groups` pmg ON pmg.id=pvg.pc_menu_group_id where pv.code='ENTERPRISE_SCMS' AND pmg.code='ADM_ADMIT_REGISTER') AND code in ('ADM_ADMISSION_ADMIT_REGISTER');
