{if $system_configuration.shoppingcart_quickbuy == 1}
<div class="full_box">
	<div class="title_wrapper">
		<div class="title">
			<h2>Schnelleinkauf</h2>
		</div>
	</div>

	<div class="box_content">
		<div class="box_padder">
			Suche Sie hier nach Artikel und legen diese direkt in den Warenkorb.<br />
			<input type="text" id="shoppingcart_search_item" name="search_item" autocomplete="off" value="Suchartikel hier eingeben" style="border:1px solid #555555;width:680px;" />
			<div id="shoppingcart_search_result" style="position:relative;z-index:999999;"></div>
		</div>
	</div>
</div>
{/if}

<div class="full_box">
	<div class="title_wrapper">
		<div class="title">
			<h2>Warenkorb</h2>
		</div>
	</div>

	<div class="box_content">
		<div class="box_padder">
			{if $shoppingcart.items}
					<form method="post" action="" id="cart_form">
					<table class="cart_table" width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr class="cart_head">
							<td class="alcenter">Pos.</td>
							<td class="alcenter">Bild</td>
							<td>Beschreibung</td>
							<td class="alright">St&uuml;ckpreis</td>
							<td class="alcenter">Anzahl*</td>
							<td class="alcenter">l&ouml;schen</td>
							<td class="alright">Gesamtpreis</td>
						</tr>

						{foreach from=$shoppingcart.items item=item name=items_loop}
							{if $item->short_uri}
								{assign var=itemSuri value="/`$item->short_uri`.html"}
							{else}
								{assign var=itemSuri value="/index.php?item_id=`$item->id`"}
							{/if}
							<tr class="cart_row">
								<td class="alcenter">{$smarty.foreach.items_loop.iteration}</td>
								<td class="alcenter"><img src="{$SHOP_DIR}images/article/thumb_{if $item->default_image_file_name}{$item->default_image_file_name}{else}default_image.png{/if}" /></td>
								<td>
									<a href="{$serverProtocol}://{$servername}{$itemSuri}"><strong>{$item->name}</strong></a><br />
									{if $item->variant_1 || $item->variant_2}
										{$item->variant_1} {$item->variant_2}<br />
									{/if}
									{if ($item->variant_1 || $item->variant_2) && $item->item_number}
										<span>Art.-Nr. {$item->item_number}</span>
									{else}
										{if $item->attribute_7 && $item->number != $item->attribute_7}
											<span>Art.-Nr. {$item->attribute_7}&nbsp;&nbsp;&nbsp;({$template_text.item_details.old_item_number_title} {$item->number})</span>
										{else}
											<span>Art.-Nr. {$item->number}</span>
										{/if}

									{/if}
								</td>
								<td class="alright">{$item->calculatedPrices.shownPrice|number_format:"2":",":"."} &euro;</td>
								<td class="alcenter item_container" buy_quantity="{$item->buy_quantity}" min_quantity="{$item->min_quantity}">
									<div style="position:relative;">
										<div id="scart_error_message_one" class="message_min_quantity">
											<div class="close_message_box">x</div>
											<div class="content">Mindestabnahmemenge von {$item->min_quantity} St&uuml;ck nicht erreicht!</div>
										</div>
										<div id="scart_error_message_two" class="message_wrong_quantity">
											<div class="close_message_box">x</div>
											<div class="content">Sie haben eine ung&uuml;ltige St&uuml;ckzahl eingegeben! Die Abnahmest&uuml;ckzahl ist in {$item->buy_quantity}er Schritten gestaffelt!</div>
										</div>
										<input type="text" name="update_item[{$item->shopping_cart_item_id}]" class="input_quantity" value="{$item->quantity}" />
									</div>
								</td>
								<td class="alcenter item_container" buy_quantity="{$item->buy_quantity}" min_quantity="{$item->min_quantity}">
									<a href="#" class="item_delete" title="löschen" style="text-decoration:none;font-family: Arial;font-size:14px;font-weight:bold;color:#ff0000;">x</a>
								</td>
								<td class="alright">
									<strong>{($item->calculatedPrices.shownPrice * $item->quantity)|number_format:"2":",":"."} &euro;</strong>
								</td>
							</tr>
						{/foreach}
						<tr class="cart_footer_first">
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>Summe aller Artikel</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td class="alright">{$shoppingcart.shown_price_sum|number_format:"2":",":"."} &euro;</td>
						</tr>
						{foreach $shoppingcart.tax_values as $taxRate => $taxData}
							<tr class="cart_footer_vat">
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>
									{if $shoppingcartVATUsage}
										Darin enthaltene MwSt.
									{else}
										Zzgl. MwSt.
									{/if}
								</td>
								<td>{$taxRate} %</td>
								<td>&nbsp;</td>
								<td class="alright">
									{$taxData['vat']|number_format:"2":",":"."} &euro;
								</td>
							</tr>
						{/foreach}
						<tr class="cart_footer_sum">
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>
								F&auml;lliger Betrag
							</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td class="alright">
								{$shoppingcart.price_sum_gross|number_format:"2":",":"."} &euro;
							</td>
						</tr>
						<tr class="cart_footer_sum">
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							<td colspan="4" class="alright">
								{$shoppingcart.price_tax_text|replace:'[tax]%':''}
							</td>
						</tr>
					</table>
					<br /><br />

					<div style="float:left;">
						<input type="button" id="update_cart" name="shoppingcart_update" class="button" value="&gt;&gt; Aktualisieren" />

						<div style="color:#959595;">
							*Um Artikel zu entfernen, Anzahl <strong>0</strong> eingeben
						</div>
					</div>
					<div style="float:right;">
						<input id="cashdesk_button" type="button" class="button" value="&gt;&gt; Zur Kasse" />
					</div>

					<br style="clear:both;" />
				</form>
			{else}
				Es befinden sich keine Artikel in Ihrem Warenkorb
			{/if}
		</div>
	</div>
</div>

{if $shoppingcart.items && $system_configuration.shoppingcart_ordertext == 1}
<br /><br />
<div class="full_box">
	<div class="title_wrapper">
		<div class="title">
			<h2>Anmerkung zu dieser Bestellung</h2>
		</div>
	</div>

	<div class="box_content">
		<div class="box_padder">
		  <form method="post">
			Sie können hier einen Nachrichtentext an uns zu dieser Bestellung hinzuf&uuml;gen.<br />
			<textarea style="width:100%; height:200px;border:1px solid #555555;" name="customer_info">{if isset($customer_info)}{$customer_info}{/if}</textarea>
			<input type="submit" name="order_text" class="button" value="Text speichern" />
		  </form>
		</div>
	</div>
</div>
{/if}

{literal}
<script type="text/javascript">
$(document).ready(function() {
	$('#cashdesk_button').click(function(e) {
		e.preventDefault();

		window.location.href = '/Kasse/';
	});

	$('.item_delete').click(function(e) {
		e.preventDefault();
		//$(this).prev('.input_quantity').val(0);
		$('.input_quantity', $(this).parents('tr.cart_row')).val(0);
		$('#update_cart').trigger('click');
	});


	$('#update_cart').click(function(e) {
		e.preventDefault();

		var amount_ok = 1;
		$('.item_container').each(function() {
			var buy_quantity = $(this).attr('buy_quantity');
			var min_quantity = $(this).attr('min_quantity');
			var quantity = $('.input_quantity', this).val();

			if (parseInt(quantity) != 0) {
				if (parseInt(min_quantity) <= 1 || parseInt(quantity) >= parseInt(min_quantity)) {
					if (parseInt(buy_quantity) <= 1 || (parseInt(quantity) % parseInt(buy_quantity)) == 0) {
						$('.message_min_quantity', this).css({'display': 'none'});
						$('.message_wrong_quantity', this).css({'display': 'none'});
					}
					else {
						$('.message_min_quantity', this).css({'display': 'none'});
						$('.message_wrong_quantity', this).css({'display': 'block'});
						amount_ok = 0;
					}
				}
				else {
					$('.message_min_quantity', this).css({'display': 'block'});
					$('.message_wrong_quantity', this).css({'display': 'none'});
					amount_ok = 0;
				}
			}

		});

		if(amount_ok == 1) {
			$('#cart_form').submit();
		}

	});

	$('.close_message_box').click(function(e) {
		e.preventDefault();
		$('#scart_error_message_two').css({'display': 'none'});
		$('#scart_error_message_one').css({'display': 'none'});
	});

	
	
});
</script>
{/literal}
