<?

// Level 6 이하만 사용 가능
$func->checkLevelModal(7);



//////////////////////////////////
// EXPORT - OIL HISTORY
//////////////////////////////////

$oil_cnt = 2;
//$oilSTR = "<tr>";
foreach ($oilhistoryArray AS $key=>$value)
{
	//echo "[$key][$value]";   => [0][Waiting][1][Confirmed][E][Declined]...
	
	if ($oil_cnt%4 == 0) $divideSTR = "</tr><tr>";
	else $divideSTR = "";
	
	if ($key == "c_accountno" || $key == "d_inputdate" || $key == "d_quantity") $disableTAG = "disabled";
	else $disableTAG = "";
	
	$oilSTR .= "
                  <td>
                  <label class=\"container-chk\">".$value."
                    <input type=\"checkbox\" name=\"export_oil[]\" id='oil_".$key."' value=\"".$key."\" checked=\"checked\" $disableTAG>
                    <span class=\"checkmark\"></span>
                  </label>
                  </td>".$divideSTR;
	$oil_cnt++;
}
$oilSTR .= "</tr>";


$todayDate = date("Y-m-d");
$thisMonth = date("Y-m")."-01";

?>


<script type="text/javascript">
$(document).ready(function(){

		$("#checkboxalloil").click(function () {
		   $('#checkboxoil input:checkbox:not(:disabled)').not('this').prop('checked', this.checked);
		});
		
		$('#oil_period_from, #oil_period_to').datepicker({ 

						dateFormat: 'yy-mm-dd',
										//minDate: "-10D", 
										//maxDate: "+1M",
										//maxDate: "+1M +10D",
			              //showOn: "button",
			              //yearRange: '-50:+5',
			              buttonImage: "/images/cal_red.png",
			              //beforeShowDay: $.datepicker.noWeekends,
			              buttonImageOnly: true,
			              //showOn: "both",
			              changeMonth: true,
			              changeYear: true,
			              firstDay: 7              
		});


		$("#exportoil").submit(function() {
		    $("input").removeAttr("disabled");
		});		


});
</script>



  <main id="main" class="main">

    <!-- ======= Breadcrumbs ======= -->
    <div class="breadcrumbs">
      <div class="container">

        <div class="d-flex justify-content-between align-items-center">
          <h2>EXPORT</h2>
          <ol>
            <li><a href="index.html">HOME</a></li>
            <li>CONFIGURATION</li>
            <li>EXPORT</li>
          </ol>
        </div>

      </div>
    </div><!-- End Breadcrumbs -->

		<section class="page">
			
      <div class="container" data-aos="fade-up">

        <div class="h3-title-section"> 
             <br><h3><span style="color:var(--color-primary);">OIL HISTORY</span> Data</h3>
        </div>

				<FORM NAME=exportoil id=exportoil class="form-config-search" METHOD=POST ACTION=/doc/export_process.php >
				<input type=hidden name=mode value="export">
				<input type=hidden name=actionStr value="OILHISTORY">
				
          <table id="checkboxoil" class="td-search checkboxoilclass">
            <tr>
              <td>
                <span class="txt-period" >Period</span>
                <input class="txt-first-period-input" type="text" id="oil_period_from" name="oil_period_from" value="<?=$thisMonth?>" placeholder="2023-04-01" readonly> ~ 
                <input type="text" id="oil_period_to" name="oil_period_to" value="<?=$todayDate?>" placeholder="2023-04-31" readonly>
              </td>

<?=$oilSTR?>

<!--
              <td>
                <label class="container-chk">Account No
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>

              <td>
                <label class="container-chk">Account Status
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>

              <td>
                <label class="container-chk">Restaurant Name
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>
            </tr>

            <tr>
              <td>
                <label class="container-chk">Driver
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>
                          	
              <td>
                <label class="container-chk">Address
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>

              <td>
                <label class="container-chk">Payment
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>

              <td>
                <label class="container-chk">Payment Cycle
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>

            </tr>



            <tr>

              <td>
                <label class="container-chk">Payable To
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>
                          	
              <td>
                <label class="container-chk">Mailing Address
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>

              <td>
                <label class="container-chk">Pickup Date
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>

              <td>
                <label class="container-chk">Oil Quantity
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>

            </tr>


            <tr>

              <td>
                <label class="container-chk">Paid (Cash)
                  <input type="checkbox" checked="checked">
                  <span class="checkmark"></span>
                </label>
              </td>
                          	
              <td>
              </td>

              <td>
              </td>

              <td>
              </td>
            </tr>
-->


            <tr>
              <td colspan="2"></td>
              <td>
                <label class="container-chk">Select All 
                    <input type="checkbox" name="checkboxalloil" id="checkboxalloil" checked="checked" value="1">
                    <span class="checkmark"></span>    
                </label>
              </td>
              <td>
              	<div class="text-center"><button class="btn-sub" type="submit">CSV DOWNLOAD</button></div>

              </td>
            </tr>
          </table>
          

        </FORM>

    </div><!--container Ends-->





        

    </section>

  </main><!-- End #main -->