<?

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


if ($mode == "update") {

			$columns = array();
			$values = array();
			
			$columns[] = "cfg_autoflag";
			$columns[] = "cfg_autocnt";
			$columns[] = "cfg_autopercent";
			$columns[] = "cfg_listcnt";
			$columns[] = "cfg_forecastcnt";
			$columns[] = "cfg_drivercnt";

			$values[] = $cfg_autoflag;
			$values[] = $cfg_autocnt;
			$values[] = $cfg_autopercent;
			$values[] = $cfg_listcnt;
			$values[] = $cfg_forecastcnt;
			$values[] = $cfg_drivercnt;

			$jdb->uQuery("tbl_config", $columns, $values, " where cfg_uid = 1 ");
			$msg = "Updated successfully.";
			$func -> modalMsg ($msg, "/index_intranet.php?view=$view");
			exit();
}


$query = "SELECT * FROM tbl_config WHERE cfg_uid = 1 ";
$result = $jdb->fQuery($query, "query error");

// No data
if ($result[0] =="") {
	$msg = "Invaild data. Please try again.";
	$func -> modalMsg ($msg, "/index_intranet.php?view=customer_list");
	exit();
}

//echo "[$query]";
for($i=0; $i<sizeof($result); $i++) {
	//list($key, $value) = each($result);
	foreach ( (Array) $result as $key => $value )		
	$$key = $value;
}

?>

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

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

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

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

    <section class="page">


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

				<FORM NAME=forecast id=forecast class="form-config-number-search" METHOD=POST ACTION=/index_intranet.php >
				<input type=hidden name=view value="configure">
				<input type=hidden name=mode value="update">
				<input type=hidden name=actionStr value="CONFIGURE">
          	
            <table class="td-search">
              <tr>
                <td>
                  <span class="config-icon-box"><i class="bi bi-arrow-right"></i></span>Normal Page List
                </td>
                <td>               
                   <input class="customerPageList" type="number" id="cfg_listcnt" name="cfg_listcnt" value="<?=$cfg_listcnt?>" maxlength="3" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" placeholder="100">
                </td>
              </tr>

              <tr>
                <td>
                  <span class="config-icon-box"><i class="bi bi-arrow-right"></i></span>Forecast Page (Order) List
                </td>
                <td>               
                   <input class="ForecastPageList" type="number" id="cfg_forecastcnt" name="cfg_forecastcnt" value="<?=$cfg_forecastcnt?>" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" maxlength="3" placeholder="500">
                </td>
              </tr>

              <tr>
                <td>
                  <span class="config-icon-box"><i class="bi bi-arrow-right"></i></span>Forecast Page (Driver) List
                </td>
                <td>               
                   <input class="ForecastPageList" type="number" id="cfg_drivercnt" name="cfg_drivercnt" value="<?=$cfg_drivercnt?>" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" maxlength="3" placeholder="500">
                </td>
              </tr>
              
              <tr>
                <td>
                  <span class="config-icon-box"><i class="bi bi-arrow-right"></i></span>Forecast Cycle 
                </td>
                <td>
                	 <input TYPE='radio' NAME='cfg_autoflag' value="Y" id="cfg_autoflagyes" <?if($cfg_autoflag=="Y") echo"checked";?>> Yes 
                	 &nbsp;&nbsp;&nbsp;
                   <input TYPE='radio' NAME='cfg_autoflag' value="N" id="cfg_autoflagno" <?if($cfg_autoflag=="N") echo"checked";?>> No
                </td>
              </tr>

              <tr>
                <td>
                  <span class="config-icon-box"><i class="bi bi-arrow-right"></i></span>Cycle Condition : Count
                </td>
                <td>   
									<input class="ForecastRate" type="number" id="cfg_autocnt" name="cfg_autocnt" value="<?=$cfg_autocnt?>"oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"  maxlength="3" placeholder="25">
                </td>
              </tr>

              <tr>
                <td>
                  <span class="config-icon-box"><i class="bi bi-arrow-right"></i></span>Cycle Condition : Percent (%)
                </td>
                <td>               
                   <input class="ForecastRate" type="number" id="cfg_autopercent" name="cfg_autopercent" value="<?=$cfg_autopercent?>" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" maxlength="3" placeholder="25">
                </td>
              </tr>

              <tr>
                <td></td>
                <td>               
                  <div class="text-center"><button class="btn-sub" type="submit">UPDATE</button></div>
                </td>
              </tr>
           
            </table>
            
  
          </form>

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


    </section>

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