{{ header }}{{ column_left }} 
<div id="content"><div class="container-fluid">
	<div class="page-header">
	    <h1>Header Notice</h1>
	    <ul class="breadcrumb">
		     {% for breadcrumb in breadcrumbs %} 
		      <li><a href="{{ breadcrumb['href'] }}">{{ breadcrumb['text'] }}</a></li>
		      {% endfor %} 
	    </ul>
	  </div>
	
	<link rel="stylesheet" type="text/css" href="view/stylesheet/css/colorpicker.css" />
	<script type="text/javascript" src="view/javascript/jquery/colorpicker.js"></script>  
    <link href='https://fonts.googleapis.com/css?family=Poppins:700,600,500,400,300' rel='stylesheet' type='text/css'>
    	
	<script type="text/javascript">
	$.fn.tabs = function() {
		var selector = this;
		
		this.each(function() {
			var obj = $(this); 
			
			$(obj.attr('href')).hide();
			
			$(obj).click(function() {
				$(selector).removeClass('selected');
				
				$(selector).each(function(i, element) {
					$($(element).attr('href')).hide();
				});
				
				$(this).addClass('selected');
				
				$($(this).attr('href')).show();
				
				return false;
			});
		});
	
		$(this).show();
		
		$(this).first().click();
	};
	</script>
	
	
	<script type="text/javascript">
	$(document).ready(function() {
	
		$('.colorpicker-input').ColorPicker({
			onChange: function (hsb, hex, rgb, el) {
				$(el).val("#" +hex);
				$(el).next('.color_selected').css("background", "#" + hex);
			},
			onShow: function (colpkr) {
				$(colpkr).show();
				return false;
			},
			onHide: function (colpkr) {
				$(colpkr).hide();
				return false;
			}
		});
	});
	</script>

	{% if (error_warning) %} 
		<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} 
		  <button type="button" class="close" data-dismiss="alert">&times;</button>
		</div>
	{% elseif (success) %} 
		<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i> {{ success }} 
			<button type="button" class="close" data-dismiss="alert">&times;</button>
		</div>
	{% endif %} 
	
	<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form">
		<div class="set-size" id="header_notice">
			<div class="content">
				<div>
					<div class="tabs clearfix">
						<!-- Tabs module -->
						<div id="tabs" class="htabs main-tabs">
							{% set module_row = 1 %} 
							{% for module in modules %} 
							<a href="#tab-module-{{ module_row }}" id="module-{{ module_row }}">Module {{ module_row }} &nbsp;<img src="view/image/module_template/delete-slider.png"  alt="" onclick="$('.vtabs a:first').trigger('click'); $('#module-{{ module_row }}').remove(); $('#tab-module-{{ module_row }}').remove(); return false;" /></a>
							{% set module_row = module_row + 1 %} 
							{% endfor %} 
                            <span id="module-add" onclick="addModule();" ><img src="view/image/module_template/add.png" alt="" />Add<br> Module &nbsp;</span>
						</div>
						
						{% set module_row = 1 %} 
						{% for module in modules %} 
						<div id="tab-module-{{ module_row }}" class="tab-content">
							<div id="language-{{ module_row }}" class="htabs">
							  {% for language in languages %} 
							  <a href="#tab-language-{{ module_row }}-{{ language['language_id'] }}"><img src="language/{{ language['code'] }}/{{ language['code'] }}.png" title="{{ language['name'] }}" /> {{ language['name'] }}</a>
							  {% endfor %} 
							</div>
							
							{% for language in languages %} 
							<div id="tab-language-{{ module_row }}-{{ language['language_id'] }}">
							  <div class="html{{ module_row }}">
								  <table class="form">
								    <tr>
								      <td>Text:</td>
								      <td><textarea name="header_notice_module[{{ module_row }}][html][{{ language['language_id'] }}]" class="html">{{ module['html'][language['language_id']] is defined ? module['html'][language['language_id']] : '' }}</textarea></td>
								    </tr>
								  </table>
							  </div>
							</div>
							{% endfor %} 
							
							<table class="form">
							  <tr>
							       <td>Background color:</td>
							       <td class="color_input">
                                       <input type="text" class="colorpicker-input" name="header_notice_module[{{ module_row }}][background_color]" value="{{ module['background_color'] }}" />
                                       <span class="color_selected" {% if (module['background_color'] != '') %} {{ 'style="background: ' ~ module['background_color'] ~ '"' }} {% endif %} ></span>
                                   </td>
							  </tr>
							  <tr>
							       <td>Text link color:</td>
							       <td class="color_input">
                                       <input type="text" class="colorpicker-input" name="header_notice_module[{{ module_row }}][text_color]" value="{{ module['text_color'] }}" />
                                       <span class="color_selected" {% if (module['text_color'] != '') %} {{ 'style="background: ' ~ module['text_color'] ~ '"' }} {% endif %} ></span>
                                   </td>
							  </tr>
							  <tr>
							       <td>Text link hover color:</td>
							       <td class="color_input">
                                       <input type="text" class="colorpicker-input" name="header_notice_module[{{ module_row }}][text_link_hover_color]"  value="{{ module['text_link_hover_color'] }}" />
                                       <span class="color_selected" {% if (module['text_link_hover_color'] != '') %} {{ 'style="background: ' ~ module['text_link_hover_color'] ~ '"' }} {% endif %} ></span>
                                   </td>
							  </tr>
							  <tr>
							       <td>Close button background color:</td>
							       <td class="color_input">
                                       <input type="text" class="colorpicker-input" name="header_notice_module[{{ module_row }}][close_button_background_color]" value="{{ module['close_button_background_color'] }}" />
                                       <span class="color_selected" {% if (module['close_button_background_color'] != '') %} {{ 'style="background: ' ~ module['close_button_background_color'] ~ '"' }} {% endif %} ></span>
                                   </td>
							  </tr>
							  <tr>
							       <td>Close button text color:</td>
							       <td class="color_input">
                                       <input type="text" class="colorpicker-input" name="header_notice_module[{{ module_row }}][close_button_text_color]" value="{{ module['close_button_text_color'] }}" />
                                       <span class="color_selected" {% if (module['close_button_text_color'] != '') %} {{ 'style="background: ' ~ module['close_button_text_color'] ~ '"' }} {% endif %} ></span>
                                   </td>
							  </tr>
							  <tr>
							       <td>Close button hover background color:</td>
							       <td class="color_input">
                                       <input type="text" class="colorpicker-input" name="header_notice_module[{{ module_row }}][close_button_hover_background_color]" value="{{ module['close_button_hover_background_color'] }}" />
                                       <span class="color_selected" {% if (module['close_button_hover_background_color'] != '') %} {{ 'style="background: ' ~ module['close_button_hover_background_color'] ~ '"' }} {% endif %} ></span>
                                   </td>
							  </tr>
							  <tr>
							       <td>Close button hover text color:</td>
							       <td class="color_input">
                                       <input type="text" class="colorpicker-input" name="header_notice_module[{{ module_row }}][close_button_hover_text_color]" value="{{ module['close_button_hover_text_color'] }}" />
                                       <span class="color_selected" {% if (module['close_button_hover_text_color'] != '') %} {{ 'style="background: ' ~ module['close_button_hover_text_color'] ~ '"' }} {% endif %} ></span>
                                   </td>
							  </tr>
							  <tr>
							    <td>Show only once:</td>
							    <td><select name="header_notice_module[{{ module_row }}][show_only_once]">
     							    	{% if (0 == module['show_only_once']) %} 
     							    	<option value="0" selected="selected">No</option>
     							    	{% else %} 
     							    	<option value="0">No</option>
     							    	{% endif %} 
							    		{% if (1 == module['show_only_once']) %} 
							    		<option value="1" selected="selected">Yes</option>
							    		{% else %} 
							    		<option value="1">Yes</option>
							    		{% endif %} 
							      </select></td>
							  </tr>
							  <tr>
							    <td>Disable on desktop:</td>
							    <td><select name="header_notice_module[{{ module_row }}][disable_on_desktop]">
							  	    	{% if (0 == module['disable_on_desktop']) %} 
							  	    	<option value="0" selected="selected">No</option>
							  	    	{% else %} 
							  	    	<option value="0">No</option>
							  	    	{% endif %} 
							    		{% if (1 == module['disable_on_desktop']) %} 
							    		<option value="1" selected="selected">Yes</option>
							    		{% else %} 
							    		<option value="1">Yes</option>
							    		{% endif %} 
							      </select></td>
							  </tr>
							  <tr>
							    <td>Disable on mobile:</td>
							    <td><select name="header_notice_module[{{ module_row }}][disable_on_mobile]">
							  	    	{% if (0 == module['disable_on_mobile']) %} 
							  	    	<option value="0" selected="selected">No</option>
							  	    	{% else %} 
							  	    	<option value="0">No</option>
							  	    	{% endif %} 
							    		{% if (1 == module['disable_on_mobile']) %} 
							    		<option value="1" selected="selected">Yes</option>
							    		{% else %} 
							    		<option value="1">Yes</option>
							    		{% endif %} 
							      </select></td>
							  </tr>
							  <tr>
							    <td>Layout:</td>
							    <td><select name="header_notice_module[{{ module_row }}][layout_id]">
							    	{% if (99999 == module['layout_id']) %} 
							    	<option value="99999" selected="selected">All pages</option>
							    	{% else %} 
							    	<option value="99999">All pages</option>
							    	{% endif %} 
							    	
							    		{% for store in stores %} 
							    		<option value="99999{{ store['store_id'] }}" {% if ('99999' ~ store['store_id'] == module['layout_id']) %} {{ 'selected="selected"' }} {% endif %}>All pages - Store {{ store['name'] }}</option>
							    		{% endfor %} 
							    		
							        {% for layout in layouts %} 
							        {% if (layout['layout_id'] == module['layout_id']) %} 
							        <option value="{{ layout['layout_id'] }}" selected="selected">{{ layout['name'] }}</option>
							        {% else %} 
							        <option value="{{ layout['layout_id'] }}">{{ layout['name'] }}</option>
							        {% endif %} 
							        {% endfor %} 
							      </select></td>
							  </tr>
							  <tr style="display: none">
							    <td>Position:</td>
							    <td><select name="header_notice_module[{{ module_row }}][position]">
							    	<option value="header_notice" selected="selected">Header notice</option>
							      </select></td>
							  </tr>
							  <tr>
							    <td>Status:</td>
							    <td><select name="header_notice_module[{{ module_row }}][status]">
							        {% if (module['status']) %} 
							        <option value="1" selected="selected">Enabled</option>
							        <option value="0">Disabled</option>
							        {% else %} 
							        <option value="1">Enabled</option>
							        <option value="0" selected="selected">Disabled</option>
							        {% endif %} 
							      </select></td>
							  </tr>
							  <tr>
							    <td>Sort Order:</td>
							    <td><input type="text" name="header_notice_module[{{ module_row }}][sort_order]" value="{{ module['sort_order'] }}" size="3" /></td>
							  </tr>
							</table>
						</div>
						{% set module_row = module_row + 1 %} 
						{% endfor %} 
					</div>
					
					<!-- Buttons -->
					<div class="buttons"><input type="submit" name="button-save" class="button-save" value=""></div>
				</div>
			</div>
		</div>
	</form>
</div>
<script type="text/javascript"><!--
$('.main-tabs a').tabs();
//--></script> 

<script type="text/javascript"><!--
{% set module_row = 1 %} 
{% for module in modules %} 
$('#language-{{ module_row }} a').tabs();
{% set module_row = module_row + 1 %} 
{% endfor %} 
//--></script> 

<script type="text/javascript"><!--
{% set module_row = 1 %} 
{% for module in modules %} 
{% set module_row = module_row + 1 %} 
{% endfor %} 
//--></script> 

<script type="text/javascript"><!--
var module_row = {{ module_row }};

function addModule() {	
	html  = '<div id="tab-module-' + module_row + '" class="tab-content">';

		html += '  <div id="language-' + module_row + '" class="htabs">';
	    {% for language in languages %} 
	    html += '    <a href="#tab-language-'+ module_row + '-{{ language['language_id'] }}"><img src="language/{{ language['code'] }}/{{ language['code'] }}.png" title="{{ language['name'] }}" /> {{ language['name'] }}</a>';
	    {% endfor %} 
		html += '  </div>';
	
		{% for language in languages %} 
		html += '    <div id="tab-language-'+ module_row + '-{{ language['language_id'] }}">';

		html += '	 <div class="html' + module_row + '">';
		html += '      <table class="form">';
		html += '        <tr>';
		html += '          <td>Text:</td>';
		html += '          <td><textarea name="header_notice_module[' + module_row + '][html][{{ language['language_id'] }}]" class="html"></textarea></td>';
		html += '        </tr>';
		html += '      </table>';
		html += '	  </div>';
		
		html += '    </div>';
		{% endfor %} 

		html += '  <table class="form">';
		html += '    <tr>';
		html += '      <td>Background color:</td>';
		html += '      <td class="color_input"><input type="text" class="colorpicker-input" name="header_notice_module[' + module_row + '][background_color]" value="" /> <span class="color_selected"></span></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Text link color:</td>';
		html += '      <td class="color_input"><input type="text" class="colorpicker-input" name="header_notice_module[' + module_row + '][text_color]" value="" /> <span class="color_selected"></span></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Text link hover color:</td>';
		html += '      <td class="color_input"><input type="text" class="colorpicker-input" name="header_notice_module[' + module_row + '][text_link_hover_color]" value="" /> <span class="color_selected"></span></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Close button background color:</td>';
		html += '      <td class="color_input"><input type="text" class="colorpicker-input" name="header_notice_module[' + module_row + '][close_button_background_color]" value="" /> <span class="color_selected"></span></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Close button text color:</td>';
		html += '      <td class="color_input"><input type="text" class="colorpicker-input" name="header_notice_module[' + module_row + '][close_button_text_color]" value="" /> <span class="color_selected"></span></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Close button hover background color:</td>';
		html += '      <td class="color_input"><input type="text" class="colorpicker-input" name="header_notice_module[' + module_row + '][close_button_hover_background_color]" value="" /> <span class="color_selected"></span></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Close button hover text color:</td>';
		html += '      <td class="color_input"><input type="text" class="colorpicker-input" name="header_notice_module[' + module_row + '][close_button_hover_text_color]" value="" /> <span class="color_selected"></span></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Show only once:</td>';
		html += '      <td><select name="header_notice_module[' + module_row + '][show_only_once]">';
		html += '        <option value="0">No</option>';
		html += '        <option value="1">Yes</option>';
		html += '      </select></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Disable on desktop:</td>';
		html += '      <td><select name="header_notice_module[' + module_row + '][disable_on_desktop]">';
		html += '        <option value="0">No</option>';
		html += '        <option value="1">Yes</option>';
		html += '      </select></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Disable on mobile:</td>';
		html += '      <td><select name="header_notice_module[' + module_row + '][disable_on_mobile]">';
		html += '        <option value="0">No</option>';
		html += '        <option value="1">Yes</option>';
		html += '      </select></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Layout:</td>';
		html += '      <td><select name="header_notice_module[' + module_row + '][layout_id]">';
		html += '           <option value="99999">All pages</option>';
		
		{% for store in stores %} 
		html += '           <option value="99999{{ store['store_id'] }}">All pages - Store {{ store['name'] }}</option>';
		{% endfor %} 
		          
		{% for layout in layouts %} 
		html += '           <option value="{{ layout['layout_id'] }}">{{ layout['name']|e('html') }}</option>';
		{% endfor %} 
		
		html += '      </select></td>';
		html += '    </tr>';
		html += '    <tr style="display: none">';
		html += '      <td>Position:</td>';
		html += '      <td><select name="header_notice_module[' + module_row + '][position]">';
		html += '       		<option value="header_notice">Header notice</option>';
		html += '      </select></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Status:</td>';
		html += '      <td><select name="header_notice_module[' + module_row + '][status]">';
		html += '        <option value="1">Enabled</option>';
		html += '        <option value="0">Disabled</option>';
		html += '      </select></td>';
		html += '    </tr>';
		html += '    <tr>';
		html += '      <td>Sort Order:</td>';
		html += '      <td><input type="text" name="header_notice_module[' + module_row + '][sort_order]" value="" size="3" /></td>';
		html += '    </tr>';
		html += '  </table>'; 
	html += '</div>';
	
	$('.tabs').append(html);
	
	$('#language-' + module_row + ' a').tabs();

	$('#module-add').before('<a href="#tab-module-' + module_row + '" id="module-' + module_row + '">Module ' + module_row + ' &nbsp;<img src="view/image/module_template/delete-slider.png" alt="" onclick="$(\'.vtabs a:first\').trigger(\'click\'); $(\'#module-' + module_row + '\').remove(); $(\'#tab-module-' + module_row + '\').remove(); return false;" /></a>');
	
	$('.main-tabs a').tabs();
	
	$('#module-' + module_row).trigger('click');

	$('.colorpicker-input').ColorPicker({
		onChange: function (hsb, hex, rgb, el) {
			$(el).val("#" +hex);
			$(el).next('.color_selected').css("background", "#" + hex);
		},
		onShow: function (colpkr) {
			$(colpkr).show();
			return false;
		},
		onHide: function (colpkr) {
			$(colpkr).hide();
			return false;
		}
	});
	
	module_row++;
}
//--></script> 
{{ footer }}