<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

      <div class="main my-0">
        <div class="row mt-3 mx-0">
          <div class="col-md-6">
            <h3><?php echo $pgheading;?></h3>
          </div>
          <div class="col-md-5 text-right">
            &nbsp;
          </div>
        </div>
        
        <div class="row mx-0">
        <div class="container_fluid mt-2 px-3 ml-3 col-md-7">

         <?php
			if($this->session->flashdata("message")!="" && $this->session->flashdata("alerttype")!="")
			{
         ?>
         <div class="text-center my-4">
			 <span class="alert <?php echo $this->session->flashdata("alerttype");?>"><?php echo $this->session->flashdata("message");?></span>
         </div>
         <?php
			}
         ?>
			
		<form name="frmgeneral" method="post" action="account/importstock/managedata" enctype="multipart/form-data" onsubmit="return checkform();">
        <table class="webforms mt-0 table-responsive-sm">
		<tr>
          <td width="30%"><label>Vendor:</label></td>
          <td width="70%">
		  <select name="vendorid" id="vendorid" required>
		  <option value="">Select Vendor</option>
			<?php
			if(is_array($vendorlist) && count(array_filter($vendorlist))>0)
			{
				foreach($vendorlist as $row)
				{
					echo '<option value="' . $row->fld_id . '">' . $row->fld_name . '</option>';
				}
			}
			?> 
		  </select>
		  </td>
         </tr>   
		<tr>
          <td><label>Warehouse:</label></td>
          <td>
		  <select name="warehouseid" id="warehouseid" required>
		  <option value="">Select Warehouse</option>
			<?php
			if(is_array($warehouselist) && count(array_filter($warehouselist))>0)
			{
				foreach($warehouselist as $row)
				{
					echo '<option value="' . $row->fld_id . '">' . $row->fld_name . '</option>';
				}
			}
			?> 
		  </select>
		  </td>
         </tr>   
		<tr>
          <td><label>Zone:</label></td>
          <td>
		  <select name="zoneid" id="zoneid">
		  <option value="">Select Zone</option>
			<?php
			if(is_array($zonelist) && count(array_filter($zonelist))>0)
			{
				foreach($zonelist as $row)
				{
					echo '<option value="' . $row->fld_id . '">' . $row->fld_name . '</option>';
				}
			}
			?> 
		  </select>
		  </td>
         </tr>   
		<tr>
          <td><label>Outlet:</label></td>
          <td>
		  <select name="outletid" id="outletid">
		  <option value="0">Select Outlet</option>
			<?php
			if(is_array($outletlist) && count(array_filter($outletlist))>0)
			{
				foreach($outletlist as $row)
				{
					echo '<option value="' . $row->fld_id . '">' . $row->fld_name . '</option>';
				}
			}
			?> 
		  </select>
		  </td>
         </tr>   
         <tr>
          <td><label>Select File (.xlsx):</label></td>
          <td><input type="file" name="importfile" id="importfile"  required="required"></td>
         </tr>
         <tr>
          <td><label>Select Task:</label></td>
          <td>
			  <label class="container-checkbox horzbox">
				<input type="checkbox" name="taskproduct" id="taskproduct" value="yes" class="nxtinput"/>Products
				<span class="checkmark leftchkbx"></span>
				</label>
				<span class="mr-2"></span>
          
			  <label class="container-checkbox horzbox">
				<input type="checkbox" name="taskstock" id="taskstock" value="yes" class="nxtinput"/>Purchase/Stock
				<span class="checkmark leftchkbx"></span>
				</label>
				<span class="mr-2"></span>
          
			  <label class="container-checkbox horzbox">
				<input type="checkbox" name="taskprice" id="taskprice" value="yes" class="nxtinput"/>Pricing
				<span class="checkmark leftchkbx"></span>
				</label>
          
          </td>
         </tr>
		 <tr>
             <td></td>
             <td><button class="btn btn-success" id="submit">Import</button></td>
         </tr>
         </table>
         </form> 
	         <div class="clearfix"></div>          
        </div>
        </div>
        
       </div>

<script>
function checkform()
{
	if($('#taskproduct').is(":checked")==false && $('#taskstock').is(":checked")==false && $('#taskprice').is(":checked")==false)
	{
		alert("Please select task to proceed!");
		return false;
	}
	else
	{
		return true;
	}
}
</script>
