<?php 
	$header_file=APPPATH.'views/include/header.php';
	require($header_file);
	
	?>

    <!-- BEGIN: Content-->
    <div class="app-content content">
      <div class="content-overlay"></div>
      <div class="content-wrapper">
        <div class="content-header row">
          <div class="content-header-left col-md-12 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-inline-block">Transferred List</h3>
            <div class="row breadcrumbs-top d-inline-block">
              <div class="breadcrumb-wrapper col-12">
                <ol class="breadcrumb">
                  <li class="breadcrumb-item"><a href="#">Home</a>
                  </li>
                  <li class="breadcrumb-item"><a href="#">Transfer</a>
                  </li>
                  <li class="breadcrumb-item active">Transferred List
                  </li>
                </ol>
              </div>
            </div>
          </div>
        
        </div>
        <div class="content-body"><!-- Zero configuration table -->
<section id="configuration">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
               <!-- <div class="card-header">
                    <h4 class="card-title">Transferred List</h4>
                    <a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
                    <div class="heading-elements">
                        <ul class="list-inline mb-0">
                            <li><a data-action="collapse"><i class="ft-minus"></i></a></li>
                            <li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
                            <li><a data-action="expand"><i class="ft-maximize"></i></a></li>
                            <li><a data-action="close"><i class="ft-x"></i></a></li>
                        </ul>
                    </div>
                </div>-->
                <div class="card-content collapse show">
                    <div class="card-body card-dashboard">
                        <div class="table-responsive">
                            <?php
    						  $isMob = is_numeric(strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "mobile"));
    						  if($isMob){
    						  ?>
						    <table class="table dataex-html5-export">
                                <thead>
                                    <tr>
                                        <th>Trns No</th>
										<th>Dept</th>
										<th>Inward</th>
									<!--	<th>Manual Close</th>-->
									</tr>
                                </thead>
                                <tbody>
								 <?php
									$branch_name = $_SESSION['branch_name'];
									foreach($transfer_list as $trlist)
									{
								?>
                                <tr>
                                	<td><?php echo $trlist->trans_no; ?></td>
									<?php if($trlist->branchname == $branch_name) { ?>
									<td><?php echo $trlist->dept_name; ?></td>
									<?php } else {
										$branch = $trlist->branchname;
										$q1 = $this->db->query("select * from user where branch_name='$branch'");
										$r = $q1->row_array();
									?>
									<td><?php echo $r['username']; ?></td>	
									<?php } ?>
									<?php if($trlist->rcv_status == 'Pending' && $trlist->to_branch == $branch_name) { ?>
										<td class="uk-text-nowrap">
											<a href="<?php echo site_url('Transfer/transferInward/'. $trlist->tr_id); ?>" class="btn btn-sm btn-info">Inward</a>
										</td>
									<?php } else { ?>
										<td class="uk-text-nowrap">
											<button class="btn btn-sm btn-warning disabled">Inward</button>
										</td>
									<?php } ?>
									<?php /*if($trlist->rcv_status == 'Received') { ?>
										<td><button class="btn btn-sm btn-success font-medium-1 grid-form-dialog-btn ">Close Manual</button></td>
										<div class="grid-form-dialog" title="Manual Transfer Close">
											<div class="container">
												<form action="" class="uk-form-stacked"  method="post" autocomplete="off">
													<div class="form-group row">
														<label for="inputEmail3" class="col-sm-2 col-form-label">Enter Remarks</label>
														<div class="col-sm-10">
															<input name="tr_id" id="tr_id" type="hidden" class="textbox" value="<?php echo $trlist->tr_id; ?>">
															<input name="branch" id="branch" type="hidden" class="textbox" value="<?php echo $_SESSION['branch_name']; ?>">
															<input name="trbranch" id="trbranch" type="hidden" class="textbox" value="<?php echo $trlist->branchname; ?>">
															<input type="text" class="form-control"name="trans_remark" id="trans_remark">
														</div>
													</div>
													<div class="form-group row">
														<div class="offset-sm-2 col-sm-10">
															<button type="button" class="btn btn-warning uk-modal-close">Close</button>
															<input type="button" class="btn btn-primary" value="Confirm" name="submit3" id="submit3">
														</div>
													</div>
												</form>
											</div>
										</div>
									<?php } else { ?>
										<td><button class="btn btn-sm disabled">Close Manual</button></td>
									<?php } */ ?>
								</tr>
                                    
                                   <?php
								}
							?>
                            </table>
							<?php } else { ?>
							<table class="table table-striped table-bordered dataex-html5-export">
                                <thead>
                                    <tr>
                                    	<th>Sl No</th>
                                        <th>Trns No</th>
										<th>Trns Date</th>
										<th>To/From</th>
										<th>Dept</th>
										<th>Status</th>
										<th>Remark</th>
										<th>Inward</th>
										<th>Manual Close</th>
										<th>View</th>
									</tr>
                                </thead>
                                <tbody>
								 <?php
									$branch_name = $_SESSION['branch_name'];
									$count =1;
									foreach($transfer_list as $trlist)
									{
								?>
                                <tr>
                                	<td><?php echo $count; ?></td>
									<td><?php echo $trlist->trans_no; ?></td>
									<td><?php echo $trlist->trans_date; ?></td>
									<?php if($trlist->branchname == $branch_name) { ?>
									<td>To</td>
									<?php } else { ?>
									<td>From</td>
									<?php } ?>
									<?php if($trlist->branchname == $branch_name) { ?>
									<td><?php echo $trlist->dept_name; ?></td>
									<?php } else {
										$branch = $trlist->branchname;
										$q1 = $this->db->query("select * from user where branch_name='$branch'");
										$r = $q1->row_array();
									?>
									<td><?php echo $r['username']; ?></td>	
									<?php } ?>
									<?php
										if($trlist->to_status == 'Pending') {
										?>
										<td class="pending_data"><span class="badge badge-danger"><?php echo $trlist->to_status; ?></span></td>
										<?php
											} else {
										?>	
										<td class="success_data"><span class="badge badge-success"><?php echo $trlist->from_status; ?></span></td>
										<?php
										}
									?>
									<?php
										if($trlist->to_status == 'Pending') {
										?>
										<td><?php echo $trlist->from_remark; ?></td>
										<?php
											} else {
										?>	
										<td><?php echo $trlist->to_remark; ?></td>
										<?php
										}
									?>
									<?php if($trlist->rcv_status == 'Pending' && $trlist->to_branch == $branch_name) { ?>
										<td class="uk-text-nowrap">
											<a href="<?php echo site_url('Transfer/transferInward/'. $trlist->tr_id); ?>" class="btn btn-sm btn-info">Inward</a>
										</td>
									<?php } else { ?>
										<td class="uk-text-nowrap">
											<button class="btn btn-sm btn-warning disabled">Inward</button>
										</td>
									<?php } ?>
									<?php if($trlist->rcv_status == 'Received') { ?>
										<td><button class="btn btn-sm btn-success font-medium-1 grid-form-dialog-btn ">Close Manual</button></td>
										<div class="grid-form-dialog" title="Manual Transfer Close">
											<div class="container">
												<form action="" class="uk-form-stacked"  method="post" autocomplete="off">
													<div class="form-group row">
														<label for="inputEmail3" class="col-sm-2 col-form-label">Enter Remarks</label>
														<div class="col-sm-10">
															<input name="tr_id" id="tr_id" type="hidden" class="textbox" value="<?php echo $trlist->tr_id; ?>">
															<input name="branch" id="branch" type="hidden" class="textbox" value="<?php echo $_SESSION['branch_name']; ?>">
															<input name="trbranch" id="trbranch" type="hidden" class="textbox" value="<?php echo $trlist->branchname; ?>">
															<input type="text" class="form-control"name="trans_remark" id="trans_remark">
														</div>
													</div>
													<div class="form-group row">
														<div class="offset-sm-2 col-sm-10">
															<button type="button" class="btn btn-warning uk-modal-close">Close</button>
															<input type="button" class="btn btn-primary" value="Confirm" name="submit3" id="submit3">
														</div>
													</div>
												</form>
											</div>
										</div>
									<?php } else { ?>
										<td><button class="btn btn-sm disabled">Close Manual</button></td>
									<?php } ?>
									<td class="uk-text-nowrap">
										<a href="<?php echo site_url('Transfer/transferView/'. $trlist->tr_id); ?>" class=""> <i class='ft-eye'></i></a>
									</td>
								</tr>
                                    
                                   <?php
								  $count++;
								}
							  
							?>
                            </table>
							<?php } ?>
						</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<!--/ Zero configuration table -->



<!--/ Language - Comma decimal place table -->

        </div>
      </div>
    </div>
    <!-- END: Content-->

   <?php //require('include/theme_customizer.php');?>
 <?php 
  $footer_file=APPPATH.'views/include/footer.php';
	require($footer_file);
	?>
	<script>
	$('#submit3').click(function() {
		var trans_remark = $('#trans_remark').val();
		var tr_id = $('#tr_id').val();
		var branch = $('#branch').val();
		var trbranch = $('#trbranch').val();
		if(trans_remark == '')
		{
			alert("Please Enter Remarks");
			return false;
		}
		else
		{
			$.ajax({
				type: "POST",
				dataType:'json',
				data : { tr_id : tr_id, trans_remark : trans_remark, branch : branch, trbranch : trbranch },
				url: "<?php echo base_url();?>index.php/Transfer/transferRmkissUpdate",
				success: function(data) { 
					setTimeout(function() {
						window.location.href = '<?php echo site_url('Transfer/transfeClosedList');?>';
					}, 200);
				}
			});
		}
	});
</script>
<script>
	$('.param_check').each(function() { $(this).on( {'click contextmenu': function() {
		//contextmenu
		var i = $(this).data('value');
		var anchor = $("a");
		var anchorTarget = $(this).parent().find('.parmetre').val();
		var submodid = $(this).parent().find('.submod_id').val();
		var link = $(this).attr('href');
		$(this).attr("href", link + submodid +'/'+anchorTarget);

		location.reload();
	}
	})
	})
</script>  
  </body>
  <!-- END: Body-->

<!-- Mirrored from pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-modern-menu-template/form-layout-basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Apr 2020 09:38:02 GMT -->
</html>