<?php
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);

session_start();

if (isset($_SESSION["client_id"])){
}else{
	$_SESSION["client_id"] = 1;
	
	//get sales_id if logged in
	
	
}

?>
<!doctype html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="theme-color" content="#000000">
    <title>phoenixsoftware.co.nz. Shop POS solutions.</title>
    <meta name="description" content="phoenixsoftware.co.nz. Shop POS solutions.">
    <link rel="icon" type="image/png" href="../images/logo.png" sizes="32x32">
    <link rel="apple-touch-icon" sizes="180x180" href="../images/logo.png">


	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <link rel="manifest" href="../manifest.json">

</head>

<body class=""  onload="javascript: view_mode()">
    <link rel="stylesheet" href="../assets/css/style.min.css">
	<link rel="stylesheet" href="../css/jquery-ui.min.css">
	


	<style>
	.chip {
  display: inline-block;
  padding: 0 25px;
  height: 50px;
  font-size: 16px;
  line-height: 50px;
  border-radius: 25px;
  background-color: #f1f1f1;
}

.chip img {
  float: left;
  margin: 0 10px 0 -25px;
  height: 50px;
  width: 50px;
  border-radius: 50%;
}

</style>

	
	
    <!-- loader -->

    <!-- * loader -->

    <!-- App Header -->
    <div class="appHeader bg-primary scrolled is-active">
        <div class="left">
            <a href="#" class="headerButton" data-toggle="modal" data-target="#sidebarPanel">
                <ion-icon name="menu-outline"></ion-icon>
            </a>
        </div>

        <div  class="center">
		
		<?php
		
		//get 
		
		
		?>
	
	PhoenixCRM - Settings / Admin Screen


		</div>
    </div>
    <!-- * App Header -->

    <!-- Search Component -->

    <!-- * Search Component -->

    <!-- App Capsule -->
    <div id="appCapsule">
<center>

<?php

		$phxcrmclient_id = $_COOKIE['phxcrmclient_id'];
		

		include("../php/configi.php");
		
		$sqlstaff = "SELECT * FROM phx_userid where idphx_userid = " . $phxcrmclient_id;
		
//		echo $sqlstaff;
					

		$resultstaff = $conn->query($sqlstaff);

		if ($resultstaff->num_rows > 0) {
			// output data of each row
			while($rowcompany = $resultstaff->fetch_assoc()) {

				$uid_company 			= $rowcompany["idphx_userid"];
				$company_name 			= $rowcompany["comp_name"];
				$contact_name 			= $rowcompany["contact_name"];
				$comp_phys_addr1 		= $rowcompany["comp_phys_addr1"];
				$comp_phys_addr2 		= $rowcompany["comp_phys_addr2"];
				$comp_phys_addr3 		= $rowcompany["comp_phys_addr3"];
				$comp_phys_addr4		= $rowcompany["comp_phys_addr4"];
				$comp_phys_addr5 		= $rowcompany["comp_phys_addr5"];
			//	$company_logo	 		= $rowcompany["company_logo"];
				$comp_ird_no	 		= $rowcompany["comp_ird_no"];
				$comp_phone	 			= $rowcompany["comp_phone"];
				$company_email	 		= $rowcompany["email"];	
		//		$hssigned_id	 		= $rowcompany["hssigned_id"];	
		//		$handsplan		 		= $rowcompany["handsplan"];					
		//		$hssigned_date		 	= strtotime($rowcompany["hssigned_date"]);
		
				$comp_country				= $rowcompany["comp_country"];
				$comp_gst_rate			= $rowcompany["comp_gst_rate"];
				$comp_gst_registered	= $rowcompany["comp_gst_registered"];
				$comp_website_url		= $rowcompany["comp_website_url"];
				$comp_type2				= $rowcompany["comp_type2"];
				$comp_stock_type		= $rowcompany["comp_stock_type"];
				$comp_eftpos_type		= $rowcompany["comp_eftpos_type"];
				$short_userid			= $rowcompany["short_userid"];
				$comp_receipt_type		= $rowcompany["comp_receipt_type"];
				$comp_screen_size		= $rowcompany["comp_screen_size"];				
				
				$comp_pos_layout		= $rowcompany["comp_pos_layout"];		


			}
			
		}
				



?>




    <div class="row" style="height: 900px;" >
	


        <div style="border: solid 1px; border-color: #6c757d" class="col-md-6">
                 <div style="" class="section mt-6 mb-6">
				 
				 
				 
				           <div class="tab-pane fade show active" id="pilled" role="tabpanel">

                <div style="margin-top: 10px" class="section full mt-1">



                    <div class="wide-block pt-2 pb-2">

                        <ul class="nav nav-tabs lined" role="tablist">
                            <li class="nav-item">
                                <a onclick="" id="tabcurrentsale" class="nav-link active" data-toggle="tab" href="#home" role="tab">
                                    My Company Details
                                </a>
											<button onclick="javascript: edit_mode()" id="buteditcompany" style="display: none" type="button" class="btn btn-primary" >Edit Company</button>
																						<button onclick="javascript: view_mode()" id="butviewcompany" style="display: none" type="button" class="btn btn-secondary" >View Company</button>
                            </li>



                        </ul>
			
                        <div class="tab-content mt-2">
                            <div class="tab-pane fade show active" id="home" role="tabpanel">
                                
                <div style="text-align: left; margin-top: 10px" class="section full mt-1">
                    
                  


			
		<div style="" class="" id="divcompdetails">
		


												<!-- required [php action request] -->
												<input type="hidden" id="uid_company" name="uid_company" value="<?php echo $phxcrmclient_id?>" />
												<input type="hidden" name="action" value="contact_send" />
													
												<div class="row">
													<div class="form-group">
																											<div class="col-md-9 col-sm-9">
															<label>Company Name</label><br>
															<input class="form-control" readonly  type="text"   value="<?php echo htmlspecialchars($company_name)?>">
													

													</div>
	
	
															<div class="col-md-9 col-sm-9">
																<label style="">Company Email</label><br>
																<input class="form-control" readonly type="text"  value="<?php echo htmlspecialchars($company_email) ?>"  onchange="javascript: update_field_company('company_email', 'input', this.value)">
															</div>
																														<div class="col-md-9 col-sm-9">
																<label style="">Company Short Userid</label><br>
																<input readonly class="form-control" type="text"  value="<?php echo htmlspecialchars($short_userid) ?>"  onchange="javascript: update_field_company('short_userid', 'input', this.value)">
															</div>
																																									<div class="col-md-9 col-sm-9">
															<label>Main Contact Name</label><br>
															<input id="contact_name" readonly  class="form-control"  type="text" value="<?php echo htmlspecialchars($contact_name)?>" onchange="javascript: update_field_company('contact_name', 'input', this.value)" >
													

													</div>
															<div class="col-md-9 col-sm-9">
																<label style="">Company Phone</label><br>
															<input  id="comp_phone"  readonly class="form-control" type="text"  value="<?php echo htmlspecialchars($comp_phone) ?>"  onchange="javascript: update_field_company('comp_phone', 'input', this.value)" >
															</div>
															<div class="col-md-9 col-sm-9">
																<label style="">Country</label><br>
												<?

	
include("../php/configi.php");

$querycy="SELECT * FROM 1_countries order by country_order, country_name";
//echo $querycy;
$resultcy=mysqli_query($conn, $querycy);

?>
		<select  readonly disabled  class="form-control" id="comp_country" name="comp_country" style="width: 100%;"  onchange="javascript: update_field_company('comp_country', 'input', this.options[this.selectedIndex].value, <?php echo $uid_company;?>)"  >

<?php

 while($rowcy=mysqli_fetch_array($resultcy)) {

?>
		<option 
		<?php if ($rowcy['country_name'] == $comp_country){echo " selected ";} ?> 
		value="<? echo $rowcy["country_name"]; ?>"><? echo $rowcy["country_name"]; ?></option>

		<?


}


	 
?>
</select>


					<label style="">Company Website</label><br>
						<input readonly class="form-control" id="comp_website_url" type="text"  value="<?php echo htmlspecialchars($comp_website_url) ?>"  	onchange="javascript: update_field_company('comp_website_url', 'input', this.value)" >


		</div>
						
															<div class="col-md-9 col-sm-9">
																<label style="">Company Address</label><br>
																<input id="comp_phys_addr1" readonly class="form-control" type="text"  value="<?php echo htmlspecialchars($comp_phys_addr1) ?>"  	onchange="javascript: update_field_company('comp_phys_addr1', 'input', this.value)" >
																<input id="comp_phys_addr2" readonly class="form-control" type="text"   value="<?php echo htmlspecialchars($comp_phys_addr2) ?>"  onchange="javascript: update_field_company('comp_phys_addr2', 'input', this.value)" >
																<input id="comp_phys_addr3" readonly class="form-control" type="text" value="<?php echo htmlspecialchars($comp_phys_addr3) ?>"  	onchange="javascript: update_field_company('comp_phys_addr3', 'input', this.value)" >
																<input id="comp_phys_addr4" readonly class="form-control" type="text"  value="<?php echo htmlspecialchars($comp_phys_addr4) ?>" 	onchange="javascript: update_field_company('comp_phys_addr4', 'input', this.value)" >
																<input id="comp_phys_addr5" readonly class="form-control" type="text"   value="<?php echo htmlspecialchars($comp_phys_addr5) ?>"  onchange="javascript: update_field_company('comp_phys_addr5', 'input', this.value)" >
																
								<label style="">Sales Tax / GST Registered ?</label><br>
												
												<?php 
												
												if ($comp_gst_registered == 1){
													$reg_checked = " checked ";
												}else{
													$reg_checked = " ";
													
												}
																
																?>
                <div class="custom-control custom-switch">
                    <input readonly disabled <?php echo $reg_checked ?> type="checkbox" class="custom-control-input" id="comp_gst_registered" 	onchange="javascript: update_field_company('comp_gst_registered', 'inputcheck', this.checked)">
                    <label class="custom-control-label" for="comp_gst_registered"></label>
                </div>

																
				<label style="">Sales Tax / GST Number</label><br>
				<input readonly class="form-control" id="comp_ird_no" type="text"  value="<?php echo htmlspecialchars($comp_ird_no) ?>"  	onchange="javascript: update_field_company('comp_ird_no', 'input', this.value)" >
																																									<label style="">Sales Tax / GST Rate %</label><br>
	<select disabled readonly class="form-control custom-select" id="comp_gst_rate"  onchange="javascript: update_field_company('comp_gst_rate', 'inputnum', this.options[this.selectedIndex].value, <?php echo $uid_company;?>)" >
	
	
	<?php
		 include '../php/configi.php';

 
		$queryst="SELECT * from 1_tax_rates order by tr_value";

		echo $querytable;
		$resultst=mysqli_query($conn, $queryst);


		while($rowst=mysqli_fetch_array($resultst)) { 

			$tr_uid		 			= $rowst['tr_uid'];
			$tr_value	 			= $rowst['tr_value'];
			
			if ($comp_gst_rate == $tr_value){
			
			 echo "<option selected value='".htmlspecialchars($tr_value)."'>".htmlspecialchars($tr_value)."</option>";
			
			}else{

			 echo "<option value='".htmlspecialchars($tr_value)."'>".htmlspecialchars($tr_value)."</option>";
				
			}
		}
			
			?>
	
                            </select>
																
															</div>

														</div>
													</div>

					







        </div>


        <!-- Discount Action Sheet -->

        <!-- * Discount Action Sheet -->

        <div class="section mt-2 mb-2" id="divcarttotals">

        </div>
                  
                </div>
                            </div>


                        </div>

                    </div>
                </div> </div>
				 
				 




        </div>
        </div>

        <div style="border: solid 1px; border-color: #6c757d; margin-top: 0px;padding-top: 0px;" class="col-md-6">

 <div style="margin-top: 0px; padding-top: 0px;"  class="section mt-6 mb-6">
                 

				           <div class="tab-pane fade show active" id="pilled" role="tabpanel">

                <div class="section full mt-1">


                    <div class="wide-block pt-2 pb-2">

                        <ul class="nav nav-tabs lined" role="tablist">
                            <li class="nav-item">
                                <a id="tabcurrentsale" class="nav-link active" data-toggle="tab" href="#quickpicks" role="tab">
                                    My Settings
                                </a>
                            </li>

                        </ul>
                        <div style="text-align: left" class="tab-content mt-2">
						               

                            <div class="tab-pane fade show active" id="quickpicks" role="tabpanel">
                                
                <div class="section full mt-1">
                    
             
                    
                    <div class="wide-block pt-2 pb-2">
					
					 <label class="label" for="table">Company Type:</label>
	<select disabled readonly class="form-control custom-select" id="comp_type2"   onchange="javascript: update_field_company('comp_type2', 'input', this.options[this.selectedIndex].value, <?php echo $uid_company;?>)"  >
	
	
	<?php
		 include '../php/configi.php';

 
		$querytable="SELECT * from 1_comp_types order by ct_name";

	//	echo $querytable;
		$resulttable=mysqli_query($conn, $querytable);


		while($rowtable=mysqli_fetch_array($resulttable)) { 

			$ct_uid		 			= $rowtable['ct_uid'];
			$ct_name	 			= $rowtable['ct_name'];
			
			if ($comp_type2 == $ct_name){
			
			 echo "<option selected value='".$ct_name."'>".htmlspecialchars($ct_name)."</option>";
			
			}else{

			 echo "<option value='".$ct_name."'>".htmlspecialchars($ct_name)."</option>";
				
			}
		}
			
			?>
	
                            </select>
							
							
												
					 <label class="label" for="table">Stock Management:</label>
	<select disabled readonly class="form-control custom-select" id="comp_stock_type"   onchange="javascript: update_field_company('comp_stock_type', 'input', this.options[this.selectedIndex].value, <?php echo $uid_company;?>)" >
	
	
	<?php
		 include '../php/configi.php';

 
		$queryst="SELECT * from 1_stock_types order by st_name";

//		echo $querytable;
		$resultst=mysqli_query($conn, $queryst);


		while($rowst=mysqli_fetch_array($resultst)) { 

			$st_uid		 			= $rowst['st_uid'];
			$st_name	 			= $rowst['st_name'];
			
			if ($comp_stock_type == $st_uid){
			
			 echo "<option selected value='".htmlspecialchars($st_name)."'>".htmlspecialchars($st_name)."</option>";
			
			}else{

			 echo "<option value='".htmlspecialchars($st_name)."'>".htmlspecialchars($st_name)."</option>";
				
			}
		}
			
			?>
	
                            </select>
							
							
							
																			
					 <label class="label" for="table">Eftpos Integration:</label>
	<select disabled readonly class="form-control custom-select" id="comp_eftpos_type"  onchange="javascript: update_field_company('comp_eftpos_type', 'input', this.options[this.selectedIndex].value, <?php echo $uid_company;?>)" >
	
	
	<?php
		 include '../php/configi.php';

 
		$queryst="SELECT * from 1_eftpos_types order by et_name";

	//	echo $querytable;
		$resultst=mysqli_query($conn, $queryst);


		while($rowst=mysqli_fetch_array($resultst)) { 

			$et_uid		 			= $rowst['et_uid'];
			$et_name	 			= $rowst['et_name'];
			
			if ($comp_eftpos_type == $et_name){
			
			 echo "<option selected value='".htmlspecialchars($et_name)."'>".htmlspecialchars($et_name)."</option>";
			
			}else{

			 echo "<option value='".htmlspecialchars($et_name)."'>".htmlspecialchars($et_name)."</option>";
				
			}
		}
			
			?>
	
                            </select>

					 <label class="label" for="table">Receipt Type:</label>
	<select disabled readonly class="form-control custom-select" id="comp_receipt_type"  onchange="javascript: update_field_company('comp_receipt_type', 'input', this.options[this.selectedIndex].value, <?php echo $uid_company;?>)" >
	
	
	<?php
		 include '../php/configi.php';

 
		$queryrt="SELECT * from 1_general_codes where code_type = 'receipttype' order by code_value";

	//	echo $querytable;
		$resultrt=mysqli_query($conn, $queryrt);


		while($rowrt=mysqli_fetch_array($resultrt)) { 

			$pk_code				= $rowrt['pk_code'];
			$code_value	 			= $rowrt['code_value'];
			
			if ($comp_receipt_type == $code_value){
			
			 echo "<option selected value='".htmlspecialchars($code_value)."'>".htmlspecialchars($code_value)."</option>";
			
			}else{

			 echo "<option value='".htmlspecialchars($code_value)."'>".htmlspecialchars($code_value)."</option>";
				
			}
		}
			
			?>
	
                            </select>

					 <label class="label" for="table">Screen Size:</label>
	<select disabled readonly class="form-control custom-select" id="comp_screen_size"  onchange="javascript: update_field_company('comp_screen_size', 'input', this.options[this.selectedIndex].value, <?php echo $uid_company;?>)" >
	
	
	<?php
		 include '../php/configi.php';

 
		$queryrt="SELECT * from 1_general_codes where code_type = 'screensize' order by code_value";

	//	echo $querytable;
		$resultrt=mysqli_query($conn, $queryrt);


		while($rowrt=mysqli_fetch_array($resultrt)) { 

			$pk_code				= $rowrt['pk_code'];
			$code_value	 			= $rowrt['code_value'];
			
			if ($comp_screen_size == $code_value){
			
			 echo "<option selected value='".htmlspecialchars($code_value)."'>".htmlspecialchars($code_value)."</option>";
			
			}else{

			 echo "<option value='".htmlspecialchars($code_value)."'>".htmlspecialchars($code_value)."</option>";
				
			}
		}
			
			?>
	
                            </select>
							
							
												 <label class="label" for="table">POS Item Layout:</label>
	<select disabled readonly class="form-control custom-select" id="comp_pos_layout"  onchange="javascript: update_field_company('comp_pos_layout', 'input', this.options[this.selectedIndex].value, <?php echo $uid_company;?>)" >
	
	
	<?php
		 include '../php/configi.php';

 
		$queryrt="SELECT * from 1_general_codes where code_type = 'poslayout' order by code_value";

	//	echo $querytable;
		$resultrt=mysqli_query($conn, $queryrt);


		while($rowrt=mysqli_fetch_array($resultrt)) { 

			$pk_code				= $rowrt['pk_code'];
			$code_value	 			= $rowrt['code_value'];
			
			if ($comp_pos_layout == $code_value){
			
			 echo "<option selected value='".htmlspecialchars($code_value)."'>".htmlspecialchars($code_value)."</option>";
			
			}else{

			 echo "<option value='".htmlspecialchars($code_value)."'>".htmlspecialchars($code_value)."</option>";
				
			}
		}
			
			?>
	
                            </select>

	 <label class="label" for="table">Company Logo:</label><br>
	 <img src="../images/logo/<?php echo $phxcrmclient_id?>.jpg" alt="icon" style="height: 50px">


	
		 
	        <div class="section full mb-2">
            <div class="section-title">Stages</div>

            <div class="wide-block p-0">

                <div class="table-responsive" style="height: 200px; overflow-y: scroll;">
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <th scope="col">#</th>
                                <th scope="col">Stage</th>

                            </tr>
                        </thead>
                        <tbody>
						
							<?php
		 include '../php/configi.php';

 
		$querysta="SELECT * from ".$_COOKIE['phxcrmclient_id']."_pos_status order by ps_uid";

//		echo $querytable;
		$resultsta=mysqli_query($conn, $querysta);


		while($rowsta=mysqli_fetch_array($resultsta)) { 

			$ps_uid		 			= $rowsta['ps_uid'];
			$ps_name	 			= $rowsta['ps_name'];
			
			?>
                            <tr>
                                <th scope="row"><?php echo htmlspecialchars($ps_uid) ?></th>
                                <td>
								
								<input readonly class="form-control" id="ps_name_<?php echo $ps_uid?>" type="text"  value="<?php echo htmlspecialchars($ps_name) ?>"  	onchange="javascript: update_field_company('ps_name', 'inputposstatus', this.value,<?php echo $ps_uid?>)" >
								
								</td>
          
                            </tr>
		<?php

			
		}
		?>

                        </tbody>
                    </table>
                </div>
<span><i>NB: Name each of your stages of service. #1 is always Completed.  Leave the ones you dont need blank and let us know if you need more than 10.</i></span>
            </div>
        </div>
		
		<?php
		
		if ($comp_type2 == "Retail" OR $comp_type2 == "Retail On Behalf Of" ){
		}else{
		?>
	        <div class="section full mb-2">
            <div class="section-title">Tables for Service</div>

            <div class="wide-block p-0">

                <div class="table-responsive" style="height: 200px; overflow-y: scroll;">
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <th scope="col">#</th>
                                <th scope="col">Table</th>

                            </tr>
                        </thead>
                        <tbody>
						
							<?php
		 include '../php/configi.php';

 
		$querystab="SELECT * from ".$_COOKIE['phxcrmclient_id']."_pos_tables order by pt_uid";

//		echo $querytable;
		$resultstab=mysqli_query($conn, $querystab);


		while($rowstab=mysqli_fetch_array($resultstab)) { 

			$pt_uid		 			= $rowstab['pt_uid'];
			$pt_name	 			= $rowstab['pt_name'];
			
			?>
                            <tr>
                                <th scope="row"><?php echo htmlspecialchars($pt_uid) ?></th>
                                <td>
								
								<input readonly class="form-control" id="pt_name_<?php echo $pt_uid?>" type="text"  value="<?php echo htmlspecialchars($pt_name) ?>"  	onchange="javascript: update_field_company('pt_name', 'inputpostable', this.value,<?php echo $pt_uid?>)" >
								
								</td>
          
                            </tr>
		<?php

			
		}
		?>

                        </tbody>
                    </table>
                </div>
<span><i>NB: Name each of your tables starting with #1. Leave the ones you dont need blank and let us know if you need more than 10.</i></span>
            </div>
        </div>
		
		<?php
		
		}
		?>
		

</div>


        <!-- Discount Action Sheet -->

        <!-- * Discount Action Sheet -->


                   
                </div>
                            </div>


                            </div>
                            <div class="tab-pane fade" id="no3" role="tabpanel">
 
						  
                            </div>
                        </div>

                    </div>
                </div> </div>
				


         


</div>

</div>

        <div class="section full mt-2">
            <div class="section-title"></div>
            <div  class="wide-block pt-2 pb-2">
				

				 
            </div>   
        </div>

        <!-- Dialog Form -->
        <div class="modal fade dialogbox" id="DialogStaffLogin" data-backdrop="static" tabindex="-1" role="dialog">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Please log in</h5>
                    </div>
                    <form>
                        <div class="modal-body text-left mb-2">
                            <div class="form-group basic">
                                <div class="input-wrapper">
								<table align="center">
								<tr align="center">
								<td style="width: 65px">
								<button onclick="javascript: add_charp('1')" type="button" style="border-radius: 50%; width: 55px; height: 55px" class="button button5">1</button>
								</td>
								<td style="width: 65px">

								<button onclick="javascript: add_charp('2')"  type="button"  style="border-radius: 50%; width: 55px; height: 55px" class="button button5">2</button>
		</td>
		
								<td style="width: 65px">

						<button  onclick="javascript: add_charp('3')"  type="button"  style="border-radius: 50%; width: 55px; height: 55px" class="button button5">3</button>
											</td>
								<td>
</tr>



								<tr style="margin-top: 15px; padding-top: 15px;" align="center">
								<td style="width: 65px;margin-top: 15px; padding-top: 15px;">
								<button  onclick="javascript: add_charp('4')"  type="button"  style="border-radius: 50%; width: 55px; height: 55px" class="button button5">4</button>
								</td>
								<td style="width: 65px;margin-top: 15px; padding-top: 15px;">

								<button onclick="javascript: add_charp('5')"  type="button"  style="border-radius: 50%; width: 55px; height: 55px" class="button button5">5</button>
		</td>
		
								<td style="width: 65px;margin-top: 15px; padding-top: 15px;">

						<button  onclick="javascript: add_charp('6')"  type="button"  style="border-radius: 50%; width: 55px; height: 55px" class="button button5">6</button>
											</td>
								<td>
</tr>




								<tr align="center">
								<td style="width: 65px;margin-top: 15px; padding-top: 15px;">
								<button  onclick="javascript: add_charp('7')"  type="button"  style="border-radius: 50%; width: 55px; height: 55px" class="button button5">7</button>
								</td>
								<td style="width: 65px;margin-top: 15px; padding-top: 15px;">

								<button  onclick="javascript: add_charp('8')"  type="button" style="border-radius: 50%; width: 55px; height: 55px" class="button button5">8</button>
		</td>
		
								<td style="width: 65px;margin-top: 15px; padding-top: 15px;">

						<button type="button"  onclick="javascript: add_charp('9')"   style="border-radius: 50%; width: 55px; height: 55px" class="button button5">9</button>
											</td>
								<td>
</tr>
								<tr align="center">
								<td style="width: 65px;margin-top: 15px; padding-top: 15px;">
							
								</td>
								<td style="width: 65px;margin-top: 15px; padding-top: 15px;">

								<button  onclick="javascript: add_charp('0')"  type="button"  style="border-radius: 50%; width: 55px; height: 55px" class="button button5">0</button>
		</td>
		
								<td style="width: 65px;margin-top: 15px; padding-top: 15px;">
<button type="button" onclick="javascript: clear_charp();"  style="border-radius: 10%; width: 55px; height: 55px" class="button button5">Clear</button>
					
											</td>
								<td>
</tr>
</table>
<table style="width: 90%">
<tr style="width: 90%">
<td style="width: 90%">

<label style="text-align: center" class="label" for="password1">Enter Your PIN</label>

<div style="position:relative;">
<center>
  <input size="4" maxlength="4" readonly type="text" class="form-control" style="; width: 85px; font-size: 24px;  text-align: centre;"  id="Bullets" value="" />
  <input size="4" tabindex="999" maxlength="4" id="tagsstaffpw" type="text" class="form-control"  style="position:absolute;left:0px;top:0px;opacity:0; width: 85px; font-size: 24px;  text-align: centre;" onkeyup="document.getElementById('Bullets').value=this.value.replace(/(.)/g,'•');" />
</center>

</div>

</td>

</tr>

</table>								

                                </div>
                            </div>

                        </div>
                        <div class="modal-footer">
                            <div class="btn-inline">
                                <button  onclick="javascript: logout_staff();" type="button" class="btn btn-text-secondary">LOGOUT</button>
                                <button onclick="javascript: login_staff();" type="button" class="btn btn-text-primary">SIGN IN</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!-- * Dialog Form -->


		</div>
        </div>
    </div>

</div>




        <!-- app footer -->
        <div  class="section mt-6 mb-6">


		<center>	<small>
 </center>
	<?	
					 	 include '../php/configi.php';
						 
		//	echo "cookie".$_COOKIE['phxcrmclient_id'];			 
						 
						 
	if (isset($_COOKIE['phxcrmclient_id'])){
		 $phxcrmclient_id = $_COOKIE['phxcrmclient_id'];
		 
		 		$queryclient="SELECT * from ".$_COOKIE['phxcrmclient_id']."_client where uid_client = " . $phxcrmclient_id;
	//	echo $queryprod;
		$resultclient=mysqli_query($conn, $queryclient);

		while($rowclient=mysqli_fetch_array($resultclient)) { 

			$comp_name			 				= $rowclient['comp_name'];
			
		}

?>

<?

//echo $_COOKIE['phxcrmclient_id'];

	}else{
		
		
	//	echo $_COOKIE['phxcrmclient_id'];

		
	}
	?>
	<br>

     
            <div class="footer-title">
			<center>
                Copyright © phoenixsoftware.co.nz 2021.<br> All Rights Reserved.
            </center>
			</div>
 


        </div>
        <!-- * app footer -->

    </div>
    <!-- * App Capsule -->
<div class="modal fade dialogbox" id="DialogBasic" data-backdrop="static" tabindex="-1" role="dialog">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Apply Payment:</h5>
                    </div>
                    <div class="modal-body">
                      

						
                    </div>
                    <div class="modal-footer">
                        <div class="btn-inline">
                            <a href="#" class="btn btn-text-primary" data-dismiss="modal">OK</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
		

		
		        <div class="modal inset fade action-sheet ios-add-to-home" id="ios-add-to-home-screen" tabindex="-1"
            role="dialog">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Add to Home Screen</h5>
                        <a href="javascript:;" class="close-button" data-dismiss="modal">
                            <ion-icon name="close"></ion-icon>
                        </a>
                    </div>
                    <div class="modal-body">
                        <div class="action-sheet-content text-center">
                            <div class="mb-1"><img src="../images/logo.png" alt="image" class="imaged w48">
                            </div>
                            <h4>phoenixsoftware.co.nz</h4>
                            <div>
                                Install phoenixsoftware.co.nz on your iPhone's home screen.
                            </div>
                            <div>
                                Tap the menu for your browser. Then tap Add to homescreen.
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- * iOS Add to Home Action Sheet -->
        <!-- Android Add to Home Action Sheet -->
        <div class="modal inset fade action-sheet android-add-to-home" id="android-add-to-home-screen" tabindex="-1"
            role="dialog">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Add to Home Screen</h5>
                        <a href="javascript:;" class="close-button" data-dismiss="modal">
                            <ion-icon name="close"></ion-icon>
                        </a>
                    </div>
                    <div class="modal-body">
                        <div class="action-sheet-content text-center">
                            <div class="mb-1"><img src="../images/logo.png" alt="image" class="imaged w48">
                            </div>
                            <h4>phoenixsoftware.co.nz</h4>
                            <div>
                                Install phoenixsoftware.co.nz on your Android's home screen.
                            </div>
                            <div>
								Click menu for your browser then click "add app" or "install app".<br>If these options are not there - check for "add to home" option.<br> Once install is complete, go to your home screen and there should<br> be a phoenixsoftware.co.nz app installed. 
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    <!-- App Bottom Menu -->
    <div class="appBottomMenu">
        <a href="index.php" class="item active">
            <div class="col">
                <ion-icon name="home-outline"></ion-icon>
            </div>
        </a>


		
		
        <a href="javascript:;" class="item" data-toggle="modal" data-target="#sidebarPanel">
            <div class="col">
                <ion-icon name="menu-outline"></ion-icon>
            </div>
        </a>
    </div>
    <!-- * App Bottom Menu -->

    <!-- App Sidebar -->
	<?php include ('../php/sidebar.php'); ?>
    <!-- * App Sidebar -->

    <!-- welcome notification  -->
    <div id="notification-welcome" class="notification-box">
        <div class="notification-dialog android-style">
            <div class="notification-header">
                <div class="in">
                    <img src="../assets/img/icon/72x72.png" alt="image" class="imaged w24">
                    <strong>phoenixsoftware.co.nz</strong>
                    <span>just now</span>
                </div>
                <a href="#" class="close-button">
                    <ion-icon name="close"></ion-icon>
                </a>
            </div>
            <div class="notification-content">
                <div class="in">
                    <h3 class="subtitle">Welcome to phoenixcrm.co.nz</h3>
                    <div class="text">
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
        <div id="toast-login-successful" class="toast-box toast-bottom bg-success">
            <div style="text-align: center;" class="in">
                <div style="text-align: center;" class="text">
					<center>Login Successful</center>
                </div>
            </div>
        </div>
		
		        <div id="toast-sale-successful" class="toast-box toast-bottom bg-success">
            <div style="text-align: center;" class="in">
                <div style="text-align: center;" class="text">
					<center>Sale Successfuly procesed</center>
                </div>
            </div>
        </div>
				        <div id="toast-login-failed" class="toast-box toast-bottom bg-danger">
            <div style="text-align: center;" class="in">
                <div style="text-align: center;" class="text">
					<center>Login Failed. Please try again</center>
                </div>
            </div>
        </div>
		
						        <div id="toast-fail0" class="toast-box toast-bottom bg-danger">
            <div style="text-align: center;" class="in">
                <div style="text-align: center;" class="text">
					<center>The total is $0 so can't apply payment</center>
                </div>
            </div>
        </div>
		
								        <div id="toast-client_dup" class="toast-box toast-bottom bg-danger">
            <div style="text-align: center;" class="in">
                <div style="text-align: center;" class="text">
					<center>This client already is in system. Please select them from drop down list</center>
                </div>
            </div>
        </div>

    <!-- * welcome notification -->

    <!-- ///////////// Js Files ////////////////////  -->
    <!-- Jquery -->
    <script src="../assets/js/lib/jquery-3.4.1.min.js"></script>
	
	

	<script src="../js/jquery-ui.min.js"> </script>
	
    <!-- Bootstrap-->
    <script src="../assets/js/lib/popper.min.js"></script>
    <script src="../assets/js/lib/bootstrap.min.js"></script>
    <!-- Ionicons -->
    <script type="module" src="https://unpkg.com/ionicons@5.2.3/dist/ionicons/ionicons.js"></script>
  
    <!-- Base Js File -->
    <script src="../assets/js/base.js"></script>
    <!-- Owl Carousel -->
    <script src="../assets/js/plugins/owl-carousel/owl.carousel.min.js"></script>
    <!-- jQuery Circle Progress -->
    <script src="../assets/js/plugins/jquery-circle-progress/circle-progress.min.js"></script>

    <script>
	
	
	function getCookie(cname) {
  let name = cname + "=";
  let ca = document.cookie.split(';');
  for(let i = 0; i < ca.length; i++) {
    let c = ca[i];
    while (c.charAt(0) == ' ') {
      c = c.substring(1);
    }
    if (c.indexOf(name) == 0) {
      return c.substring(name.length, c.length);
    }
  }
  return "";
}


    </script>

    <script>


	
	
			
	 function update_field_company(field_name, field_type, field_value, field_value2) {

		//	alert ("update"+field_name+field_type+field_value+field_value2);
			
		//	return false;
	//		alert ("update ");
			
			var uid_company			= document.getElementById('uid_company').value;
			
		//	alert (uid_client);
			

	//		var element_je_job_outlet_name = document.getElementById('je_job_outlet_name')
			var outlet_id 			= 1;			
			var old_status			= "";

			var c_favcmts 			= "";

			
			//set defaults
			var c_favcmts = "";
			var c_popup = "";


			if (field_type == "inputcheck"){
	
				if (field_value === true){
					
					field_value = 1;
					
				}else{

					
					field_value = 0;
					
				}
				
				var field_type			= "inputcheck";
				var field_name1_db		= field_name;
				var field_name2_db		= "";
				var field_value1 		= field_value;
				var field_value2 		= "";

			}else if (field_type == "inputposstatus"){
	
			
				var field_type			= "inputposstatus";
				var field_name1_db		= field_name;
				var field_name2_db		= "";
				var field_value1 		= field_value;
				var field_value2 		= field_value2;
				
			}else if (field_type == "inputpostable"){
	
			
				var field_type			= "inputpostable";
				var field_name1_db		= field_name;
				var field_name2_db		= "";
				var field_value1 		= field_value;
				var field_value2 		= field_value2;
			}else{
	
				
				var field_type			= "input";
				var field_name1_db		= field_name;
				var field_name2_db		= "";
				var field_value1 		= field_value;
				var field_value2 		= "";

			}		
		
			var jobfields = {};

			jobfields.sales_id	 = 0;			
			jobfields.field_name = field_name;
			jobfields.field_type = field_type;
			jobfields.field_name1_db = field_name1_db;
			jobfields.field_name2_db = field_name2_db;
			jobfields.field_value1 = field_value1;
			jobfields.field_value2 = field_value2;
			jobfields.old_status = old_status;
			jobfields.uid_company = uid_company;
			jobfields.outlet_id = outlet_id;			
			
	//		alert (jobfields.field_name);
	//		alert ("about to ajax");


			
	//		alert (JSON.stringify(jobfields));
			
//			alert (c_favcmts);
			
			
			
			$.ajax({
				url: '../php/companyupdfield.php',
				type: 'post',
				data: {"jobfields" : JSON.stringify(jobfields), "c_favcmts" : c_favcmts, "c_popup" : c_popup},
				success: function(data) {
			//		alert ("success"+data);
				//
				if (data == "Update Successful"){
				}else{
					alert ("Update failed error details are"+data);
				}
//				alert (data);

//					alert (field_name+data);
					// Do something with data that came back. 
				}
			});			
			
		//	alert (	jobfields.sales_id+jobfields.field_name+jobfields.field_type+jobfields.field_name1_db+jobfields.field_name2_db+jobfields.field_value1+jobfields.field_value2);


			
		 }
		 
		 function setCookie(cname, cvalue, exdays) {
  const d = new Date();
  d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  let expires = "expires="+d.toUTCString();
  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
		 
		 
 			
	 function update_field_st(field_name, field_type, field_value) {

	//		alert ("update"+field_name+field_type+field_value);
			
		//	return false;
	//		alert ("update ");
			
			var st_id			=  getCookie("phxcrm_sales_id_sel");
			
		//	alert (uid_client);
			

	//		var element_je_job_outlet_name = document.getElementById('je_job_outlet_name')
			var outlet_id 			= 1;			
			var old_status			= "";

			var c_favcmts 			= "";

			
			//set defaults
			var c_favcmts = "";
			var c_popup = "";

	
				
				var field_type			= "inputint";
				var field_name1_db		= field_name;
				var field_name2_db		= "";
				var field_value1 		= field_value;				
		
			var jobfields = {};

			jobfields.st_id	 = st_id;			
			jobfields.field_name = field_name;
			jobfields.field_type = field_type;
			jobfields.field_name1_db = field_name1_db;
			jobfields.field_name2_db = field_name2_db;
			jobfields.field_value1 = field_value1;
			jobfields.old_status = old_status;
			jobfields.uid_client = 0;
			jobfields.outlet_id = outlet_id;			
	
			
			$.ajax({
				url: '../php/orderupdstfield.php',
				type: 'post',
				data: {"jobfields" : JSON.stringify(jobfields), "c_favcmts" : c_favcmts, "c_popup" : c_popup},
				success: function(data) {
				//	alert ("success"+data);
				//
				if (data == "Update Successful"){
				}else{
					alert ("Update failed error details are"+data);
				}

				}
			});			
			
			
		 }
		 
		 
		 function edit_mode(){
			 
			 document.getElementById("contact_name").readOnly  = false;
			 document.getElementById("comp_phone").readOnly  = false;
			 document.getElementById("comp_country").readOnly  = false;
			 document.getElementById('comp_country').removeAttribute("disabled");
			 document.getElementById('comp_country').style.backgroundColor  = "white";
			 document.getElementById("comp_website_url").readOnly  = false;
			 document.getElementById("comp_phys_addr1").readOnly  = false;
			 document.getElementById("comp_phys_addr2").readOnly  = false;
			 document.getElementById("comp_phys_addr3").readOnly  = false;
			 document.getElementById("comp_phys_addr4").readOnly  = false;
			 document.getElementById("comp_phys_addr5").readOnly  = false;

			 document.getElementById("comp_receipt_type").readOnly  = false;			 
			 document.getElementById('comp_receipt_type').removeAttribute("disabled");
			 document.getElementById('comp_receipt_type').style.backgroundColor  = "white";			 


			 document.getElementById("comp_screen_size").readOnly  = false;			 
			 document.getElementById('comp_screen_size').removeAttribute("disabled");
			 document.getElementById('comp_screen_size').style.backgroundColor  = "white";	

			 document.getElementById("comp_pos_layout").readOnly  = false;			 
			 document.getElementById('comp_pos_layout').removeAttribute("disabled");
			 document.getElementById('comp_pos_layout').style.backgroundColor  = "white";	
//			 alert ("done");
			 

			 document.getElementById("comp_gst_registered").readOnly  = false;
			 document.getElementById('comp_gst_registered').removeAttribute("disabled");


			 document.getElementById("comp_gst_rate").readOnly  = false;
			 document.getElementById('comp_gst_rate').removeAttribute("disabled");
			 document.getElementById('comp_gst_rate').style.backgroundColor  = "white";	
			 
			 document.getElementById("contact_name").focus();
			 
 			 document.getElementById("comp_ird_no").readOnly  = false;


			 document.getElementById("comp_type2").readOnly  = false;
			 document.getElementById('comp_type2').removeAttribute("disabled");
			 document.getElementById('comp_type2').style.backgroundColor  = "white";

			 document.getElementById("comp_stock_type").readOnly  = false;
			 document.getElementById('comp_stock_type').removeAttribute("disabled");
			 document.getElementById('comp_stock_type').style.backgroundColor  = "white";

			 document.getElementById("comp_eftpos_type").readOnly  = false;
			 document.getElementById('comp_eftpos_type').removeAttribute("disabled");
			 document.getElementById('comp_eftpos_type').style.backgroundColor  = "white";		


			document.getElementById('buteditcompany').style.display="none";
			document.getElementById('butviewcompany').style.display="block";
			
		//	document.getElementById("ps_name_1").readOnly  = false;
			document.getElementById("ps_name_2").readOnly  = false;
			document.getElementById("ps_name_3").readOnly  = false;
			document.getElementById("ps_name_4").readOnly  = false;
			document.getElementById("ps_name_5").readOnly  = false;			
			document.getElementById("ps_name_6").readOnly  = false;
			document.getElementById("ps_name_7").readOnly  = false;			
			document.getElementById("ps_name_8").readOnly  = false;			
			document.getElementById("ps_name_9").readOnly  = false;			
			document.getElementById("ps_name_10").readOnly  = false;			

			
	//		document.getElementById("pt_name_1").readOnly  = false;
	//		document.getElementById("pt_name_2").readOnly  = false;
	//		document.getElementById("pt_name_3").readOnly  = false;
	//		document.getElementById("pt_name_4").readOnly  = false;
	//		document.getElementById("pt_name_5").readOnly  = false;			
	//		document.getElementById("pt_name_6").readOnly  = false;
	//		document.getElementById("pt_name_7").readOnly  = false;			
	//		document.getElementById("pt_name_8").readOnly  = false;			
	//		document.getElementById("pt_name_9").readOnly  = false;			
	//		document.getElementById("pt_name_10").readOnly  = false;	




		 }

		 function view_mode(){
			 
			document.getElementById("contact_name").readOnly  = true;
			document.getElementById("comp_phone").readOnly  = true;	
			document.getElementById("comp_country").readOnly  = true;			 
			 document.getElementById('comp_country').setAttribute("disabled","disabled");
			 document.getElementById('comp_country').style.backgroundColor  = "rgb(233, 236, 239)";
			 document.getElementById("comp_website_url").readOnly  = true;
			 document.getElementById("comp_website_url").readOnly  = true;
			 document.getElementById("comp_phys_addr1").readOnly  = true;
			 document.getElementById("comp_phys_addr2").readOnly  = true;
			 document.getElementById("comp_phys_addr3").readOnly  = true;
			 document.getElementById("comp_phys_addr4").readOnly  = true;
			 document.getElementById("comp_phys_addr5").readOnly  = true;
			 document.getElementById('comp_gst_registered').setAttribute("disabled","disabled");
			 
 			 document.getElementById("comp_ird_no").readOnly  = true;
			 
			 document.getElementById("comp_receipt_type").readOnly  = true;	
			 document.getElementById('comp_receipt_type').setAttribute("disabled","disabled");
			 document.getElementById('comp_receipt_type').style.backgroundColor  = "rgb(233, 236, 239)";
			 
			 document.getElementById("comp_screen_size").readOnly  = true;	
			 document.getElementById('comp_screen_size').setAttribute("disabled","disabled");
			 document.getElementById('comp_screen_size').style.backgroundColor  = "rgb(233, 236, 239)";
			 
			 document.getElementById("comp_pos_layout").readOnly  = true;	
			 document.getElementById('comp_pos_layout').setAttribute("disabled","disabled");
			 document.getElementById('comp_pos_layout').style.backgroundColor  = "rgb(233, 236, 239)";
			 
			 document.getElementById("comp_gst_rate").readOnly  = true;
			 document.getElementById('comp_gst_rate').setAttribute("disabled","disabled");
			 document.getElementById('comp_gst_rate').style.backgroundColor  = "rgb(233, 236, 239)";	 

			 document.getElementById("comp_type2").readOnly  = true;
			 document.getElementById('comp_type2').setAttribute("disabled","disabled");
			 document.getElementById('comp_type2').style.backgroundColor  = "rgb(233, 236, 239)";
			 

			 document.getElementById("comp_stock_type").readOnly  = true;
			 document.getElementById('comp_stock_type').setAttribute("disabled","disabled");
			 document.getElementById('comp_stock_type').style.backgroundColor  = "rgb(233, 236, 239)";


			 document.getElementById("comp_eftpos_type").readOnly  = true;
			 document.getElementById('comp_eftpos_type').setAttribute("disabled","disabled");
			 document.getElementById('comp_eftpos_type').style.backgroundColor  = "rgb(233, 236, 239)";		

			document.getElementById('buteditcompany').style.display="block";
			document.getElementById('butviewcompany').style.display="none";

			
			document.getElementById("ps_name_1").readOnly  = true;
			document.getElementById("ps_name_2").readOnly  = true;
			document.getElementById("ps_name_3").readOnly  = true;
			document.getElementById("ps_name_4").readOnly  = true;
			document.getElementById("ps_name_5").readOnly  = true;			
			document.getElementById("ps_name_6").readOnly  = true;
			document.getElementById("ps_name_7").readOnly  = true;			
			document.getElementById("ps_name_8").readOnly  = true;			
			document.getElementById("ps_name_9").readOnly  = true;			
			document.getElementById("ps_name_10").readOnly  = true;		
			
	//		document.getElementById("pt_name_1").readOnly  = true;
	//		document.getElementById("pt_name_2").readOnly  = true;
	////		document.getElementById("pt_name_3").readOnly  = true;
	//		document.getElementById("pt_name_4").readOnly  = true;
	//		document.getElementById("pt_name_5").readOnly  = true;			
	//		document.getElementById("pt_name_6").readOnly  = true;
	//		document.getElementById("pt_name_7").readOnly  = true;			
	//		document.getElementById("pt_name_8").readOnly  = true;			
	//		document.getElementById("pt_name_9").readOnly  = true;			
	//		document.getElementById("pt_name_10").readOnly  = true;	

		 }
		 
		 
    </script>

</body>

</html>