
{showMessage}

{if $customersList}

	<table class="list" width="100%" style="margin:0">

		{******************************************************************************************}
		{********************************* TABLE HEADER *******************************************}
		{******************************************************************************************}

		<tr>
			<th width="1%" style="font-size: 12px;">#</th>
			<th style="font-size: 12px;">{$_LANG.orderForm.clientsList.customersList.th.name}</th>
			<th style="font-size: 12px;">{$_LANG.orderForm.clientsList.customersList.th.type}</th>
			<th style="font-size: 12px;">{$_LANG.orderForm.clientsList.customersList.th.company}</th>
			<th width="2%" style="font-size: 12px;">{$_LANG.orderForm.clientsList.customersList.th.owner}</th>
			<th class="right nowrap" width="1%" style="font-size: 12px;">{$_LANG.orderForm.clientsList.customersList.th.options}</th>
		</tr>

		{******************************************************************************************}
		{*********************************** TABLE INFO *******************************************}
		{******************************************************************************************}

		{foreach $customersList as $customer}
			<tr class="{cycle values="odd,even"}">
				<td class="nowrap" width="1%">{counter name=resultsCount}.</td>

				<td>
					{if $customer->getId()==$idCustomerOwner}<b>{/if}
					{$customer->name}
					{if $customer->getId()==$idCustomerOwner}</b>{/if}
				</td>

				<td>
					{$customer->typeName}
				</td>

				<td>
					{corporateLabel ref=$customer->idCorporate|default:'-'}
				</td>

				<td class="center">

					{** customer owner **}
					{if $customer->getId()==$idCustomerOwner}
						<a href="#" align="absmiddle" class="icon-accepted"
							tooltip="{$_LANG.orderForm.clientsList.customersList.ownerTooltip}"
						/>
					{else}
						<a href="#" class="icon-accept"
							tooltip="{$_LANG.orderForm.clientsList.customersList.chooseOwnerTooltip}"
							onClick="window.parent.messageBox.showQuestion('{$_LANG.confirm}','{$_LANG.orderForm.clientsList.customersList.setCustomerOwnerMessage}<br />&bull; {$customer->lastName|escape} {$customer->firstName|escape}',[ ['{$_LANG.yes}', 'window.parent.$(\'iframe1\').src=\'./clientsList.php?setOwnerCustomerId={$customer->getId()}\''], '{$_LANG.no}'])"
						/>
					{/if}
				</td>

				<td class="right">

					<table class="options">

						<td>
							{** customer details **}
							<a class="icon-infoOrange" href="#;"
								tooltip="{$_LANG.orderForm.clientsList.customersList.viewDetailsTooltip}"
								onClick="RemoteLoad.load(this, MVC.appUrl('RemoteData/InfoBox', 'customer', { 'id': '{$customer->getId()}' }), null);"
							></a>
						</td>

						<td>
							{** edit customer **}
							<a href="#;"
								{if CurrentUserAccess::getInstance()->hasAccessToOption('Modules/Partners/Customers-update')}
									class="icon-edit"
									tooltip="{$_LANG.orderForm.clientsList.customersList.editCustomerTooltip}"
									onClick="customerUpdate('{$customer->getId()}')"
								{else}
									class="icon-edit-disabled"
									tooltip="{$_LANG.noAccessToOption}"
								{/if}
							></a>
						</td>

						<td>
							{** delete customer **}
							<a href="#;"
								onClick="window.parent.messageBox.showQuestion('{$_LANG.confirm}','{$_LANG.orderForm.clientsList.customersList.delCustMessage} <br /> &bull; {$customer->lastName|escape} {$customer->firstName|escape} / {$customer->titleName|escape}',[ ['{$_LANG.yes}', 'window.parent.$(\'iframe1\').src=\'./clientsList.php?deleteCustomerId={$customer->getId()}\''], '{$_LANG.no}'])"
								class="icon-delete"
								tooltip="{$_LANG.orderForm.clientsList.customersList.delCustomerTooltip}"
							></a>
						</td>
					</table>

				</td>
			</tr>
		{/foreach}
	</table>

{/if}