<!--
****************************************************************************  
*  Description: Layout for tickets content                                 *
*  Created: 05/22/2006                                                     *
****************************************************************************
-->

<!-- I have to replicate some styles here, because in the public section I can't include style.php -->
<style type="text/css">
.formLabel {
    font-weight     : bold;
    color           : #333333;
    background-color: rgb(209,220,235);
}

.formField {
    font-weight      : normal;
    color            : #333333;
    background-color : rgb(238,242,247);
}
.largeheader, .largeheader a {
    font    : bold 11px Verdana, Arial, Helvetica, sans-serif;
    color   : #000000;
}
.LeftPadding {
    padding-left: 10px;
}
.inner {
    background-color: rgb(228,234,242);
}
.formFieldPaddLeft {
    font-weight     : normal;
    color           : #333333;
    background-color: rgb(238,242,247);
    padding-left    : 6px;
}
</style>

<script type="text/javascript" src="../javascript/modules/support.js?version={VERSION}"></script>
<script type="text/javascript" src="newedge/javascript/jscalendar/NE_calendarConsolidated.php?version={VERSION}"></script>
<script type="text/javascript" src="newedge/javascript/jscalendar/lang/calendar-en.js?version={VERSION}"></script>
<script type="text/javascript">
    onLoadFunctions.push(function() {changeTicketType({TICKETID}, '{EXTRA_ARGS}')});

    function deleteTicket()
    {
        return confirm(lang("Click OK if you are sure you want to delete this ticket"));
    }

    function ticketAdditionalNotification()
    {

         var ticketId = $('ticketid').value;
         var ticketAdditionalNotificationId = $('ticketAdditionalNotificationId').value;


        if (ticketId == 0) {
            return;
        }
        setStatus(lang('Adding to notification list'));
        if (ticketAdditionalNotificationId == 0) {
            new Ajax.Request(   'index.php?fuse=support&action=AddTicketAdditionalNotification_ASync&ticketid='+ticketId,
                                {
                                    onSuccess   : AddTicketAdditionalNotification
                                }
            );
        } else {
        
            new Ajax.Request(   'index.php?fuse=support&action=DeleteTicketAdditionalNotification_ASync&additionalNotificationID='+ticketAdditionalNotificationId,
                                {
                                    onSuccess   : DeleteTicketAdditionalNotification
                                }
            );
        }
    }

    function AddTicketAdditionalNotification(responseObj)
    {
        var responseArr = responseObj.responseText.split('|');
        unsetStatus('', 1); 

        if (typeof responseArr[1] == 'undefined' || responseArr[0] != 'OK') {
            alert(responseObj.responseText);
        }  else {
            $('ticketAdditionalNotificationId').value = responseArr[1];
            $('ticketAdditionalNotificationButton').value = lang("Unsubscribe");
        }
    }

    function DeleteTicketAdditionalNotification(responseObj)
    {
        if(responseObj.responseText == 'OK') {
            unsetStatus('', 1); 
            $('ticketAdditionalNotificationId').value = 0;
            $('ticketAdditionalNotificationButton').value = lang("Subscribe");
       } else {
            alert(responseObj.responseText);
       }
    }

    {TICKET_TYPE_ARRAY}
</script>

<div id="dropdownlist">
{CLIENTDROPDOWN}
</div>

<div id="ticketDetailsDiv">
    <table bgcolor=white cellpadding=0 cellspacing=0 border=0 width=580>
      <tr>
        <td>
			  <!-- Header -->
              <table width='100%' cellpadding=0 border=0 cellspacing=0>
              <tr><td class="snapshot-header-left"></td>
                  <td class="snapshot-header" width="160">
              		<font class=snapshot-header-text>
              		{TICKET_HEADER_NUMBER} :
              		</font>
              	  </td>
              	  <td class="snapshot-header" align="left">
	              	<div class=snapshot-header-text id="tdSubject">
	              	{TICKET_HEADER_SUBJECT}
	              	</div>
              	  </td>
              	  <input type="hidden" id="originalSubject" value="{TICKET_SUBJECT}" />
              <td class="snapshot-header" align=right>
              	{TICKET_OVERVIEW_TOGGLE}
              </td>
              <td class="snapshot-header-right"></td>
              </tr>
              </table>                
        </td>
      </tr>
      <tr>
        <td>

    <div id="ticketdetails" style="width:660px;">
        <input type="hidden" id="originalStatus" value="{TICKET_STATUS}" />
        <input type="hidden" id="originalPriority" value="{TICKET_PRIORITY}" />     
        <input type="hidden" id="originalType" value="{TICKET_TYPE}" />
        <table width=100% cellpadding=4 cellspacing=1 border=0>
          <tr>
            <td width=75 class=formLabel nowrap align=right>[l]Status[/l]:</td>
            <td class=formField nowrap><span id="ticket_status_link">{TICKET_STATUS_LINK}</span>
            <!-- BEGIN DYNAMIC BLOCK: ticket_reopen -->
            &nbsp;&nbsp; [ {TICKET_REOPEN} ]
            <!-- END DYNAMIC BLOCK: ticket_reopen -->
            </td>
            <td class=formLabel width=52 nowrap align=right>[l]Priority[/l]:</td>
            <td {TICKET_PRIORITYCLASS} id="tdPriority" width=80 nowrap align=center>{TICKET_PRIORITY_LINK}</td>
            <td class=formLabel width=90 nowrap align=right>[l]Ticket Type[/l]: </td>
            <td width=160 id="tdType" nowrap class=formField align=center>
                {TICKET_TYPE_LINK}
            </td>
          </tr>
        </table>
        <table width=100% cellpadding=4 cellspacing=1 border=0>
          <tr>
            <td width=75 class=formLabel nowrap align=right>[l]Opened By[/l]:</td>
            <td id="tdOwner" class='formField' nowrap>
                <div style="{TICKET_GROUPCOLORSTYLE}">
                    {TICKET_OWNERLINK}
                    <!-- BEGIN DYNAMIC BLOCK: ticket_moveToRegistered -->
                    <br />
                    <a href="javascript:ShowEditBox('tdOwner', 'support', 'SetOwner', 'owner')" class="liveupdate" >[l]Move to registered user[/l]</a>
                    <!-- END DYNAMIC BLOCK: ticket_moveToRegistered -->
                </div>
            </td>
            <td width=90 class=formLabel nowrap align=right>[l]Assigned To[/l]:</td>    
            <td class=formField nowrap align="center" width=160>
                <div id="assignedtoname">{TICKET_ASSIGNEE_LINK}</div>
                <input type="hidden" id="ticket_owner_id" value="{TICKET_OWNER_ID}" />
                <input type="hidden" id="originalAssignedToName" value="{TICKET_ASSIGNEE}" />    
                <input type="hidden" id="assignedToId" value="{TICKET_ASSIGNED_TO_ID}" />
                <input type="hidden" id="userId" value="{USER_ID}" />
            </td>	
          </tr>
        </table>
        <table width=100% cellpadding=4 cellspacing=1 border=0>
          <tr>
            <td width=75 class=formLabel nowrap align=right>[l]Created[/l]:</td>
            <td class=formField nowrap>{TICKET_DATESUBMITTED}</td>
            <td class=formLabel width=90 nowrap align=right>[l]Total Elapsed[/l]:</td>
            <td class=formField width=160 nowrap align=center>{TICKET_TIMEELAPSED}</td>
          </tr>
        </table>
        <table width=100% cellpadding=4 cellspacing=1 border=0>
          <tr>
            <td width=75 class=formLabel nowrap align=right>[l]Package[/l]:</td>
            <td class=formField id="tdDomain" nowrap>{TICKET_DOMAIN_LINK}</div></td>
            <td class=formLabel width=90 nowrap align=right>[l]Plan Name[/l]:</td>
            <td class=formField width=160 align=center>
                <div id="ticket_packagename">{TICKET_PACKAGENAME}</div>
                <input type="hidden" id="ticketid" name="ticketid" value="{TICKET_ID}" />  
                <input type="hidden" id="originalDomain" value="{TICKET_DOMAIN}" />    
            </td>
          </tr>  
        </table>
        <!-- BEGIN DYNAMIC BLOCK: ticketRate -->
        <table width=100% cellpadding=4 cellspacing=1 border=0>
          <tr>
            <td width=75 class=formLabel nowrap align=right>[l]Rated given by customer[/l]:</td>
            <td class=formField width=100% nowrap>{TICKET_RATE}</td>
          </tr>
        </table>
        <!-- END DYNAMIC BLOCK: ticketRate -->
        <!-- BEGIN DYNAMIC BLOCK: ticket_attachment -->
        <table width=100% cellpadding=4 cellspacing=1 border=0>
          <tr>
            <td width=75 class=formLabel nowrap align=right>[l]Attachment[/l]:</td>
            <td class=formField width=100% nowrap>{ATTACHMENT_URL}
            <!-- BEGIN DYNAMIC BLOCK: ticket_attachment_remove -->
            &nbsp;&nbsp;[&nbsp{ATTACHMENT_REMOVEURL}&nbsp;]&nbsp;
            <!-- END DYNAMIC BLOCK: ticket_attachment_remove -->
            - {ATTACHMENT_ADDEDBY}
            </td>
            <td class=formLabel width=90 nowrap align=right>[l]Added On[/l]:</td>
            <td class=formField width=160 nowrap align=center>{ATTACHMENT_DATEADDED}</td>
          </tr>
        </table>
        <!-- END DYNAMIC BLOCK: ticket_attachment -->
    </div>

    <div class="clearline">&nbsp;</div>
    <div class="clearline">&nbsp;</div>
    <div style="position:relative;">
        <ul id="ajaxTabs" class="tickettabs">    
            <!-- BEGIN DYNAMIC BLOCK: tickettab -->
                <li class="{TICKETTAB_CLASS}" name='tickettab' id='{TICKETTAB_ID}_tab'>
                    <a href="#" onclick="cSelectTab('{TICKETTAB_FUSE}','{TICKETTABVIEW}','{TICKETTAB_ID}','tickettab','activetickettab','selectedId={TICKETID}&from=ViewTicketDetails&email={GUEST_EMAIL}&accesscode={ACCESS_CODE}&customerId={TICKET_OWNER_ID}');return false;">{TICKETTAB_NAME}</a>
                </li>
            <!-- END DYNAMIC BLOCK: tickettab -->
        </ul>
        <div style="position:absolute; right:0; bottom:5px; border:1x solid blue">
            <!-- BEGIN DYNAMIC BLOCK: deleteTicketBtn -->
            <form method="post" action="index.php?fuse=support&action=DeleteTicket" style="display:inline">
                <input type="hidden" name="ticketid" value="{TICKETID}" />
                <input type="submit" class="button_large" value="[l]Delete[/l]" onclick="return deleteTicket()" />
            </form>
            <!-- END DYNAMIC BLOCK: deleteTicketBtn -->
            <span id="notificationButton" style="display:{STYLE_TICKET_NOTIFICATIONS}">
                 <input type="button" id="ticketAdditionalNotificationButton" onclick="ticketAdditionalNotification()" class="button_large" value="{TICKET_ADDITIONAL_NOTIFICATION_TITLE}">
                 <input type="hidden" id="ticketAdditionalNotificationId" value="{TICKET_ADDITIONAL_NOTIFICATION_ID}" />
            </span>
        </div>
    </div>
 
    <div id="activetickettab"></div>

	<script type="text/javascript">
		cSelectTab('support','TicketTab_Messages','tickettab_messages','tickettab','activetickettab','selectedId={TICKETID}');	
	</script>

	<div id="initialtickettab">
	{TICKETTAB_INITIAL}
	</div>

	</td>
  </tr>
</table>
</div>
<div id="ticketNotesDiv"></div>
