<h1 class="page-title"> Company Settings
</h1>

<!-- CONTENT -->
<div class="row">
	<div class="col-md-12">
		<!-- BEGIN PROFILE SIDEBAR -->
		<div class="profile-sidebar">
			<!-- PORTLET MAIN -->
			<div class="portlet light profile-sidebar-portlet ">
				<!-- SIDEBAR USERPIC -->
				<form enctype="multipart/form-data" class="cmxform form-horizontal adminex-form" id="editPicForm" method="post" action="/company/edit/updatepic">
					<div class="profile-userpic ">
						<div class="fileinput fileinput-new row" data-provides="fileinput">
							<div class="col-md-12">
								<div class="fileinput-new img-responsive">	
									<center>				
										<img id="uploadPreview" src="<?php echo showCompanyImage($_SESSION['user_id'], "user_id"); ?>" alt="" style="margin-left: 30px;" /> 
										<span class="btn btn-file" style="position:static;">
											<a class="fileinput-new" style="top: 0 !important;right : 0 !important;margin: 0 !important;color: #fff !important;opacity: .6 !important;border: none !important;padding: 3px 9px !important;font-size: 12px !important;background: #000 !important;position: absolute !important;filter: alpha(opacity=60) !important;"> edit </a>
											<input type="file" name="image" id="image" onchange="PreviewImage();"> 
										</span>
									</center>
								</div>
							</div>
						</div>
					</div>
				</form>
				<!-- END SIDEBAR USERPIC -->
				<!-- SIDEBAR USER TITLE -->
				<div class="profile-usertitle">
					<div class="profile-usertitle-name"> <?php echo getCompanyData($_SESSION["user_id"], "user_id", "name"); ?> </div>
				</div>
				<!-- END SIDEBAR USER TITLE -->
				<!-- SIDEBAR MENU -->
				<div class="profile-usermenu">
					<ul class="nav">
						<li>
							<a href="/profile/edit">
								<i class="icon-settings"></i> Personal Settings </a>
						</li>
						<li class="active">
							<?php if(getCompany($_SESSION['user_id']) == 0 || (getCompany($_SESSION['user_id']) <> 0 && getCompanyPosition($_SESSION['user_id']) == 1)){?>
								<a href="/company/edit">
								<i class="icon-info"></i> Company Settings </a>
							<?php }elseif(getCompany($_SESSION['user_id']) <> 0 && getCompanyPosition($_SESSION['user_id']) == 2){?>
								<a href="/company">
								<i class="icon-info"></i> Company Information </a>
							<?php } ?>	
						</li>
					</ul>
				</div>
				<!-- END MENU -->
			</div>
			<!-- END PORTLET MAIN -->
			
		</div>
		<!-- END BEGIN PROFILE SIDEBAR -->
		<!-- BEGIN PROFILE CONTENT -->
		<div class="profile-content">
			<div class="row">
				<div class="col-md-12">
					<div class="portlet light ">
						<div class="portlet-title tabbable-line">
							<ul class="nav nav-tabs">
								<li class="active">
									<a href="/company/edit">Company Information</a>
								</li>
								<?php if($_SESSION['group_id'] == 2){ ?>
								<li>
									<a href="/company/branch">Branch Information</a>
								</li>
								<?php } ?>
								<li>
									<?php if($_SESSION['group_id'] == 2){ ?>
									<a href="/company/warehouse">Delivery Information</a>
									<?php }else{ ?>
									<a href="/company/warehouse">Warehouse Information</a>
									<?php } ?>
								</li>
								<li>
									<a href="/company/staff">Staff Information</a>
								</li>
							</ul>
						</div>
						<div class="portlet-body">
							<div class="tab-content">
								<!-- PERSONAL INFO TAB -->
								<div class="tab-pane form active">
									<form enctype="multipart/form-data" class="cmxform form-horizontal adminex-form" id="editPicForm2" method="post" action="/company/edit/updatebizreg">
										<div id='suksesupdate' class="alert alert-success alert-block fade in" style='display:none;'>
											<strong><i class="icon-ok-sign"></i>Success! </strong>Yehaa.. Your profile has been updated
										</div>
										<div id='gagalupdate' class="alert alert-danger alert-block fade in" style='display:none;'>
											<strong><i class="icon-ok-sign"></i>Whoops! </strong>Your profile cant be updated, please try again later ( Make sure you make any changes to your profile when update )
										</div>
										<div class="form-group">
											<label class="control-label col-md-3">Business Registration Certificate</label>
											<div class="fileinput fileinput-new row" data-provides="fileinput">
												<div class="col-md-12">
													<div class="fileinput-new img-responsive" >									
														<img id="uploadPreview2" src="<?php echo showCompanyRegCertImage($_SESSION['user_id'], "user_id");?>" alt=""  style="width: 200px; height: auto;" /> 
													</div>
													<div>
														<span class="btn btn-file" style="position:static;">
															<a class="fileinput-new" style="top: 0 !important;right : 0 !important;margin: 0 !important;color: #fff !important;opacity: .6 !important;border: none !important;padding: 3px 9px !important;font-size: 12px !important;background: #000 !important;position: absolute !important;filter: alpha(opacity=60) !important;"> edit </a>
															<input type="file" name="image2" id="image2" onchange="PreviewImage2();"> 
														</span>												
													</div>
												</div>
											</div>
										</div>
									</form>
									
									<form class="form-horizontal form-row-seperated" id="editForm" method="post" action="">
										<div class="form-body">
											<div class="form-group">
												<label class="control-label col-md-3">Company Name</label>
												<div class="col-md-9">
													<input class=" form-control" id="name" name="name" minlength="2" type="text"  value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "name"); ?>" />
												</div>
											</div>
											<div class="form-group">
												<label class="control-label col-md-3">Registration No</label>
												<div class="col-md-9">
													<input class=" form-control" id="reg_no" name="reg_no" minlength="2" type="text"  value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "reg_no"); ?>" />
												</div>
											</div>
											<div class="form-group">
												<label class="control-label col-md-3">Tax No</label>
												<div class="col-md-9">
													<input class=" form-control" id="tax_no" name="tax_no" minlength="2" type="text"  value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "tax_no"); ?>" />
												</div>
											</div>
											<div class="form-group">
												<label class="control-label col-md-3">Tel No</label>
												<div class="col-md-9">
													<input class=" form-control" id="company_no" name="company_no" minlength="2" type="text"  value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "company_no"); ?>" />
												</div>
											</div>
											<div class="form-group">
												<label class="control-label col-md-3">Fax</label>
												<div class="col-md-9">
													<input class=" form-control" id="company_fax" name="company_fax" minlength="2" type="text"  value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "company_fax"); ?>" />
												</div>
											</div>
											<div class="form-group">
												<label class="control-label col-md-3">Address</label>
												<div class="col-md-9">
													<input class=" form-control" id="address" name="address" minlength="2" type="text"  value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "address"); ?>" />
												</div>
											</div>
											<div class="form-group ">
												<label class="control-label col-md-3">City</label>
												<div class="col-md-9">
													<input class="form-control " id="city" name="city" value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "city"); ?>"/>
												</div>
											</div>
											<div class="form-group ">
												<label class="control-label col-md-3">Postcode</label>
												<div class="col-md-9">
													<input class="form-control " id="zip" name="zip" value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "zip"); ?>"/>
												</div>
											</div>
											<div class="form-group ">
												<label class="control-label col-md-3">State</label>
												<div class="col-md-9">
													<input class="form-control " id="state" name="state" value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "state"); ?>"/>
												</div>
											</div>
											<div class="form-group ">
												<label class="control-label col-md-3">Country</label>
												<div class="col-md-9">
													<input class="form-control " id="country" name="country" value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "country"); ?>"/>
												</div>
											</div>
											<div class="form-group ">
												<label class="control-label col-md-3">Contact Person</label>
												<div class="col-md-9">
													<input class="form-control " id="contact_person" name="contact_person" value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "contact_person"); ?>"/>
												</div>
											</div>
											<div class="form-group ">
												<label class="control-label col-md-3">Contact Person No</label>
												<div class="col-md-9">
													<input class="form-control " id="contact_person_no" name="contact_person_no" value="<?php echo getCompanyData($_SESSION["user_id"], "user_id", "contact_person_no"); ?>"/>
												</div>
											</div>
											<div class="col-md-12" style="margin-top:10px;">
												<div class="col-md-6 pull-right">
													<button class="btn btn-primary pull-right" name="upload" value="upload" id='submitprofile' type="submit">Save</button>
													<button class="btn btn-default pull-right" id="waiting" style="display:none;">Submitting data...</button>
												</div>
											</div>
										</div>
									</form>
								</div>
								<!-- END PERSONAL INFO TAB -->
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- END PROFILE CONTENT -->
	</div>
</div>