<?php
session_start(); 
	/* teamleader edit form*/	
	if(!isset($_SESSION['atcrmsuloginsesion']))
	{
		header('Location: index.php');
		return;
	}
	if($_SESSION['atcrmsutype']!='Superuser'){
			header('Location: index.php');
		return;
	}
$_SESSION['_token']=bin2hex(openssl_random_pseudo_bytes(16));
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
    <!--<![endif]-->
    <!-- BEGIN HEAD -->

    <head>
        <meta charset="utf-8" />
        <title>Business Account Edit : LinkArise TeleCall</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta content="width=device-width, initial-scale=1" name="viewport" />
        <meta content="" name="description" />
        <meta content="" name="author" />
        <!-- BEGIN GLOBAL MANDATORY STYLES -->
        <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
        <link href="../../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <link href="../../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
        <link href="../../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="../../assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css" />
        <link href="../../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
        <!-- END GLOBAL MANDATORY STYLES -->
        <!-- BEGIN THEME GLOBAL STYLES -->
        <link href="../../assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
        <link href="../../assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
        <!-- END THEME GLOBAL STYLES -->
        <!-- BEGIN THEME LAYOUT STYLES -->
        <link href="../../assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
        <link href="../../assets/layouts/layout/css/themes/darkblue.min.css" rel="stylesheet" type="text/css" id="style_color" />
        <link href="../../assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
        <!-- END THEME LAYOUT STYLES -->
		<link href="../../assets/global/plugins/bootstrap-toastr/toastr.min.css" rel="stylesheet" type="text/css" />
        <link rel="shortcut icon" href="favicon.ico" /> 
		<link href="../../assets/global/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
        <link href="../../assets/global/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
		
		</head>
    <!-- END HEAD -->
<?php

	include("connect.php");
	
				date_default_timezone_set("Asia/Kolkata");
				$cdatetime= date('Y-m-d H:i:s');
				
				$par1 = $_SESSION['atcrmsuname'];
				$ipaddress = "";
	
				if (getenv('HTTP_CLIENT_IP'))
					$ipaddress = getenv('HTTP_CLIENT_IP');
				else if(getenv('HTTP_X_FORWARDED_FOR'))
					$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
				else if(getenv('HTTP_X_FORWARDED'))
					$ipaddress = getenv('HTTP_X_FORWARDED');
				else if(getenv('HTTP_FORWARDED_FOR'))
					$ipaddress = getenv('HTTP_FORWARDED_FOR');
				else if(getenv('HTTP_FORWARDED'))
					$ipaddress = getenv('HTTP_FORWARDED');
				else if(getenv('REMOTE_ADDR'))
					$ipaddress = getenv('REMOTE_ADDR');
				else
					$ipaddress = 'UNKNOWN';
				
				$userserver=$_SERVER['HTTP_USER_AGENT'];
				$eve1 = "insert into res_user_log (lid,mobile,lastupdatedtime,pagename,taskname,ipaddress,useragentdetail) values(NULL,'$par1','$cdatetime','Agent','Edit Business','$ipaddress','$userserver')";
				$re1 = mysqli_query($conn, $eve1);
	
?>

    <body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">
        <!-- BEGIN HEADER -->
        <div class="page-header navbar navbar-fixed-top">
            <!-- BEGIN HEADER INNER -->
            <div class="page-header-inner ">
                <!-- BEGIN LOGO -->
                <div class="page-logo">
                    <a href="#">
                        <img src="../../assets/layouts/layout/img/logo.png" alt="logo" class="logo-default" /> </a>
                    <div class="menu-toggler sidebar-toggler"> </div>
                </div>
                <!-- END LOGO -->
                <!-- BEGIN RESPONSIVE MENU TOGGLER -->
                <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse"> </a>
                <!-- END RESPONSIVE MENU TOGGLER -->
                <!-- BEGIN TOP NAVIGATION MENU -->
                <div class="top-menu">
                    <ul class="nav navbar-nav pull-right">
                        <!-- BEGIN NOTIFICATION DROPDOWN -->
                        <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
                        <?php
							require ('notification.php');
						?>
                        <!-- END NOTIFICATION DROPDOWN -->
                        <!-- BEGIN INBOX DROPDOWN -->
                        <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
                        
                        <!-- END INBOX DROPDOWN -->
                        <!-- BEGIN TODO DROPDOWN -->
                        <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
                        
                        <!-- END TODO DROPDOWN -->
                        <!-- BEGIN USER LOGIN DROPDOWN -->
                        <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
                      
                        <!-- END USER LOGIN DROPDOWN -->
                        <!-- BEGIN QUICK SIDEBAR TOGGLER -->
                        <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
                       
                        <!-- END QUICK SIDEBAR TOGGLER -->
                    </ul>
                </div>
                <!-- END TOP NAVIGATION MENU -->
            </div>
            <!-- END HEADER INNER -->
        </div>
        <!-- END HEADER -->
        <!-- BEGIN HEADER & CONTENT DIVIDER -->
        <div class="clearfix"> </div>
        <!-- END HEADER & CONTENT DIVIDER -->
        <!-- BEGIN CONTAINER -->
        <div class="page-container">
            <!-- BEGIN SIDEBAR -->
			<?php
            require ('sidebar.php');
			?>
            <!-- END SIDEBAR -->
            <!-- BEGIN CONTENT -->
            <div class="page-content-wrapper">
                <!-- BEGIN CONTENT BODY -->
                <div class="page-content">
                    <!-- BEGIN PAGE HEADER-->
                    <!-- BEGIN THEME PANEL -->
                   
                    <!-- END THEME PANEL -->
                    <!-- BEGIN PAGE BAR -->
                   
                    <!-- END PAGE BAR -->
                    <!-- BEGIN PAGE TITLE-->
					
				
					
                  
					
					<div class="portlet box blue-hoki green">
					<div class="portlet-title green">
						<div class="caption">
							<i class="fa fa-gift"></i><small>Edit Business Account</small>  </div>
						<div class="actions">
							
						</div>
					</div>
					
                    <!-- END PAGE TITLE-->
                    <!-- END PAGE HEADER-->
					
					<div class="portlet-body form">
					
				<!--<div class="alert alert-block alert-info fade in">
					<button type="button" class="close" data-dismiss="alert"></button>
					<h4 class="alert-heading"> Edit Customer Details</h4>
					<p> Confirm before updating customer details, As it will reflect everywhere where cutomer is details is used.</p>
					
				</div>-->
					
									<?php
										$brmid=(int)mysqli_real_escape_string($conn,$_GET['id']);
										
										$eve = "select * from res_businessregister_master where brmid=$brmid";
										
										$re = mysqli_query($conn, $eve);
										 while($rt = mysqli_fetch_assoc($re))
										{
											$bcmid1=$rt['bcmid'];
											$eve2 = "select * from res_user_master where utype='Admin' and brmid=$brmid";
											$re2 = mysqli_query($conn, $eve2);
											 while($rt2 = mysqli_fetch_assoc($re2))
											{
												$umobile=$rt2['umobile'];
												$upassword=$rt2['upassword'];
											}
											
									?>
									
                                                <!-- BEGIN FORM-->
                                               <form action="businessregisteredit2.php" method="POST" class="form-horizontal" id="myForm">
												<input type="hidden" name="brmid" value="<?php echo $brmid; ?>">
												
                                                    <div class="form-body">
														
													
                                                        <div class="form-group">
                                                            <label class="col-md-3 control-label"> Name <span class="required"> *</span></label>
                                                            <div class="col-md-3">
                                                                <input type="text" name="brname" value="<?php echo $rt['brname']; ?>" class="form-control" placeholder="Enter Name" required>
                                                            </div>
                                                        </div>
													
														
														
														<div class="form-group">
                                                            <label class="col-md-3 control-label">Mobile <span class="required"> *</span></label>
                                                            <div class="col-md-3">
                                                                <input type="text" name="brmobile" value="<?php echo $umobile; ?>" class="form-control" placeholder="Enter Mobile" required>
                                                            </div>
														</div>
															<div class="form-group">
                                                            <label class="col-md-3 control-label">Password <span class="required"> *</span></label>
                                                            <div class="col-md-3">
                                                                <input type="password" name="upassword" value="<?php echo $upassword; ?>" class="form-control" placeholder="Enter Password" required>
                                                            </div>
														</div>
														
														<div class="form-group">
                                                            <label class="col-md-3 control-label">Email Id</label>
                                                            <div class="col-md-3">
                                                                <input type="email" name="bremail" value="<?php echo $rt['bremail']; ?>" class="form-control" placeholder="Enter Email Id" >
                                                            </div>
														</div>
														<div class="form-group">
                                                            <label class="col-md-3 control-label">Address</label>
                                                            <div class="col-md-3">
                                                                <input type="text" name="braddress" value="<?php echo $rt['braddress']; ?>" class="form-control" placeholder="Enter Address" >
                                                            </div>
														</div>
														<div class="form-group">
										<label class="col-md-3 control-label">State<span class="required"> * </span></label>
										<div class="col-md-3">
											<select name="brstate" class="form-control select2" data-required="1">
												<?php
													$eve_category = "select statename from res_states_master order by statename";
													$re_category = mysqli_query($conn, $eve_category);
													while($rt_category = mysqli_fetch_assoc($re_category))
													{
														$statename=$rt_category['statename'];
														if($rt['brstate']==$statename)
														{
															echo "<option value='$statename' selected>$statename</option>";
														}
														else
														{ 
															echo "<option value='$statename'>$statename</option>";
														}

													}
												?>
											</select>
										</div>
									</div>
														<div class="form-group">
                                                            <label class="col-md-3 control-label">No. of Users</label>
                                                            <div class="col-md-3">
                                                                <input type="number" name="brtotalusers" id="username" class="form-control" placeholder="Enter No of Users"value="<?php echo $rt['brtotalusers']; ?>" required>
                                                            </div>
														</div>
														<div class="form-group">
															<label class="col-md-3 control-label">Expiry Date</label>
															<div class="col-md-3">
																<!--<div class="input-group input-medium date date-picker" data-date-format="dd-mm-yyyy" >
																	<input type="text" id="datepicker" name="planexpirydate" class="form-control" value="<?php //echo date("d-m-Y", strtotime($rt['planexpirydate'])); ?>" >	
																</div>-->
																<input class="form-control form-control-inline  date-picker" data-date-format="dd-mm-yyyy" type="text" name="brplanexpirydate"  value="<?php echo date("d-m-Y", strtotime($rt['brplanexpirydate'])); ?>">
															</div>
														</div>
														<div class="form-group">
															<label class="col-md-3 control-label">Plan Status</label>
															<div class="col-md-3">
																
																	<select class="form-control select2" name="brcurrentplanstatus" >
																	
																	<option value="Active" <?php if($rt['brcurrentplanstatus']=='Active'){ echo "selected"; } ?>>Active</option>
																	<option value="Blocked" <?php if($rt['brcurrentplanstatus']=='Blocked'){ echo "selected"; } ?>>Blocked</option>
																	<option value="Expired"  <?php if($rt['brcurrentplanstatus']=='Expired'){ echo "selected"; } ?>>Expired</option>
																	</select>
																
															</div>
														</div>
														<div class="form-group">
															<label class="col-md-3 control-label">Plan Type</label>
															<div class="col-md-3">
																
																	<select class="form-control select2" name="brcurrentplantype" >
																	
																	<option value="Free" <?php if($rt['brcurrentplantype']=='Free'){ echo "selected"; } ?>>Free</option>
																	<option value="Paid"  <?php if($rt['brcurrentplantype']=='Paid'){ echo "selected"; } ?>>Paid</option>
																	</select>
																
															</div>
														</div>
														
                                                    <!-- /input-group -->
                                                   	
                                                    <div class="form-actions">
                                                        <div class="row">
                                                            <div class="col-md-offset-3 col-md-9">
                                                                <button type="submit" class="btn  green">Submit</button>
                                                                <button type="button" class="btn  grey-salsa btn-outline" onclick="document.location.href='businessregister.php'">Cancel</button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </form>
                                                <!-- END FORM-->
												
									<?php
										}
									?>
												
                                            </div>
                                        </div>
                                      
                                         
                    	
					
                </div>
                <!-- END CONTENT BODY -->
            </div>
            <!-- END CONTENT -->
            <!-- BEGIN QUICK SIDEBAR -->
            <!-- END QUICK SIDEBAR -->
        </div>
        <!-- END CONTAINER -->
        <!-- BEGIN FOOTER -->
        <div class="page-footer">
            <div class="page-footer">
            <div class="page-footer-inner">&copy; Arth Technology
               
            </div>
            <div class="scroll-to-top">
                <i class="icon-arrow-up"></i>
            </div>
        </div>
        </div>
        <!-- END FOOTER -->
        <!--[if lt IE 9]>
<script src="../../assets/global/plugins/respond.min.js"></script>
<script src="../../assets/global/plugins/excanvas.min.js"></script> 
<![endif]-->
         <script src="../../assets/global/plugins/jquery.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
		<script src="../../assets/global/plugins/counterup/jquery.counterup.min.js" type="text/javascript"></script>
        <!-- END CORE PLUGINS -->
        <!-- BEGIN THEME GLOBAL SCRIPTS -->
        <script src="../../assets/global/scripts/app.min.js" type="text/javascript"></script>
        <!-- END THEME GLOBAL SCRIPTS -->
		
		
		  <script src="../../assets/global/plugins/morris/morris.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/morris/raphael-min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/counterup/jquery.waypoints.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/counterup/jquery.counterup.min.js" type="text/javascript"></script>
        
        <script src="../../assets/global/plugins/flot/jquery.flot.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/flot/jquery.flot.resize.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/flot/jquery.flot.categories.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/jquery-easypiechart/jquery.easypiechart.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/jquery.sparkline.min.js" type="text/javascript"></script>
		<script src="../../assets/pages/scripts/ui-toastr.min.js" type="text/javascript"></script>
		<script src="../../assets/global/plugins/bootstrap-toastr/toastr.min.js" type="text/javascript"></script>

		 <!-- BEGIN PAGE LEVEL SCRIPTS -->
       
        <!-- END PAGE LEVEL SCRIPTS -->
        <!-- BEGIN THEME LAYOUT SCRIPTS -->
        <script src="../../assets/layouts/layout/scripts/layout.min.js" type="text/javascript"></script>
        <script src="../../assets/layouts/layout/scripts/demo.min.js" type="text/javascript"></script>
        <script src="../../assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
        <!-- END THEME LAYOUT SCRIPTS -->
		<script type="text/javascript" src="js/notification.js"/></script>	
		
		<script src="../../assets/global/plugins/bootstrap-timepicker/js/bootstrap-timepicker.min.js" type="text/javascript"></script>
        <script src="../../assets/global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
		<script src="../../assets/pages/scripts/components-date-time-pickers.min.js" type="text/javascript"></script>
		
		<script src="../../assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js" type="text/javascript"></script>
        
		
		
		<script src="../../assets/global/plugins/select2/js/select2.full.min.js" type="text/javascript"></script>
		 
		<script src="../../assets/pages/scripts/components-select2.min.js" type="text/javascript"></script>
		
	<script type="text/javascript">
	 $(function()
	{
		$('#myForm').submit(function(e)
		{
			if($('#bcmid').val() == '0')
			{
				alert('Select Business Category!');
				e.preventDefault();
			}

		});
	});
	</script>		
   </body>
</html>