<?php if($has_reqs): ?>
<div class="photo_req_info">
	<h3>Photo Upload Requirements</h3>
	<div>
		<ul>
			<li><b>Photos uploaded here must be <?php echo e($max_width_display); ?> wide by <?php echo e($max_height_display); ?> tall to maintain consistency across the website.</b></li>
		</ul>
	</div>
</div>
<?php endif; ?>



<div class="row">
	<span class="">
		<div class="repeatable-file-uploader"
			data-fileupload-control-server-id="<?php echo e($fileupload_server_dir); ?>"
			data-fileupload-control-field-name="<?php echo e($fileupload_field_name); ?>"
			<?php if(isset($fileupload_path_prefix)): ?>
				data-fileupload-control-path-prefix="<?php echo e($fileupload_path_prefix); ?>"
			<?php endif; ?>
			<?php if(isset($fileupload_accept_file_types)): ?>
				data-fileupload-control-file-types="<?php echo e($fileupload_accept_file_types); ?>"
				<?php if(isset($fileupload_accept_file_types_flags)): ?>
					data-fileupload-control-file-types-flags="<?php echo e($fileupload_accept_file_types_flags); ?>"
				<?php endif; ?>
			<?php else: ?>
				data-fileupload-control-file-types="(\.|\/)(gif|jpe?g|png)$"
				data-fileupload-control-file-types-flags="i"
			<?php endif; ?>
			>
				<noscript>
						<p>Please enable JavaScript to use file uploader.</p>
						<!-- or put a simple form for upload here -->
				</noscript>
				<!-- The template to display files available for upload -->
				<script class="repeatable-template-upload" type="text/x-tmpl">
				{% for (var i=0, file; file=o.files[i]; i++) { %}
						<tr class="template-upload fade">
								<td class="photo_sort_handle">&nbsp;</td>
								<td>
									<?php if(!isset($has_previews) || $has_previews): ?>
										<span class="preview"></span>
									<?php endif; ?>
								</td>
								<td class="file_error">
									<p class="name">{%=file.name%}</p>
									{% if (file.error) { %}
											<div><br /><span class="label label-important error_label">Error: </span> {%=file.error%}</div>
									{% } %}
								</td>
								<td>
									<p class="size">{%=o.formatFileSize(file.size)%}</p>
									{% if (!o.files.error) { %}
											<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div>
									{% } %}
								</td>
								<td>
									{% if (!o.files.error && !i && !o.options.autoUpload) { %}
											<button class="btn btn-primary start start_upload">
													<i class="icon-upload icon-white"></i>
													<span>Start Upload</span>
											</button>
									{% } %}
									{% if (!i) { %}
											<button class="btn btn-warning cancel">
													<i class="icon-ban-circle icon-white"></i>
													<span>Cancel</span>
											</button>
									{% } %}
								</td>
						</tr>
				{% } %}
				</script>
				<!-- The template to display files available for download -->
				<script class="repeatable-template-download" type="text/x-tmpl">
				{% for (var i=0, file; file=o.files[i]; i++) { %}

						<tr class="template-download fade photo_list_item upload_image_container" data-file-name="{%=file.name%}">
								<td class="photo_sort_handle upload_col1">
									<?php if(isset($has_order) && $has_order): ?>
										<img src="<?php echo URL::asset('admin/images/icons/reorder.png'); ?>" class="reorder" alt="Order" title="Reorder items" />
									<?php endif; ?>
								</td>

								 
									<td class="upload_col2">
										<?php if(!isset($has_previews) || $has_previews): ?>
											<span class="preview">
													{% if (file.thumbnailUrl) { %}
															<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
													{% } %}
											</span>
										<?php endif; ?>
									</td>
								


								<td class="upload_col3">
									<p class="name">
											<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
									</p>
									<?php if(isset($has_caption) && $has_caption): ?>
										<div class="custom_file_details"><input data-file-name="{%=file.name%}" class="file_caption file_caption_set_value" type="text" name="caption" value="" placeholder="Caption"/></div>
										<button class="savePhotoCaption">Save Caption</button>
										{% if (file.error) { %}
												<div><span class="label label-important">Error</span> {%=file.error%}</div>
										{% } %}
									<?php endif; ?>
								</td>

								<td class="upload_col4">
									<div><span class="size">{%=o.formatFileSize(file.size)%}</span></div>
								</td>

								<td class="upload_col5">
									<button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
											<i class="icon-trash icon-white"></i>
											<span>Delete</span>
									</button>
									<input type="checkbox" name="delete" value="1" class="toggle">
								</td>

						</tr>
				{% } %}
				</script>
			<!-- The file upload form used as target for the file upload widget -->
			<?php echo Form::open(array(
				'class' => 'repeatable_fileupload',
				'method' => 'post', 
				'url' => "/fileupload".($has_path?"/$photo_path":'').(isset($item->id)?"/$item->id":'')."/$fileupload_server_dir",
				'enctype' => 'multipart/form-data',
				'data-url' => url("fileupload".($has_path?"/$photo_path":'').(isset($item->id)?"/$item->id":'')."/$fileupload_server_dir"),
				'data-image-max-width' => $has_reqs ? $max_width:null,
				'data-image-max-height' => $has_reqs ? $max_height:null,
				)); ?>
				<!-- The table listing the files available for upload/download -->
				<table role="presentation" class="table table-striped full_table uploads_table">
					<thead>	
						<tr class="template-upload fade uploads_header">
							<th class="upload_col1">Order</th>
							<th class="upload_col2">Image</th>
							<th class="upload_col3">File Name</th>
							<th class="upload_col4">File Size</th>
							<th class="upload_col5">Delete Item</th>
						</tr>
					</thead>
					<tbody class="files">
					</tbody>
				</table>
				<!-- Redirect browsers with JavaScript disabled to the origin page -->
				<noscript><input type="hidden" name="redirect" value="http://blueimp.github.io/jQuery-File-Upload/"></noscript>
				<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
				<div class="row fileupload-buttonbar full_table">
						<div class="span7">
								<!-- The fileinput-button span is used to style the file input field as button -->
								<span class="btn btn-success fileinput-button">
										<i class="icon-plus icon-white"></i>
										<span>Upload files...</span>
										<input class="repeatable_file_upload_input" type="file" name="files[]" multiple>
								</span>
								<?php /* 
								<button type="submit" class="btn btn-primary start">
										<i class="icon-upload icon-white"></i>
										<span>Start upload</span>
								</button>
								<button type="reset" class="btn btn-warning cancel">
										<i class="icon-ban-circle icon-white"></i>
										<span>Cancel upload</span>
								</button>
								 */ ?>
								<div id="delete_container">
									<button type="button" class="btn btn-danger delete">
											<i class="icon-trash icon-white"></i>
											<span>Delete ALL Checked Items</span>
									</button>
									<input type="checkbox" class="toggle">
								</div>
								<!-- The loading indicator is shown during file processing -->
								<span class="fileupload-loading"></span>
						</div>
						<!-- The global progress information -->
						<div class="span5 fileupload-progress fade">
								<!-- The global progress bar -->
								<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
										<div class="bar" style="width:0%;"></div>
								</div>
								<!-- The extended global progress information -->
								<div class="progress-extended">&nbsp;</div>
						</div>
				</div>
			<?php echo Form::close(); ?>
		</div>
	</span>
</div>
<?php $__env->startSection('file_uploader_css'); ?>
	<?php foreach($file_upload_styles as $style): ?>
		<?php echo HTML::style($style); ?>
	<?php endforeach; ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('file_uploader_js'); ?>
	<?php foreach($file_upload_scripts as $script): ?>
		<?php echo HTML::script($script); ?>
	<?php endforeach; ?>
<?php $__env->stopSection(); ?>
