<div class="table-form-admin-contein">
<button onclick="date='<?php echo $prev_date; ?>'; getHome(<?php echo $category_id; ?>);" class="btn btn-primary">Назад</button>
<button onclick="date='<?php echo $next_date; ?>'; getHome(<?php echo $category_id; ?>);" class="btn btn-primary">Вперед</button>
<input type="text" style="width:100px;display: block;float: right;" id="chdate" value="<?php echo $today; ?>" data-date-format="YYYY-MM-DD" class="date form-control" onchange="date=$('#chdate').val(); getHome(<?php echo $category_id; ?>);">
<script>
$('#chdate').datepicker({
    firstDay: 1,
    dateFormat: "yy-mm-dd",
    dayNamesMin: [ "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб" ],
    monthNames: [ "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" ]
});
//-->
</script>



<head>
        <title>FixedHeaderTable Test</title>
        
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        
        
      
<link href="https://book.villa-milana.com.ua/catalog/view/theme/default/template/product/scripttable/css/custom.css" rel="stylesheet" media="screen" />
        

     
        



<script type="text/javascript">
            /* <![CDATA[ */
            $(document).ready(function() {
                $('#myDemoTable').fixedHeaderTable({ 
footer: true,
cloneHeadToFoot: true,
altClass: 'odd',
autoShow: true
});
            });
 
            /* ]]> */
        </script>
        
        <style type="text/css">
        </style>
        
    </head>
  



  <body>





<div class="table-fix-contain">
    <div class="table-fix-head">
        <div class="outerbox">
            <div class="innerbox">
                <table  border="1" class="table-form-admin table-td-width bluetable" id="myDemoTable" cellpadding="0" cellspacing="0">
        		    <thead>
<tr>


        <td class="form-td">
Товар...</td>

        <?php foreach($days as $key => $day){ ?>
        <?php if($day['date_'] == $today2) { ?>
        <td style="background: yellow;"><?php echo $week[$day['week']].' '.$day['datpmc']; ?></td>
        <?php } else { ?>
        <td><?php echo $week[$day['week']]; ?> <?php echo$day['datpmc']; ?></td>
        <?php } ?>
        <?php } ?>
</tr>
        </thead>
        <tbody>

    





    <?php foreach($products as $product){ ?>
    <tr>
        <td class="form-td">
            <?php echo $product['name']; ?>
        </td>
        <?php foreach($days as $i=>$day){  
		if ($product['booking'] != '') { 
		
		$datsys = explode("/", $day['date_']);
		$dats=$datsys[2]."-".$datsys[1]."-".$datsys[0];
		$colorys = '';
		foreach($product['booking']  as $booking) 
		{ 
		if ( $booking['booking_date'] == $dats ) { $colorys = '+++'; 			} 
		}
				}		
		?>
            <td onclick="getDay(<?php echo $product['product_id'] ?>,'<?php echo  $day['date'];  ?>',this);" class="table-form-quantity <?php if($colorys != '' ) echo 'not-available-td' ?>">
                
            </td>
        <?php } ?>
    </tr>
    <?php }?>
    </tbody>
</table>
        </div><!-- innerbox -->
        	<div class="clear"></div>
		   
    		</ul>
        </div><!-- outerbox -->
 





   </body>

<div id="view" style="display: none;">
    <div class="close" onclick="$('#view').hide();"></div>
</div>




<style>

      table thead,
    table  tbody
    {
        display:block;
    }

    table  tbody
    {
        overflow: auto;
        height:410px;
    }
 table  td
    {
        width:150px;
    }
 .table-fix-head{
        margin-right: 17px;

     }
    .table-fix-body{
        height: 500px;
        overflow-y: auto;
    }
    .table-td-width tr td{
        min-width: 39px;
    text-overflow: clip;
        padding: -15px 15px;
    }

    .price span{
        font-size: 12px;
    line-height: 1.0 !important;
    }
    .form-td{
        font-weight: bold;
        width: 205px;
    }
    .table-form-admin tr td,
    #view2 tr td{
        padding: -15px 15px;
 text-overflow: clip;
    }

    .table-form-quantity {
        background-color: #f1f1f1;
        font-size: 14px;
        text-align: center;
        width: 115px;
    }

    .table-form-admin thead tr td {
        font-weight: bold;
 text-overflow: clip;
    }

    .table-form-admin {
        width: 100%;
    }

    .table-form-admin-contein {
        //overflow-y: auto;
        max-height: 500px;
    }

    .table-form-admin-contein.table2-contein{
        max-height: 400px;
    }

    .table-form-admin-contein button {
        margin-bottom: 20px;
    }

    .close {
        position: absolute;
        top: 0;
        right: 0;
        width: 30px;
        height: 25px;
        color: #333;
        text-align: center;
        text-shadow: none;
        padding: 4px 0;
    }

    #view {
        position: fixed;
        top: 7% !important;
        left: 4% !important;
        right: 10% !important;
        min-width: 800px;
        min-height: 100px;
        background: #ffffff;
        z-index: 99 !important;
        box-shadow: 0 0 10px #909090;
        padding: 5px;
        max-width: 100% !important;
        max-height: 100% !important;
        width: 1300px;
    }

    #view2 {
        z-index: 999 !important;
        top: 17% !important;
        left: 25% !important;
        right: 25% !important;
        min-width: 800px;
        max-width: 100% !important;
    }

    #view2 .btn{
        margin-top: 20px;
    }
    .not-available-td{
        background: #f56b6b!important;
        color: #fff;
    }
    .selected{
        background: #75a74d !important;
        color: #fff;
    }

    .not-available-td.selected{
        background: #75a74d !important;
    }
    @media (min-width: 1010px) and (max-width: 1260px) {
        .table-td-width tr td {
            min-width: 89px;
            width: 104px;
            padding: 10px 5px;
        }
        #view{
            width: 900px;
        }
    }

    @media (min-width: 992px) and (max-width: 1009px) {
        .table-td-width tr td {
            min-width: 79px;
            width: 74px;
            padding: 10px 0;
            text-align: center;
        }
        #view{
            width: 760px;
        }
    }
    @media (max-width: 991px){
        .table-fix-body {
            overflow-y: visible;
        }
        .table-fix-contain{
            overflow: auto;
        }
    }
</style>

<script>
    function getDay(product_id,day,lm) {
        $(lm).addClass('selected');
        $.ajax({
            type: "GET",
            url: 'index.php?route=sale/order/getDay2',
            data:{ 'product_id': product_id,'day':day,'token':"<?php echo $token; ?>" },
            dataType: 'json',
            success: function(json) {

                $('#view2').html(json.html);
                $('#view2').show();
            }
        });
    }

</script>


