{% extends 'themes/default/config/layout.html' %}
{% block body %}

<style>
	.color-picker{	
		width: 100%;
		border: 1px solid lightgray;
		padding: 5px;
		font-size: 10px;
		font-weight: bold;
	}
</style>
<div class="row">
	
	
	
		<div class="col s12 m12">
            <h4 class="light">General Settings</h4>
            <div class="card orange">
              <div class="card-content white-text">
                <p>Here you can find the general configuration parameters, for the module specific parameters you can use the module tabs on the left sidebar.</p>
              </div>
              <div class="card-tabs">
                <ul class="tabs tabs-fixed-width tabs-transparent">
                  {% if app.licensed %}<li class="tab"><a href="#general-tab" >General</a></li>{% endif %}
                  <li class="tab"><a href="#license-tab" {% if app.licensed == false %}class="active"{% endif %}>License and Updates</a></li>
                  {% if app.licensed %}
                  <li class="tab"><a href="#api-tab">API Credentials</a></li>
                  <li class="tab"><a href="#admin-tab">Portal Admin User</a></li>
                  <li class="tab"><a href="#theme-tab">Theme</a></li>
                  <li class="tab"><a href="#dashboard-tab">Dashboard</a></li>
                  <li class="tab"><a href="#gateways-tab">Payment Gateways</a></li>
                  {% endif %}
                <div class="indicator" style="right: 173.594px; left: 173.406px;"></div></ul>
              </div>
              <div class="card-content white general-settings-tab">
                
                <div id="general-tab" {% if app.licensed %}class="active"{% endif %} {% if app.licensed == false %}style="display: none;"{% endif %}>
	                <div class="col s12 m6">
							<ul class="collection">
						      						      
						      <li class="collection-item" field-name="default_route">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Default Module: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {% if module_routes[general_settings['default_route']].label is defined %}
							      	{{module_routes[general_settings['default_route']].label}}
							      {% else %}
							     	{% if general_settings['default_route'] == "home" %}
								 	 	{{ "LBL_DASHBOARD"|trans }}
								 	{% else %}
								 		{{general_settings['default_route'] | trans }}
								 	{% endif %}
							      {% endif %}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[default_route]" class=""  >
								      <option value="home" {% if general_settings['default_route']=="home" %}selected{% endif %} >{{ "LBL_DASHBOARD"|trans }}</option>
								      {% for route,moduleinfo in configured_modules %}
								      <option value="{{route}}" {% if general_settings['default_route']==route %}selected{% endif %} >{{ route|trans }}</option>
								      {% endfor %}
							      </select>
									   
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li>
						      

						      
						      
						      
						      <li class="collection-item" field-name="date_format">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Date Format: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {% set date_labels = {"d/m/Y":"dd/mm/yyyy","d-m-Y":"dd-mm-yyyy","Y/m/d":"yyyy/mm/dd","Y-m-d":"yyyy-dd-mm","d.m.Y":"dd.mm.yyyy"} %}
							      {{date_labels[general_settings['date_format']]}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[date_format]" class=""  >
								      <option value="d/m/Y" {% if general_settings['date_format']=="d/m/Y" %}selected{% endif %}>dd/mm/yyyy</option>
								      <option value="d-m-Y" {% if general_settings['date_format']=="d-m-Y" %}selected{% endif %}>dd-mm-yyyy</option>
								      <option value="d.m.Y" {% if general_settings['date_format']=="d.m.Y" %}selected{% endif %}>dd.mm.yyyy</option>
								      <option value="Y/m/d" {% if general_settings['date_format']=="Y/m/d" %}selected{% endif %}>yyyy/mm/dd</option>
								      <option value="Y-m-d" {% if general_settings['date_format']=="Y-m-d" %}selected{% endif %}>yyyy-dd-mm</option>
								      
							      </select>
									   
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li> 
						      
						      <li class="collection-item" field-name="time_format">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Time Format: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {% set time_labels = {"H:i":"24 Hours","h:i A":"12 Hours"} %}
							      {{time_labels[general_settings['time_format']]}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[time_format]" class=""  >
								      <option value="H:i" {% if general_settings['time_format']=="H:i" %}selected{% endif %} >24 Hours</option>
								      <option value="h:i A" {% if general_settings['time_format']=="h:i A" %}selected{% endif %}>12 Hours</option>
							      </select>
									   
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li> 
						      
						      
						      <li class="collection-item" field-name="timezone">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Timezone: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {% set time_labels = {"H:i":"24 Hours","h:i A":"12 Hours"} %}
							      {{general_settings['timezone']}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[timezone]" class="chosen-select" >
								      {% for tz in available_timezones %}
								      <option value="{{tz}}" {% if general_settings['timezone']==tz %}selected{% endif %} >{{tz}}</option>
								      {% endfor %}
							      </select>
									   
									  <br><br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li> 
						      
						      
						      <li class="collection-item" field-name="default_lang">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Default Language: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {{available_languages[general_settings['default_lang']]}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[default_lang]" class=""  >
								      {% for langcode,langname in available_languages %}
								      <option value="{{langcode}}" {% if general_settings['default_lang']==langcode %}selected{% endif %} >{{langname}}</option>
								      {% endfor %}
							      </select>
									   
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li> 
						      
						      
						      
						      
						      <!--
						      <li class="collection-item">
						      <a href="#!" class="secondary-content btn-floating red hide"><i class="material-icons">edit</i></a>
						      <b>Cache Duration: </b><br><span class=" flow-text">admin</span></li>
						      <li class="collection-item">
						      <a href="#!" class="secondary-content btn-floating red hide"><i class="material-icons">edit</i></a>
						      <b>Debug Mode: </b><br><span class=" flow-text">admin</span></li> -->
						    </ul>
					</div>
					<div class="col s12 m6">
							<ul class="collection">
							  
							 
						      <li class="collection-item" field-name="decimals_lenght">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Decimals Precision: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {{general_settings['decimals_lenght']}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[decimals_lenght]" class=""  >
								      {% for n in [1,2,3,4] %}
								      <option value="{{n}}" {% if general_settings['decimals_lenght']==n %}selected{% endif %} >{{n}}</option>
								      {% endfor %}
							      </select>
									   
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li>
						      
						      
						      <li class="collection-item" field-name="decimals_symbol">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Decimals Separator: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {{general_settings['decimals_symbol']}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[decimals_symbol]" class=""  >
								      {% for s in [",","."] %}
								      <option value="{{s}}" {% if general_settings['decimals_symbol']==s %}selected{% endif %} >{{s}}</option>
								      {% endfor %}
							      </select>
									   
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li>
						      
						      <li class="collection-item" field-name="thousands_symbol">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Thousands Separator: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {{general_settings['thousands_symbol']}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[thousands_symbol]" class=""  >
								      {% for s in [",","."] %}
								      <option value="{{s}}" {% if general_settings['thousands_symbol']==s %}selected{% endif %} >{{s}}</option>
								      {% endfor %}
							      </select>
									   
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li>
						      
						      <li class="collection-item" field-name="limited_languages">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Limit Available Languages: </b><br>
						      <div class="details_content">
						      	{% for langcode in general_settings['limited_languages'] %}
						      		<a class="btn {{themebasiccolor}} btn-small">{{available_languages[langcode]|trans}}</a> 
						      	{% endfor %} 
						      	
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[limited_languages]" class="chosen-select" multiple sort-order="{{general_settings['limited_languages']|join(',')}}">
								      						      
								      {% for langcode,langname in available_languages %}
								      <option value="{{langcode}}" {% if langcode in general_settings['limited_languages'] %}selected{% endif %} >{{langname}}</option>
								      {% endfor %}
								      
								      
							      </select>
							      <br><br>
									 <a class="btn grey cancel-edit-btn">Cancel</a>
								     <a class="btn green save-edit-btn">Save</a>	
						      </div>
						      
						      </li> 
						      
						      
						      
						      
						      <li class="collection-item" field-name="fancy_urls">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Fancy URLs (mod_rewrite): </b><br>
						      <div class="details_content">
							      <span class=" flow-text">{% if general_settings['fancy_urls'] is defined and general_settings['fancy_urls'] %}On{% else %}Off{% endif %}</span>
						      </div>
						      <div class="edit_content hide">
								      <div class="switch">
									    <label>Off 
									    <input type="checkbox" name="settings[fancy_urls]" {% if general_settings['fancy_urls'] is defined and general_settings['fancy_urls'] %}checked="checked" value="1" {% endif %}>
									    <span class="lever"></span> On
									    </label>
									  </div>
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li>
						      
						      
						    </ul>
					</div>
					
					
					
					<div class="col s12 m12"><hr><h5>Modules Sorting</h5></div>
	                
	                <div class="col s12 m12">
					<ul class="collection">
					<li class="collection-item" field-name="modules_sorting">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>			
						      <b>Modules Sorting: </b><br>
						      <div class="details_content">
						      	{% for moduleroute in general_settings['modules_sorting'] %}
						      	{% if module_routes[moduleroute] is defined %}
						      		<a class="btn {{themebasiccolor}} btn-small">{{module_routes[moduleroute].route.label|trans}}</a> 
						      	{% endif %}
						      	{% endfor %} 
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[modules_sorting]" class="chosen-select" multiple sort-order="{{general_settings['modules_sorting']|join(',')}}">
								      						      
								      {% for route,moduleinfo in configured_modules %}
								      <option value="{{route}}" selected >{{ route|trans }}</option>
								      {% endfor %}
								      
								      
							      </select>
							      <br><br>
									 <a class="btn grey cancel-edit-btn">Cancel</a>
								     <a class="btn green save-edit-btn">Save</a>	
						      </div>
							  </li>
						    </ul>
					</div>

					
					
                </div>
                
                
                
                
                
                
                <div id="license-tab" {% if app.licensed == false %}class="active"{% else %}style="display: none;"{% endif %}>
	               {% if app.licensed %} 
	                <div class="col s12 m12 center-align app-update-container">
		                <h4>Updates</h4>
		                <p>Your Software Version is:</p>
		                <h5>v{{app_updates.current}}</h5>
		                {% if app_updates.result=="NEED_UPDATES" %}
		                <p>The most recent Version is:</p>
		                <h5>v{{app_updates.newest_version}}</h5>
		                <a class="btn green {% if app.licensed == false %}disabled{% endif %}"  {% if app.licensed == false %}disabled{% endif %} onclick="startAppUpdate()"><i class="material-icons left">refresh</i> Update</a><br><br>
		                <br><br>
		                {% else %}
		                <p>Your Software is updated to the most recent Version</p>
		                {% endif %}
		                <br><a class="btn green {% if app.licensed == false %}disabled{% endif %}"  {% if app.licensed == false %}disabled{% endif %} href="{{app.config.base_url}}/myc-config/download-ws-zip"><i class="material-icons left">file_download</i> Download CRM Module</a>
		                <br><br><br>
		                <hr>
	                </div>
	                {% endif %}
	                <div class="col s12 m6">
							<ul class="collection">
						      
						      <li class="collection-item">
							      <b>License Status: </b><br>
							      <div class="details_content">
								      <span class=" flow-text">{{app.license|trans}}</span>
							      </div>				      
						      </li>
				      
						    </ul>
					</div>
					
					<div class="col s12 m6">
							<ul class="collection">
															
							  <li class="collection-item" field-name="product_license_key" field-group="license_data">
						      <b>License Key: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">{{general_settings['product_license_key']}}</span>
						      </div>
						      <div class="edit_content hide">
							    <input type="text" name="settings[product_license_key]" param-name="product_license_key" {% if general_settings['product_license_key'] %} value="{{general_settings['product_license_key']}}" {% endif %} required>	
							    <div class="clearfix"></div>
						      </div>
						      </li>
						      
						      					      							
						    </ul>
					</div>					
					<div class="col s12 m12 center-align">
		                {% if app.licensed == false %}
		                <a class="btn orange edit-group-btn" field-group="license_data"><i class="material-icons left">edit</i>Edit</a>
		                
		                <a class="btn green save-group-btn hide" field-group="license_data" field-validation="license_data">Activate</a>
					    <a class="btn grey hide cancel-group-btn" field-group="license_data"><i class="material-icons left">close</i>Cancel</a>
					    <br><br>
					    {% else %}
					    <a class="btn red" onclick="deactivateSubscriptionKey()" ><i class="material-icons left">power_off</i>Dectivate License</a>{% endif %}
	                </div>
	                
	                
	                
					
                </div>

                
                
                
                
                
                
                <div id="api-tab" style="display: none;">
	                <div class="col s12 m6">
							<ul class="collection">
						      
						      <li class="collection-item">
							      <b>Platform Type: </b><br>
							      <div class="details_content">
								      <span class=" flow-text">{{general_settings['platform_type']|trans}}</span>
							      </div>
							      <div class="edit_content hide">
								      <span class=" flow-text">{{general_settings['platform_type']|trans}}</span>
							      </div>					      
						      </li>
						      
						      <li class="collection-item" field-name="platform_url" field-group="platform_data">
							      <b>Platform Url: </b><br>
							      <div class="details_content">
								      <span class=" flow-text">
								      {{general_settings['platform_url']}}
								      </span>
							      </div>
							      <div class="edit_content hide">
								    <input type="text" name="settings[platform_url]" param-name="platform_url" {% if general_settings['platform_url'] %} value="{{general_settings['platform_url']}}" {% endif %} required>
									<div class="clearfix"></div>
							      </div>
						      </li>
						      
						      
						    </ul>
					</div>
					
					<div class="col s12 m6">
							<ul class="collection">
															
							  <li class="collection-item" field-name="api_user" field-group="platform_data">
						      <b>API Username: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">{{general_settings['api_user']}}</span>
						      </div>
						      <div class="edit_content hide">
							    <input type="text" name="settings[api_user]" param-name="api_user" {% if general_settings['api_user'] %} value="{{general_settings['api_user']}}" {% endif %} required>	
							    <div class="clearfix"></div>
						      </div>
						      </li>
						      
						      
						      <li class="collection-item" field-name="api_key" field-group="platform_data">
							      <b>API Key/Password: </b><br>
							      <div class="details_content">
								      <span class=" flow-text">{{general_settings['api_key']}}</span>
							      </div>
							      <div class="edit_content hide">
								    <input type="text" name="settings[api_key]" param-name="api_key" {% if general_settings['api_key'] %} value="{{general_settings['api_key']}}" {% endif %} required>
								    <div class="clearfix"></div>
							      </div>
						      </li>	
						      							
						    </ul>
					</div>					
					<div class="col s12 m12 center-align">
		                <a class="btn red edit-group-btn" field-group="platform_data"><i class="material-icons left">edit</i>Edit</a>
		                <a class="btn green save-group-btn hide" field-group="platform_data" field-validation="platform_data">Save</a>
					    <a class="btn grey hide cancel-group-btn" field-group="platform_data"><i class="material-icons left">close</i>Cancel</a>
	                </div>
	                
	                
					
                </div>
                
                
                <div id="admin-tab" style="display: none;">         
	                <div class="col s12 m6">
							<ul class="collection">
						      
						      
						      
						      <li class="collection-item" field-name="admin_username">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Admin Username: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {{general_settings['admin_username']}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      
									    <input type="text" name="settings[admin_username]" {% if general_settings['admin_username'] %} value="{{general_settings['admin_username']}}" {% endif %} required>
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li>
						      
						      
						       <li class="collection-item" field-name="admin.email">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Admin Email: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {{general_settings['admin_email']}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      
									    <input type="email" name="settings[admin_email]" {% if general_settings['admin_email'] %} value="{{general_settings['admin_email']}}" {% endif %} required>
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li> 
						      
						      
						      
						      
						      
						      
						      
						    </ul>
					</div>
					
					<div class="col s12 m6">
							<ul class="collection">		      
						    
						      
						      <li class="collection-item" field-name="admin_password">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Admin Password: </b><br>
						      <div class="details_content">
							      <span class="flow-text">
							      *****
							      </span>
						      </div>
						      <div class="edit_content hide">
							      		  <label>New Password</label>
									      <input type="password" name="settings[admin_password]" id="admin_password" required>
										  <br>
										  
										  <label id="admin_password_confirm_lbl" >New Password Confirm</label>
										  <input type="password" id="admin_password_confirm">
								
										  
										  <br>
									  
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn" id="admin_password_save">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li> 
						      
						    </ul>
					</div>
                </div>
                
                
                <div id="dashboard-tab" style="display: none;">
	                <div class="col s12 m6">
							<ul class="collection">
						      
						      <li class="collection-item" field-name="twitter_widget_enabled" >
							      	<a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
							      <b>Enable Twitter Widget: </b><br>
							      <div class="details_content">
								      <span class=" flow-text">{% if general_settings['twitter_widget_enabled'] %}On{% else %}Off{% endif %}</span>
							      </div>
							      <div class="edit_content hide">
									      <div class="switch">
										    <label>Off 
										    <input type="checkbox" name="settings[twitter_widget_enabled]" {% if general_settings['twitter_widget_enabled'] %}checked="checked" value="1" {% endif %}  param-name="twitter_widget_enabled">
										    <span class="lever"></span> On
										    </label>
										  </div>
										  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>	
								      	  <div class="clearfix"></div>
							      </div>													     
						      </li>
							</ul>
	                </div>	      
					<div class="col s12 m6">
							<ul class="collection">	      
						      <li class="collection-item" field-name="twitter_page_url">
						      	<a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
							      <b>Twitter Profile Name/ID: </b><br>
							      <div class="details_content">
								      <span class=" flow-text">{{general_settings['twitter_page_url']}}</span>
							      </div>
							      <div class="edit_content hide">
								    <input type="text" name="settings[twitter_page_url]" param-name="twitter_page_url" {% if general_settings['twitter_page_url'] %} value="{{general_settings['twitter_page_url']}}" {% endif %} required>
									<br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>
								    <div class="clearfix"></div>
							      </div>
						      </li>	
						      
							</ul>
	                </div>
	                
	                <div class="col s12 m12"><hr></div>
	                <div class="col s12 m6">
							<ul class="collection">
						      
						      <li class="collection-item" field-name="facebook_widget_enabled" >
							      	<a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
							      <b>Enable Facebook Widget: </b><br>
							      <div class="details_content">
								      <span class=" flow-text">{% if general_settings['facebook_widget_enabled'] %}On{% else %}Off{% endif %}</span>
							      </div>
							      <div class="edit_content hide">
									      <div class="switch">
										    <label>Off 
										    <input type="checkbox" name="settings[facebook_widget_enabled]" {% if general_settings['facebook_widget_enabled'] %}checked="checked" value="1" {% endif %}  param-name="facebook_widget_enabled">
										    <span class="lever"></span> On
										    </label>
										  </div>
										  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>	
								      	  <div class="clearfix"></div>
							      </div>													     
						      </li>
							</ul>
	                </div>	      
					<div class="col s12 m6">
							<ul class="collection">	      
						      <li class="collection-item" field-name="facebook_page_url">
						      	<a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
							      <b>Facebook Page Name/ID: </b><br>
							      <div class="details_content">
								      <span class=" flow-text">{{general_settings['facebook_page_url']}}</span>
							      </div>
							      <div class="edit_content hide">
								    <input type="text" name="settings[facebook_page_url]" param-name="facebook_page_url" {% if general_settings['facebook_page_url'] %} value="{{general_settings['facebook_page_url']}}" {% endif %} required>
									<br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>
								    <div class="clearfix"></div>
							      </div>
						      </li>	
						      
							</ul>
	                </div>
	                
	                
                </div>
                
                <div id="theme-tab" style="display: none;">
	                <div class="col s12 m6">
							<ul class="collection">
						      <li class="collection-item" field-name="theme_basic_color">
						      
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Basic Color: </b><br>
						      <div class="details_content">
						      		<div style="padding: 5px;">
							      			<div class="color-picker {{general_settings['theme_basic_color']}}" color-name="{{general_settings['theme_basic_color']}}">
								      			{{general_settings['theme_basic_color']}}
							      			</div>						    
							      	</div>
						      </div>
						      <div class="edit_content hide">
							  		  <input type="hidden" name="settings[theme_basic_color]" {% if general_settings['theme_basic_color'] %} value="{{general_settings['theme_basic_color']}}" {% endif %}>
								      <h5>Colors</h5>
								      <div class="row">								      
									  {% for basiccolor,variations in theme_colors%}
							      		<div class="col s6 m3" style="padding: 5px;">
							      			<div class="color-picker basic_color {{basiccolor}}" color-name="{{basiccolor}}">{{basiccolor}}</div>						    
							      		</div>
								      {% endfor %}
								      </div>
						      	<br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      
						      </div>
						      
						      </li>
						      
						      
						      <li class="collection-item" field-name="portal_logo" field-type="logo">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Portal Logo: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      <img src="{{app.config['app_url']}}/app/themes/default/resources/images/{{general_settings['portal_logo']}}" style="max-width: 100%">
							      
							      </span>
						      </div>
						      <div class="edit_content hide">
							       <br>
									    <input type="file" name="settings[portal_logo]"  accept="image/*">
									  <br> <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn" >Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li> 
						      
						      <li class="collection-item" field-name="portal_brand">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Portal Brand (custom HTML is allowed): </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {% if general_settings['portal_brand'] is defined %}{{general_settings['portal_brand']|raw}}{% endif %}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      
									    <textarea name="settings[portal_brand]">{% if general_settings['portal_brand'] is defined %}{{general_settings['portal_brand']|raw}}{% endif %}</textarea>
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li> 
						      
						    </ul>
					</div>
					
					<div class="col s12 m6">
							<ul class="collection">		      
						      
						      <li class="collection-item" field-name="current_theme">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Current Theme: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {{general_settings['current_theme']}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      <select name="settings[current_theme]" class=""  >
								      {% for themename in portal_themes %}
								      <option value="{{themename}}" {% if general_settings['current_theme']==themename %}selected{% endif %} >{{themename}}</option>
								      {% endfor %}
							      </select>
									   
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li>
						      
						      <li class="collection-item" field-name="portal_title">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Portal Title: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">
							      {{general_settings['portal_title']}}
							      </span>
						      </div>
						      <div class="edit_content hide">
							      
									    <input type="text" name="settings[portal_title]" {% if general_settings['portal_title'] %} value="{{general_settings['portal_title']}}" {% endif %}  required>
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li> 
						      
						      
						      
						      <li class="collection-item" field-name="theme_colored_sidebar">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>
						      
						      <b>Colored Sidebar: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">{% if general_settings['theme_colored_sidebar'] %}On{% else %}Off{% endif %}</span>
						      </div>
						      <div class="edit_content hide">
								      <div class="switch">
									    <label>Off 
									    <input type="checkbox" name="settings[theme_colored_sidebar]" {% if general_settings['theme_colored_sidebar'] %}checked="checked" value="1" {% endif %}>
									    <span class="lever"></span> On
									    </label>
									  </div>
									  <br>
										  <a class="btn grey cancel-edit-btn">Cancel</a>
										  <a class="btn green save-edit-btn">Save</a>		
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li>
						      
						    </ul>
					</div>
                </div>
                
                
                <div id="gateways-tab" style="display: none;">
	                
	                <div class="row">
		                <div class="col s12 m12 center-align">
		                	<h4 class="light">Default Currency</h4>
		                </div>
		                <div class="col s12 m6">
								<ul class="collection">
							   
						      <li class="collection-item" field-name="default_currency_name">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>			
						      <b>Currency Name: </b><br>
						      <div class="details_content">
						      <span class=" flow-text">{{general_settings['default_currency_name']}}</span>
						      </div>
						      
						      <div class="edit_content hide">
						      
							      <input type="text" name="settings[default_currency_name]" param-name="default_currency_name" value="{{general_settings['default_currency_name']}}" required>
							      <br><br>
									 <a class="btn grey cancel-edit-btn">Cancel</a>
								     <a class="btn green save-edit-btn">Save</a>	
						      </div>
						      
						      </li>

						      <li class="collection-item"  field-name="default_currency_code">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>			
						      <b>Currency Code: </b><br>
						      <div class="details_content">
						      <span class=" flow-text">{{general_settings['default_currency_code']}}</span>
						      </div>
						      
						      <div class="edit_content hide">
						      
							      <input type="text" name="settings[default_currency_code]" param-name="default_currency_code" value="{{general_settings['default_currency_code']}}" required>
							      <br><br>
									 <a class="btn grey cancel-edit-btn">Cancel</a>
								     <a class="btn green save-edit-btn">Save</a>	
						      </div>
						      
						      </li>
						      
						      
						      
							    </ul>
						</div>
						
						<div class="col s12 m6">
								<ul class="collection">		      
							      
							  <li class="collection-item"  field-name="default_currency_symbol">
						      <a class="secondary-content btn-floating red hide edit-btn"><i class="material-icons">edit</i></a>
						      <a class="secondary-content btn-floating grey hide cancel-edit-btn"><i class="material-icons">close</i></a>			
						      <b>Currency Symbol: </b><br>
						      <div class="details_content">
						      <span class=" flow-text">{{general_settings['default_currency_symbol']}}</span>
						      </div>
						      
						      <div class="edit_content hide">
						      
							      <input type="text" name="settings[default_currency_symbol]" param-name="default_currency_symbol" value="{{general_settings['default_currency_symbol']}}" required>
							      <br><br>
									 <a class="btn grey cancel-edit-btn">Cancel</a>
								     <a class="btn green save-edit-btn">Save</a>	
						      </div>
						      
						      </li>
						      
						      
						      
							    </ul>
						</div>
						
						
	                </div>
	                
	                
	                
	                
	                {% for gw_name, gateway in available_payment_gw %}
	                <div class="clearfix"></div>
					<div class="myc-divider-section"></div>
					
	                <div class="row">
		                <div class="col s12 m12 center-align">
		                	<h4 class="light">{{gateway.label}}</h4>
		                </div>
		                
		                <div class="col s12 m12">
							<ul class="collection">
							  
							  
							  <li class="collection-item"  field-group="gw_{{gw_name}}" field-name="{{gw_name}}">
						      <b>Is Enabled: </b><br>
						      <div class="details_content">
							      <span class=" flow-text">{% if configured_payment_gw[gw_name]["enabled"] is defined and  configured_payment_gw[gw_name]["enabled"] %}On{% else %}Off{% endif %}</span>
						      </div>
						      <div class="edit_content hide">
								      <div class="switch">
									    <label>Off 
									    <input type="checkbox" name="settings[{{gw_name}}]" param-name="enabled" {% if configured_payment_gw[gw_name]["enabled"] is defined and configured_payment_gw[gw_name]["enabled"] %}checked="checked" value="1" {% endif %}>
									    <span class="lever"></span> On
									    </label>
									  </div>	
							      	  <div class="clearfix"></div>
						      </div>
						      
						      </li>
							  
							  {% for gw_paramname, gw_param in gateway.settings %}
							  
						      <li class="collection-item"  field-group="gw_{{gw_name}}" field-name="{{gw_name}}">
						      <b>{{gw_param.label}}: </b><br>
						      <div class="details_content">
						      <span class=" flow-text">
						      {% if configured_payment_gw[gw_name]["settings"][gw_paramname] is defined %} 
							      {% if gw_param.type == "string" %}
							      	{{configured_payment_gw[gw_name]["settings"][gw_paramname]}}
							      {% elseif gw_param.type == "boolean" %}
							      	{% if configured_payment_gw[gw_name]["settings"][gw_paramname] %}On{% else %}Off{% endif %}
							      {% endif %}
						      {% endif %}
						      </span>
						      </div>
						      
						      <div class="edit_content hide">
						      	  {% if gw_param.type == "string" %}
							      <input type="text" name="settings[{{gw_name}}]" param-name="{{gw_paramname}}" value="{% if configured_payment_gw[gw_name]['settings'][gw_paramname] is defined %}{{configured_payment_gw[gw_name]['settings'][gw_paramname]}}{% endif %}" required>
							      {% elseif gw_param.type == "boolean" %}
							      <div class="switch">
									    <label>Off 
									    <input type="checkbox" name="settings[{{gw_name}}]" param-name="{{gw_paramname}}" {% if configured_payment_gw[gw_name]['settings'][gw_paramname] is defined and configured_payment_gw[gw_name]['settings'][gw_paramname] %}checked="checked" value="1" {% endif %}>
									    <span class="lever"></span> On
									    </label>
									  </div>
							      {% endif %}
							      <div class="clearfix"></div>	
						      </div>
						      
						      </li>
							  
							  {% endfor %}

							    </ul>
						</div>
						
						<div class="col s12 m12 center-align">
			                <a class="btn red edit-group-btn" field-group="gw_{{gw_name}}"><i class="material-icons left">edit</i>Edit</a>
			                <a class="btn green save-group-btn hide" field-group="gw_{{gw_name}}" field-validation="payment_gateway">Save</a>
						    <a class="btn grey hide cancel-group-btn" field-group="gw_{{gw_name}}"><i class="material-icons left">close</i>Cancel</a>
		                </div>
	                
	                </div>
	                {% endfor %}
	                
                </div>
                
                <div class="clearfix"></div>
                
              </div>
            </div>
          </div>
	
</div>	




{% endblock %}

{% block footerscripts %}

<script>
	
							$("#admin_password_save").addClass("disabled");
												  
							$("#admin_password, #admin_password_confirm").keyup(function(){
								if($("#admin_password").val()!="" && $("#admin_password").val()==$("#admin_password_confirm").val()){ 
									$("#admin_password_save").removeClass("disabled");
									$("#admin_password_confirm_lbl").removeClass("red-text").addClass("green-text");
								}
								
								else {
									$("#admin_password_save").addClass("disabled");
									$("#admin_password_confirm_lbl").addClass("red-text").removeClass("green-text");
								}
							});
	
							      	var prevColor = "";
							    	$(".basic_color").click(function(){
								    	
								    	$(this).parent().parent().parent().find("input").val($(this).attr("color-name"));
								    	
								    	$(".color-selected").remove();
								    	$(this).prepend("<i class='material-icons tiny color-selected'>done</i>");
								    	$(".color-variations .color-picker").removeClass(prevColor).addClass($(this).attr("color-name"));
								    	prevColor = $(this).attr("color-name");
								    	
								    	
								    	if(prevColor == "brown" || prevColor == "grey" || prevColor == "blue-grey")
								    		$(".variation_accent").hide();
								    	else if(prevColor == "black" || prevColor == "white")
								    		$(".color-variations").hide();							    	
								    	else $(".color-variations, .variation_accent").show();	
								    	
							    	});
							    	
							    	$(".color-variations .color-picker").click(function(){
								    	
							    	});
							    	
							    	$(function(){
								    	$(".color-picker[color-name='{{general_settings['theme_basic_color']}}']").trigger("click");
							    	});
							    	
							    	
							    	function startAppUpdate(){
																												
										var fieldGroupBtn = $(".app-update-container");
										fieldGroupBtn.find(".card-message").remove();
										fieldGroupBtn.append(infoCard('Donwloading and Installing Update. . .<br><div class="progress"><div class="indeterminate"></div></div>'));
										
										$.post("{{app.config.base_url}}/myc-config/update/")
										 .done(function(data){											
											window.location.reload();
										});
												
										
									}
															    	
							    </script>

{% include 'themes/default/config/resources/myc_field_engine.js.html' %}

{% endblock %}