<!DOCTYPE html>
<html>
    
	<?php require_once('head' . cfg('template', 'template_extension')); ?>
    
	<body class="skin-black">
        
		<?php require_once('header' . cfg('template', 'template_extension')); ?>
		
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <aside class="left-side sidebar-offcanvas">
                
			    <?php require_once('sidebar' . cfg('template', 'template_extension')); ?>	
				
            </aside>

            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        Add Slide
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li><a href="slides.php">Slides</a></li>
	                    <li class="active">Add Slide</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
                    <div class="row">
                        
                        <div class="col-md-12">
                            
							<?php if ($error->hasErrors()): ?>
							 <div class="alert alert-danger alert-dismissable">
								<i class="fa fa-ban"></i>
								<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
								<span>
								<strong>An error occurred while processing request</strong>
								</span>
								<?php foreach ($error->displayErrors() as $value): ?>		
								<p><?php echo $value; ?></p>
								<?php endforeach; ?>
							 </div>
							 <?php $error->clearErrors(); endif; ?>
							<?php if ($session->get('success') && isset($_POST['submit'])): ?>
							 <div class="alert alert-success alert-dismissable">
								<i class="fa fa-check"></i>
								<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
								Slide added successfully! 
							 </div>
							 <?php endif; ?>
							
							<!-- form start -->
                            <form role="form" action="" method="post" enctype="multipart/form-data">
                                 
								<div class="box box-primary">
									<div class="box-header">
                                        <!--<h3 class="box-title">Quick Example</h3>-->
                                    </div><!-- /.box-header -->
									<div class="box-body">
										
										<!-- Custom Tabs (Pulled to the right) -->
										<div class="nav-tabs-custom">
											<ul class="nav nav-tabs pull-right">
												<?php foreach ($languages as $row): ?>
												<li <?php if($row['language_code']==cfg('language', 'site_language')) echo 'class="active"'; ?>><a href="#<?php echo $row['language_code']; ?>" data-toggle="tab"><?php echo $row['language_code']; ?></a></li>
												<?php endforeach; ?>
												<li class="pull-left header"><i class="fa fa-flag"></i> Language</li>
											</ul>
											<div class="tab-content">
												<?php foreach ($languages as $row): ?>
												<div class="tab-pane <?php if($row['language_code']==cfg('language', 'site_language')) echo 'active'; ?>" id="<?php echo $row['language_code']; ?>">
												        <input type="hidden" class="form-control" name=language_code" value="<?php echo $row['language_code']; ?>">
														<div class="form-group col-md-12 no-padding">
															<label class="control-label col-md-2">Title</label>
															<div class="col-md-10 no-padding">
																<input type="text" class="form-control" name="slide_title<?php echo '_'.$row['language_code']; ?>" value="<?php if (isset($_POST['slide_title'.'_'.$row['language_code']])) echo $_POST['slide_title'.'_'.$row['language_code']]; ?>">
															</div>
														</div>
														<div class="form-group col-md-12 no-padding">
															<label class="control-label col-md-2">Info</label>
															<div class="col-md-10 no-padding">
																<textarea class="form-control" rows="3" name="slide_info<?php echo '_'.$row['language_code']; ?>"><?php if (isset($_POST['slide_info'.'_'.$row['language_code']])) echo $_POST['slide_info'.'_'.$row['language_code']];?></textarea>
															</div>
														</div>
												</div><!-- /.tab-pane -->
												<?php endforeach; ?>
										</div><!-- /.tab-content -->
										<div class="clearfix"></div>
										</div><!-- nav-tabs-custom -->
								        <!-- END CUSTOM TABS -->
										
										<div class="form-group col-md-12 no-padding">
											<label class="control-label col-md-2">Image</label>
											<div class="col-md-10 no-padding">
												<input id="image" type="file" name="image">
												<span class="help-block">Image browser and preview only. Press submit to upload.</span>
											</div>
										</div>
										<div class="form-group col-md-12 no-padding">
											<label class="control-label col-md-2">Slide Url</label>
											<div class="col-md-10 no-padding">
												<input type="text" class="form-control" name="slide_url" value="<?php if (isset($_POST['slide_url'])) echo $_POST['slide_url']; ?>">
											    <span class="help-block">Enter full url with http:// included.</span>
											</div>
										</div>
										<div class="form-group col-md-12 no-padding">
											<label class="control-label col-md-2">Slide order</label>
											<div class="col-md-2 no-padding">
												<input type="text" class="form-control" name="slide_order" value="<?php if (isset($_POST['slide_order'])) echo $_POST['slide_order']; ?>">
											</div>
										</div>
										<div class="form-group col-md-12 no-padding">
											<label class="control-label col-md-2">Target Blank</label>
											<div class="col-md-10 no-padding">
												<div class="radio-inline">
													<label><input type="radio" name="target_blank" class="iradio_minimal" value="1" checked="checked"> Yes </label>
												 </div>
												 <div class="radio-inline">															
													<label><input type="radio" name="target_blank" class="iradio_minimal" value="0"> No </label>
												 </div>
										    </div>
										</div>
										<div class="form-group col-md-12 no-padding">
											<label class="control-label col-md-2">Slide status</label>
											<div class="col-md-10 no-padding">
												<div class="radio-inline">
													<label><input type="radio" name="slide_status" class="iradio_minimal" value="1" checked="checked"> Active </label>
												 </div>
												 <div class="radio-inline">															
													<label><input type="radio" name="slide_status" class="iradio_minimal" value="0"> Inactive </label>
												 </div>
										    </div>
										</div>
										
									</div><!-- /.box-body -->  
									<div class="box-footer">
										<div class="form-group col-md-12 no-padding">
											<label class="control-label col-md-2"></label>
											<div class="col-md-10 no-padding">
												<button type="submit" name="submit" class="btn btn-primary">Submit</button>
											</div>
										</div>
									</div><!-- /.box-footer -->                                                                        
							    
								<div class="clearfix"></div>
								
								</div><!-- /.box -->
                            </form><!-- /.form -->
							
                        </div><!--/.col -->
                    </div>   <!-- /.row -->
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
        
    <?php require_once('footer' . cfg('template', 'template_extension')); ?>
	
	<!-- Bootstrap File Input -->
	<script src="<?php echo cfg('template', 'site_url');?>templates/admin/assets/plugins/bootstrap-fileinput/fileinput.js" type="text/javascript"></script>
	<script>
    $("#image").fileinput({
        browseClass: "btn btn-primary btn-md",
		showCaption: false,
		showUpload: false,
		previewClass: "preview-image",
		removeLabel: '',
	});
	</script>
	
    </body>
</html>
