<div id="objective_setting">
	<fieldset ng-disabled="(state >= 2 || ( state > 0 && isAppraisee )) || dateNow > TapsstateList[0].dateend">
	<form name="myForm">
		<br/>
		<div class="row">
			<div class="col-md-1" style="border:1px solid black;">Name</div>
			<div class="col-md-4" style="border:1px solid black;">{{ aprraisee_data.fullname }}</div>
			<div class="col-md-2 col-md-offset-1" style="border:1px solid black;">Dep. & Title</div>
			<div class="col-md-4" style="border:1px solid black;">{{ aprraisee_data.positionname }}</div>
		</div>
		<br/>
		<div class="row" ng-show="isApsyear2016">
			<div class="col-md-3" ><strong>1.0 Global basic condition:</strong></div>
			<div class="col-md-9" ><input type="text" style="width:100%;" ng-model="global_basic_condition" name="global_basic_condition" value="{{ global_basic_condition }}"/></div>
		</div>
		<br/>
		<div class="row">
			<div class="col-md-12" >
				<strong>{{ kpi_category_name[0].tdesc }}</strong>
				<strong style="float:right;">
					current:<span style="color:red;">{{ getCat(0).length }}</span>
					min:<span style="color:red;">{{ kpi_category_name[0].itemmin }}</span>
					max:<span style="color:red;">{{ kpi_category_name[0].itemmax }}</span> (row)
				</strong>
			</div>
		</div>
		<table class="table table-bordered" style="width: inherit;">
			<col width="3%" />
			<col width="15%" />
			<col width="15%" />
			<col width="7%" />
			<col width="18%" />
			<col width="18%" />
			<col width="24%" />
			<tr>
				<th class="bold-center bluehead"></th>
				<th class="bold-center bluehead">BU/Region<br>/Function</th>
				<th class="bold-center bluehead">OBJECTIVES</th>
				<th class="bold-center bluehead" style="min-width: 110px;">Weight </th>
				<th class="bold-center bluehead">Commitment</th>
				<th class="bold-center bluehead"><span ng-if="isApsyear2016">Target</span><span ng-if="!isApsyear2016">SST</span></th>
				<th class="bold-center bluehead"><span ng-if="isApsyear2016">ACTION</span><span ng-if="!isApsyear2016">Specific Action</span></th>
			</tr>
			<tr ng-repeat="item in getCat(0)" class="more-data-lg">
				<td><input ng-hide="item.isfix==1" type="checkbox" value="{{$index}}" ng-model="item.isChecked" /></td>
				<td><textarea ng-hide="item.isfix==1" class="text-md" ng-model="item.bu" ></textarea><span ng-show="item.isfix==1">{{ item.bu }}<span></td>
				<td><textarea ng-hide="item.isfix==1" class="text-md" ng-model="item.obj" ></textarea><span ng-show="item.isfix==1">{{ item.obj }}<span></td>
				<td ng-if="item.isfix!=1" style="text-align:center;">
					<md-input-container style="margin-left:10px;" class="md-block">
						<label></label>
						<input ng-model="item.weight" type="number" step="0.5" style="text-align:right;width:60px;">
						<!-- <input ng-hide="item.isfix==1" ng-model="item.weight" type="number" step="0.5" style="text-align:right;width:60px;">
						<span ng-show="item.isfix==1">{{ item.weight }}<span> -->
						<span>%</span>
					</md-input-container>
				</td>
				<td ng-if="item.isfix==1" class="bold-center">{{ item.weight }} %</td>
				<td><textarea class="text-md" ng-model="item.commitment" ></textarea></td>
				<td><textarea class="text-md" ng-model="item.target" ></textarea></td>
				<td><textarea class="text-md" ng-model="item.action" ></textarea></td>
			</tr>
			<tr>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;">
					<span style="color:red;">
						{{ sumWeight(0) }} / {{ kpi_category_name[0].kpiweight }}
					</span>
				</td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
			</tr>
		</table>
		<div class="row" ng-if="(state == 0 && isAppraisee) || (state < 2 && isAppraiser)">
			<div class="col-md-12" style="text-align:center;">
				<button type="button" class="btn btn-success" ng-show="(ObjectiveSetting | filter:{kpi_category:kpi_category_name[0].kcatid, isDelete:false}).length < kpi_category_name[0].itemmax" ng-click="addRow(kpi_category_name[0].kcatid)"><span ng-if="isApsyear2016">Add 1.1</span><span ng-if="!isApsyear2016">Add 1</span></button>
				<button type="button" class="btn btn-danger" ng-click="delRow(kpi_category_name[0].kcatid)"><span ng-if="isApsyear2016">Delete 1.1</span><span ng-if="!isApsyear2016">Delete 1</span></button>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12" >
				<strong>{{ kpi_category_name[1].tdesc }}</strong>
				<strong ng-if="isApsyear2016" style="float:right;">
					current:<span style="color:red;">{{ getCat(1).length }}</span>
					min:<span style="color:red;">{{ kpi_category_name[1].itemmin }}</span>
					max:<span style="color:red;">{{ kpi_category_name[1].itemmax }}</span> (row)
				</strong>
				<strong ng-if="!isApsyear2016" style="float:right;">
					current:<span style="color:red;">{{ getCat(1).length+getCat(2).length }}</span>
					min:<span style="color:red;">{{ getFloat(kpi_category_name[1].itemmin)+getFloat(kpi_category_name[2].itemmin) }}</span>
					max:<span style="color:red;">{{ getFloat(kpi_category_name[1].itemmax)+getFloat(kpi_category_name[2].itemmax) }}</span> (row)
				</strong>
			</div>
		</div>
		<table class="table table-bordered" style="width: inherit;">
			<col width="3%" />
			<col width="15%" />
			<col width="15%" />
			<col width="7%" />
			<col width="18%" />
			<col width="18%" />
			<col width="24%" />
			<tr>
				<th class="bold-center bluehead"></th>
				<th class="bold-center bluehead">BU/Region<br>/Function</th>
				<th class="bold-center bluehead">OBJECTIVES</th>
				<th class="bold-center bluehead" style="min-width: 110px;">Weight</th>
				<th class="bold-center bluehead">Commitment</th>
				<th class="bold-center bluehead" ng-if="isApsyear2016">Target</th>
				<th class="bold-center bluehead" ng-if="isApsyear2016">ACTION</th>
				<th class="bold-center bluehead" ng-if="!isApsyear2016" colspan="2">Specific Action</th>
			</tr>
			<tr ng-repeat="item in getCat(1)" class="more-data-lg">
				<td><input ng-hide="item.isfix==1" type="checkbox" value="{{$index}}" ng-model="item.isChecked" /></td>
				<td><textarea ng-hide="item.isfix==1" class="text-md" ng-model="item.bu" ></textarea><span ng-show="item.isfix==1">{{ item.bu }}<span></td>
				<td><textarea ng-hide="item.isfix==1" class="text-md" ng-model="item.obj" ></textarea><span ng-show="item.isfix==1">{{ item.obj }}<span></td>
				<td style="text-align:center;">
					<md-input-container style="margin-left:10px;" class="md-block">
						<label></label>
						<input ng-model="item.weight" type="number" step="0.5" style="text-align:right;width:60px;">
						<!-- <input ng-hide="item.isfix==1" ng-model="item.weight" type="number" step="0.5" style="text-align:right;width:60px;">
						<span ng-show="item.isfix==1">{{ item.weight }}<span> -->
						<span>%</span>
					</md-input-container>
				</td>
				<td><textarea class="text-md" ng-model="item.commitment" ></textarea></td>
				<!-- <td><textarea class="text-md" ng-model="item.target" ></textarea></td>
				<td><textarea class="text-md" ng-model="item.action" ></textarea></td> -->
				<td ng-if="isApsyear2016"><textarea class="text-md" ng-model="item.target" ></textarea></td>
				<td ng-if="isApsyear2016"><textarea class="text-md" ng-model="item.action" ></textarea></td>
				<td ng-if="!isApsyear2016" colspan="2"><textarea class="text-md" ng-model="item.action" ></textarea></td>
			</tr>
			<tr ng-if="!isApsyear2016" ng-repeat="item in getCat(2)" class="more-data-lg">
				<td><input ng-hide="item.isfix==1" type="checkbox" value="{{$index}}" ng-model="item.isChecked" /></td>
				<td><textarea ng-hide="item.isfix==1" class="text-md" ng-model="item.bu" ></textarea><span ng-show="item.isfix==1">{{ item.bu }}<span></td>
				<td><textarea ng-hide="item.isfix==1" class="text-md" ng-model="item.obj" ></textarea><span ng-show="item.isfix==1">{{ item.obj }}<span></td>
				<td ng-if="item.isfix!=1" style="text-align:center;">
					<md-input-container style="margin-left:10px;" class="md-block">
						<label></label>
						<input ng-model="item.weight" type="number" step="0.5" style="text-align:right;width:60px;">
						<!-- <input ng-hide="item.isfix==1" ng-model="item.weight" type="number" step="0.5" style="text-align:right;width:60px;">
						<span ng-show="item.isfix==1">{{ item.weight }}<span> -->
						<span>%</span>
					</md-input-container>
				</td>
				<td ng-if="item.isfix==1" class="bold-center">{{ item.weight }} %</td>
				<td><textarea class="text-md" ng-model="item.commitment" ></textarea></td>
				<td ng-if="isApsyear2016"><textarea class="text-md" ng-model="item.target" ></textarea></td>
				<td ng-if="isApsyear2016"><textarea class="text-md" ng-model="item.action" ></textarea></td>
				<td ng-if="!isApsyear2016" colspan="2"><textarea class="text-md" ng-model="item.action" ></textarea></td>
			</tr>
			<tr>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;">
					<span ng-if="isApsyear2016" style="color:red;">
						{{ sumWeight(1) }} / {{ kpi_category_name[1].kpiweight }}
					</span>
					<span ng-if="!isApsyear2016" style="color:red;">
						{{ sum2Weight(1,2) }} / {{ (getFloat(kpi_category_name[1].kpiweight)+getFloat(kpi_category_name[2].kpiweight)).toFixed(2)  }}
					</span>
				</td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
			</tr>
		</table>
		<div class="row" ng-if="(state == 0 && isAppraisee) || (state < 2 && isAppraiser)">
			<div class="col-md-12" style="text-align:center;">
				<button type="button" class="btn btn-success" ng-show="(ObjectiveSetting | filter:{kpi_category:kpi_category_name[1].kcatid, isDelete:false}).length < kpi_category_name[1].itemmax" ng-click="addRow(kpi_category_name[1].kcatid)"><span ng-if="isApsyear2016">Add 1.2</span><span ng-if="!isApsyear2016">Add 2</span></button>
				<button type="button" class="btn btn-danger" ng-click="delRow( kpi_category_name[1].kcatid )"><span ng-if="isApsyear2016">Delete 1.2</span><span ng-if="!isApsyear2016">Delete 2</span></button>
			</div>
		</div>
		<div ng-if="isApsyear2016" class="row">
			<div class="col-md-12" >
				<strong>{{ kpi_category_name[2].tdesc }}</strong>
				<strong style="float:right;">
					current:<span style="color:red;">{{ getCat(2).length }}</span>
					min:<span style="color:red;">{{ kpi_category_name[2].itemmin }}</span>
					max:<span style="color:red;">{{ kpi_category_name[2].itemmax }}</span> (row)
				</strong>
			</div>
		</div>
		<table ng-if="isApsyear2016" class="table table-bordered" style="width: inherit;">
			<col width="3%" />
			<col width="15%" />
			<col width="15%" />
			<col width="7%" />
			<col width="18%" />
			<col width="18%" />
			<col width="24%" />
			<tr>
				<th class="bold-center bluehead"></th>
				<th class="bold-center bluehead">BU/Region<br>/Function</th>
				<th class="bold-center bluehead">OBJECTIVES</th>
				<th class="bold-center bluehead" style="min-width: 110px;">Weight</th>
				<th class="bold-center bluehead">Commitment</th>
				<th class="bold-center bluehead">Target</th>
				<th class="bold-center bluehead">ACTION</th>
			</tr>
			<tr ng-repeat="item in getCat(2)" class="more-data-lg">
				<td><input ng-hide="item.isfix==1" type="checkbox" value="{{$index}}" ng-model="item.isChecked" /></td>
				<td><textarea ng-hide="item.isfix==1" class="text-md" ng-model="item.bu" ></textarea><span ng-show="item.isfix==1">{{ item.bu }}<span></td>
				<td><textarea ng-hide="item.isfix==1" class="text-md" ng-model="item.obj" ></textarea><span ng-show="item.isfix==1">{{ item.obj }}<span></td>
				<td ng-if="item.isfix!=1" style="text-align:center;">
					<md-input-container style="margin-left:10px;" class="md-block">
						<label></label>
						<input ng-model="item.weight" type="number" step="0.5" style="text-align:right;width:60px;">
						<!-- <input ng-hide="item.isfix==1" ng-model="item.weight" type="number" step="0.5" style="text-align:right;width:60px;">
						<span ng-show="item.isfix==1">{{ item.weight }}<span> -->
						<span>%</span>
					</md-input-container>
				</td>
				<td ng-if="item.isfix==1" class="bold-center">{{ item.weight }} %</td>
				<td><textarea class="text-md" ng-model="item.commitment" ></textarea></td>
				<td><textarea class="text-md" ng-model="item.target" ></textarea></td>
				<td><textarea class="text-md" ng-model="item.action" ></textarea></td>
			</tr>
			<tr>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;">
					<span style="color:red;">
						{{ sumWeight(2) }} / {{ kpi_category_name[2].kpiweight }}
					</span>
				</td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
				<td class="bold-center" style="border:0px;"></td>
			</tr>
		</table>
		<div class="row" ng-if="isApsyear2016 && ((state == 0 && isAppraisee) || (state < 2 && isAppraiser))">
			<div class="col-md-12" style="text-align:center;">
				<button type="button" class="btn btn-success" ng-show="(ObjectiveSetting | filter:{kpi_category:kpi_category_name[2].kcatid, isDelete:false}).length < kpi_category_name[2].itemmax" ng-click="addRow(kpi_category_name[2].kcatid)"><span>Add 1.3</span></button>
				<button type="button" class="btn btn-danger" ng-click="delRow(kpi_category_name[2].kcatid)"><span>Delete 1.3</span></button>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12" ><strong>Total</strong></div>
		</div>
		<table class="table table-bordered" style="width:50%;">
			<col width="70%" />
			<col width="30%" />
			<tr>
				<th class="bold-center bluehead" >Total</th>
				<th class="bold-center bluehead" >Weight</th>
			</tr>
			<tr class="more-data-sm">
				<td style="text-align:center;"><span ng-if="isApsyear2016">Total of 1.1, 1.2, and 1.3</span><span ng-if="!isApsyear2016">Total of 1 and 2</span></td>
				<td style="text-align:center;">{{ sum(ObjectiveSetting, 'weight')+'%' }}</td>
			</tr>
		</table>
		<br/>
		<div class="col-md-12" style="text-align:center;padding-bottom:50px;" ng-hide='Invalid'>
			<button type="button" class="btn btn-primary save-button" ng-if="(state == 0 && isAppraisee) || (state < 2 && isAppraiser)" ng-click="save()">Save Draft</button>
			<button type="button" class="btn btn-success save-button" ng-if="(state == 0 && isAppraisee)" ng-click="Next()">Send To Appraiser</button>
		</div>
	</form>
	</fieldset>
</div>