ALTER TABLE `tblplan_features` CHANGE `order` `order` INT(4) NOT NULL DEFAULT '999';

UPDATE `tblplan_features` SET `is_highlight` = 0,`order`=999;

-- tblplan_features Queries
UPDATE tblplan_features SET name = 'Manage Leads', description = "You can add your leads one at a time, or import in bulk via the web panel. You can track your conversations and when you're ready, convert them to a client in the tap of a button!", is_highlight = 1, `order` = '5' WHERE codename = 'leads_module';

UPDATE tblplan_features SET name = 'Manage Clients', description = "Add your clients and all of their properties. Add them one at a time, import them from your phone contact list, or import your entire client database in bulk via CSV. Access all your estimates, invoices, post-inspections, payments, contracts and active jobs on a per-client basis. The best client manager you've ever used.", is_highlight = 1, `order` = '10' WHERE codename = 'client_module';

UPDATE tblplan_features SET name = 'Send Estimates', description = "Three types of estimates to choose from. 1) Area & Task Itemized: Perfect for complete unit turns/remodels and servicing properties for property management companies. 2) Quick Bid: Works like a digital contractor pad. The fastest way to send a proposal. 3) Standard: Your typical estimator you've experienced everywhere else. Line by line. Except, we let you bid by the Unit, Sq. Ft. Hour, and more!  Your clients get BEAUTIFUL estimates via web and PDF, and you get notified when a client views, or approves each estimate.", is_highlight = 1, `order` = '15' WHERE codename = 'estimate_module';

UPDATE tblplan_features SET name = 'Send Invoices', description = "Instantly convert an estimate to an invoice in the touch of a button. Send highly comprehensive, attractive, branded invoices with your preferred payment options right there on the same screen. Quickly access client payment history on a per invoice basis. Everything you need to track the financial progress of every job.", is_highlight = 1, `order` = '20' WHERE codename = 'invoice_module';

-- UPDATE tblplan_features SET name = 'Contractor+ Payments', description = "Accept all major credit cards and eChecks 100% FREE! If you bank with Chase, you'll get access to your funds the SAME day! Get setup in minutes with ZERO monthly fees!<br><br>Transaction Fees:  3.1% + $0.30 per transaction for credit cards and 1.5% for ACH/eCheck. ", is_highlight = 1, `order` = '25' WHERE codename = 'wepay_transaction_fees';

UPDATE tblplan_features SET name = 'Homeowner Financing', description = "Your clients can apply for financing through our partners at SunTrust Bank. This helps people increase the number of bids you win by giving people alternative ways to pay for the job.", is_highlight = 1, `order` = '30', `type` = "allow" WHERE codename = 'update_display_financing_offer_to_client';

UPDATE tblplan_features SET name = '3m+ Supply Prices', description = "We've partnered with Home Depot, Lowe's, Ace Hardware and others to provide you with over 3 million supply prices you can access while making an estimate, invoice or shopping list.", is_highlight = 1, `order` = '35' WHERE codename = 'suppliers_supplies_module';

UPDATE tblplan_features SET name = 'Track Tools & Equipment', description = "A streamlined tool and asset management solution with optional low-cost Bluetooth Tool Tags™. Stop your tools from growing legs, hold your team and subcontractors accountable, and reduce the amount of loss, while knowing where everything is supposed to be, and who's supposed to have it.", is_highlight = 1, `order` = '40' WHERE codename = 'tools_module';

UPDATE tblplan_features SET name = 'Schedule & Manage Jobs', description = "Use the drag and drop job schedule to coordinate jobs, projects and tasks across your entire team. Assign team members to individual jobs and tasks, and visualize on one screen everything you have going on.  Plus, let each of your team members sync their Job Schedule with their local calendar, with support for iCal, Google Calendar and Outlook.", is_highlight = 1, `order` = '45' WHERE codename = 'job_schedule_module';

UPDATE tblplan_features SET name = 'Work Orders', description = "", is_highlight = 1, `order` = '50' WHERE codename = 'work_order_module';

UPDATE tblplan_features SET name = 'Send Post-Inspections', description = "Post-Inspection reports allow you to review the work your crews have completed in the field, and optionally share the before and after results with your clients.", is_highlight = 1, `order` = '55' WHERE codename = 'post_inspection_module';

UPDATE tblplan_features SET name = 'Manage Team / Employees', description = "Add an unlimited number of team members, choose the level of access you'd like each of your team members to have. Only want to share access to the Time Clock & Mileage Log? You can do that! Don't want them to see your clients or invoices or payments? No problem. You get to configure the access permissions on a per-employee (or team member) basis.", is_highlight = 1, `order` = '60', `type` = 'allow' WHERE codename = 'update_team_member_info_preference';

UPDATE tblplan_features SET name = 'Team & Group Chats', description = "When you add a job to the schedule, a Group Chat for that job site will be automatically created, and all the team members assigned to that job will be added to the group. This is helpful so everyone internally always knows what's going on with the job and stays on the same page at all times.", is_highlight = 1, `order` = '65' WHERE codename = 'team_chat_module';

UPDATE tblplan_features SET name = 'Track Hours', description = "You can have your individual employees clock in and out against any task or job. You (or your managers) can optionally clock in and out on behalf of individual team members and even edit their past entry's. This will make your bookkeepers life a lot easier, while also giving you the ability to generate reports to know how efficient your employees are.", is_highlight = 1, `order` = '70' WHERE codename = 'timelog_module';

UPDATE tblplan_features SET name = 'Manage Tasks / To Dos', description = "", is_highlight = 1, `order` = '75' WHERE codename = 'task_module';

UPDATE tblplan_features SET name = 'Expense Tracking', description = "", is_highlight = 1, `order` = '80' WHERE codename = 'expense_module';

UPDATE tblplan_features SET name = 'Generate Materials Shopping Lists', description = "", is_highlight = 1, `order` = '85' WHERE codename = 'shoppinglist_module';

UPDATE tblplan_features SET name = 'Custom Branding', description = "You choose your primary color for your company and we will automatically brand your client facing reports with your own brand colors, to match your business logo.", is_highlight = 1, `order` = '90' WHERE codename = 'custom_branding_module';

UPDATE tblplan_features SET name = 'More Control Over Settings', description = "You'll get access to change all kinds of settings related to Branding, Estimates, Invoices, Post-Inspections, Payments and more. ", is_highlight = 1, `order` = '95', `type` = 'allow' WHERE codename = 'estimate_auto_convert_to_invoice';

UPDATE tblplan_features SET name = 'Custom Send-From Email', description = "You can configure/link your email address to Contractor+ so that all estimates, invoices and post inspections come from YOU at YOUR domain, not @contractorplus.app.", is_highlight = 1, `order` = '100' WHERE codename = 'custom_smtp';

UPDATE tblplan_features SET name = 'Custom Contracts & eSignatures', description = "Automatically attach a client contract to any estimate or invoice and require your client sign the agreement before scheduling the work.<br><br>Our lawyer has drafted a default client contract that is valid and legally binding in most places, and, you can customize your agreement for your specific terms and how you define your client relationships.  Either way - configure it once, and never write another client contract again.", is_highlight = 1, `order` = '105' WHERE codename = 'term_contracts_module';

UPDATE tblplan_features SET name = 'Automated Client Referral Program', description = "Built-in automation settings that let you promote your referral program to your clients. You can specify how much you want to pay for client referrals, and Contractor+ will automatically promote your referral incentive to your clients. You can specify WHEN you want your clients to learn about your referral program, and we'll handle the rest.", is_highlight = 1, `order` = '110', `type` = 'allow' WHERE codename = 'client_referral';

UPDATE tblplan_features SET name = 'Automatically Collect Client Reviews', description = "All you have to do is enter your links for Google My Business and/or Yelp, and configure when you'd like to ask your clients for reviews, the software will handle the rest for you! Now you can grow your client testimonials and increase your online visibility on auto-pilot!", is_highlight = 1, `order` = '115', `type` = 'allow' WHERE codename = 'business_review';

UPDATE tblplan_features SET name = 'Integrate With QuickBooks Online', description = "Sync your clients, estimates, invoices, payments, expenses and products & services with QuickBooks Online.", is_highlight = 1, `order` = '120' WHERE codename = 'quick_book_sync';

UPDATE tblplan_features SET name = 'Custom Reports', description = "With over 15+ built-in reports, you'll know exactly how your business is doing.", is_highlight = 1, `order` = '125' WHERE codename = 'reports_module';

UPDATE tblplan_features SET name = 'Photos & Attachments', description = "Give your quotes the edge over the competition with photos of your Line Items. Limited to 20 Photos & Documents each.", is_highlight = 1, `order` = '130' WHERE codename = 'no_of_estimate_images_allowed';

UPDATE tblplan_features SET name = 'Use Your Own Payment Provider(s)', description = "", is_highlight = 1, `order` = '135' WHERE codename = 'allowed_other_payment_gateways';

UPDATE tblplan_features SET name = 'Integrate With CompanyCam', description = "Sync all your photos for every job, with the relative client(s) and tags at CompanyCam, keeping your project photos updated at all times where you need it most.", is_highlight = 1, `order` = '140', `type` = 'allow' WHERE codename = 'companycam_sync';

UPDATE tblplan_features SET name = 'Track Mileage', description = "You can track the mileage of any team member, and see their GPS route data at any time. All without having to purchase any additional external hardware or devices. This makes mileage reimbursement a breeze for your accountant.", is_highlight = 1, `order` = '145' WHERE codename = 'mileage_log_module';

UPDATE tblplan_features SET name = 'Custom Fields', description = "Every business is different. Track whatever additional information is important to you-like entry codes, PO Number, Tenant Name, Tenant Number etc.", is_highlight = 1, `order` = '150', `type` = 'allow' WHERE codename = 'custom_field';

UPDATE tblplan_features SET name = 'Change Orders', description = "A change order is work that is added to or deleted from the original scope of work of a contract. Depending on the magnitude of the change, it may or may not alter the original contract amount and/or completion date. You can utilize this feature to make revisions to a previously agreed estimate, add an addendum to the existing agreement stating the changes in scope and cost, and updating the invoice balance to reflect the changes.", is_highlight = 1, `order` = '155', `type` = 'allow' WHERE codename = 'allowed_change_order';




-- tblplan_features_value Queries
update `tblplan_features_value` set value = 0 where plans_id = 13 AND plans_features_id = (select id from tblplan_features where codename="reports_module");
update `tblplan_features_value` set value = 1 where plans_id in (14, 15) AND plans_features_id = (select id from tblplan_features where codename="reports_module");

update `tblplan_features_value` set value = 0 where plans_id = 13 AND plans_features_id = (select id from tblplan_features where codename="post_inspection_module");
update `tblplan_features_value` set value = 1 where plans_id in (14, 15) AND plans_features_id = (select id from tblplan_features where codename="post_inspection_module");

update `tblplan_features_value` set value = 0, other_data = '{\"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:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"0\"}' where plans_id = 13 AND plans_features_id = (select id from tblplan_features where codename="no_of_estimate_images_allowed");
update `tblplan_features_value` set value = 20, other_data = '{\"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\":\"UPGRADE\",\"link\":\"https:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"20\"}' where plans_id = 14 AND plans_features_id = (select id from tblplan_features where codename="no_of_estimate_images_allowed");
update `tblplan_features_value` set value = 50, other_data = '{\"outside_message\":\"You have limit of 50 photos on your plan. If you want to add more please upgrade.\",\"inside_message\":\"You have limit of 50 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:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"50\"}' where plans_id = 15 AND plans_features_id = (select id from tblplan_features where codename="no_of_estimate_images_allowed");

update `tblplan_features_value` set value = 0, other_data = '{\"outside_message\":\"If you want to add documents please upgrade to PRO.\",\"inside_message\":\"If you want to add documents please upgrade to PRO.\",\"tag_color\":\"#eb0e0e\",\"tag_title\":\"PRO\",\"link\":\"https:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"0\"}' where plans_id = 13 AND plans_features_id = (select id from tblplan_features where codename="no_of_estimate_files_allowed");
update `tblplan_features_value` set value = 20, other_data = '{\"outside_message\":\"You have limit of 20 documents on your plan. If you want to add more please upgrade.\",\"inside_message\":\"You have limit of 20 documents on your plan, we have selected first {!current_count!} documents. If you want to add more please upgrade.\",\"tag_color\":\"#eb0e0e\",\"tag_title\":\"UPGRADE\",\"link\":\"https:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"20\"}' where plans_id = 14 AND plans_features_id = (select id from tblplan_features where codename="no_of_estimate_files_allowed");
update `tblplan_features_value` set value = 50, other_data = '{\"outside_message\":\"You have limit of 50 files on your plan. If you want to add more please upgrade.\",\"inside_message\":\"You have limit of 50 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:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"50\"}' where plans_id = 15 AND plans_features_id = (select id from tblplan_features where codename="no_of_estimate_files_allowed");

update `tblplan_features_value` set value = 0, other_data = '{\"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:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"0\"}' where plans_id = 13 AND plans_features_id = (select id from tblplan_features where codename="no_of_invoice_images_allowed");
update `tblplan_features_value` set value = 20, other_data = '{\"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\":\"UPGRADE\",\"link\":\"https:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"20\"}' where plans_id = 14 AND plans_features_id = (select id from tblplan_features where codename="no_of_invoice_images_allowed");
update `tblplan_features_value` set value = 50, other_data = '{\"outside_message\":\"You have limit of 50 photos on your plan. If you want to add more please upgrade.\",\"inside_message\":\"You have limit of 50 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:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"50\"}' where plans_id = 15 AND plans_features_id = (select id from tblplan_features where codename="no_of_invoice_images_allowed");

update `tblplan_features_value` set value = 0, other_data = '{\"outside_message\":\"If you want to add documents please upgrade to PRO.\",\"inside_message\":\"If you want to add documents please upgrade to PRO.\",\"tag_color\":\"#eb0e0e\",\"tag_title\":\"PRO\",\"link\":\"https:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"0\"}' where plans_id = 13 AND plans_features_id = (select id from tblplan_features where codename="no_of_invoice_files_allowed");
update `tblplan_features_value` set value = 20, other_data = '{\"outside_message\":\"You have limit of 20 documents on your plan. If you want to add more please upgrade.\",\"inside_message\":\"You have limit of 20 documents on your plan, we have selected first {!current_count!} documents. If you want to add more please upgrade.\",\"tag_color\":\"#eb0e0e\",\"tag_title\":\"UPGRADE\",\"link\":\"https:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"20\"}' where plans_id = 14 AND plans_features_id = (select id from tblplan_features where codename="no_of_invoice_files_allowed");
update `tblplan_features_value` set value = 50, other_data = '{\"outside_message\":\"You have limit of 50 files on your plan. If you want to add more please upgrade.\",\"inside_message\":\"You have limit of 50 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:\\/\\/dev.my.contractorplus.app\\/\",\"count\":\"50\"}' where plans_id = 15 AND plans_features_id = (select id from tblplan_features where codename="no_of_invoice_files_allowed");


update `tblplan_features_value` set value = 0, other_data = '{\"outside_message\":\" Mileage Logs is an ultimate feature, in order to use it Upgrade to ULTIMATE\",\"inside_message\":\"Mileage Logs is an ultimate feature, in order to use it Upgrade to ULTIMATE\",\"tag_color\":\"#eb0e0e\",\"tag_title\":\"UPGRADE\",\"link\":\"https://my.contractorplus.app/\",\"count\":\"0\"}' where plans_id = 13 AND plans_features_id = (select id from tblplan_features where codename="mileage_log_module");
update `tblplan_features_value` set value = 0, other_data = '{\"outside_message\":\" Mileage Logs is an ultimate feature, in order to use it Upgrade to ULTIMATE\",\"inside_message\":\"Mileage Logs is an ultimate feature, in order to use it Upgrade to ULTIMATE\",\"tag_color\":\"#eb0e0e\",\"tag_title\":\"UPGRADE\",\"link\":\"https://my.contractorplus.app/\",\"count\":\"0\"}' where plans_id = 14 AND plans_features_id = (select id from tblplan_features where codename="mileage_log_module");
update `tblplan_features_value` set value = 1 where plans_id = 15 AND plans_features_id = (select id from tblplan_features where codename="mileage_log_module");

update `tblplan_features_value` set value = 0 where plans_id = 13 AND plans_features_id = (select id from tblplan_features where codename="team_chat_module");
update `tblplan_features_value` set value = 1 where plans_id in (14, 15) AND plans_features_id = (select id from tblplan_features where codename="team_chat_module");

-- 17 Jan 2023

UPDATE tblplan_features SET name = 'Contractor+ Payments', description = "Accept all major credit cards and eChecks 100% FREE! If you bank with Chase, you'll get access to your funds the SAME day! Get setup in minutes with ZERO monthly fees!", is_highlight = 1, `order` = '25' WHERE codename = 'wepay_transaction_fees';

-- <br><br>Transaction Fees:  3.1% + $0.30 per transaction for credit cards and 1.5% for ACH/eCheck. 