<?php 
  $userDetails = $this->session->userdata('isUserLoggedIn');
    $query = $this->db->select('*')->where('id',$menu_id)->get('hotel_menu');
    $menuName = $query->result_array();
    $menuName = $menuName[0];
      // echo "<pre>"; print_r($menuName); die();
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<main id="js-page-content" role="main" class="page-content">
    <ol class="breadcrumb page-breadcrumb">
        <li class="breadcrumb-item"><a href="javascript:void(0);">Dashboard</a></li>
        <li class="breadcrumb-item active"><?php echo $menuName['fsTitle']; ?>  Facilitates Form</li>
        <li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
    </ol>
 <div id="panel-2" class="panel">

    <div class="panel-hdr">
        <h2>
            <?php echo $menuName['fsTitle']; ?> Facilitates <span class="fw-300"></span>
        </h2>
    </div>


    <div class="panel-container show">
        <div class="panel-content p-0">
            <form class="needs-validation"  action="<?php echo $action; ?>" method="post" enctype="multipart/form-data"  novalidate  >
                <div class="panel-content">
                    <div class="form-row">
                        <div class="col-md-12 mb-3">
                            <label class="form-label" for="validationCustom01">Title<span class="text-danger">*</span> </label>
                            <input type="text" class="form-control" id="validationCustom01" name="fsTitle" id="fsTitle" placeholder="Enter title like TAXI" value="<?php echo $fsTitle; ?>" required>
                            <div class="valid-feedback">
                                Looks good!
                            </div>
                        </div>
                        <!-- // Ajax to Category and Sub category Menge  -->
                        <div class="form-group" hidden="">
                            <label for="int">FiMenuId <?php echo form_error('fiMenuId') ?></label>
                            <input type="text" class="form-control" name="fiMenuId" id="fiMenuId" placeholder="FiMenuId" value="<?php echo $menu_id; ?>" />
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="form-group" hidden="">
                            <label for="int">fiCategoryId <?php echo form_error('fiCategoryId') ?></label>
                            <input type="text" class="form-control" name="fiCategoryId" id="fiCategoryId" placeholder="fiCategoryId" value="<?php echo $fiCategoryId; ?>" />

                        </div>
                        <!-- <div class="col-md-12 mb-3">
                            <label class="form-label" for="customControlValidation5">Category</label>
                            <select class="custom-select replaceF" id="customControlValidation5" name="fiCategoryId" required>
                                <option value="<?php echo $fiCategoryId; ?>">Select category </option>    
                                <?php

                                   if(isset($categoryLists)){
                                      foreach($categoryLists as $subfacilitateslistvalue){
                                ?> 
                                <option value="<?php echo $subfacilitateslistvalue['id'] ?>" <?php echo $subfacilitateslistvalue['id']==$fiCategoryId?'selected':''; ?>>  <?php echo $subfacilitateslistvalue['fsTitle'] ?></option>
                                <?php

                                  }
                                }
                                ?>  
                            </select>
                            <div class="valid-feedback">
                                Looks good!
                            </div>
                        </div> -->
                        <!-- // Ajax to Category and Sub category Menge  End-->

                        <!-- <div class="form-group">
                            <label for="int">FiMenuId <?php echo form_error('fiMenuId') ?></label>
                            <input type="text" class="form-control" name="fiMenuId" id="fiMenuId" placeholder="FiMenuId" value="<?php echo $menu_id; ?>" />
                        </div> -->

                        <div class="form-group">
                            <!-- <label for="int">FiHotelsId <?php echo form_error('fiHotelsId') ?></label> -->
                            <input type="text" class="form-control" name="fiHotelsId" id="fiHotelsId" placeholder="FiHotelsId" value="<?php echo $userDetails['Id']; ?>" hidden/>
                        </div>
                        <!-- 
                        <div class="col-md-6 mb-3">
                            <label class="form-label" for="customControlValidation5">Menu select</label>
                            <select class="custom-select" id="customControlValidation5" name="fiMenuId" required>
                                <option value="<?php echo $fiMenuId; ?>">Select Menu</option>    
                                <?php

                                   if(count($menuLists) > 0){
                                      foreach($menuLists as $menulistvalue){
                                ?>
                                <option value="<?php echo $menulistvalue['id'] ?>" <?php echo $menulistvalue['id']==$fiMenuId?'selected':''; ?>>  <?php echo $menulistvalue['fsTitle'] ?></option>
                                <?php

                                  }
                                }
                                ?> 
                            </select>
                            <div class="valid-feedback">
                                Looks good!
                            </div>
                        </div> -->
                        <div class="col-md-12 mb-3">
                            <label class="form-label" for="validationCustom01">Icon (250x250)<span class="text-danger">*</span> </label>
                           <?php if($fsImage!=""): ?>
                               <img style="background: #CCC; padding: 1px; max-width: auto;  margin-bottom:  10px; margin-left: 10px;  object-fit: cover; object-position: center; height: 60px;" class="alignment_speech" target="_blank" src="<?php echo base_url().$fsImage; ?>"></img> 
                            <?php endif; ?>
                            <input style="padding-top: 5px;" accept=".jpeg,.png,.jpg" cols="12" rows="5" type="file" class="form-control form-control-file" name="fsImage" id="fsImage" placeholder="Description" value="<?php echo $fsImage; ?>" ></input>
                        </div>

                        
                        <div class="col-md-12 mb-3">
                            <label class="form-label" for="validationCustom01">Banner Image (1000x500)<span class="text-danger">*</span> </label>
                           <?php if($fsBannerImage!=""): ?>
                               <img style="background: #CCC; padding: 1px; max-width: auto;  margin-bottom:  10px; margin-left: 10px;  object-fit: cover; object-position: center; height: 60px;" class="alignment_speech" target="_blank" src="<?php echo base_url().$fsBannerImage; ?>"></img> 
                            <?php endif; ?>
                            <input style="padding-top: 5px;" accept=".jpeg,.png,.jpg" cols="12" rows="5" type="file" class="form-control form-control-file" name="fsBannerImage" id="fsBannerImage" placeholder="Description" value="<?php echo $fsBannerImage; ?>" ></input>
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="col-md-12">
                            <label class="form-label" for="validationCustom01">Description<span class="text-danger">*</span> </label>
                            <textarea name="fsDescription" id='editor' >
                                <?php echo html_entity_decode($fsDescription) ?>    
                            </textarea>
                            <div class="valid-feedback">
                                Looks good!
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-content border-faded border-left-0 border-right-0 border-bottom-0 d-flex flex-row align-items-center">
                    <input type="hidden" name="id" value="<?php echo $id; ?>" /> 
                    <button class="btn btn-primary ml-auto" type="submit">Submit</button>
                    <a style="margin-left: 5px;" href="<?php echo site_url('hotel_facilitates/menus/'.$menu_id.'/?categoryid='.$fiCategoryId) ?>" class="btn btn-danger">Cancel</a>

                </div>
            </form>

        </div>
    </div>
</div>
</main>



<script src="<?php echo base_url() ?>/assets/ckeditor/ckeditor.js"></script>

<script>
    // Example starter JavaScript for disabling form submissions if there are invalid fields
    (function()
    {
        'use strict';
        window.addEventListener('load', function()
        {
            // Fetch all the forms we want to apply custom Bootstrap validation styles to
            var forms = document.getElementsByClassName('needs-validation');
            // Loop over them and prevent submission
            var validation = Array.prototype.filter.call(forms, function(form)
            {
                form.addEventListener('submit', function(event)
                {
                    if (form.checkValidity() === false)
                    {
                        event.preventDefault();
                        event.stopPropagation();
                    }
                    form.classList.add('was-validated');
                }, false);
            });
        }, false);
    })();

    // Editer

    CKEDITOR.replace( 'editor', {
                        height: 300,
                        filebrowserUploadUrl: "http://localhost/jay/advice_management/hotel_facilitates/ajexfile?type=file",
                        filebrowserImageUploadUrl: "http://localhost/jay/advice_management/hotel_facilitates/ajexfile?type=image"
                    } );

</script>



