<?php 
include('inc/header.php');
include('inc/sidebar.php');
$manage_service = new website();
@$edit_id = (int)$_GET['edit'];
if(isset($_REQUEST['submit']) && $edit_id==0)
{
    $manage_service->add_service($_POST);
}
if(isset($_POST['submit']) && $edit_id!=0)
{
    $manage_service->update_service($_POST,$edit_id);
}
if($edit_id!=0)
{
    $get_service_info = $manage_service->fetch_rows("tbl_service","where id=$edit_id");

    
} 

?>



<div class="container">


 <div class="row">
                        <div class="col-xl-7 mx-auto">

                            <h6 class="mb-0 text-uppercase">Class Form</h6>
                            <hr/>
                            
                            <div class="card border-top border-0 border-4 border-primary">
                                <div class="card-body p-5">
                                    <div class="card-title d-flex align-items-center">
                                        <div><i class="fa fa-ticket"></i>
                                        </div>
                                        <h5 class="mb-0 text-primary">Add Class</h5>

                                    </div>

                                    <hr>
                                  <form method="post" enctype="multipart/form-data">
                            <div class="row"> 


                          <!--       <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Select Main Page*</label>
                                        <select name="category_id" class="selectpicker form-control " data-style="py-0" required="" data-live-search="true" >

                                            <option value="">Plese Select</option>
                                             -->
                                            <?php
                                        // $category_list = $manage_service->view_list("tbl_category","status = '1'","limit 500");
                                        // $sr=0;
                                        // for($i=0;$i<sizeof($category_list);$i++)
                                        // {
                                            
                                        //     $sr++;
                                        ?>
                                                    <!--     <option value="<?=$category_list[$i]['id']?>" <?php if(@$get_service_info['category_id']==$category_list[$i]['id']) echo 'selected'; ?>><?=$category_list[$i]['title']?></option> -->
                                                   <?php
                                                    // }
                                                    ?>
                                       <!--  </select>
                                    </div> 
                                </div>  -->
                             
                            
                             <!--<div class="col-md-12">-->
                             <!--       <div class="form-group">-->
                             <!--           <label>Header Slider</label>-->
                             <!--           <input type="file" class="form-control image-file" name="header_image" <?php if($edit_id==0) echo 'required'; ?>>-->
                             <!--       </div>-->
                                    <?php
                                    // if($edit_id!=0)
                                    // {
                                    //     if($get_service_info['header_image']!='')
                                    //     {
                                            ?>
                                            <!--<img src="../images/main_img/<?=$get_service_info['header_image']?>" style="height:100px;width:100px; ">-->
                                            <?php
                                    //     }
                                    // }
                                    ?>
                                <!--</div>-->
                            <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Title *</label>
                                        <input type="text" class="form-control" placeholder="Enter Title" required name="title" id="title" value="<?=$get_service_info['title']?>">

                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Metakey*</label>
                                        <textarea type="text" class="form-control" placeholder="Enter Metakey Here" name="metakey"><?=$get_service_info['meta_keyword']?></textarea>
                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div> 
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Meta Description</label>
                                        <textarea type="text" class="form-control" placeholder="Enter Meta Description Here" name="metadesc"><?=$get_service_info['meta_description']?></textarea>
                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>  
                                 <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Age *</label>
                                        <input type="text" class="form-control" placeholder="Enter Student Age"  name="age" id="age" value="<?=$get_service_info['age']?>">

                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>
                                 <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Time *</label>
                                        <input type="text" class="form-control" placeholder="Enter Timing"  name="time" id="time" value="<?=$get_service_info['time']?>">

                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>
                                 <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Capacity *</label>
                                        <input type="text" class="form-control" placeholder="Enter Capacity"  name="capacity" id="capacity" value="<?=$get_service_info['capacity']?>">

                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>
                                 <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Description</label>
                                        <textarea type="text" class="form-control" placeholder="Enter Description" id="editor" name="description"><?=$get_service_info['description']?></textarea>
                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>   
                                
                                 <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Youtube Video Link *</label>
                                        <input type="text" class="form-control" placeholder="Enter Youtube Link"  name="youtube_link" id="title" value="<?=$get_service_info['youtube_link']?>">

                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>
                                
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Image</label>
                                        <input type="file" class="form-control image-file" name="image">
                                    </div>
                                    <?php
                                    if($edit_id!=0)
                                    {
                                        if($get_service_info['image']!='')
                                        {
                                            ?>
                                            <img src="../images/main_img/<?=$get_service_info['image']?>" style="height:100px;width:100px; ">
                                            <?php
                                        }
                                    }
                                    ?>
                                </div>
                                                     
                            </div>   
                            
                            <br> 
                            <button type="submit" class="btn btn-primary mr-2" name="submit">Submit</button>
                            <button type="reset" class="btn btn-danger">Reset</button>



                        </form>
                                </div>
                            </div>
                           
                        </div>
                    </div>

 
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">

$("#mobile_no").on("keypress", function(evt) {
  var keycode = evt.charCode || evt.keyCode;
  if (keycode == 46) {
    return false;
  }
});
 

    CKEDITOR.replace('editor', {
        filebrowserUploadUrl: 'ck_upload.php',
        filebrowserUploadMethod: 'form'
    });
    /*CKEDITOR.replace('editor2', {
        filebrowserUploadUrl: 'ck_upload.php',
        filebrowserUploadMethod: 'form'
    });
    */
    
    </script>
 <?php 
include "inc/footer.php";
    ?>

