<% my $am = $settings->{'app_measures'}; %>
<% my $jam = join ',', keys %{$am}; %>
<textarea app="<%= $a %>" setting="measures" class="configure_input"  style="height: 60px; width: 99%;" type="text" value="<%= $jam %>" placeholder="Measures"><%= $jam %></textarea>

<img class="medium_thumb app_measure_configuration_adder" src="/images/make believe/add.png" app="<%= $a %>">
<br>
<% foreach my $m ( keys %{$am} ) { %>
	<% next unless $am; %>
	<% $am->{$m} = {} unless eval { keys %{$am->{$m}} }; %>
	<b style="font-size:26px;" class="app_measure_configuration_name hover" name="<%= $m %>"><%= &subs::format_name($m) %></b><br>
	<input value="<%= &subs::format_name($m) %>" oldvalue="<%= $m %>" class="app_measure_configuration" setting="measure" style="display:none;">
	<div class="app_measure_configuration_container" measure="<%= $m %>" app="<%= $a %>">
		<select class="app_measure_configuration" setting="type" oldvalue="<%= $am->{$m}->{'type'} %>">
			<option <% if ($am->{$m}->{'type'} eq 'none') { %>selected <% } %> value="none">None</option>
			<% foreach my $t ( qw/select range text number/ ) { %>
				<option <% if ($am->{$m}->{'type'} eq $t) { %>selected <% } %> value="<%= $t %>"><%= &subs::format_name($t) %></option>
			<% } %>
		</select>
		<% if ($am->{$m}->{'type'} eq 'range' || $am->{$m}->{'type'} eq 'number') { %>
			<br>
			Min:<input type="number" value="<%= $am->{$m}->{'min'} %>" class="app_measure_configuration" setting="min" oldvalue="<%= $am->{$m}->{'min'} %>"><br>
			Max:<input type="number" value="<%= $am->{$m}->{'max'} %>" class="app_measure_configuration" setting="max" oldvalue="<%= $am->{$m}->{'max'} %>">
			<br>
		<% } elsif ($am->{$m}->{'type'} eq 'select') { %>
			<br>Options:<br>
			<textarea class="app_measure_configuration" setting="options" oldvalue="<%= join ',', @{$am->{$m}->{'options'}} %>"><% if ($am->{$m}->{'options'}) { %><%= join ',', @{$am->{$m}->{'options'}} %><% } %></textarea>
			<br>
		<% } %>
		<select class="app_measure_configuration" setting="unit" oldvalue="<%= $am->{$m}->{'unit'} %>">
			<option <% if ($am->{$m}->{'unit'} eq 'none') { %>selected <% } %> value="none">None</option>
			<% foreach my $con ( sort keys %{$gb::measures} ) { %>
				<option value="<%= $con %>" <% if ($con eq $am->{$m}->{'unit'}) { %>selected<% } %>><%= &subs::format_name($gb::measures->{$con}->{'name'}) %></option>
			<% } %>
		</select>
	</div>
	<br>
<% } %>