<?php
session_start();
if(!isset($_SESSION['adm1n']) || $_SESSION['adm1n']['Nbr'] == ''){
  
       header("Location: ../misc/default.php");
       exit;
       
}
require_once("../../includes/php/defines.php");
require_once("../../includes/php/classes/mainClass.php");
require_once("../../includes/php/classes/galleryClass.php");
require_once("../../includes/php/classes/serviceClass.php");
$g = new galleryClass;
$s = new serviceClass;
$info = $s->getServiceInfo($_GET['Id']);
$gallery_categories = $g->getAlbumCategories();
$categories = $s->getServiceCategories();

?>
<section>
	<div class="container-fluid">
		<div class="container">
			<div class="col-md-12 result-heading">
				<div class="rh-form">		
				<?php
				if(isset($_GET['ReturnPage']) && $_GET['ReturnPage'] != ''){                                        

						echo '<form>';
						echo '<div class="form-group">';
						echo '<div class="return-div"><span onclick="contentChanger(\''.$_GET['ReturnPage'].'\');"><< RETURN TO services MANAGER</span></div>';
						echo '</div>';       
						echo '</form>';  

				}             
				?>		
					<h1>Edit Service Info</h1>					
					<form class="a-r-form" id="Admin_Form">
						<div id="Animation">
							<div class="blockG" id="rotateG_01"></div>
							<div class="blockG" id="rotateG_02"></div>
							<div class="blockG" id="rotateG_03"></div>
							<div class="blockG" id="rotateG_04"></div>
							<div class="blockG" id="rotateG_05"></div>
							<div class="blockG" id="rotateG_06"></div>
							<div class="blockG" id="rotateG_07"></div>
							<div class="blockG" id="rotateG_08"></div>                                            
						</div>
						<div id="Result"></div>
						<div class="form-group">
							<label>Categories</label>
							<select  class="col-md-12" id="Category" name="Category">
								<option value="" selected="selected">All Categories</option>
                                <?php
                                for($i=0;$i<count($categories);$i++){
                                    
                                    echo '<option value="'.$categories[$i]['Nbr'].'" ';
									if($info['Category_Nbr'] == $categories[$i]['Nbr']){

										echo ' selected="selected"';

									}
									echo ' >'.$categories[$i]['Name'].'</option>';

                                }
                                ?>
							</select>
						    </div>                          
						<div class="form-group">
							<label>Service Name</label>
							<input type="text" class="col-md-12" id="Name" name="Name" value="<?php  echo $info['Name']; ?>">
						</div>						
						<div class="form-group">
							<label>Keywords Tag</label>
							<input type="text" class="col-md-12" id="Keywords" name="Keywords" value="<?php  echo $info['Keywords']; ?>">
						</div>			
						<div class="form-group">
							<label>Description Tag</label>
							<input type="text" class="col-md-12" id="Description" name="Description" value="<?php  echo $info['Description']; ?>">
						</div>			            			
						<div class="form-group">
							<label>Service Status</label>
							<div class="col-md-4">
								<input type="radio" id="Status_Live" <?php if($info['Status'] == '1'){ echo 'checked="checked"'; } ?> name="Status" value="1"> <span class="cbox">Live</span>
							</div>
							<div class="col-md-4">
								<input type="radio" id="Status_Hidden" <?php if($info['Status'] == '0'){ echo 'checked="checked"'; } ?>  name="Status" value="0"> <span class="cbox">Hidden</span>
							</div>
						</div>						
						<div class="form-group">
              <p class="label-p">Listing Description</p>
							<textarea class="col-md-12" rows="5" id="Listing_Description" name="Listing_Description"><?php  echo $info['Listing_Description']; ?></textarea>
						</div>						
						<div class="form-group">
              <p class="label-p">Page Content</p>
							<textarea class="col-md-12" rows="5" id="Content" name="Content"><?php  echo $info['Content']; ?></textarea>
						</div>
            <div class="form-group" id="Image_Area" name="Image_Area">
              <?php
                if($info['Img'] != ''){

                  echo '<img src="'.WEBSITE_ADDY.'/images/services/thumbs/'.$info['Img'].'"  id="Image" name="Image" style="width:200px;"/>';

                }
              ?>
            </div>            
						<div class="form-group dropzone" id="DropZone" name="DropZone" style="background-color:#e6e6e6; border:dashed 1px #ccc; border-radius:10px; text-align:center;">														
							<label><strong>Listing Image ( jpeg, jpg & png only )</strong></label>
							<input type="file" name="Files[]" id="Files[]" multiple class="inputFile">						
						</div>							
						<div id="PreviewContainer" name="PreviewContainer" class="dropzone-previews"></div>
            <!--
						<div class="form-group">
							<label>Photo Gallery Categories</label>
							<select  class="col-md-12" id="Gallery_Category" name="Gallery_Category" onchange="updateGalleryAlbums();">
								<option value="" selected="selected">- choose -</option>
								<?php 
                  for($i=0;$i<count($gallery_categories);$i++){
                  
                      echo '<option value="'.$gallery_categories[$i]['Nbr'].'"';
                      if($info['Gallery_Category'] == $gallery_categories[$i]['Nbr']){

                        echo ' selected="selected"';

                      }
                      echo '>'.$gallery_categories[$i]['Name'].'</option>';

                  }
								?>
							</select>
						</div> 
						<div class="form-group" id="AlbumArea" name="AlbumArea">
								<p>Please select a photo gallery category to get list of albums to associate with this service.</p>
						</div> 
				-->						
            <div class="form-group" id="Submit_Paragraph">
							<input type="hidden" id="Option" name="Option" value="Edit_Service"/>
							<input type="hidden" id="Clear" name="Clear" value="No_Clear"/>
							<input type="hidden" id="Id" name="Id" value="<?php echo $info['Nbr']; ?>"/>
              <input type="hidden" id="Original_Image" name="Original_Image" value="<?php echo $info['Img']; ?>"/>
							<input type="button" value="submit" onclick="processForm('Edit_Service','No_Clear');">
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</section>
<script type="text/javascript" src="js/dropzone.js"/>
<script type="text/javascript" src="includes/ajax/dropzone_form_processor.js"/>
<script>
$(document).ready(function(){
	updateGalleryAlbums(<?php echo $info['Gallery_Album']; ?>);
});
</script>