<?php 
	include("../../php_crud/my_class.php");
	$obj=new my_class();
	extract($_POST);

	$row_id = $_REQUEST['row_num'];
    $r_id = "id_$row_id";
    $d_id = "depth_$row_id";
    $m_id = "mate_$row_id";
    $q_id = "qunt_$row_id";
    $c_id = "col_$row_id";
    $date_row_id = "date_row_$row_id";
    $after_note_col_id = "";
    $next_row_val = $row_id + 1;
    $after_note_col_id = "date_$next_row_val";
    $call_key_up_function = "call_next_val_loader(event,'$d_id','$m_id')";


?>

<tr>
            <th style="text-align: center;">
                <input type="hidden" id="<?php echo $r_id;?>" value = "">
                <input type="text" id="<?php echo $d_id; ?>" class="input-mini month_date depth" 
                style="text-align: center;font-weight:bold; width: 60%;" value=""/>
            </th>
            <th style="text-align: left;">
                <select id="<?php echo $m_id; ?>" name="material" class="chosen-select" style="width: 98%;">
                    <option value="">---SELECT---</option>
                    <?php
                    $table_name = 'LITHO_CODE_TBL';
                    $columns = 'DISTINCT MATERIAL_CODE';
                    $where_cond = '1=1 ORDER BY MATERIAL_CODE ASC';

                    foreach($obj->View_colmn_By_Cond_hydro($table_name,$columns,$where_cond) as $material_list){
                        echo '<option value="'.$material_list['MATERIAL_CODE'].'">'.$material_list['MATERIAL_CODE'].'</option>';
                        
                    }
                    ?>
                </select>
            </th> 
            <th style="text-align: left;">
                <select id="<?php echo $q_id; ?>" name="quantity" class="chosen-select" style="width: 98%;">
                    <option value="">---SELECT---</option>
                    <?php
                    $table_name = 'LITHO_QTY_TBL';
                    $columns = 'DISTINCT QUANTITY, QTY_CODE';
                    $where_cond = '1=1 ORDER BY QTY_CODE ASC';

                    foreach($obj->View_colmn_By_Cond_hydro($table_name,$columns,$where_cond) as $quantity_list){
                        echo '<option value="'.$quantity_list['QTY_CODE'].'">'.$quantity_list['QUANTITY'].'</option>';
                        
                    }
                    ?>
                </select>
            </th> 
            <th style="text-align: left;">
                <select id="<?php echo $c_id; ?>" name="color" class="chosen-select" style="width: 98%;">
                    <option value="">---SELECT---</option>
                    <?php
                    $table_name = 'COLOR_TBL';
                    $columns = 'DISTINCT COLOR';
                    $where_cond = '1=1 ORDER BY COLOR ASC';

                    foreach($obj->View_colmn_By_Cond_hydro($table_name,$columns,$where_cond) as $color_list){
                        echo '<option value="'.$color_list['COLOR'].'">'.$color_list['COLOR'].'</option>';
                        
                    }
                    ?>
                </select>
            </th> 
            <td style="text-align: center;">
                <?php
                  if($_SESSION['delete'] == 'Y'){
                    echo '&nbsp;<button class="btn btn-minier btn-danger" type="button" onclick = "delete_data('.$row_id.')">
                    <i class="icon-trash"></i> <b style="font-size: 12px;">Delete</b></button>';
                  }
                ?>
            </td>
        </tr>

<script>
$('.chosen-select').chosen({allow_single_deselect:true}); 
	//resize the chosen on window resize

	$(window)
	.off('resize.chosen')
	.on('resize.chosen', function() {
		$('.chosen-select').each(function() {
			 var $this = $(this);
			 $this.next().css({'width': '98%'});
		})
	}).trigger('resize.chosen');
	//resize chosen on sidebar collapse/expand
	$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
		if(event_name != 'sidebar_collapsed') return;
		$('.chosen-select').each(function() {
			 var $this = $(this);
			 $this.next().css({'width':  '98%'});
		})
	});
</script>
