<div class="panel-body">
	<?php 
	$export_formats = __('export_formats', true, false);
	$export_types = __('export_types', true, false);
	$export_periods = __('export_periods', true, false);
	$post = isset($_SESSION[$controller->bookingExportOptions]) ? $_SESSION[$controller->bookingExportOptions] : array();
	?>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminBookings&amp;action=pjActionExportBookings" method="post" id="frmExportBookings">
		<input type="hidden" name="booking_export" value="1" />
		<input type="hidden" name="csrf_token" value="<?php echo pjAppController::getCsrfToken(); ?>" />
		<div class="row">
			<div class="col-lg-3 col-md-4 col-sm-6">
				<div class="form-group">
					<label class="control-label"><?php __('lblFormat'); ?></label>

					<select name="format" id="format" class="form-control">
						<?php
						foreach ($export_formats as $k => $v)
						{
							?><option value="<?php echo $k; ?>"<?php echo isset($post['format']) && $post['format'] == $k ? ' selected="selected"' : null; ?>><?php echo pjSanitize::html($v); ?></option><?php
						}
						?>
					</select>
				</div>
			</div>

			<div class="col-lg-3 col-md-4 col-sm-6">
				<div class="form-group">
					<label class="control-label"><?php __('lblType'); ?></label>

					<div class="m-t-xs">
						<div class="clearfix">
							<div class="pull-left m-r-lg">
								<label>
									<input type="radio" class="i-checks-file" name="type" id="file" value="file" <?php echo isset($post['type']) ? ($post['type'] == 'file' ? ' checked="checked"' : null) : ' checked="checked"'; ?>>
									
									<?php echo $export_types['file'];?>
								</label>
							</div>

							<div class="pull-left">
								<label>
									<input type="radio" class="i-checks-feed" name="type" id="feed" value="feed"<?php echo isset($post['type']) ? ($post['type'] == 'feed' ? ' checked="checked"' : null) : null; ?>>
									
									<?php echo $export_types['feed'];?>
								</label>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div><!-- /.col-md-3 -->

		<div class="row cpPassowrdContainer" style="display:<?php echo isset($post['type']) ? ($post['type'] == 'file' ? ' none' : ' block' ) : ' none'; ?>">
			<div class="col-lg-3 col-md-4 col-sm-6">
				<div class="form-group">
					<label class="control-label"><?php __('lblEnterPassword');?></label>

					<input type="text" id="feed_password" name="password" value="<?php echo isset($post['raw_password']) ? $post['raw_password'] : null; ?>" class="form-control">
				</div>
			</div>
		</div>

		<label class="control-label"><?php __('lblBookings'); ?></label>

		<div class="row">
			<div class="col-lg-3 col-md-4 col-sm-6">
				<div class="form-group">
					<select name="period" id="export_period" class="form-control">
						<option value="next"<?php echo isset($post['period']) ? ($post['period'] == 'next' ? ' selected="selected"' : null) : ' selected="selected"'; ?>><?php echo pjSanitize::html($export_periods['next']); ?></option>
						<option value="last"<?php echo isset($post['period']) ? ($post['period'] == 'last' ? ' selected="selected"' : null) : null; ?>><?php echo pjSanitize::html($export_periods['last']); ?></option>
					</select>
				</div>
			</div>

			<div class="col-lg-3 col-md-4 col-sm-6" id="next_label" style="display:<?php echo isset($post['period']) ? ($post['period'] == 'next' ? ' block' : ' none') : ' block'; ?>;">
				<div class="form-group">
					<select name="coming_period" id="coming_period" class="form-control">
						<?php
						foreach(__('coming_arr', true) as $k => $v)
						{
							?><option value="<?php echo $k;?>"<?php echo isset($post['coming_period']) ? ($post['coming_period'] == $k ? ' selected="selected"' : null) : null; ?>><?php echo $v;?></option><?php 
						} 
						?>
					</select>
				</div>
			</div>
			
			<div class="col-lg-3 col-md-4 col-sm-6" id="last_label" style="display:<?php echo isset($post['period']) ? ($post['period'] == 'last' ? ' block' : ' none') : ' none'; ?>;">
				<div class="form-group">
					<select name="made_period" id="made_period" class="form-control">
						<?php
						foreach(__('made_arr', true) as $k => $v)
						{
							?><option value="<?php echo $k;?>"<?php echo isset($post['made_period']) ? ($post['made_period'] == $k ? ' selected="selected"' : null) : null; ?>><?php echo $v;?></option><?php 
						} 
						?>
					</select>
				</div>
			</div>
		</div>
	   
		<div class="hr-line-dashed"></div>

		<div class="clearfix">
			<button type="submit" class="ladda-button btn btn-primary btn-lg btn-phpjabbers-loader pull-left" data-style="zoom-in" style="margin-right: 15px;">
				<span class="ladda-label" id="cpSubmitButton"><?php isset($post['type']) ? ($post['type'] == 'file' ? __('btnExport') : __('btnGetFeedURL') ) :  __('btnExport'); ?></span>
				<?php include $controller->getConstant('pjBase', 'PLUGIN_VIEWS_PATH') . 'pjLayouts/elements/button-animation.php'; ?>
			</button>
		</div><!-- /.clearfix -->
		<?php
		if(isset($post['type']) && $post['type'] == 'feed') 
		{
			?>
			<div class="cpFeedContainer">
				<br/>
				<div class="row">
					<div class="col-xs-12">
						<div class="alert alert-success">
							<i class="fa fa-check m-r-xs"></i>
							<strong><?php __('infoBookingsFeedTitle'); ?></strong>
							<?php __('infoBookingsFeedDesc');?>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<textarea id="reservations_feed" name="reservations_feed" class="form-control" rows="5"><?php echo PJ_INSTALL_URL; ?>index.php?controller=pjAdminBookings&amp;action=pjActionExportFeed&amp;format=<?php echo$post['format']; ?>&amp;type=<?php echo $post['period'] == 'next' ? '1' : '2'; ?>&amp;period=<?php echo $post['period'] == 'next' ? $post['coming_period'] : $post['made_period']; ?>&amp;p=<?php echo isset($post['password']) ? $post['password'] : null;?></textarea>
						</div>
					</div>
				</div>
			</div>
			<?php
		} 
		?>
	</form>
</div>