{block content}
	<div class="span12">
		<div class="box-content">
			<div class="filter">
				{form filterForm, class => 'form-inline', style => 'float: left; width: 100%;'}
					<i class="icon-search fs20"></i>&nbsp;{input search, class => 'input-large'}&nbsp;&nbsp;&nbsp;&nbsp;
					{input show_critical}&nbsp;&nbsp;&nbsp;&nbsp;
					{input show_warn}&nbsp;&nbsp;&nbsp;&nbsp;
					{input show_over}&nbsp;&nbsp;&nbsp;&nbsp;
					{input id_stock_item_category}&nbsp;&nbsp;&nbsp;&nbsp;
					{input submit}
					{input reset}
					<a n:href="addItem" class="btn btn-primary" style="float: right;">
						<i class="icon-plus icon-white"></i>&nbsp;Přidat skladovou položku
					</a>
				{/form}
				<div class="clear"></div>
			</div>

			<div class="row-fluid">
				<div n:foreach="$flashes as $flash" class="alert alert-{$flash->type}">{$flash->message}</div>

				{*{if $customerForm->hasErrors()}*}
					{*<div n:foreach="$customerForm->errors as $error" class="alert alert-error">{$error}</div>*}
				{*{/if}*}

				{form stockItemForm}
					{if $form->hasErrors()}
						<div n:foreach="$form->errors as $error" class="alert alert-error">{$error}</div>
					{/if}

					<div class="clear"></div>

					<div class="span6" style="margin-left: 0;">
						<table style="margin-left: 30px; margin-bottom: 50px; margin-top: 20px;">
							<tr>
								<td style="padding-right: 10px; text-align: right;">{label title /}</td>
								<td colspan="3">{input title}</td>
							</tr>
							<tr>
								<td style="padding-right: 10px; text-align: right;">{label code /}</td>
								<td>{input code, class => 'input-medium'}</td>
								<td style="padding: 0 10px 0 20px; text-align: right;">{label unit /}</td>
								<td>{input unit, class => 'input-mini'}</td>
							</tr>
							<tr>
								<td style="padding-right: 10px; text-align: right;">{label location /}</td>
								<td colspan="3">{input location}</td>
							</tr>
							<tr>
								<td style="padding-right: 10px; text-align: right;">{label id_stock_item_category /}</td>
								<td colspan="3">{input id_stock_item_category}</td>
							</tr>
						</table>
					</div>

					<div class="span6">
						<table style="margin-left: 30px; margin-bottom: 50px; margin-top: 20px;">
							<tr>
								{*<td style="padding-right: 10px; text-align: right;">Skladem</td>*}
								{*<td>TODO Kg</td>*}
								{*<td></td>*}
								{*<td style="padding-right: 10px; text-align: right;">Zásoba</td>*}
								{*<td>TODO</td>*}
							</tr>
							<tr>
								<td colspan="5">&nbsp;</td>
							</tr>
							<tr>
								<td style="padding-right: 10px; text-align: right;">Limity</td>
								<td>
									<div class="limit-box">
										<span class="label bg-critical">Kritický</span>
										<span class="values">&lt;0 - {input limit_critical}></span>
									</div>
								</td>
								<td>
									<div class="limit-box">
										<span class="label bg-warn">Varovný</span>
										<span class="values">(<span data-ref="limit_critical">{$form['limit_critical']->getValue()}</span> - {input limit_warn}&gt;</span>
									</div>
								</td>
								<td>
									<div class="limit-box">
										<span class="label bg-ideal">Ideální</span>
										<span class="values">(<span data-ref="limit_warn">{$form['limit_warn']->getValue()}</span> - {input limit_ideal}&gt;</span>
									</div>
								</td>
								<td>
									<div class="limit-box">
										<span class="label bg-over">Příliš</span>
										<span class="values">(<span data-ref="limit_ideal">{$form['limit_ideal']->getValue()}</span> - &#8734;)</span>
									</div>
								</td>
							</tr>
							{*<tr>*}
								{*<td style="padding-right: 10px; text-align: right;">{label location /}</td>*}
								{*<td colspan="3">{input location}</td>*}
							{*</tr>*}
						</table>
					</div>


					<div class="clear" style="text-align: center; padding-top: 10px;">
						{input submit}
					</div>
				{/form}
			</div>
		</div>
	</div>

<script>
    $(function() {
		$('input[name="limit_critical"], input[name="limit_warn"], input[name="limit_ideal"]').on('input', function() {
		    var inputName = $(this).attr('name');
		    $('[data-ref="' + inputName + '"]').html($(this).val());
		})
    });
</script>
