<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
             <?php
               echo isset($title) ? $title : NULL;
             ?>
          </h1>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="row">
            <form method="post" role="form">
                <div class="col-lg-12">
                    <div class="box box-primary">
                        <div class="box-header with-border">
                          <h3 class="box-title">Edit Website Setting</h3>
                        </div>
                        <!-- /.box-header -->
                        <div class="adminform">
                        <!-- form start -->

                        <?php
                        if(isset($message))
                        {
                            echo $message;
                        }
                        ?>
                            <div class="form-group">
                                <label for="WebSite-name">WebSite Name</label>
                                <input type="text" name="name" class="form-control" value="<?php echo $site['name'] ?>" id="WebSite-name" placeholder="Website Name">
                                <p class="help-block">WebSite Name</p>
                            </div>

                            <div class="form-group">
                                <label for="Clinic-description">Description</label>
                                <textarea name="description" class="form-control"><?php echo $site['description'] ?></textarea>
                                <p class="help-block">Add Website Description.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-address">Address</label>
                                <input type="text" class="form-control" name="address" value="<?php echo $site['address'] ?>" placeholder="Clinic Address" id="Clinic-address">
                                <p class="help-block">Add Clinic Address.</p>
                            </div>

                            <div class="form-group">
                                <label for="Clinic-mail">Email</label>
                                <input type="text" name="mail" class="form-control" value="<?php echo $site['mail']; ?>" id="Clinic-mail" placeholder="Clinic Email">
                                <p class="help-block">Add Clinic Email.</p>
                            </div>

                            <div class="form-group">
                                <label for="Clinic-phone">Phone</label>
                                <input type="text" class="form-control" value="<?php echo $site['phone'] ?>" name="phone" placeholder="Clinic Phone" id="Clinic-phone">
                                <p class="help-block">Add Clinic Phone.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-Another">Another Phone</label>
                                <input type="text" class="form-control" value="<?php echo $site['another_phone'] ?>" name="another_phone" placeholder="Clinic  Another Phone" id="Clinic-Another">
                                <p class="help-block">Add Clinic Another Phone.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-fax">Fax </label>
                                <input type="text" class="form-control" value="<?php echo $site['fax'] ?>" name="fax" placeholder="Clinic  fax " id="Clinic-fax">
                                <p class="help-block">Add Clinic fax .</p>
                            </div>

                            <div class="form-group">
                                <label for="Clinic-FaceBook">FaceBook</label>
                                <input type="text" class="form-control" name="facebook" value="<?php echo $site['facebook'] ?>" placeholder="Clinic FaceBook Link" id="Clinic-FaceBook">
                                <p class="help-block">Add Clinic FaceBook Page Link.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-Twitter">Twitter</label>
                                <input type="text" class="form-control" name="twitter" value="<?php echo $site['twitter'] ?>" placeholder="Clinic Twitter Link" id="Clinic-Twitter">
                                <p class="help-block">Add Clinic Twitter Page Link.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-Google">YouTube</label>
                                <input type="text" class="form-control" name="youtube" value="<?php echo $site['youtube'] ?>" placeholder="Clinic YouTube Link" id="Clinic-YouTube">
                                <p class="help-block">Add Clinic YouTube Page Link.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-Google">Instagram</label>
                                <input type="text" class="form-control" name="instagram" value="<?php echo $site['instagram'] ?>" placeholder="Clinic Instagram Link" id="Clinic-Instagram">
                                <p class="help-block">Add Clinic Instagram Page Link.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-Google">Google+</label>
                                <input type="text" class="form-control" name="google" value="<?php echo $site['google'] ?>" placeholder="Clinic Google Link" id="Clinic-Google">
                                <p class="help-block">Add Clinic Google+ Page Link.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-Google">Linkedin</label>
                                <input type="text" class="form-control" name="linkedin" value="<?php echo $site['linkedin'] ?>" placeholder="Clinic linkedin Link" id="Clinic-Google">
                                <p class="help-block">Add Clinic Linkedin Page Link.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-Google">Pinterest</label>
                                <input type="text" class="form-control" name="pinterest" value="<?php echo $site['pinterest'] ?>" placeholder="Clinic pinterest Link" id="Clinic-Google">
                                <p class="help-block">Add Clinic Pinterest Page Link.</p>
                            </div>
                            <div class="form-group">
                                <label for="Clinic-Google">Vk</label>
                                <input type="text" class="form-control" name="vk" value="<?php echo $site['vk'] ?>" placeholder="Clinic Vk Link" id="Clinic-Google">
                                <p class="help-block">Add Clinic Vk Page Link.</p>
                            </div>
                            <div class="form-group">
                                <label for="website-logo">Logo</label>
                                <img src="<?php echo UPLOAD_LINK.$site['logo'] ?>" data-toggle="modal" data-target="#update-img" class="img-responsive change-logo" />
                                <p class="help-block">Change Website Logo</p>
                            </div>
                            <div class="form-group">
                                <label for="status" class="set-block">Status</label>
                                <div class="radio radio-info  radio-inline">
                                    <input type="radio" id="inlineRadio1" value="1" name="status" <?php if($site[ 'status']==1) echo "checked" ;?>>
                                    <label for="inlineRadio1"> Publish </label>
                                </div>
                                <div class="radio radio-info  radio-inline">
                                    <input type="radio" id="inlineRadio2" value="2" name="status" <?php if($site[ 'status']==2) echo "checked" ;?>>
                                    <label for="inlineRadio2"> Un Publish </label>
                                </div>
                                <p class="help-block">Select Website Status .</p>
                            </div>

                            <input type="submit" class="btn btn-primary" name="editSetting" value="Edit Setting" />
                        </div>
                      </div>
                      <!-- /.box -->
                </div>

                </form>

            </div>
      </section><!-- /.content -->
</div><!-- /.content-wrapper -->


<!-- Start edit Wwbsite Logo Modal -->
<div class="modal fade" id="update-img" role="dialog">
    <div class="modal-dialog modal-md">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Edit WebSite Logo</h4>
            </div>
            <div class="modal-body">
                <div id="updateImageResult"></div>
                <div class="row">
                    <div class="col-lg-10 pull-left">
                        <form id="updateImage" method="post" enctype="multipart/form-data">
                            <div class="form-group">
                                <label for="category-image"> Image</label>
                                <input type="file" name="image_name" id="image_name">
                                <p class="help-block">Change WebSite Logo.</p>
                            </div>
                            <input type="submit" class="btn btn-primary updatebtn" name="editImage" value="Save" />
                            <span class="loadingImage">
                                <img src="customize\backend\images\Preloader_61.gif" />
                             </span>
                        </form>
                    </div>
                    <div class="col-lg-2 pull-right">
                        <img src="" alt="" title="Edit Image" class="img-responsive old-image" />
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>
<!--End Edit Website Logo Modal-->


<script>
$(document).ready(function(){
    // start edit website logo
           $(".change-logo").click(function(){
             $("#updateImageResult").html("");
             // get image
             var image = $(this).attr("src");
             // set image into model
             $(".old-image").attr("src",image);
             $("#updateImage").submit(function(){
                $.ajax({
                    url: "<?php echo BASE_URL."Setting/update_image"; ?>",
                    type:"POST",
                    data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
                    contentType: false,       // The content type used when sending data to the server.
                    processData:false,
                    beforeSend:function(){
						$(".loadingImage").show();
                    },
                    statusCode: {
                     404: function() {
                       alert( "page not found" );
                      },
                      },
                      success:function(valdata) {
						  $(".loadingImage").hide();
                         var da = jQuery.parseJSON(valdata);
                        if(da['status'] == "success")
                        {
							$(".loadingImage").hide();
                          $("#updateImageResult").html('<div class="alert alert-success" role="alert"><strong>Success </strong> Image Updated Successfuly </div>');
                          $('#update-img').modal('hide');
                          $('.change-logo').attr("src","<?php echo UPLOAD_LINK;?>"+da['newImage']);

                        }else{
                          $("#updateImageResult").html('<div class="alert alert-danger" role="alert"><strong> Error ! </strong> Error Update Your Image (Not Allowed Image Extension Or You Did Not Choose Image)</div>');
                        }
                      }
                });
                return false;
             });
           });
         // end edit website logo
});
</script>
