<?php include('header.php');?>

    <script type="text/javascript"><?php echo 'var global_frequency_type = '.$schedule_data['repeat_frequency'];?></script>
    <script type="text/javascript"><?php echo 'var global_delete_type = '.$schedule_data['delete_type'];?></script>
    <main id="dashboard">
        <div class="container">
            <div class="row">

                <div class="col-md-10 col-sm-8">

                    <div class="page-title">
                        <h1><strong> Select Schedule Options </strong> </h1>
                    </div>

                </div>
<!--
                <div class="col-md-2 col-sm-4 text-right">
                    <a href="<?php echo baseUrl('addnew.php');?>" class="btn btn-lg btn-success btn-block">Add New <i class="fa fa-plus"></i> </a>
                </div>
-->
            </div>
            <br>

            <div class="row">
                <div class="col-sm-12 errors_block">
                </div>
            </div>

            <br>

            <div class="row">
                <div class="col-sm-12">

                    <div class="form-group clearfix">
                        <label for="" class="label-control col-sm-2 pts">When to post</label>

                        <div class="col-sm-3 mbm">
                            <input name="datefrom" type="text" value="<?php echo $schedule_data['datefrom'];?>" placeholder="Date picker" class="btn btn-default btn-block date_picker">
                        </div>

                        <div class="col-sm-3 mbm">
                            <input name="timefrom" type="text" value="<?php echo $schedule_data['timefrom'];?>" placeholder="Time picker" class="btn btn-default btn-block time_picker">
                        </div>
                    </div>

                    <div class="form-group clearfix">

                        <label for="" class="label-control col-sm-2 pts">Repeat Search</label>

                        <div class="col-sm-1">
                            <div class="checkbox">
                                <label class="checkbox-swith" id="repeat_search">
                                    <input type="checkbox" value="<?php echo $schedule_data['is_repeat'];?>" id="repeat-swith-1">
                                    <span id="swith-1" class="swith <?php echo ($schedule_data['is_repeat']) ? 'checked' : ''?>">
                                        <span class="off">OFF</span>
                                        <span class="on">ON</span>
                                    </span>
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group clearfix is_repeat" id="repeat_options" style="<?php echo (!$schedule_data['is_repeat']) ? 'display:none' : '';?>">
                        <label for="" class="label-control col-sm-2 pts">Repeat Option</label>

                        <div class="col-sm-10">
                            <div class="btn-group">
                                <button type="button" data-id="<?php echo $schedule_data['repeat_frequency'];?>" class="btn btn-gray dropdown-toggle" data-toggle="dropdown">
                                    <span class="repeat_frequency"><?php echo $schedule_data['frequency_types'][$schedule_data['repeat_frequency']];?></span> <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu" role="menu">
                                    <?php foreach($schedule_data['frequency_types'] as $key => $type) { ?>
                                        <li data-id="<?php echo $key;?>" class="<?php echo ($key == $schedule_data['repeat_frequency']) ? 'active' : '';?> repeat_frequency"><a class="repeat_frequency" data-id="<?php echo $key;?>" href="#"><?php echo $type;?></a></li>
                                    <?php } ?>
                                </ul>
                            </div>
                        </div>
                    </div>

                    <div class="form-group clearfix is_repeat" id="repeat_weekdays" style="<?php echo (!$schedule_data['is_repeat'] || $schedule_data['repeat_frequency'] != 2) ? 'display:none' : '';?>">
                        <label for="" class="label-control col-sm-2 pts">Repeat Weekdays</label>

                        <div class="col-sm-10">
                            <button type="button" data-id="1" class="btn btn-gray btn-sm weekdays_btn <?php echo (in_array(1,$schedule_data['weekdays'])) ? 'btn-success' : '';?>">Su</button>
                            <button type="button" data-id="2" class="btn btn-gray btn-sm weekdays_btn <?php echo (in_array(2,$schedule_data['weekdays'])) ? 'btn-success' : '';?>">Mo</button>
                            <button type="button" data-id="3" class="btn btn-gray btn-sm weekdays_btn <?php echo (in_array(3,$schedule_data['weekdays'])) ? 'btn-success' : '';?>">Tu</button>
                            <button type="button" data-id="4" class="btn btn-gray btn-sm weekdays_btn <?php echo (in_array(4,$schedule_data['weekdays'])) ? 'btn-success' : '';?>">We</button>
                            <button type="button" data-id="5" class="btn btn-gray btn-sm weekdays_btn <?php echo (in_array(5,$schedule_data['weekdays'])) ? 'btn-success' : '';?>">Th</button>
                            <button type="button" data-id="6" class="btn btn-gray btn-sm weekdays_btn <?php echo (in_array(6,$schedule_data['weekdays'])) ? 'btn-success' : '';?>">Fr</button>
                            <button type="button" data-id="7" class="btn btn-gray btn-sm weekdays_btn <?php echo (in_array(7,$schedule_data['weekdays'])) ? 'btn-success' : '';?>">Sa</button>
                        </div>
                    </div>

                    <div class="form-group clearfix is_repeat" id="repeat_until" style="<?php echo (!$schedule_data['is_repeat']) ? 'display:none' : '';?>">
                        <label for="" class="label-control col-sm-2 pts">Repeat Untill</label>

                        <div class="col-sm-3 mbm">
                            <input name="untildate" type="text" value="<?php echo $schedule_data['untildate'];?>" placeholder="Date picker" class="btn btn-default btn-block date_picker">
                        </div>

                        <div class="col-sm-3 mbm">
                            <input name="untiltime" type="text" value="<?php echo $schedule_data['untiltime'];?>" placeholder="Time picker" class="btn btn-default btn-block time_picker">
                        </div>
                    </div>

                    <div class="form-group clearfix is_repeat" id="repeat_delay" style="<?php echo (!$schedule_data['is_repeat'] || $schedule_data['repeat_frequency'] != 4) ? 'display:none' : '';?>">
                        <label for="" class="label-control col-sm-2 pts">Repeat Dalay</label>

                        <div class="col-sm-3">
                            <input name="repeat_delay" type="text" value="<?php echo $schedule_data['repeat_delay'];?>" placeholder="Dalay time" class="btn btn-default btn-block">
                        </div>
                    </div>

                    <div class="form-group clearfix">

                        <label for="" class="label-control col-sm-2 pts">Auto Delete</label>

                        <div class="col-sm-1">
                            <div class="checkbox">
                                <label class="checkbox-swith" id="auto_delete">
                                    <input type="checkbox" id="repeat-swith-2" value="<?php echo $schedule_data['auto_delete'];?>">
                                    <span id="swith-2" class="swith <?php echo ($schedule_data['auto_delete']) ? 'checked' : ''?>">
                                        <span class="off">OFF</span>
                                        <span class="on">ON</span>
                                    </span>
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group clearfix is_delete" id="delete_options" style="<?php echo (!$schedule_data['auto_delete']) ? 'display:none' : '';?>">
                        <label for="" class="label-control col-sm-2 pts">Auto Delete Option</label>

                        <div class="col-sm-10">
                            <div class="btn-group">
                                <button type="button" data-id="<?php echo $schedule_data['delete_type'];?>" class="btn btn-gray dropdown-toggle" data-toggle="dropdown">
                                    <span class="delete_options"><?php echo $schedule_data['delete_options'][$schedule_data['delete_type']];?></span> <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu" role="menu">
                                    <?php foreach($schedule_data['delete_options'] as $key => $type) { ?>
                                        <li data-id="<?php echo $key;?>" class="<?php echo ($key == $schedule_data['delete_type']) ? 'active' : '';?> delete_options"><a class="delete_options" data-id="<?php echo $key;?>" href="#"><?php echo $type;?></a></li>
                                    <?php } ?>
                                </ul>
                            </div>
                        </div>
                    </div>

                    <div class="form-group clearfix is_delete" id="delete_date" style="<?php echo (!$schedule_data['auto_delete'] || $schedule_data['delete_type'] == 1) ? 'display:none' : '';?>">
                        <label for="" class="label-control col-sm-2 pts">Auto Delete At</label>

                        <div class="col-sm-3 mbm">
                            <input name="deletedate" type="text" value="<?php echo $schedule_data['deletedate'];?>" placeholder="Date picker" class="btn btn-default btn-block date_picker">
                        </div>

                        <div class="col-sm-3 mbm">
                            <input name="deletetime" type="text" value="<?php echo $schedule_data['deletetime'];?>" placeholder="Time picker" class="btn btn-default btn-block time_picker">
                        </div>
                    </div>


                    <div class="form-group clearfix is_delete" id="delete_after" style="<?php echo (!$schedule_data['auto_delete'] || $schedule_data['delete_type'] == 2) ? 'display:none' : '';?>">
                        <label for="" class="label-control col-sm-2 pts">Auto Delete After</label>

                        <div class="col-sm-3">
                            <input name="delete_delay" type="text" value="<?php echo $schedule_data['delete_after'];?>" placeholder="Auto delete after" class="btn btn-default btn-block">
                        </div>
                    </div>



                </div>
            </div>

            <br>
            <br>

            <div class="row">

                <div class="col-md-10 col-sm-8">

                </div>

                <div class="col-md-2 col-sm-4 text-right">
                    <a href="#" id="next_step5" class="btn btn-lg btn-success btn-block">Next <i class="fa fa-hand-o-right"></i> </a>
                </div>
            </div>

        </div>
    </main>

    <script src="<?php echo assetsPath();?>js/schedule.js?v=1"></script>
<?php include('footer.php');?>