MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 3.134.253.166
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home1/a1673wkz/propstonerealty.com/Admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home1/a1673wkz/propstonerealty.com/Admin/edit_property.php
<?php
// error_reporting(0);
session_start();
if (empty($_SESSION['username'])) {
    echo '<script>window.location.href="login.php"</script>';
}
?>
<!DOCTYPE html>
<html>
<?php //header link
include("header_link.php"); ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.css" />
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-bs4.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<body>
    <?php
    //database file link
    include("config.php");
    ?>
    <?php
    // header
    include("header.php");
    ?>
    <!-- Main Wrapper -->
    <div class="main-wrapper">
        <!-- Page Wrapper -->
        <div class="page-wrapper">
            <!-- Page Content -->
            <div class="content container-fluid">
                <!-- Page Header -->
                <div class="page-header">
                    <div class="row align-items-center">
                        <div class="col">
                            <h3 class="page-title">Edit Property</h3>
                            <ul class="breadcrumb">
                                <li class="breadcrumb-item"><a href="index.html">Dashboard</a></li>
                                <li class="breadcrumb-item active">Edit Property</li>
                            </ul>
                        </div>
                        <div class="col-auto float-right ml-auto">
                        <a href="property.php" class="btn add-btn"><i class="fa fa-eye"></i> View Property</a>
                        </div>
                    </div>
                </div>

                <?php
                $id = base64_decode($_GET['id']);
                $cnt = '0';
                $val = $obj->arr("SELECT * FROM property WHERE id='$id'");
                $old = $val['image']; ?>
                <!-- /Page Header -->
                <script src="js/jquery-3.2.1.min.js"></script>
                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-body">
                                <form id="edit_doctor">
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Location <span class="text-danger">*</span></label>
                                                <select class="form-control" aria-label="Default select example" id="location" name="location">
                                                    <option selected>Open this select Location</option>
                                                    <?php
                                                    $fetch = $obj->fetch('SELECT * from brand');
                                                    foreach ($fetch as $va) { ?>
                                                        <option value="<?php echo $va['id'] ?>" <?php echo ($va['id'] == $val['location']) ? 'selected' : ''; ?>><?php echo $va['brand'] ?></option>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Sub Location <span class="text-danger">*</span></label>
                                                <select class="form-control" aria-label="Default select example" id="sublocation" name="sub_location">
                                                    <?php
                                                    $mid = $val['sub_location'];
                                                    $fet = $obj->fetch("SELECT * From model WHERE id='$mid'");
                                                    foreach ($fet as $vaf) { ?>
                                                        <option value="<?php echo $vaf['id'] ?>" <?php echo ($vaf['id'] == $val['sub_location']) ? 'selected' : ''; ?>><?php echo $vaf['model'] ?></option>

                                                    <?php
                                                    } ?>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Property Type <span class="text-danger">*</span></label>
                                                <select class="form-control" id="pro_cat" name="pro_cat" >
                                                    
                                                  
                                                    <?php
                                                         $slc=$obj->fetch("SELECT * FROM pro_category");
                                                         foreach($slc as $vc){
                                                    ?>
                                                    <option value="<?php echo $vc['id'];  ?>" <?php echo ($val['pro_cat']==$vc['id'])? 'selected':''; ?>><?php echo $vc['category'];  ?></option>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <?php
                                            if(!empty($val['bhk']))
                                            {
                                            ?>
                                            <div class="form-group">
                                                <label>BHK <span class="text-danger">*</span></label>
                                                <select class="form-control mulsel" multiple id="bhk" name="bhk[]" >
                                                    
                                                    <?php
                                                      $bhk_id=unserialize($val['bhk']);
                                                      $cont=count((array) $bhk_id);
                                                     //print_r($bhk_id);
                                                    
                                                      for($r=0;$r<$cont;$r++)
                                                      {
                                                    ?>
                                                    <option value="<?php echo $bhk_id[$r];  ?>" selected><?php echo $bhk_id[$r];  ?> BHK</option>

                                                    <?php } ?>
                                                    <?php
                                                         $sl=$obj->fetch("SELECT * FROM year");
                                                         foreach($sl as $v){
                                                    ?>
                                                    <option value="<?php echo $v['year'];  ?>"><?php echo $v['year'];  ?> bhk</option>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                            <?php }else{ ?>
                                            <div class="form-group sq">
                                                <label>Sq.ft.</label>
                                                <input type="text" class="form-control" name="sq" value="<?php echo $val['sq'] ?>">
                                            </div>
                                            <div class="form-group sq">
                                                <label>Commercial Type</label>
                                                <select name="comm_type" class="form-control" name="comm_type">
                                                    <option value="Commercial Office Space" <?php echo ('Commercial Office Space' == $val['comm_type']) ? 'selected' : ''; ?>>Commercial Office Space</option>
                                                    <option value="Commercial Shop" <?php echo ('Commercial Shop' == $val['comm_type']) ? 'selected' : ''; ?>>Commercial Shop</option>
                                                </select>
                                            </div>
                                            <?php } ?>
                                        </div>
                                      
                                    </div>
                                    <div class="row">
                                          <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Property Type <span class="text-danger">*</span></label>
                                                <select class="form-control" aria-label="Default select example" id="pro_type" name="pro_type">
                                                    <option value="">Select Property Type</option>
                                                    <option value="For Rent" <?php echo ('For Rent' == $val['pro_type']) ? 'selected' : ''; ?>>For Rent</option>
                                                    <option value="For Buy" <?php echo ('For Buy' == $val['pro_type']) ? 'selected' : ''; ?>>For Buy</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Status <span class="text-danger">*</span></label>
                                                <select class="form-control mulsel" id="status" name="status[]" multiple>
                                                    <option value="">Select Status</option>
                                                    <?php
                                                    $unsrl=unserialize($val['status']);
                                                    $cnb=count((array) $unsrl);
                                                    for($s=0; $s < $cnb; $s++)
                                                    {
                                                    
                                                    ?>
                                                    <?php
                                                    if('Ready To Move' == $unsrl[$s])
                                                    {
                                                    ?>
                                                    <option value="Ready To Move" <?php echo ('Ready To Move' == $unsrl[$s]) ? 'selected' : ''; ?>>Ready To Move</option>
                                                   <?php } ?>
                                                    <?php
                                                    if('Under Construction' == $unsrl[$s])
                                                    {
                                                    ?>
                                                    <option value="Under Construction" <?php echo ('Under Construction' == $unsrl[$s]) ? 'selected' : ''; ?>>Under Construction</option>
                                                    <?php } ?>
                                                    
                                                     <?php
                                                    if('New Launch' == $unsrl[$s])
                                                    {
                                                    ?>
                                                     <option value="New Launch" <?php echo ('New Launch' == $unsrl[$s]) ? 'selected' : ''; ?>>New Launch</option>
                                                      <?php } ?>
                                                      
                                                       <?php
                                                    if('Resale' == $unsrl[$s])
                                                    {
                                                    ?>
                                                      <option value="Resale" <?php echo ('Resale' == $unsrl[$s]) ? 'selected' : ''; ?>>Resale</option>
                                                     <?php  } ?>
                                                     
                                                      <?php
                                                    if('Signature' == $unsrl[$s])
                                                    {
                                                    ?>
                                                      <option value="Signature" <?php echo ('Signature' == $unsrl[$s]) ? 'selected' : ''; ?>>Signature</option>
                                                   <?php } ?>
                                                  
                                                   <?php } ?>
                                                     <option value="Ready To Move">Ready To Move</option>
                                                    <option value="Under Construction">Under Construction</option>
                                                    <option value="New Launch">New Launch</option>
                                                    <option value="Resale">Resale</option>
                                                    <option value="Signature">Signature</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Product Name <span class="text-danger">*</span></label>
                                                <input id="banner<?php echo $val['id']; ?>" class="form-control" value="<?php echo $val['pro_name']; ?>" name="pro_name" type="text" />
                                                <span class="dr_name"></span>
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                             <div class="form-group">
                                                <label>Company name<span class="text-danger">*</span></label>
                                                <input class="form-control" type="text" name="company" value="<?php echo $val['company']; ?>"/>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Total Area(sq.ft.)<span class="text-danger">*</span></label>
                                                <input class="form-control" type="text" name="area" id="area" value="<?php echo $val['area']; ?>"/>
                                            </div>
                                        </div>
                                        
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Property Full Address <span class="text-danger">*</span></label>
                                                <input id="qly<?php echo $val['id']; ?>" class="form-control" value="<?php echo $val['pro_full_ads']; ?>" type="text" name="pro_full_ads" />
                                                <span class="qly"></span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Min Price <span class="text-danger">*</span></label>
                                                <input class="form-control" type="text" name="min_price" value="<?php echo $val['min_price'] ?>"/>
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label>Max Price <span class="text-danger">*</span></label>
                                                <input class="form-control" type="text" name="max_price" value="<?php echo $val['max_price'] ?>"/>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label>Project Overview <span class="text-danger">*</span></label>
                                                <textarea class="form-control summernote" name="pro_overview"> <?php echo base64_decode($val['pro_overview']); ?></textarea>
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label>Description <span class="text-danger">*</span></label>
                                                <textarea class="form-control summernote" name="description">
                                            <?php echo base64_decode($val['description']); ?>
                                            </textarea>
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label>Details <span class="text-danger">*</span></label>
                                                <textarea class="form-control summernote" name="details">
                                            <?php echo base64_decode($val['details']); ?>
                                            </textarea>
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label>Amenities <span class="text-danger">*</span></label>
                                                 <?php
                                                if(!empty($val['ameniti_aprt']))
                                                {
                                                ?>
                                                <div class="d-flex">
                                                    <?php 
                                                    $am= unserialize($val['amenities']);
                                                    $am_cn=count((array) $am);
                                                    for($a=0;$a<$am_cn;$a++)
                                                    {
                                                        $ex=explode("||",$am[$a]);
                                                        ?>
                                                     <div class="image">
                                                         <div class="main-img">
                                                              <img src="<?php echo $ex[5];?>">
                                                         </div>
                                                           
                                                           
                                                         
                                                          <p><?php echo  $ex[0] ?></p>
                                                          </div>
                                                       
                                                        
                                                   <?php }
                                                    ?>
                                                </div>
                                                <?php } ?>
                                                <select class="form-control" id="framework" multiple name="amenities[]">
                                                   
                                                </select>
                                                
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                        
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label>Apartment Amenities <span class="text-danger">*</span></label>
                                                <?php
                                                if(!empty($val['ameniti_aprt']))
                                                {
                                                ?>
                                                <div class="d-flex">
                                                    <?php 
                                                    $am2= unserialize($val['ameniti_aprt']);
                                                    $am_cn2=count((array) $am2);
                                                    for($b=0;$b<$am_cn2;$b++)
                                                    {
                                                        $ex2=explode("||",$am2[$b]);
                                                        ?>
                                                     <div class="image">
                                                         <div class="main-img">
                                                              <img src="<?php echo $ex2[5];?>">
                                                         </div>
                                                           
                                                           
                                                         
                                                          <p><?php echo  $ex2[0] ?></p>
                                                          </div>
                                                       
                                                        
                                                   <?php }
                                                    ?>
                                                </div>
                                                <?php } ?>
                                                <select class="form-control" id="framework1" multiple name="ameniti_aprt[]">
                                                   
                                                </select>
                                                
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label>Payment Plan <span class="text-danger">*</span></label>
                                                <textarea class="form-control summernote" name="payment_plan">
                                            <?php echo base64_decode($val['payment_plan']); ?>
                                            </textarea>
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label>Specification <span class="text-danger">*</span></label>
                                                <textarea class="form-control summernote" name="specification">
                                            <?php echo base64_decode($val['specification']); ?>
                                            </textarea>
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                       <?php
                                        $unser_floor = unserialize($val['floor_plan']);
                                        //print_r($unser);
                                        $cntt = count((array) $unser_floor);
                                        $to_img_fl = 0;
                                        for ($k = 0; $k < $cntt; $k++) {
                                            if($unser_floor[$k]) {
                                                $to_img_fl++;
                                        ?>
                                                <div class="col-sm-12">
                                                    <div class="form-group">
                                                        <label>Floor Image <span class="text-danger">*</span></label><br />
                                                        <a data-fancybox="image" id="imga" data-caption="<?php echo $unser_floor[$k] ?>" data-src="<?php echo $unser_floor[$k] ?>" style="cursor:pointer;">
                                                            <img class="thumbnail img<?php echo $k; ?>" id="img" src="<?php echo $unser_floor[$k]; ?>" style="width: 100px;" />
                                                        </a>
                                                        <input id="image<?php echo $val['id']; ?>" class="form-control file_floor<?php echo $k; ?>" type="file" style="margin-top: 10px;" name="floor_plan[]" />
                                                        <input type="hidden" name="old_image_floor[]" value="<?php echo $unser_floor[$k]; ?>" id="old_image_floor<?php echo $k; ?>" />
                                                    </div>
                                                    <div class="form-group">
                                                        <p class="btn btn-danger" id="dtimg_floor<?php echo $k; ?>"><i class="fa fa-trash"></i> Delete Image</p>
                                                    
                                                    </div>
                                                </div>

                                                <script type="text/javascript">
                                                    $(".file_floor<?php echo $k; ?>").on("change", function(e) {
                                                        e.preventDefault();
                                                        var src = URL.createObjectURL(event.target.files[0]);
                                                        //alert(src);
                                                        $(".img<?php echo $k; ?>").prop("src", src);
                                                    });
                                                </script>
                                                <script>
                                                    $('#dtimg_floor<?php echo $k; ?>').on("click", function(){
                                                        //alert("jjh");
                                                        var image = $('#old_image_floor<?php echo $k; ?>').val();
                                                        var product_id=<?php echo $val['id'] ?>;
                                                        $.ajax({
                                                            url:"delete_image_floor.php",
                                                            type:"post",
                                                            data:{image:image,product_id,product_id},
                                                            success: function(data)
                                                            {
                                                                //alert(data);
                                                                $('.preview1').html(data);
                                                                setTimeout(location.reload.bind(location), 1500);
                                                            }
                                                        })
                                                    })
                                                </script>
                                        <?php }else{ ?>
                                         <div class="col-sm-12">
                                                    <div class="form-group">
                                                        <label>Floor Image <span class="text-danger">*</span></label><br />
                                                         <input  class="form-control" type="file" name="floor_plan[]" multiple />
                                                         </div>
                                                         </div>
                                      <?php } } ?>
                                        <div class="col-sm-12 d-none">
                                            <div class="form-group">
                                                <label>Location Map Iframe<span class="text-danger">*</span></label>
                                                <input type="text" class="form-control" name="loc_map" value='<?php echo base64_decode($val['loc_map']) ?>'>
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label>Video Link<span class="text-danger">*</span></label>
                                                <input type="text" class="form-control" name="video_link" value='<?php echo base64_decode($val['video_link']) ?>'>
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label>Upload Brochure <span class="text-danger">*</span></label>
                                                <input type="file" class="form-control" name="brochure">
                                                <input type="hidden" name="brochure_old" value="<?php echo $val['brochure']; ?>" id="brochure_old" />
                                                <span class="des" style="color: red;"></span>
                                            </div>
                                        </div>
                                        <?php
                                        $unser = unserialize($val['image']);
                                        //print_r($unser);
                                        $cn = count((array) $unser);
                                        $to_img = 0;
                                        for ($i = 0; $i < $cn; $i++) {
                                            if($unser[$i]) {
                                                $to_img++;
                                        ?>
                                                <div class="col-sm-12">
                                                    <div class="form-group">
                                                        <label>Image <span class="text-danger">*</span></label><br />
                                                        <a data-fancybox="image" id="imga" data-caption="<?php echo $unser[$i] ?>" data-src="<?php echo $unser[$i] ?>" style="cursor:pointer;">
                                                            <img class="thumbnail img<?php echo $i; ?>" id="img" src="<?php echo $unser[$i]; ?>" style="width: 100px;" />
                                                        </a>
                                                        <input id="image<?php echo $val['id']; ?>" class="form-control file<?php echo $i; ?>" type="file" style="margin-top: 10px;" name="img[]" />
                                                        <input type="hidden" name="old_image[]" value="<?php echo $unser[$i]; ?>" id="old_image<?php echo $i; ?>" />
                                                    </div>
                                                    <div class="form-group">
                                                        <p class="btn btn-danger" id="dtimg<?php echo $i; ?>"><i class="fa fa-trash"></i> Delete Image</p>
                                                    
                                                    </div>
                                                </div>

                                                <script type="text/javascript">
                                                    $(".file<?php echo $i; ?>").on("change", function(e) {
                                                        e.preventDefault();
                                                        var src = URL.createObjectURL(event.target.files[0]);
                                                        //alert(src);
                                                        $(".img<?php echo $i; ?>").prop("src", src);
                                                    });
                                                </script>
                                                <script>
                                                    $('#dtimg<?php echo $i; ?>').on("click", function(){
                                                        //alert("jjh");
                                                        var image = $('#old_image<?php echo $i; ?>').val();
                                                        var product_id=<?php echo $val['id'] ?>;
                                                        $.ajax({
                                                            url:"delete_image.php",
                                                            type:"post",
                                                            data:{image:image,product_id,product_id},
                                                            success: function(data)
                                                            {
                                                                //alert(data);
                                                                $('.preview1').html(data);
                                                                setTimeout(location.reload.bind(location), 1500);
                                                            }
                                                        })
                                                    })
                                                </script>
                                        <?php }
                                        } ?>

                                        <div class="add_img col-sm-12"></div>
                                        <div class="col-sm-12">
                                            <div class="submit-section">
                                                <span class="btn btn-primary" id="add_input">+</span>
                                                <input type="hidden" class="total_img" name="total_img" value="<?php echo $to_img; ?>">
                                                <input type="hidden" name="doctor_id" value="<?php echo $val['id']; ?>" id="doctor_id" />
                                                <button name="submit" id="edit_banner_btn" class="btn btn-primary edit_banner_btn">Submit</button>
                                            </div>
                                            <div class="preview1" style="text-align: center;"></div>
                                        </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /Page Content -->
        </div>
    </div>
    <?php
    //footer link
    include("footer_link.php");

    //footer
    include("footer.php");

    ?>
</body>

</html>
<script type="text/javascript">
    $(document).ready(function(e) {
        // Submit form data via Ajax
        $("#edit_doctor").on("submit", function(e) {
            e.preventDefault();
            $.ajax({
                type: "POST",
                url: "edit_property_form.php",
                data: new FormData(this),
                contentType: false,
                cache: false,
                processData: false,
                beforeSend: function(){
                    $('#edit_banner_btn').html('<i class="fa fa-circle-o-notch fa-spin"></i> Uploading');
                },
                success: function(data) {
                    //console.log(response);

                    // var mydata = JSON.parse(response);
                    //alert(data);
                    // console.log(response.message);
                    $(".preview1").html(data);
                    $('#edit_banner_btn').html('Submit');
                    // setTimeout(function () {
                 //   setTimeout(location.reload.bind(location), 1500);

                    // if(response.status == 1){
                    //     $('#fupForm')[0].reset();
                    //     $('.statusMsg').html('<p class="alert alert-success">'+response.message+'</p>');
                    // }else{
                    //     $('.statusMsg').html('<p class="alert alert-danger">'+response.message+'</p>');
                    // }
                    // $('#fupForm').css("opacity","");
                    // $(".submitBtn").removeAttr("disabled");
                },
            });
        });
    });
</script>

<script type="text/javascript">
    $(".file").on("change", function(e) {
        e.preventDefault();
        var src = URL.createObjectURL(event.target.files[0]);
        //alert(src);
        $(".img").prop("src", src);
    });
</script>

<script>
    $(document).ready(function() {
        var count = $('.total_img').val();
        $("#add_input").on("click", function() {
            count++;
            $('.total_img').val(count);
            var html_code = '';
            html_code += '<div class="form-group" id="ro_input' + count + '">';
            html_code += '<label>Image</label>';
            html_code += '<div style="width:100%;display:flex;">';
            html_code += '<input class="form-control" type="file" name="img[]" data-srno="' + count + '" id="image' + count + '" style="width:90%;">';
            html_code += '<span class="btn btn-danger remove_row" style="width:10%;" id="' + count + '"><i class="fa fa-remove" style="padding-top:8px;"></i></span>';
            html_code += '</div>';
            html_code += '</div>';
            $('.add_img').append(html_code);
        });
        $(document).on('click', '.remove_row', function() {
            var row_id = $(this).attr("id");
            $('#ro_input' + row_id).remove();
            count--;
            $('.total_img').val(count);
        });
    });
</script>
<script>
    $('#menu').on("change", function() {
        var menu = $('#menu').val();
        $.ajax({
            url: "fetch-submenu.php",
            type: "POST",
            data: {
                menu: menu
            },
            success: function(data) {
                $('#submenu').html(data);
            }
        })
    })
</script>
<script>
    $(".mulsel  option").each(function() {
        $(this).siblings('[value="' + this.value + '"]').remove();
    });
</script>
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-bs4.min.js"></script>
<script>
    $('.summernote').summernote();
</script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script>
    $('.mulsel').select2();
  
</script>
 <script>
    var frameworks = [
    <?php
        $ar=glob("icon/*.png");
        $cni=count((array) $ar);
        
        for($t=0;$t<$cni;$t++)
        {
            $path=pathinfo($ar[$t]);
            $extension = strtolower($path['extension']);
            echo"{";
    ?>
    
        "id":"<?php echo $path['filename'] ?>||SubName<?php echo $t; ?>||Product<?php echo $t; ?>||Desc<?php echo $t; ?>||Spec<?php echo $t; ?>||https://propstonerealty.com/Admin/<?php echo $ar[$t] ?>",
        "text":"<?php echo $path['filename'] ?>"
    
    <?php echo"},"; }?>
    ]
  
$('#framework').empty();
$("#framework").select2({
  data: frameworks,
  templateResult: format,
  templateSelection: format,
  escapeMarkup: function(m) {
    return m;
  },

  placeholder: "--Select--",
}).val(null).trigger("change");

function format(state) {
  if (!state.id) return state.text; // optgroup
  return '<img src="' + state.id.split("||")[5] + '" style="width: 20px; max-width: 100%; height: auto" title="Select icon" /> ' + state.text;
}
    </script>
    
       <script>
    var frameworks1 = [
    <?php
        $ar1=glob("icon/options/*.png");
        $cni1=count((array) $ar1);
        
        for($t1=0;$t1<$cni1;$t1++)
        {
            $path1=pathinfo($ar1[$t1]);
            $extension1 = strtolower($path1['extension']);
            echo"{";
    ?>
    
        "id":"<?php echo $path1['filename'] ?>||SubName<?php echo $t1; ?>||Product<?php echo $t1; ?>||Desc<?php echo $t1; ?>||Spec<?php echo $t1; ?>||https://propstonerealty.com/Admin/<?php echo $ar1[$t1] ?>",
        "text":"<?php echo $path1['filename'] ?>"
    
    <?php echo"},"; }?>
    ]
  
$('#framework1').empty();
$("#framework1").select2({
  data: frameworks1,
  templateResult: format1,
  templateSelection: format1,
  escapeMarkup: function(m) {
    return m;
  },

  placeholder: "--Select--",
}).val(null).trigger("change");

function format1(state) {
  if (!state.id) return state.text; // optgroup
  return '<img src="' + state.id.split("||")[5] + '" style="width: 20px; max-width: 100%; height: auto" title="Select icon" /> ' + state.text;
}
    </script>

MMCT - 2023