<?php require_once('../auth/auth.php');?>
<?php
 $comid=$_GET['comid'];
$acc= mysqli_query($conn,"SELECT * FROM company where coid='$comid' ") or die(mysqli_error($conn));
$ac= mysqli_fetch_assoc($acc);
$picture    = $ac['signature'];
?>


<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-4">
                <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
                    <div class="card-header" style="padding: 5px 8px;"><h3 class="card-title"><?php echo language(367);?></h3> 
			            <div class="card-tools"> <button type="button" class="btn btn-tool" data-card-widget="remove"> <i class="fas fa-times"></i>  </button> 
			            </div>
                    </div>

                    <div class="card-body">
                        <div class="col-md-12">
					        <form id="sig_form" action="#" method="post" autocomplete="off">
					        	<div class="card-body">
			                        <div class="col-md-12">
			                            <div class="row">

	                                    	<div class="col-md-12">
												<div class="form-group">
												              <?php if($picture != ""): ?>
                <img id="img_data" class="profile-user-img " src="data:image/gif;base64,<?php echo $picture;?>" alt="User signature"  style="width:100%">
                <?php else : ?>
                <img id="img_data" class="profile-user-img" src="../../dist/img/no_img.jpg" alt="User signature"  style="width:100%">
                <?php endif; ?>
												    

										     	 </div>
                                            </div>

											<div class="col-md-12">
												<div class="form-group">
													<label> <b class="text-danger"> *</b> <?php echo language(368);?>:</label>
													<br/> 
													<div id="sig" style="height:100px; width:300px;"></div>
													<br/>
													<button class="btn btn-danger btn-xs" id="clear"><?php echo language(367);?> <?php echo language(24);?></button>
											     	<textarea id="signature64" name="signed" style="display: none"></textarea>
										     	 </div>
                                            </div>
                                        </div></div>
                                    </div>
                                    <center>
					                     <div class="card-footer" style="padding: 8px 5px;">
					                        <button type="submit" id="save" class="btn btn-success btn-xs"><?php if (@$_GET['getuid']) {echo language(25);}else{echo language(23);}?></button>
					                     </div>
					                </center>
						    </form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>



<script type="text/javascript">

	var sig = $('#sig').signature({syncField: '#signature64', syncFormat: 'PNG'});

$('#sig_form').on('submit', function(e){


$('#save').prop('disabled', true);
$('#save').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+'Loading...');
e.preventDefault();
$.post("../company_setup/printer_setup_db.php",$(this).serialize(),function(data){
$('#sig_form')[0].reset();
$('#save').prop('disabled', false);
$('#save').html('Company Save');
$.post('../company_setup/signature_index.php?comid='+'<?php echo $comid ?>',{},function(res){
$('#com_profile_view').html(res);
toastr.success(Showing, '<?php echo "Data Load Succefully " ?>');
});
});
});










$('#clear').click(function(e) {
e.preventDefault();
sig.signature('clear');
$("#signature64").val('');
});
</script>