<div id="configuration_container" style="overflow-x:auto;">
	<% &subs::manufacturer_grabber(); %>
	<% foreach my $a (sort keys %{$appts}) { %>
		<% if ($appts->{$a}->{'formatted_name'}) { %>
			<a href="/manager?app=<%= $a %>&timestamp=<%= $timestamp %>" target="_blank" timestamp="<%= $timestamp %>"><img src="/images/decipherable/windows.png" class="medium_thumb" app="<%= $a %>"></a>
			<span class="navbar_buttons" style="right:7px;">
			<img src="/images/decipherable/vacuum.png" class="vacuum_app medium_thumb" app="<%= $a %>">
			<img src="/images/decipherable/adopt.png" class="adopt_app medium_thumb" app="<%= $a %>">
			<img src="/images/decipherable/home.png" class="medium_thumb" onClick="appointmentGrabber('<%= $a %>','<%= $timestamp %>')">
			<img src="/images/decipherable/clothesline.png" class="medium_thumb clothesline" app="<%= $a %>">
			<% my $template = $gb::pos->{$appts->{$a}->{'setting'}->{'pos'}}->{'template'}; %>
			<% if ($template) { %>
				<%= include $template, appts => $appts, a => $a %>
			<% } else { %>

			<% } %>
			<div>
				<br>
				<span app="<%= $a %>"><input setting="name_change" class="name_change timed_input configure_input" app="<%= $a %>" value="<%= $appts->{$a}->{'formatted_name'} %>"></span>
				<span app="<%= $a %>"><input type="color" setting="colour" class="colour timed_input configure_input" app="<%= $a %>" value="<%= $appts->{$a}->{'setting'}->{'colour'} %>"></span><br>
				<span>
					<input app="<%= $a %>" class="configure_checkbox" value="checked" type="checkbox" 
						<% if ($appts->{$a}->{'setting'}->{'visible'} eq "checked") { %> checked="checked" <% } %> setting="visible" id="configure_visibility_<%= $a %>"></input> Visible
				</span>
				<span>
					<input app="<%= $a %>" class="configure_checkbox" value="checked" type="checkbox" 
						<% if ($appts->{$a}->{'setting'}->{'unique'} eq "checked") { %> checked="checked" <% } %> setting="unique" id="configure_visibility_<%= $a %>"></input> Unique
				</span>
				<br><br>
				<span>
					<select class='pos' app='<%= $a %>' id="<%= $a %>_pos">
						<% foreach my $o (sort keys %{$gb::pos}) { %>
							<option <% if ( $appts->{$a}->{'setting'}->{'pos'} eq $o ){ %>selected="selected"<% } %>
							value="<%= $o %>"><%= &subs::format_name($o) %></option>
						<% } %>
					</select>
				</span>
				<span>
					<select class='mab' app='<%= $a %>' id="<%= $a %>_pos">
						<option <% if ( $appts->{$a}->{'setting'}->{'mab'} eq '' ){ %>selected="selected"<% } %>
						<% foreach my $o (sort keys %{$gb::pos}) { %>
							<option <% if ( $appts->{$a}->{'setting'}->{'mab'} eq $o ){ %>selected="selected"<% } %>
							value="<%= $o %>"><%= &subs::format_name($o) %></option>
						<% } %>
					</select>
				</span>
				<% if ($appts->{$a}->{'setting'}->{'main_image'}) { %>
					<span class="main_image_config" app="<%= $a %>">
						<% my $main_image = &subs::main_icon_maker({ app => $a, timestamp => $timestamp, settings => $appts->{$a}->{'setting'}, size => 'huge' }); %>
						<br>
						<%== $main_image %>
						<img src="/icons/trash.png" class="little_thumb" onClick="settingDeleter({ 'app': '<%= $a %>', 'setting': 'main_image' });$('.main_image_config[app=<%= $a %>]').remove()"
					</span>
				<% } %>
				<br>
				<span style="width:100%;">
					<% foreach my $b (sort keys %{$gb::abilities}) { %>
						<button style="width:95%;" app="<%= $a %>" formatted_setting="<%= &subs::format_name($b) %>" setting="<%= $b %>" class="app_configure_toggle"><b><%= &subs::format_name($b) %>:</b> <%= &subs::shorthand_name($appts->{$a}->{'setting'}->{$b},20) %></button>
						<div style="display:none;" class="app_configure_input" setting="<%= $b %>" app="<%= $a %>">
							<% if ($b eq 'notifications') { %>
								<div class="app_notification_configurator" app="<%= $a %>">
									<% foreach my $when ( ('','start_','stop_','budget_')) { %>
										<h4><%= &subs::format_name($when || 'default') %></h4>
										<select class="app_notification_sound_selector configure_input" setting="<%= $when %>notification_sound" when="<%= $when %>" app="<%= $a %>">
											<% foreach my $sound ( split /\n/, `ls ./public/sounds/notifications/*.mp3` ) { %>
												<% 
													my @fs = split '/', $sound;
													my @t = split '\.', $fs[-1];
												%>
												<option value="<%= $sound %>" <% if ($sound eq $appts->{$a}->{'setting'}->{$when . 'notification_sound'}) { %>selected<% } %>><%= &subs::format_name($t[0]) %></option>
											<% } %>
										</select>

										<textarea app="<%= $a %>" setting="<%= $when %>notification_text" class="configure_input"  style="height: 60px; width: 97%;" type="text" value="<%= $appts->{$a}->{'setting'}->{$when . 'notification_text'} %>" placeholder="<%= &subs::format_name($when . 'text') %>"><%= $appts->{$a}->{'setting'}->{$when . 'notification_text'} %></textarea>
									<% } %>
								</div>
							<% } elsif ($b eq 'measures') { %>
								<div class="app_measures_configurator" app="<%= $a %>">
									<%= include 'configure/app_measures', settings => $appts->{$a}->{'setting'}, a => $a %>
								</div>
							<% } elsif ($b eq 'packaging') { %>
								<div class="app_packaging_configurator" app="<%= $a %>">
									<%= include 'configure/packaging', settings => $appts->{$a}->{'setting'}, a => $a %>
								</div>
							<% } elsif ($b eq 'home_plate') { %>
								Lat:<input type="text" class="manual_home_plate" app="<%= $a %>" setting="latitude" value="<%= $appts->{$a}->{'setting'}->{'app_home_plate'}->{'latitude'} %>"><br>
								Long:<input type="text" class="manual_home_plate" app="<%= $a %>" setting="longitude" value="<%= $appts->{$a}->{'setting'}->{'app_home_plate'}->{'longitude'} %>"<br>
							<% } elsif ($gb::abilities->{$b}->{'config'} eq 'select') { %>
								<select app="<%= $a %>" setting="<%= $b %>" class="configure_input" style="height: 33px; width: 99%;" type="text" value="<%= $appts->{$a}->{'setting'}->{$b} %>" placeholder="<%= $b %>">
									<% foreach my $o ( @{$gb::abilities->{$b}->{'options'}}) { %>
										<option <% if ($o eq $appts->{$a}->{'setting'}->{$b}) { %>selected <% } %> value="<%= $o %>"><% if ($gb::abilities->{$b}->{'formatted'} eq 'yes') { %><%= &subs::format_name($o) %><% } else { %><%= $o %><% } %></option>
									<% } %>
								</select>
							<% } else { %>									
								<textarea app="<%= $a %>" setting="<%= $b %>" class="configure_input"  style="height: 60px; width: 97%;" type="text" value="<%= $appts->{$a}->{'setting'}->{$b} %>" placeholder="<%= $b %>"><%= $appts->{$a}->{'setting'}->{$b} %></textarea>
							<% } %>
						</div>
					<% } %>
				</span>
			</div>
		<% } %>
	<% } %>				

</div>