<div id="csLoadingBar" class="csLoadingBar"></div>
<div id="ticketMenu" class="ticketMenu" style="visibility: hidden;">
<div ng-controller="ticketMenuCtrl" id="ticketMenuCtrl">
<div id="resultMessage" ng-show="showAlert"
class="result-message userSearch alert {{resultMessageClass}}">
<i class="{{resultMessageClassExt}}"></i> {{resultMessage}}
</div>




<div ng-if="ticket != null" id="ticketMenuApplication boxContainer" class="ng-scope uiBox containerTopicDetail all-box {{ticket.warning}}{{man}}">
<div class="ellipsed titleTicket postViewHeader "> {{ticket.title | decodeStr}}</div>

<a ng-show="canManage && !showEdit"  class="actionIcon" style="float:right; margin-right: 15px;" ng-click="editTicket();showEdit=true"> <i class="uiIconEdit"></i></a>
<a ng-show="canManage && showEdit"  class="actionIcon " style="float:right; border: Solid 1px #cadaea; margin-right: 5px;" ng-click="getTicket();showEdit=false"> <i class="uiIconClose"></i></a>
<a ng-show="canManage && showEdit"  class="actionIcon " style="float:right; border: Solid 1px #cadaea; margin-right: 5px;" ng-click="saveTicket();showEdit=false"> <i class="uiIconTick"></i></a>

<div class="pull-left left-box" >
<button class="btn btn-xlarge ng-scope"   ng-click="backTickets()"><i class="uiIconSocLastestReply uiIconWhite"></i>   {{i18n.backToTickets}}</button>
<button class="btn btn-primary btn-xlarge ng-scope" ng-click="createTicket()"> <i class="uiIconEcmsAddDocument uiIconWhite"></i>   {{i18n.createNewTicket}}</button>
</div>

<div class="pull-right right-box">
<div ng-if="!showEdit" class="col-sm-6">
<b>{{i18n.status}}:</b> <span>{{i18n[ticket.status]}}</span> <br>
<b ng-click="showEditReason()">{{i18n.reason}}:</b> 
<span ng-if="[ticket.reason]!==undefined && !editReason" ng-click="showEditReason()">{{i18n[ticket.reason]!==undefined ? i18n[ticket.reason] : ticket.reason}}</span>
<select ng-if="reasons.length>1 && editReason && !editSelectReason" ng-model="ticket.reason" ng-init="tempReason=ticket.reason" name="selectReason" id="selectReason">
<option ng-repeat="reason_ in reasons" value="{{reason_}}">{{i18n[reason_]}}</option>
</select>
<a ng-if="reasons.length>1 && editReason && !editSelectReason""class="actionIcon " style="margin-top: -7px;margin-left: -46px;" ng-click="editSelect()"> <i class="uiIconEdit" style="color: #578dc994;"></i></a>
<input ng-if="(reasons.length<=1 || editSelectReason )&& editReason" type="text" name="newReason" id="newReason"  ng-model="ticket.reason">
<a  ng-if="editReason" class="actionIcon " style="background-color: #578dc9;vertical-align: text-bottom;border: Solid 1px #cadaea;margin-right: 5px;margin-left: 12px;" ng-click="saveReason()"> <i class="uiIconTick" style="color: white;"></i></a>
<a  ng-if="editReason" class="actionIcon " style="vertical-align: text-bottom; border: Solid 1px #cadaea; margin-right: 5px;" ng-click="hideEditReason()"> <i class="uiIconClose"></i></a>
<br>
<b>{{i18n.type}}:</b> <span>{{i18n[ticket.type]}}</span> <br>
<div ng-if="canManage"><b>{{i18n.owner}}:</b> <span>{{ticket.owner}}</span> <br></div>
</div>
<div ng-if="!showEdit" class="col-sm-6">
<b>{{i18n.ticketseverity}}:</b> <span>{{i18n[ticket.severity]}}</span><br>
<div ng-if="canManage"><b>{{i18n.assignee}}:</b> <span>{{getDisplayName(ticket.assignee)}}</span> <br></div>
<b>{{i18n.created}}:</b> <span>{{ticket.startDate| date:'d MMM y HH:mm:ss'}}</span> <br>
<div ng-if="canManage"><b>{{i18n.attachedJira}}:</b>
<img src="{{ticket.jiraStatusIcon}}" height="16" width="16">
<a target="_blank" ng-if="ticket.jiraStatus==6" class="closedJira" href="https://jira.exoplatform.org/browse/{{ticket.attachedJira}}">{{ticket.attachedJira}}</a>
<a target="_blank" ng-if="ticket.jiraStatus!=6"  href="https://jira.exoplatform.org/browse/{{ticket.attachedJira}}">{{ticket.attachedJira}}</a>
<br>

</div>
</div>
<div ng-if="showEdit && canManage" class="col-sm-6">
<b>{{i18n.status}}:</b>                 
<select ng-model="ticket.status" name="status" ng-change="setReason()" ng-init="tempStatus=ticket.status">
<option ng-repeat="status in allStatusesNames" value="{{status.state}}">{{i18n[status.state]}}</option></select> <br>
<b>{{i18n.reason}}:</b> 
<span ng-if="[ticket.reason]!==undefined && !editReason" ng-click="showEditReason()">{{i18n[ticket.reason]!==undefined ? i18n[ticket.reason] : ticket.reason}}</span>
<select ng-if="reasons.length>1 && editReason && !editSelectReason" ng-model="ticket.reason" ng-init="tempReason=ticket.reason" name="selectReason" id="selectReason">
<option ng-repeat="reason_ in reasons" value="{{reason_}}">{{i18n[reason_]}}</option>
</select>
<a ng-if="reasons.length>1 && editReason && !editSelectReason""class="actionIcon " style="margin-top: -7px;margin-left: -46px;" ng-click="editSelect()"> <i class="uiIconEdit" style="color: #578dc994;"></i></a>
<input ng-if="(reasons.length<=1 || editSelectReason )&& editReason" type="text" name="newReason" id="newReason"  ng-model="ticket.reason">

<br>
<b>{{i18n.type}}:</b>
<select ng-model="ticket.type" name="selectType" id="selectType">
<option ng-repeat="selectedType in ticketTypes" value="{{selectedType}}">{{selectedType}}</option>
</select> <br>
<b>{{i18n.owner}}:</b>
<select  ng-model="ticket.owner" name="selectType" id="selectedOwner">
<option ng-repeat="selectedOwner in ownersList" value="{{selectedOwner}}">{{selectedOwner}}</option>
</select> <br>
</div>
<div ng-if="showEdit && canManage" class="col-sm-6"> <b>{{i18n.ticketseverity}}:</b>
<select  ng-model="ticket.severity" name="selectSeverity" id="selectSeverity">
<option ng-repeat="selectedSeverity in severities" value="{{selectedSeverity}}">{{selectedSeverity}}</option>
</select><br>
<b>{{i18n.created}}:</b> <span>{{ticket.startDate| date:'d MMM y HH:mm:ss'}}</span><br>
<b>{{i18n.assignee}}:</b>
<select ng-model="ticket.assignee" name="assignee">
<option ng-repeat="assignee in assignees" value="{{assignee.userName}}">{{assignee.displayName}}</option>
<option value="{{i18n.empty}}">{{i18n.empty}}</option>
</select> <!-- <a href="javascript:void(0);" ng-click="ticket.assignee=currentUser">{{i18n.assignToMe}}</a> -->
<br>
<b>{{i18n.attachedJira}}:</b>
<input type="text" name="attachedJira" id="attachedJira"  ng-model="ticket.attachedJira">
<br>

</div>


<div class="col-sm-12">

<a href="#" ng-click="toggleEnv()">
<div ng-if="showEnv" class="uiIconArrowDown uiIconLightGray"></div>
<div ng-if="!showEnv" class="uiIconArrowRight uiIconLightGray"></div>
</a>

<b>{{i18n.environmentName}}:</b> <a href="#" ng-click="toggleEnv()">{{enveronment.name}}</a><br><span></span>
</div>
<div ng-hide="!showEnv"  class="col-sm-12">
<div class="col-sm-6">
<b>{{i18n.productVersion}}:</b> <span>{{enveronment.productVersion}}</span> <br>
<b>{{i18n.osName}}:</b> <span>{{enveronment.osName}} {{enveronment.osVersion}}</span> <br>
<b>{{i18n.jvmVendorName}}:</b> <span>{{enveronment.jvmVendorName}} {{enveronment.jvmVersion}}</span> <br>
</div>
<div class="col-sm-6">
<b>{{i18n.asName}}:</b> <span>{{enveronment.asName}} {{enveronment.asVersion}}</span> <br>
<b>{{i18n.dbName}}:</b> <span>{{enveronment.dbName}} {{enveronment.dbVersion}}</span> <br>
<b>{{i18n.ssoName}}:</b> <span>{{enveronment.ssoName}} {{enveronment.ssoVersion}}</span> <br>
</div>
</div>
<div ng-if="showStatuses" class="col-sm-12">
<b>{{i18n.changeStatusTo}}:</b>
<div class="btn-toolbar" style="display:block">

<div class="btn-group">
<a ng-repeat="status in successors" class="btn" href="#" ng-click="saveStatus(status)" ><i class=""> {{i18n[status.state]}}</i></a>
</div>
</div>

</div>

</div>
</div>

<div class="toggle-radio" ng-show="ticket.status!='open'">
<input type="radio" name="rdo" id="yes" ng-model="ticket.customerSatisfied" ng-value=true  ng-change="updateCustomerSatisfaction()" ng-disabled="disabledVote">
<input type="radio" name="rdo" id="no" ng-model="ticket.customerSatisfied" ng-value=false ng-change="updateCustomerSatisfaction()" ng-disabled="disabledVote">

<div ng-if="disabledVote" class="lab-switch">Customer rate:</div>
<div ng-if="!disabledVote" class="lab-switch">How would you rate the support you received ?</div>
<div class="switch">
<label for="yes">Good</label>
<label for="no">Bad</label>
<span></span>
</div>
</div>
