<?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">Request 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="#">Product Request</a>
                  </li>
                  <li class="breadcrumb-item active">Request 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">Request 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>Request No</th>
										<th>Department</th>
										<th>View Issues</th>
									</tr>
                                </thead>
                                <tbody>
								 <?php
									foreach($req_list as $rlist)
									{
								?>
                                    <tr>
                                        <td><?php echo $rlist->pr_req_no; ?></td>
										<td><?php echo $rlist->dept; ?></td>
										<td class="uk-text-nowrap">
										    <a href="<?php echo site_url('ProductRequest/requestIssueList/'. $rlist->request_id); ?>" class=""> <i class='ft-eye'></i></a>
									    </td>
									</tr>
                                    
                                   <?php
								}
							?>
                            </table>
                            <?php } else { ?>
                            <table class="table table-striped table-bordered dataex-html5-export">
                                <thead>
                                    <tr>
                                        <th>Sl No</th>
                                        <th>Request No</th>
										<th>Request Date</th>
										<th>Department</th>
										<th>Status</th>
										<th>Cls Rmrk</th>
										<th>Odr Rmrks</th>
										<th>View Issues</th>
										<th>View REQ</th>
									</tr>
                                </thead>
                                <tbody>
								 <?php
									$count =1;
									foreach($req_list as $rlist)
									{
								?>
                                    <tr>
                                        <td><?php echo $count; ?></td>
									<td><?php echo $rlist->pr_req_no; ?></td>
									<td><?php echo $rlist->request_date; ?></td>
									<td><?php echo $rlist->dept; ?></td>
									<?php 
										$req_id = $rlist->request_id;
										$q1 = $this->db->query("SELECT *,DATE_FORMAT(R.request_date, '%d-%m-%Y') as request_date,DATE_FORMAT(I.issue_date, '%d-%m-%Y') as issue_date FROM product_request R inner join product_issues_creation I on R.request_id=I.request_id where I.request_id='$req_id'");
										$req_res = $q1->result();
										$req_count1 = 0;
										$req_count2 = 0;
										foreach($req_res as $req_row)
										{
											if(($req_row->issue_status == 'Accepted'))
											{	
												$req_count1++;	
											}
											$req_count2++;
										}
									?>
									<?php
										if($req_count1 == $req_count2) {
										?>
										<td class="pending_data"><?php echo $rlist->receipt_status; ?></td>
										<?php
											} else {
										?>	
										<td class="success_data"><?php echo $rlist->receipt_status; ?></td>
										<?php
										}
									?>
									<td><?php echo $rlist->remark; ?></td>
									<td><?php echo $rlist->order_remarks; ?></td>
									<td class="uk-text-nowrap">
									    <?php if($rlist->branchname=='BY2C7'){ ?>
										<a href="<?php echo site_url('ProductRequest/requestIssueList/'. $rlist->request_id); ?>" class=""> <i class='ft-eye'></i></a>
									<?php }else{ ?>
										<a href="#" class="btn btn-sm btn-success disabled"> View</a>
									<?php } ?>
									</td>
									<td class="uk-text-nowrap">
										<a href="<?php echo site_url('ProductRequest/requestView/'. $rlist->request_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>
	$('.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>