
{showMessage}


{if $corporatesList}

	<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.corporatesList.th.name}</th>
			<th style="font-size: 12px;">{$_LANG.orderForm.clientsList.corporatesList.th.type}</th>
			<th width="2%" style="font-size: 12px;">{$_LANG.orderForm.clientsList.corporatesList.th.owner}</th>
			<th class="right nowrap" width="1%" style="font-size: 12px;">{$_LANG.orderForm.clientsList.corporatesList.th.options}</th>
		</tr>

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

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

				<td {if $corporate->status!='CLIENT'}class="italic"{/if}>

					{if $corporate->idAccountManager}
						<span style="float:right" class="italic grey" tooltip="{$_LANG['orderForm']['clientsList']['corporatesList']['kamCorp']}">{userLabel ref=$corporate->idAccountManager}</span>
					{/if}

					{if $corporate->getId()==$idCorporateOwner}
						<span tooltip="{$_LANG.orderForm.clientsList.corporatesList.ownerTooltip}" style="font-weight: bold;">
					{/if}

						{$corporate->alias}

						{if $corporate->status!='CLIENT'}
							[{$corporate->statusName}]
						{/if}

					{if $corporate->getId()==$idCorporateOwner}
						</span>
					{/if}
				</td>

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

				<td class="center">

					{** corporate owner **}

					{if $corporate->getId()==$idCorporateOwner}
						<a href="#" class="icon-accepted"
							tooltip="{$_LANG.orderForm.clientsList.corporatesList.unsetOwnerTooltip}"
							onClick="window.parent.messageBox.showQuestion('{$_LANG.confirm}','{$_LANG.orderForm.clientsList.corporatesList.unsetOwnerMessage}',[ ['{$_LANG.yes}', 'window.parent.$(\'iframe1\').src=\'./clientsList.php?setOwnerCorporateId={$corporate->getId()}\''], '{$_LANG.no}'])"
						/>
					{else}
						<a href="#" class="icon-accept"
							tooltip="{$_LANG.orderForm.clientsList.corporatesList.chooseOwnerTooltip}"
							onClick="window.parent.messageBox.showQuestion('{$_LANG.confirm}','{$_LANG.orderForm.clientsList.corporatesList.setOwnerMessage}',[ ['{$_LANG.yes}', 'window.parent.$(\'iframe1\').src=\'./clientsList.php?setOwnerCorporateId={$corporate->getId()}\''], '{$_LANG.no}'])"
						/>
					{/if}

				</td>

				<td class="right">

					<table class="options">

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

						<td>
							{** edit corporate **}
							<a
								href="#;"
								{if CurrentUserAccess::getInstance()->hasAccessToOption('Modules/Partners/Corporates-update')}
									onClick="corporateUpdate('{$corporate->getId()}');"
									class="icon-edit"
									tooltip="{$_LANG.orderForm.clientsList.corporatesList.editCorpTooltip}"
								{else}
									class="icon-edit-disabled"
									tooltip="{$_LANG.noAccessToOption}"
								{/if}
							></a>
						</td>

						<td>
							{** delete corporate **}
							<a
								href="#;"
								onClick="window.parent.messageBox.showQuestion('{$_LANG.confirm}','{$_LANG.orderForm.clientsList.corporatesList.delCorpMessage} <br /> &bull; {$corporate->alias|escape}',[ ['{$_LANG.yes}', 'window.parent.$(\'iframe1\').src=\'./clientsList.php?deleteCorporateId={$corporate->getId()}\''], '{$_LANG.no}'])"
								class="icon-delete"
								tooltip="{$_LANG.orderForm.clientsList.corporatesList.delCorpTooltip}"
							></a>
						</td>
					</table>

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

{/if}