<?php $this->view('ajax_loading_v'); ?>
<script type="text/javascript">
    $(function(){
        $("#start_date").mask("99/99/9999");
        $("#end_date").mask("99/99/9999");
    });
    
    function preview(){
        var ret = '';
        if($('#start_date').val()==''){
            ret+='กรอกข้อมูล จากวันที่จอง \n';
        }
        if($('#end_date').val()==''){
            ret+='กรอกข้อมูล วันที่ถึง \n';
        }
        
        if(ret==''){
            $('#myform').submit();
        }else{
            alert(ret);
        }
        
        return false;
    }
</script>
<div class="textbox">
    <div class="toolbar">
        <div class="pull-left title"><?php echo $page_title; ?></div>
        <div class="pull-right">
            <a href="#" onclick="return preview();" class="btn"><i class='icon-print'></i> แสดงรายงาน</a>
            <?php echo anchor('report', "<i class='icon-remove-circle'></i> ปิด", array('class' => 'btn')); ?>
        </div>
        <div class="clear"></div>
    </div>
    <div class="textbox_content">
        <?php echo form_open('rpt_roombooking/preview/', array('class' => 'form-inline', 'style' => 'margin-bottom:4px', 'id' => 'myform', 'target' => '_blank')); ?>
        <table border="0" cellpadding="4" cellspacing="1" class="tblform">
            <tbody>
                <tr>
                    <td width="100" class="td1">จากวันที่จอง :</td>
                    <td>
                        <div class="input-append">
                            <input type='text' id='start_date' name='start_date' style="width:100px" value="<?php echo $start_date; ?>" class="required"/>
                            <span class="btn" type="button" id="cal_start_date" tabindex="-1"><i class="icon-calendar"></i></span>
                            <script type="text/javascript">
                                Calendar.setup({
                                    inputField    : "start_date",
                                    button        : "cal_start_date",
                                    ifFormat    : "%d/%m/%Y"
                                });
                            </script>
                        </div>&nbsp;&nbsp;
                        <b>ถึง</b>&nbsp;&nbsp;
                        <div class="input-append">
                            <input type='text' id='end_date' name='end_date' style="width:100px" value="<?php echo $end_date; ?>" class="required"/>
                            <span class="btn" type="button" id="cal_end_date" tabindex="-1"><i class="icon-calendar"></i></span>
                            <script type="text/javascript">
                                Calendar.setup({
                                    inputField    : "end_date",
                                    button        : "cal_end_date",
                                    ifFormat    : "%d/%m/%Y"
                                });
                            </script>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="td1">รูปแบบรายงาน :</td>
                    <td>
                        <select name="rptstyle" style="width:140px">
                            <option value="0">PDF</option>
                            <option value="1">Excel</option>
                        </select>
                    </td>
                </tr>
            </tbody>
        </table>
        <?php echo form_close(); ?>
    </div>
</div>