CREATE TABLE tbljobvisit_image_files (
  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  job_id bigint(20) unsigned DEFAULT NULL,
  visit_id bigint(20) unsigned DEFAULT NULL,
  file_name varchar(191) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  title varchar(255) DEFAULT NULL,
  description longtext DEFAULT NULL,
  filetype varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  visible_to_customer bigint(20) unsigned NOT NULL DEFAULT 0,
  attachment_key varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  external varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  external_link text CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  thumbnail_link text CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'For external usage',
  original_file_name varchar(191) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  dateadded datetime NOT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE tbljobvisit_files (
  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  job_id bigint(20) unsigned DEFAULT NULL,
  visit_id bigint(20) unsigned DEFAULT NULL,
  file_name varchar(191) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  title varchar(255) DEFAULT NULL,
  description longtext DEFAULT NULL,
  filetype varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  visible_to_customer bigint(20) unsigned NOT NULL DEFAULT 0,
  attachment_key varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  external varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  external_link text CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  thumbnail_link text CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'For external usage',
  original_file_name varchar(191) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  dateadded datetime NOT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;


INSERT INTO tblapad_options (type, name, value, autoload)
VALUES('job_visit_files','allowed_file_extention','{"image":["jpeg","jpg","png","gif"],"video":["mp4","mpeg","webp", "avi"],"audio":[],"document":["pdf","doc","docx"]}',1),
      ('job_visit_files','allowed_file_size','5120',1),
      ('job_visit_image_files','allowed_file_extention','{"image": ["jpeg", "jpg", "png", "gif"]}',1),
      ('job_visit_image_files','allowed_file_size','5120',1);


INSERT INTO tblplan_features (name, codename, description,type,added_on) 
VALUES('No of Visit Images', 'no_of_visit_images_allowed', 'No of Visit images allowed in plan.','restrict','2022-03-29 12:12:14');

SET @no_of_visit_images_allowed = LAST_INSERT_ID();

INSERT INTO tblplan_features_value (plans_id, plans_features_id, value,other_data,added_on) 
VALUES(9, @no_of_visit_images_allowed, 0,'{"outside_message":"If you want to add photos please upgrade to Pro.","inside_message":"If you want to add photos please upgrade to Pro.","tag_color":"#eb0e0e","tag_title":"PRO","link":"https:\/\/my.contractorplus.app\/","count":"0"}','2022-03-29 12:12:14'),
(10, @no_of_visit_images_allowed, 5,'{"outside_message":"You have limit of 5 photos on your plan. If you want to add more please upgrade.","inside_message":"You have limit of 5 photos on your plan, we have selected first {!current_count!} photos. If you want to add more please upgrade.","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https:\/\/my.contractorplus.app\/","count":"5"}','2022-03-29 12:12:14'),
(11, @no_of_visit_images_allowed, 10,'{"outside_message":"You have limit of 10 photos on your plan. If you want to add more please upgrade.","inside_message":"You have limit of 10 photos on your plan, we have selected first {!current_count!} photos. If you want to add more please upgrade.","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https:\/\/my.contractorplus.app\/","count":"10"}','2022-03-29 12:12:14'),
(12, @no_of_visit_images_allowed, 20,'{"outside_message":"You have limit of 20 photos on your plan. If you want to add more please upgrade.","inside_message":"You have limit of 20 photos on your plan, we have selected first {!current_count!} photos. If you want to add more please upgrade.","tag_color":"#eb0e0e","tag_title":"","link":"https:\/\/my.contractorplus.app\/","count":"20"}','2022-03-29 12:12:14'); 


INSERT INTO tblplan_features (name, codename, description,type,added_on) 
VALUES('No of Visit Files', 'no_of_visit_files_allowed', 'No of Visit files allowed in plan.','restrict','2022-03-29 12:12:14');

SET @no_of_visit_files_allowed = LAST_INSERT_ID();
INSERT INTO tblplan_features_value (plans_id, plans_features_id, value,other_data,added_on) 
VALUES(9, @no_of_visit_files_allowed, 0,'{ "outside_message":"If you want to add files please upgrade to Pro.", "inside_message":"If you want to add files please upgrade to Pro.","tag_color":"#eb0e0e","tag_title":"PRO","link":"https:\/\/my.contractorplus.app\/","count":"0"}','2022-03-29 12:12:14'),
(10, @no_of_visit_files_allowed, 5,'{ "outside_message":"You have limit of 5 files on your plan. If you want to add more please upgrade.", "inside_message":"You have limit of 5 files on your plan, we have selected first {!current_count!} files. If you want to add more please upgrade.", "tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https:\/\/my.contractorplus.app\/","count":"5"}','2022-03-29 12:12:14'),
(11, @no_of_visit_files_allowed, 10,'{ "outside_message":"You have limit of 10 files on your plan. If you want to add more please upgrade.", "inside_message":"You have limit of 10 photos on your plan, we have selected first {!current_count!} files. If you want to add more please upgrade.", "tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https:\/\/my.contractorplus.app\/","count":"10"}','2022-03-29 12:12:14'),
(12, @no_of_visit_files_allowed, 20,'{ "outside_message":"You have limit of 20 files on your plan. If you want to add more please upgrade.", "inside_message":"You have limit of 20 files on your plan, we have selected first {!current_count!} files. If you want to add more please upgrade.", "tag_color":"#eb0e0e","tag_title":"","link":"https:\/\/my.contractorplus.app\/","count":"20"}','2022-03-29 12:12:14'); 

INSERT INTO tblplan_features (name, codename, description,type,added_on) 
VALUES('No of Job Images', 'no_of_job_images_allowed', 'No of Job images allowed in plan.','restrict','2022-03-29 12:12:14');

SET @no_of_job_images_allowed = LAST_INSERT_ID();

INSERT INTO tblplan_features_value (plans_id, plans_features_id, value,other_data,added_on) 
VALUES(9, @no_of_job_images_allowed, 0,'{"outside_message":"You can add any no of photos.","inside_message":"If you want to add photos please upgrade to Pro.","tag_color":"#eb0e0e","tag_title":"PRO","link":"https:\/\/my.contractorplus.app\/","count":"0","no_limit":true}','2022-03-29 12:12:14'),
(10, @no_of_job_images_allowed, 5,'{"outside_message":"You can add any no of photos.","inside_message":"You have limit of 5 photos on your plan, we have selected first {!current_count!} photos. If you want to add more please upgrade.","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https:\/\/my.contractorplus.app\/","count":"0","no_limit":true}','2022-03-29 12:12:14'),
(11, @no_of_job_images_allowed, 10,'{"outside_message":"You can add any no of photos.","inside_message":"You have limit of 10 photos on your plan, we have selected first {!current_count!} photos. If you want to add more please upgrade.","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https:\/\/my.contractorplus.app\/","count":"0","no_limit":true}','2022-03-29 12:12:14'),
(12, @no_of_job_images_allowed, 20,'{"outside_message":"You can add any no of photos.","inside_message":"You have limit of 20 photos on your plan, we have selected first {!current_count!} photos. If you want to add more please upgrade.","tag_color":"#eb0e0e","tag_title":"","link":"https:\/\/my.contractorplus.app\/","count":"0","no_limit":true}','2022-03-29 12:12:14'); 

INSERT INTO tblplan_features (name, codename, description,type,added_on) 
VALUES('No of Job Files', 'no_of_job_files_allowed', 'No of Job files allowed in plan.','restrict','2022-03-29 12:12:14');

SET @no_of_job_files_allowed = LAST_INSERT_ID();
INSERT INTO tblplan_features_value (plans_id, plans_features_id, value,other_data,added_on) 
VALUES(9, @no_of_job_files_allowed, 0,'{ "outside_message":"You can add any no of files", "inside_message":"If you want to add files please upgrade to Pro.","tag_color":"#eb0e0e","tag_title":"PRO","link":"https:\/\/my.contractorplus.app\/","count":"0","no_limit":true}','2022-03-29 12:12:14'),
(10, @no_of_job_files_allowed, 5,'{ "outside_message":"You can add any no of files", "inside_message":"You have limit of 5 files on your plan, we have selected first {!current_count!} files. If you want to add more please upgrade.", "tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https:\/\/my.contractorplus.app\/","count":"0","no_limit":true}','2022-03-29 12:12:14'),
(11, @no_of_job_files_allowed, 10,'{ "outside_message":"You can add any no of files", "inside_message":"You have limit of 10 photos on your plan, we have selected first {!current_count!} files. If you want to add more please upgrade.", "tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https:\/\/my.contractorplus.app\/","count":"0","no_limit":true}','2022-03-29 12:12:14'),
(12, @no_of_job_files_allowed, 20,'{ "outside_message":"You can add any no of files", "inside_message":"You have limit of 20 files on your plan, we have selected first {!current_count!} files. If you want to add more please upgrade.", "tag_color":"#eb0e0e","tag_title":"","link":"https:\/\/my.contractorplus.app\/","count":"0","no_limit":true}','2022-03-29 12:12:14'); 
