{************************** TRANS_CURRENT_PACKAGE_STATUS **************************}

<fieldset>
	<legend>{"TRANS_CURRENT_STATUS"|lmsg}</legend>

	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="list">

		<tr>
			<td class="title">{"TRANS_PACKAGESTATUS"|lmsg}</td>
            <td>
             {if ("failed"|get_status_id:"package") == $packageInfo.packageStatus}
                 <img src="{$imageDirectory}/ico/sync-status-error.gif" width="16" height="16" border="0" alt="{$packageStatuses[$packageInfo.packageStatus]}" title="{$packageStatuses[$packageInfo.packageStatus]}" style="vertical-align:middle;border-style:none;" />
            {/if}
            {$packageStatuses[$packageInfo.packageStatus]}
             </td>
		</tr>
		<tr>
			<td class="title">{"TRANS_STATUS_CHANGE_REASON"|lmsg}</td>
			<td>{$packageInfo.packageStatusReason}</td>
		</tr>
		<tr>
			<td class="title">
				{if "reseller" == ($packageInfo.packageType|getAPITypeName:"products")}
					{"TRANS_PACKAGE_RESELLER_STATUS_REASON_OPTION"|lmsg}
				{else}
					{"TRANS_PACKAGE_CUSTOMER_STATUS_REASON_OPTION"|lmsg}
				{/if}
			</td>
			<td>{$packageInfo.packageCustomerStatusReason}</td>
		</tr>
	</table>
</fieldset><br>

{if $packageInfo.packageActive && (
	$packageInfo.packageStatus == ("none"|get_status_id:"package") ||
	$packageInfo.packageStatus == ("suspended"|get_status_id:"package") ||
	$packageInfo.packageStatus == ("pending"|get_status_id:"package") ||
	$packageInfo.packageStatus == ("work_in_progress"|get_status_id:"package") ||
	$packageInfo.packageStatus == ("pending_renewal"|get_status_id:"package") ||
	$packageInfo.packageStatus == ("user_input_required"|get_status_id:"package")
)}
<fieldset>
	<legend>{"TRANS_ADMINISTRATIVE_ACTIONS"|lmsg}</legend>
	<form style="display:inline;" action="{getFormAction controller="packages"}" method="post" name="subscriptionActions" id="subscriptionActions">
		<input type="hidden" name="token" value="{$token}" />
		<input type="hidden" name="act" value="{getActionID action="EditPackageResponse"}" />
		<input type="hidden" name="packageID" value="{$packageInfo.packageID}" />
		<input type="hidden" name="subscriptionAction" value="" />
	</form>
	<script type="text/javascript">
	{literal}
	function performActionForSubscription(action)
	{
		var form = jQuery('#subscriptionActions');
		form.find('input[name="subscriptionAction"]').val(action);
		form.submit();

	}
	{/literal}
	</script>

	{if $packageInfo.packageStatus == ("none"|get_status_id:"package")} {* Show operation "Suspend" *}
		{include file="$tplDirectory/widgets/actionLink.tpl"
			javascriptLink="performActionForSubscription('suspend');"
			icoImage="../bull/02.gif"
			icoWidth="16"
			icoHeight="16"
			id="actionSuspend"
			altText="TRANS_SUBSCRIPTION_OPERATION_SUSPEND"
			linkText="TRANS_SUBSCRIPTION_OPERATION_SUSPEND"
		}<br>
	{/if}
	{if $packageInfo.showActivateLink} {* Show operation "Activate" *}
		{include file="$tplDirectory/widgets/actionLink.tpl"
			javascriptLink="performActionForSubscription('activate');"
			icoImage="../bull/02.gif"
			icoWidth="16"
			icoHeight="16"
			id="actionActivate"
			altText="TRANS_SUBSCRIPTION_OPERATION_ACTIVATE"
			linkText="TRANS_SUBSCRIPTION_OPERATION_ACTIVATE"
		}<br>
	{/if}
	{if $packageInfo.packageStatus == ("none"|get_status_id:"package") || $packageInfo.packageStatus == ("suspended"|get_status_id:"package")} {* Show operations "Cancel" or "Rollback" *}
		{if $packageInfo.packagePendingCancellation == 0} {* Show operation "Cancel" *}
			{include file="$tplDirectory/widgets/actionLink.tpl"
				javascriptLink="performActionForSubscription('cancel');"
				icoImage="../bull/02.gif"
				icoWidth="16"
				icoHeight="16"
				id="actionCancel"
				altText="TRANS_SUBSCRIPTION_OPERATION_CANCEL"
				linkText="TRANS_SUBSCRIPTION_OPERATION_CANCEL"
			}<br>
		{elseif $packageInfo.packagePendingCancellation == 1 || $packageInfo.packagePendingCancellation == 2}{* Show operation "Rollback" *}
			{include file="$tplDirectory/widgets/actionLink.tpl"
				javascriptLink="performActionForSubscription('withdrawCancellation');"
				icoImage="../bull/02.gif"
				icoWidth="16"
				icoHeight="16"
				id="actionWithdrawCancellation"
				altText="TRANS_SUBSCRIPTION_OPERATION_WITHDRAW_CANCELLATION"
				linkText="TRANS_SUBSCRIPTION_OPERATION_WITHDRAW_CANCELLATION"
			}<br>
		{/if}
	{/if}

	{if "upgrade" != ($packageInfo.packagePendingCancellation|getAPITypeName:"pendingcancellation") && !($packageInfo.packageStatus == ("pending"|get_status_id:"package") && "" != $packageInfo.packagePriorID)}
		{* Show operation "Cancel immediately" *}
		{include file="$tplDirectory/widgets/actionLink.tpl"
			javascriptLink="performActionForSubscription('cancelImmediately');"
			icoImage="../bull/02.gif"
			icoWidth="16"
			icoHeight="16"
			id="actionCancelImmediately"
			altText="TRANS_SUBSCRIPTION_OPERATION_CANCEL_IMMEDIATELY"
			linkText="TRANS_SUBSCRIPTION_OPERATION_CANCEL_IMMEDIATELY"
		}<br>
	{/if}

	{if $packageInfo.canCancelUpgrade}
		{* Show operation "Cancel upgrade or downgrade" *}
		{include file="$tplDirectory/widgets/actionLink.tpl"
			javascriptLink="performActionForSubscription('cancelUpgrade');"
			icoImage="../bull/02.gif"
			icoWidth="16"
			icoHeight="16"
			id="actionCancelImmediately"
			altText="TRANS_SUBSCRIPTION_OPERATION_CANCEL_UPGRADE_DOWNGRADE"
			linkText="TRANS_SUBSCRIPTION_OPERATION_CANCEL_UPGRADE_DOWNGRADE"
		}<br>
	{/if}
</fieldset><br>
{/if}

{foreach key="serverGroupID" item="attribute" from=$serverGroupStatuses}
	{if !$attribute.absent}
		{assign var="panel_status" value=$attribute.packageAttributeValue}
		{assign var="configGroupID" value=$attribute.configGroupID}
		{assign var="queueID" value=$queueItems[$configGroupID].systemQueueID}
		{if $panel_status=="none"}
			{assign var="panel_status" value="Active"}
		{elseif $panel_status=="suspended"}
			{assign var="panel_status" value="Suspended"}
		{/if}

		{if $panel_status=="Active" || $panel_status=="Suspended" || !$isReseller}
			<fieldset>
				<legend>{"TRANS_SUBSCRIPTION_ON_PANEL_GROUP"|lmsg:"PANEL_GROUP":$serverGroupList.$serverGroupID}</legend>
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="list">
		{/if}

		{if $panel_status=="Active" || $panel_status=="Suspended"}
				<tr>
					<td class="title">{"TRANS_PACKAGE_DETAILS_STATUS_ON_PANEL"|lmsg}</td>
					<td>{$panel_status}</td>
				</tr>
				<tr>
					<td class="title">{"TRANS_SYSTEM_QUEUE_STATUS_OPTION"|lmsg}</td>
					<td>{$queueItems[$configGroupID].subCommand}: <a href="{getHREF page="events.php" actionName="ShowTask" args="systemQueueID=$queueID"}">{$queueItems[$configGroupID].systemQueueStatus}</a></td>
				</tr>
		{/if}

		{if !$isReseller}
			{if 1 != $panels|@count}
				<form style="display:inline" action="{getFormAction controller="packages"}&act={getActionID action="EditPackageAttributeResponse}"}" method="post" name="delete_section">
					<tr class="listButtons">
						<td colspan="2" valign="top"><div>

							<select name="configGroupID">
								{html_options options=$panels selected=$configGroupID}
							</select>

							<input type="hidden" name="token" value="{$token}" />
							<input type="hidden" name="act" value="{getActionID action="ReassignPackageAttributeResponse"}" />
							<input type="hidden" name="oldConfigID" value="{$configGroupID}" />
							<input type="hidden" name="referralActionID" value="{getActionID action="ShowPackageDetails"}" />
							<input type="hidden" name="referralActionFile" value="packages.php" />
							<input type="hidden" name="packageID" value="{$packageInfo.packageID}" />
							<input class="submit" style="background-color:red;" type="submit" name="submit_update" value="{"TRANS_REASSIGN"|lmsg}"/><br />
							<small style="padding: 3px;"><em>{"TRANS_REASSIGN_DESC"|lmsg}</em></small>
						</div></td>
					</tr>
				</form>
			{else}
				<tr>
					<td class="title">{"TRANS_PANEL_SERVERNAME_OPTION"|lmsg}</td>
					<td>
						{$panels.$configGroupID}
						{if $panel_status == "Active" && $serverDetails[$configGroupID].loginUrl}
							<a href="{$serverDetails[$configGroupID].loginUrl}" target="_blank"><img src="{$imageDirectory}/ico/id_card.gif" width="16" height="16" style="vertical-align:middle;border-style:none; margin-right: 4px;" alt="{"TRANS_LOGIN"|lmsg}" title="{"TRANS_LOGIN"|lmsg}" /></a>&nbsp;
							<a href="{$serverDetails[$configGroupID].loginUrl}" target="_blank" id="loginPanel_{$configGroupID}">{"TRANS_LOGIN"|lmsg}</a>
						{/if}
					</td>
				</tr>
			{/if}
		{/if}

		{if $panel_status=="Active" || $panel_status=="Suspended" || !$isReseller}
				</table>
			</fieldset><br>
		{/if}
	{/if} {* ! absent *}
{/foreach}