<?php
/**********************************************************************
    Copyright (C) FrontAccounting, LLC.
	Released under the terms of the GNU General Public License, GPL, 
	as published by the Free Software Foundation, either version 3 
	of the License, or (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
function page_footer($no_menu=false, $is_index=false)
{
	global $path_to_root, $js_lib, $Validate, $Editors, $Ajax, $sql_queries;

	$page_header_args = func_get_args();
	hook_invoke_all('pre_footer', $page_header_args);

	include_once($path_to_root."/themes/".user_theme()."/renderer.php");
	$rend = new renderer();
	$rend->menu_footer($no_menu, $is_index);

	$edits = "editors = ".$Ajax->php2js($Editors).";";
	$Ajax->addScript('editors', $edits);

	echo "<script type='text/javascript'>
		_focus = '" . get_post('_focus') . "';
		_validate = " . $Ajax->php2js($Validate).";
		var $edits
	</script>";

   	add_user_js_data();
	echo "\n<script type=\"text/javascript\"><!--\n";

	foreach($js_lib as $text)
	  	echo $text;
	echo "\n--></script>\n";

	if ($sql_queries) {
		div_start('footer_debug');
		 echo "<div class='note_msg'>$sql_queries</div>";
		div_end();
	}
	if(defined('KVCODES_DEMO')&& !$no_menu){ ?>
	<script type="text/javascript" src="<?php echo $path_to_root; ?>/js/jquery-3.6.0.min.js"></script>
	<script>
			    var s = document.createElement("script");
				
				if (localStorage.getItem("auto_show") === null) {
					
					localStorage.setItem('auto_show', true);
					var auto_show = true;
				} else 
				 	var auto_show = localStorage.getItem("auto_show");

			    s.type = "text/javascript";
			    s.async = true;
			    s.src = "<?php echo $path_to_root; ?>/js/WhatsApp_Widget.js?60614";
			    var options = {
			  "enabled":true,
			  "chatButtonSetting":{
			      "backgroundColor":"#4dc247",
			      "ctaText":"",
			      "borderRadius":"25",
			      "marginLeft":"0",
			      "marginBottom":"20",
			      "marginRight":"30",
			      "position":"left"
			  },
			  "brandSetting":{
			      "brandName":"<?php echo get_company_pref('coy_name'); ?>",
			      "brandSubTitle":"FA modules and Enhancement solution",
			      "brandImg":"https://www.kvcodes.com/wp-content/themes/kvcodes2016/images/kv-favicon.png",
			      "welcomeText":`Hi there!. 
				  We have modules of
1. ExtendedHRM (Payroll and Personnel management)
2. Kvcodes CRM, ( Leads, Customers, opportunity, project, tasks, Estimates, and Proposal)
3. Approval  (FrontAccounting transactions will be hold until the Approver approves it. And multi-level of approval with it).
4. Customer Loan
5. Batch and Expiry date, which is actually a core module, its core customized code. 
6. Consolidated Reports
7. SMS modules, which is actually limited with few SMS gateways, we can extend to cover other sms gateways as well
8. WorkShop module, which is mainly for the vehicle repair shops to perform the jobs and make invoice and collect money from them.
9. FrontAccounting POS Module 
10. KOT (Restaurant management System, which actually helps to handle the, table plan, takeaway, and door delivery bookings along with delivery man login and all.

Themes
1. Vanigam
2. LTE
3. Saai Theme`,
			      "messageText":"Hello,I have a question about Kvcodes ERP",
			      "backgroundColor":"#0a5f54",
			      "ctaText":"Start Chat",
			      "borderRadius":"25",
			      "autoShow":auto_show,
			      "phoneNumber":"+919626960016"
			  }
			};
			    s.onload = function() {
			        CreateWhatsappChatWidget(options);
			    };
			    var x = document.getElementsByTagName("script")[0];
			    x.parentNode.insertBefore(s, x);
				$("body").on("click", ".wa-chat-bubble-close-btn", function() {
					localStorage.setItem("auto_show", false);
				});
				$("body").on("click", "#wa-widget-send-button", function() {
					localStorage.setItem('auto_show', true);
				})
			</script>
			<!--Start of Tawk.to Script-->
            <script type="text/javascript">
            var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
            (function(){
                var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
                s1.async=true;
                s1.src='https://embed.tawk.to/5b1275fd10b99c7b36d49122/default';
                s1.charset='UTF-8';
                s1.setAttribute('crossorigin','*');
                s0.parentNode.insertBefore(s1,s0);
            })();
            </script>
            <!--End of Tawk.to Script-->
			<style>
				 .wa-chat-box-content{
            background: url('<?php echo $path_to_root; ?>/js/wabackground.png');            
        }
		</style>
	<?php }
    echo "</body></html>\n";
}

