<div class="container" id="detail-container" ng-cloak ng-show="caseInstance">
	<div class="row" ng-if="caseInstance">
		<div class="col-md-9">
			<div class="component component-pack" >
				<div class="title">
					<div class="pull-right">
						<a ng-click="returnToList()" class="action">&larr; {{'GENERAL.ACTION.RETURN-TO-LIST' | translate}}</a>
					</div>
					<h2>{{caseInstance.name &amp;&amp; caseInstance.name + "-" || ""}}{{caseInstance.id}}</h2>
				</div>
				<div class="property-wrapper">
					<table>
						<tr class="property">
							<td class="property-name" translate="CASE-INSTANCE.ID"></td>
							<td>{{caseInstance.id}}</td>
							<td class="property-name" translate="CASE-INSTANCE.BUSINESS-KEY"></td>
							<td>{{caseInstance.businessKey | empty}}</td>
						</tr>
						<tr class="property">
							<td class="property-name" translate="CASE-INSTANCE.NAME"></td>
							<td>{{caseInstance.name | empty}}</td>
							<td class="property-name" translate="CASE-INSTANCE.DESCRIPTION"></td>
							<td>{{caseInstance.description | empty}}</td>
						</tr>
						<tr class="property">
							<td class="property-name" translate="CASE-INSTANCE.STATUS"></td>
							<td>{{caseInstance.endTime &amp;&amp; ('CASE-INSTANCE.STATUS-COMPLETED' | translate) || ('CASE-INSTANCE.STATUS-ACTIVE' | translate)}}</td>
							<td class="property-name">Case definition:</td>
							<td><a ng-click="openCaseDefinition(caseInstance.caseDefinitionId)"><i class="glyphicon glyphicon-zoom-in"></i>
							 	{{definition.name &amp;&amp; definition.name || caseInstance.caseDefinitionId}}
							 </a></td>
						</tr>
						<tr class="property">
							<td class="property-name"><span class="glyphicon glyphicon-user"></span> {{'CASE-INSTANCE.STARTED-BY' | translate}}</td>
							<td>{{caseInstance.startUserId | empty}}</td>
							<td class="property-name" translate="CASE-INSTANCE.TENANT-ID"></td>
                            <td>{{caseInstance.tenantId | empty}}</td>
						</tr>
					</table>
				</div>
				<div class="seperator" ng-if="caseInstance.endTime"></div>
				<div class="property-wrapper" ng-if="caseInstance.endTime">
					<table>
						<tr class="property" >
							<td class="property-name"><span class="glyphicon glyphicon-time"></span> {{'CASE-INSTANCE.END-TIME' | translate}}</td>
							<td>{{caseInstance.endTime | dateformat | empty}}</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
		<div class="col-md-3">
			<div class="component tip-left">
				<div class="title">
					<h2 translate="GENERAL.TITLE.ACTIONS"></h2>
				</div>
				<ul class="list-group">
                    <li ng-if="definition.graphicalNotationDefined">
                        <button type="button" class="btn btn-sm btn-default" ng-click="showCaseDiagram()">
                            <i class="glyphicon glyphicon-zoom-in"></i>{{'CASE-INSTANCE.ACTION.SHOW-DIAGRAM' | translate}}
                        </button>
                    </li>
                    <li>
                        <button type="button" class="btn btn-sm btn-default" ng-click="showMigrateCaseDialog()">
                            <i class="glyphicon glyphicon-zoom-in"></i>{{'CASE-INSTANCE.ACTION.MIGRATE-CASEINSTANCE' | translate}}
                        </button>
                    </li>
                    <li ng-if="caseCompleted">
					    <button type="button" class="btn btn-sm btn-default btn-danger" ng-click="deleteCaseInstance()">
							<i class="glyphicon glyphicon-remove"></i>{{'CASE-INSTANCE.ACTION.DELETE' | translate}}
					    </button>
					  </li>
					  <li ng-if="!caseCompleted">
					    <button type="button" class="btn btn-sm btn-default btn-danger" ng-click="terminateCaseInstance()">
							<i class="glyphicon glyphicon-remove"></i>{{'CASE-INSTANCE.ACTION.TERMINATE' | translate}}
					    </button>
					  </li>
				</ul>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-9">
			<div class="component">
				<div class="tabs-wrapper">
		       		<div class="tabs clearfix">
		       			<div class="tab" ng-repeat="tab in tabData.tabs" ng-class="{'active': tabData.activeTab == tab.id}">
		       				<a ng-click="tabData.activeTab = tab.id">
		       					{{tab.name | translate:node}}&nbsp;
		    					<span class="badge" ng-if="tab.info != undefined">{{tab.info}}</span>
		    				</a>
		       			</div>
		       		</div>
		        	<div class="title"></div>

		        	<div class="grid-wrapper grid-wrapper-compact" ng-if="tasks && tabData.activeTab == tabData.tabs[0].id">
						<div class="grid-message" ng-if="tasks.size > 0">
	                        <span>{{'CASE-INSTANCE.TASKS-SIZE' | translate:tasks}}</span> 
	                        <span>
	                        	<a ng-click="showAllTasks()" class="action"><i class="glyphicon glyphicon-zoom-in"></i> {{'CASE-INSTANCE.ACTION.SHOW-ALL-TASKS' | translate}}</a>
							</span>
						</div>
	                     <div class="grid-message" ng-if="tasks.size == 0">
	                        <span>{{'PROCESS-INSTANCE.TASKS-EMPTY' | translate}}</span>
	                    </div>
						<div ng-grid="gridTasks" class="gridStyle" ng-if="tasks" ng-show="tasks.size > 0"></div>
					</div>

					<div class="grid-wrapper grid-wrapper-compact" ng-if="variables && tabData.activeTab == tabData.tabs[1].id">
						<div class="grid-message" ng-if="variables.size > 0">
	                        <span>{{'CASE-INSTANCE.VARIABLES-SIZE' | translate:variables}}</span>
	                    </div>
	                     <div class="grid-message" ng-if="variables.size == 0">
	                         <span>{{'CASE-INSTANCE.VARIABLES-EMPTY' | translate}}</span>
	                    </div>
						<div ng-grid="gridVariables" class="gridStyle" ng-if="variables" ng-show="variables.size > 0"></div>
					</div>

					<div class="grid-wrapper grid-wrapper-compact" ng-if="jobs && tabData.activeTab == tabData.tabs[2].id">
						<div class="grid-message" ng-if="jobs.size > 0">
	                        <span>{{'CASE-INSTANCE.JOBS-SIZE' | translate:jobs}}</span>
	                        <span>
	                        	<a ng-click="showAllJobs()" class="action"><i class="glyphicon glyphicon-zoom-in"></i> {{'CASE-INSTANCE.ACTION.SHOW-ALL-JOBS' | translate}}</a>
	                        </span>
	                    </div>
	                     <div class="grid-message" ng-if="jobs.size == 0">
	                        <span>{{'CASE-INSTANCE.JOBS-EMPTY' | translate}}</span>
	                    </div>
						<div ng-grid="gridJobs" class="gridStyle" ng-if="jobs" ng-show="jobs.size > 0"></div>
					</div>
					
					<div class="grid-wrapper grid-wrapper-compact" ng-if="decisionTables && tabData.activeTab == tabData.tabs[3].id">
						<div class="grid-message" ng-if="decisionTables.size > 0">
	                        <span>{{'CASE-INSTANCE.DECISION-TABLES-SIZE' | translate:decisionTables}}</span>
	                    </div>
	                     <div class="grid-message" ng-if="decisionTables.size == 0">
	                        <span>{{'CASE-INSTANCE.DECISION-TABLES-EMPTY' | translate}}</span>
	                    </div>
						<div ng-grid="gridDecisionTables" class="gridStyle" ng-if="decisionTables" ng-show="decisionTables.size > 0"></div>
					</div>
					
					<div class="grid-wrapper grid-wrapper-compact" ng-if="formInstances && tabData.activeTab == tabData.tabs[4].id">
						<div class="grid-message" ng-if="formInstances.size > 0">
	                        <span>{{'CASE-INSTANCE.FORM-INSTANCES-SIZE' | translate:formInstances}}</span>
	                    </div>
	                     <div class="grid-message" ng-if="formInstances.size == 0">
	                        <span>{{'CASE-INSTANCE.FORM-INSTANCES-EMPTY' | translate}}</span>
	                    </div>
						<div ng-grid="gridFormInstances" class="gridStyle" ng-if="formInstances" ng-show="formInstances.size > 0"></div>
					</div>

		        </div>
		     </div>
		</div>

        <div class="col-md-3" ng-if="tabData.activeTab == tabData.tabs[1].id && caseInstance.endTime == null && caseInstance.endTime == undefined">
            <div class="component tip-left">
                <div class="title">
                    <h2 translate="CASE-INSTANCE.ACTION.TITLE-VARIABLES"></h2>
                </div>
                <ul class="list-group">
                    <li ng-if="selectedVariables && selectedVariables.length > 0">
                        <button type="button" class="btn btn-sm btn-default" ng-click="updateSelectedVariable()">
                            <i class="glyphicon glyphicon-pencil"></i>{{'PROCESS-INSTANCE.ACTION.UPDATE-VALUE' | translate}}
                        </button>
                    </li>
                    <li>
                        <button type="button" class="btn btn-sm btn-default" ng-click="addVariable()">
                            <i class="glyphicon glyphicon-plus"></i>{{'PROCESS-INSTANCE.ACTION.ADD-VARIABLE' | translate}}
                        </button>
                    </li>
                    <li ng-if="selectedVariables && selectedVariables.length > 0">
                        <button type="button" class="btn btn-sm btn-danger" ng-click="deleteVariable()">
                            <i class="glyphicon glyphicon-remove"></i>{{'PROCESS-INSTANCE.ACTION.DELETE-VARIABLE' | translate}}
                        </button>
                    </li>
                </ul>
            </div>
        </div>
	</div>
</div>
