{extends file=$smarty.const.SMARTY_LAYOUT_CONTENT_LIST_TABLE_CURRENT_DATA}

{block name="listing-tr-class"}
	{if $rowFields['statusOp']=='XX'}
		disabled
	{/if}

	{if $rowFields['servicesList']|count != 1}
		serviceDetails-invisible
	{else}
		serviceDetails-default
	{/if}
{/block}

{block name="listing-tr-extraData"}
	data-convertedId="{$rowFields['convertedId']}"
	data-orderNumber="{$rowFields['reservationNumber']}"
	data-orderCode="{$rowFields['reservationCode']}"
{/block}

{block name="listing-td-content-services"}
	<div class="content">

		<div class="servicesGeneralDetails">
			<div><b>{$rowFields['services']}</b></div>
			<div>- {$rowFields['startDate']|dateTimeFormat:'date'} - {$rowFields['endDate']|dateTimeFormat:'date'}</div>
			{if $rowFields['cityId'] or $rowFields['countryCode']}
				<div>- 
					{if $rowFields['cityId']}
						{cityLabel ref=$rowFields['cityId']}
					{/if}
					{if $rowFields['countryCode']}
						({countryLabel ref=$rowFields['countryCode']})
					{/if}
				</div>
			{/if}

			<div style="font-weight: bold;">- [
				{foreach $rowFields['servGenOpStat'] as $status=>$count}
					{$count}x{$_LANG['reservationServices']['statusOpName'][$status]}
					{if !$smarty.foreach.status.last}, {/if}
				{/foreach}
				/{$_LANG['reservations']['statusFinName'][$rowFields['statusFin']]}]
			 </div>
		</div>

		<div class="servicesList">
            {$servicesDisplayCount=5}
			{foreach $rowFields['servicesList'] as $idService=>$serviceDetails}
				<div class="service"
				{if $serviceDetails['linkedToIdService']>0}
					style="padding-left: 5px;"
				{/if}
				 data-idService="{$idService}">
					<div class="title">
						<span>
							<b>{$serviceDetails['index']}. {serviceLabel ref=$idService format={$serviceDetails['service']}}</b>
							{if $serviceDetails['passengersTicketsList']}[
								{foreach $serviceDetails['passengersTicketsList'] as $tkt}
									{$tkt}{if !$tkt@last},{/if}

									{if $tkt@iteration>=5}
										...{break}
									{/if}
								{/foreach}
							]{/if}
						</span>

						{if $serviceDetails['isPackage']}
							<span><b>[{$lang['index']['listCols']['package']}]</b></span>
						{/if}

						{if $serviceDetails['idSupplierProduct']}
							<span class="supplierProduct"> - {supplierProductLabel ref=$serviceDetails['idSupplierProduct']}</span>
						{/if}

						<div class="optionsBox sectionRow serviceOptionsBox">
							<ul class="submenu submenu-depth-0 Simple">
								<li class="menuItem serviceOffer">
									<var class="icon-offer" tooltip="{$lang['index']['serviceOptions']['servOffer']}"></var>
								</li>
							</ul>
						</div>
					</div>
					<div class="details">
						{if $serviceDetails['startDate'] or $serviceDetails['endDate']}
							<div class="otherInfo"> - {$serviceDetails['startDate']|dateTimeFormat:'date'} - {$serviceDetails['endDate']|dateTimeFormat:'date'} </div>
						{/if}
						{if $serviceDetails['idDestinationCity'] or $serviceDetails['idDestinationCountry']}
							<div class="otherInfo"> - {cityLabel ref=$serviceDetails['idDestinationCity']}
								{if $serviceDetails['idDestinationCountry']}
									({countryLabel ref=$serviceDetails['idDestinationCountry']})
								{/if}
							 </div>
						{/if}
						<div class="statusAndOptions" style="font-weight: bold;"> - [{$_LANG['reservationServices']['statusOpName'][$serviceDetails['statusOp']]}/{$_LANG['reservationServices']['statusFinName'][$serviceDetails['statusFin']]}] </div>
					</div>
				</div>

                {* we only display a limited number of services *}
				{if $serviceDetails@iteration>=$servicesDisplayCount}
					{break}
				{/if}
			{/foreach}
            {if count($rowFields['servicesList'])>$servicesDisplayCount}
                [+{count($rowFields['servicesList'])-$servicesDisplayCount} {$lang['index']['serviceDetails']['servicesCount']}]
            {/if}
		</div>

		<div class="showDetailsContainer">
			<a class="showServiceDetails">
				<span class="show">{$lang['index']['serviceDetails']['show']}</span>
				<span class="hide">{$lang['index']['serviceDetails']['hide']}</span>
			</a>
		</div>
	</div>

{/block}

{block name="listing-td-content-corporates"}

	{foreach $rowFields['idCorporatesList'] as $idCorporate}
		{if $rowFields['idCorporateOwner'] == $idCorporate}
			<div><b>{corporateLabel ref=$idCorporate}
			{if $rowFields['idCorporateOwnerOffice']}
				[{corporateOfficeLabel ref=$rowFields['idCorporateOwnerOffice']}]
			{/if}
			</b></div>
		{else}
			<div>{corporateLabel ref=$idCorporate}</div>
		{/if}
			{if $idCorporate@iteration>=5}
			[.....]{break}
		{/if}
	{/foreach}

	{if $rowFields['idContactPerson']}
		<div>{$lang['index']['listing']['idContactPerson']}: {contactPersonLabel ref=$rowFields['idContactPerson']}</div>
	{/if}
{/block}

{block name="listing-td-content-customers"}

	{foreach $rowFields['idCustomersList'] as $idCustomer}
		<div>
			{if $rowFields['idCustomerOwner']==$idCustomer}
				<b>{customerLabel ref=$idCustomer}</b>
			{else}
				{customerLabel ref=$idCustomer}
			{/if}

			{if $idCustomer@iteration>=5}
				[.....]{break}
			{/if}
		</div>
	{/foreach}

	<div style="font-weight: bold;">
		[{$rowFields['idCustomersList']|count}/{$rowFields['pax']}]
	</div>
{/block}


{block name="listing-td-content-status"}
	<div style="font-weight:bold">
		{if $_LANG['reservations']['statusOpName'][$rowFields['statusOp']]}
			{$_LANG['reservations']['statusOpName'][$rowFields['statusOp']]}
		{else}
			{$rowFields['statusOp']}
		{/if}
		 /
		 {if $_LANG['reservations']['statusFinName'][$rowFields['statusFin']]}
		 	{$_LANG['reservations']['statusFinName'][$rowFields['statusFin']]}
		 {else}
		 	{$rowFields['statusFin']}
		 {/if}
	</div>
{/block}

{block name="listing-td-content-details"}
	<div style="float:left;">
		<div>Id: {orderLabel ref={$rowFields['id']} format={$rowFields['convertedId']}}</div>
		<div>Nr: <span class="italic">{$rowFields['reservationNumber']}</span></div>
		{if $rowFields['reservationCode']}
			<div>Cod: {$rowFields['reservationCode']}</div>
		{/if}
		<div>{$rowFields['startDate']|dateTimeFormat:'date'}&raquo;{$rowFields['endDate']|dateTimeFormat:'date'}</div>
		{if $rowFields['idMiceProject']}
			<div>{$lang['index']['listing']['idMiceProject']}: {$rowFields['miceProjectName']}</div>
		{/if}
		{if $rowFields['notes']}
			<div>
				<a href="#" class="link" onclick="orderNotes('{$rowFields['id']}')">
					{$lang['index']['listing']['viewNotes']}
				</a>
			</div>
		{/if}
	</div>
{/block}

{block name="listing-td-addTime"}
	<td class="flag-{$rowFields['flag']} {if $listObj->getOrderColumn()=='addTime'}order-active{/if}">
		{$rowFields['addTime']|dateTimeFormat:'dateWithHM'}
		<div>{userLabel ref=$rowFields['idUser']}</div>
		<div>[{officeLabel ref=$rowFields['idOffice']}]</div>
	</td>
{/block}
