{* -- OFFER ITEMS -------------------------------------------------------------------------- *}

{foreach from=$offerDetails.listItems key=idOfferItem item=offerItem}

	<tr class="offerSecTr" offerItem="{$idOfferItem}">

		<td style="width:15px;">&nbsp;</td>

		{* -- supplier --------------------------------------------------------------------- *}
		<td class="nowrap cellSeparator" supplier="{$idOffer}">
			{if $offerItem.display or $offerItem.multiplyBy}
				<div>
					{if $offerItem.display}<span class="offerItemDisplay">{$offerItem.display} </span>{/if}
					{if $offerItem.multiplyBy or $offerItem.multiplyBy=="0"}<span class="offerItemMultiplyBy">x {$offerItem.multiplyBy}</span>{/if}
					{* -- customer details -- *}
				</div>
			{/if}

			{if $displayFields.supplier}
				<div>
					{* quantity *}
					{if $offerDetails.displayQuantity}
						<input type="text" id="quantity[{$idOffer}][{$idOfferItem}]" class="formFields {if $offerItem.quantity!=$offerDetails['duration'] and $serviceQuantityType=='duration'}red{/if}" style="width:25px"
							name="quantity[{$idOffer}][{$idOfferItem}]" value="{$offerItem.quantity|default:0}"
							onfocus="if (this.value=='0') this.select();"
							{if $offerDetails['duration'] and $serviceQuantityType=='duration'}
								onblur="
									this.value=transformToPrice(this.value);
									if (this.value!={$offerDetails['duration']}) {
										$(this).addClassName('red');
									} else {
										$(this).removeClassName('red');
									}
								"
							{/if}
						/>{if $serviceQuantityType=='distance'}{$_LANG.travel.services.distanceUnit} &times;{else}&times;{/if}
					{else}
						<input type="hidden" id="quantity[{$idOffer}][{$idOfferItem}]" name="quantity[{$idOffer}][{$idOfferItem}]" value="{$offerItem.quantity}" />
					{/if}

					{* supplier price *}
					<input type="text" id="supplierValue[{$idOffer}][{$idOfferItem}]" class="formFields largeInput" {if $offerDetails.supplierVatPercent==-1}style="width:40px" tooltip="{$_LANG.reservations.serviceOffers.tpl.supplierManualVat_price}"{else}style="width:50px"{/if}
						name="supplierInitialValue[{$idOffer}][{$idOfferItem}]" value="{$offerItem.supplierInitialValue|default:0}"
						onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'supplierValue');" onfocus="if (this.value=='0') this.select();"
					/>
					{if $offerDetails.supplierVatPercent==-1}
						<input type="text" id="supplierVat[{$idOffer}][{$idOfferItem}]" class="formFields fadedField" style="width:30px" tooltip="{$_LANG.reservations.serviceOffers.tpl.supplierManualVat_vat}"
							name="supplierInitialVat[{$idOffer}][{$idOfferItem}]" value="{$offerItem.supplierInitialVat|default:0}"
							onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'supplierValue');" onfocus="if (this.value=='0') this.select();"
						/>
					{/if}
					<select size="1" class="formFields" id="supplierCurrency[{$idOffer}][{$idOfferItem}]"
						name="supplierInitialCurrency[{$idOffer}][{$idOfferItem}]" onchange="computeOffer('{$idOffer}', '{$idOfferItem}', 'supplierCurrency');"
					>
						{foreach from=$currenciesList item=currency}
							<option value="{$currency}" {if $offerItem.supplierInitialCurrency==$currency}selected="1"{/if}>{$currency}</option>
						{/foreach}
					</select>
				</div>
			{else}
				&nbsp;
			{/if}

		</td>

		{* -- commission ------------------------------------------------------------------- *}
		<td class="nowrap cellSeparator" commission="{$idOffer}">

			{if $displayFields.commission}
				<input type="text" id="commissionPercent[{$idOffer}][{$idOfferItem}]" style="width:20px" {if !$offerItem.disableCommissionPercent}class="formFields"{else}class="formFieldsDisabled"{/if}
					name="commissionPercent[{$idOffer}][{$idOfferItem}]" value="{$offerItem.commissionPercent}"
					onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'commissionPercent');" onfocus="this.select()"
				/>% &raquo;
				<input type="text" id="commissionValue[{$idOffer}][{$idOfferItem}]" class="formFields largeInput" style="width:40px"
					name="commissionInitialValue[{$idOffer}][{$idOfferItem}]" value="{$offerItem.commissionInitialValue|default:0}"
					onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'commissionValue');" onfocus="if (this.value=='0') this.select();"
				/>
				<select size="1" class="formFields" id="commissionCurrency[{$idOffer}][{$idOfferItem}]"
					name="commissionInitialCurrency[{$idOffer}][{$idOfferItem}]" onchange="computeOffer('{$idOffer}', '{$idOfferItem}', 'commissionCurrency');"
				>
					{foreach from=$currenciesList item=currency}
						<option value="{$currency}" {if $offerItem.commissionInitialCurrency==$currency}selected="1"{/if}>{$currency}</option>
					{/foreach}
				</select>
			{else}
				&nbsp;
			{/if}
		</td>

		{* -- discount --------------------------------------------------------------------- *}
		<td class="nowrap cellSeparator" discount="{$idOffer}">
			{if $displayFields.discount}
				<input type="text" id="discountPercent[{$idOffer}][{$idOfferItem}]" style="width:20px" {if !$offerItem.disableDiscountPercent}class="formFields"{else}class="formFieldsDisabled"{/if}
					name="discountPercent[{$idOffer}][{$idOfferItem}]" value="{$offerItem.discountPercent|default:0}"
					onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'discountPercent');" onfocus="this.select();"
				/>% &raquo;
				<input type="text" id="discountValue[{$idOffer}][{$idOfferItem}]" style="width:40px" {if !$offerItem.disableDiscountValue}class="formFields largeInput"{else}class="formFieldsDisabled largeInput"{/if}
					name="discountInitialValue[{$idOffer}][{$idOfferItem}]" value="{$offerItem.discountInitialValue|default:0}"
					onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'discountValue');" onfocus="if (this.value=='0') this.select();"
				/>
				<select size="1" class="formFields" id="discountCurrency[{$idOffer}][{$idOfferItem}]"
					name="discountInitialCurrency[{$idOffer}][{$idOfferItem}]" onchange="computeOffer('{$idOffer}', '{$idOfferItem}', 'discountCurrency');"
				>
					{foreach from=$currenciesList item=currency}
						<option value="{$currency}" {if $offerItem.discountInitialCurrency==$currency}selected="1"{/if}>{$currency}</option>
					{/foreach}
				</select>

				<a href="#;" class="icon-down2-10 discount"
					tooltip="{$_LANG.reservations.serviceOffers.tpl.discModeTooltip}"
					onclick="displayDiscountFields('{$idOffer}', '{$idOfferItem}');"
				></a>

				{include file="offers_list_items_discount.tpl"}

			{else}
				&nbsp;
			{/if}
		</td>

		{* -- serviceFee ------------------------------------------------------------------- *}
		<td class="nowrap cellSeparator" serviceFee="{$idOffer}">
			{if $displayFields.serviceFee}

				<input type="text" id="serviceFeePercent[{$idOffer}][{$idOfferItem}]" style="width:25px" {if !$offerItem.disableServiceFeePercent}class="formFields"{else}class="formFieldsDisabled"{/if}
					name="serviceFeePercent[{$idOffer}][{$idOfferItem}]" value="{$offerItem.serviceFeePercent|default:0}"
					onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'serviceFeePercent');" onfocus="if (this.value=='0') this.select();"
				/>% &raquo;

				<input type="text" id="serviceFeeValue[{$idOffer}][{$idOfferItem}]" class="formFields largeInput" style="width:40px"
					name="serviceFeeInitialValue[{$idOffer}][{$idOfferItem}]" value="{$offerItem.serviceFeeInitialValue|default:0}"
					onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'serviceFeeValue');" onfocus="if (this.value=='0') this.select();"
				/>
				<select size="1" class="formFields" id="serviceFeeCurrency[{$idOffer}][{$idOfferItem}]"
					name="serviceFeeInitialCurrency[{$idOffer}][{$idOfferItem}]"
					onchange="computeOffer('{$idOffer}', '{$idOfferItem}', 'serviceFeeCurrency');"
				>
					{foreach from=$currenciesList item=currency}
						<option value="{$currency}" {if $offerItem.serviceFeeInitialCurrency==$currency}selected="1"{/if}>{$currency}</option>
					{/foreach}
				</select>
			{else}
				&nbsp;
			{/if}
		</td>

		{* -- tax -------------------------------------------------------------------------- *}
		<td class="nowrap cellSeparator" tax="{$idOffer}" {if !$displayFields.tax} style="border:none;"{/if}>
			{if $displayFields.tax}
				<input type="text" id="taxValue[{$idOffer}][{$idOfferItem}]" class="formFields largeInput" {if $offerDetails.supplierVatPercent==-1}style="width:30px" tooltip="{$_LANG.reservations.serviceOffers.tpl.taxManualVat_price}"{else}style="width:40px"{/if}
					name="taxInitialValue[{$idOffer}][{$idOfferItem}]" value="{$offerItem.taxInitialValue|default:0}" onfocus="if (this.value=='0') this.select();"
					onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'taxValue');"
				/>
				{if $offerDetails.taxVatPercent==-1}
					<input type="text" id="taxVat[{$idOffer}][{$idOfferItem}]" class="formFields fadedField" style="width:30px" tooltip="{$_LANG.reservations.serviceOffers.tpl.taxManualVat_vat}"
						name="taxInitialVat[{$idOffer}][{$idOfferItem}]" value="{$offerItem.taxInitialVat|default:0}"
						onblur="computeOffer('{$idOffer}', '{$idOfferItem}', 'taxValue');" onfocus="if (this.value=='0') this.select();"
					/>
				{/if}
				<select size="1" class="formFields" id="taxCurrency[{$idOffer}][{$idOfferItem}]"
					name="taxInitialCurrency[{$idOffer}][{$idOfferItem}]"
					onchange="computeOffer('{$idOffer}', '{$idOfferItem}', 'taxCurrency');"
				>
					{foreach from=$currenciesList item=currency}
						<option value="{$currency}" {if $offerItem.taxInitialCurrency==$currency}selected="1"{/if}>{$currency}</option>
					{/foreach}
				</select>
			{else}
				&nbsp;
			{/if}
		</td>

		<td class="right" style="border:none;">
			<div class="offerItemTotal">
				{if $offerDetails.offerCalculated}
					{if $offerItem.totalMultiplyBy or $offerItem.totalMultiplyBy=="0"}
						<span class="offerItemTotalMultiplyBy">{$offerItem.totalMultiplyBy}x</span>
					{/if}
					{$offerItem.offerWorkTotal|priceFormat:$offerDetails.totalCurrency}
				{else}
					<span tooltip="{$_LANG.reservations.serviceOffers.tpl.saveOffersToCalculate}" class="help">?</span>
				{/if}
			</div>
		</td>

		<td>
			&nbsp;
		</td>

	</tr>

	<input type="hidden" name="offerItemsList[{$idOffer}][{$idOfferItem}]" value="{$idOfferItem}" />

	<input type="hidden" name="offerItemDetails[{$idOffer}][{$idOfferItem}][idCustomer]" value="{$offerItem.idCustomer}" />
	<input type="hidden" name="offerItemDetails[{$idOffer}][{$idOfferItem}][customerType]" value="{$offerItem.customerType}" />
	<input type="hidden" name="offerItemDetails[{$idOffer}][{$idOfferItem}][productMultiplier]" value="{$offerItem.productMultiplier}" />
{/foreach}
