<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9" />

	<title></title>
	<script type="text/javascript">
		var objMainRef=parent.parent;
		document.write("<link rel='stylesheet' type='text/css' href='" + objMainRef.m_strTheme + "' />");
	</script>
	<!--MqRelPath--><script type="text/javascript" src="../../js/cmqsysmsg.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/cmqsysmsg.js"></script></MqAbsPath-->
	<!--MqRelPath--><script type="text/javascript" src="../../js/mqsysutils.js"></script><!--/MqRelPath--><!--MqAbsPath><script type="text/javascript" src="<BASE_VD>/js/mqsysutils.js"></script></MqAbsPath-->
	<link rel="stylesheet" type="text/css" href="../../js/codebasegrid/dhtmlxdataview.css">
	<link rel="stylesheet" type="text/css" href="../../js/codebasegrid/dhtmlxgrid.css">
	<link rel="stylesheet" type="text/css" href="../../js/codebasegrid/skins/dhtmlxgrid_dhx_skyblue.css">
	<script type="text/javascript" src="../../js/codebasegrid/dhtmlxcommon.js"></script>
	<script type="text/javascript" src="../../js/codebasegrid/dhtmlxgrid.js"></script>
	<script type="text/javascript" src="../../js/codebasegrid/dhtmlxgridcell.js"></script>
	<script type="text/javascript" src="../../js/codebasegrid/ext/dhtmlxgrid_filter.js"></script>
	<script type="text/javascript" src="../../js/codebasegrid/ext/dhtmlxgrid_group.js"></script>
	
	<script type="text/javascript">
		// always define this object for the system messages
		var objSysMsg = new CMqSysMsg;	
				
		var COL_ID_ALLOW_MULTIPLE=9;
		var COL_ID_ASSET_STATUS=3;
		
		var mDataGrid;
		
		var m_blnAllowEditRes=true;
		var m_lngFieldID=g_MqRef.MqStr.GetQueryStringValue(location.search, "Fld");
		
		if(parent){
			if(parent.parent){
				if(parent.parent.m_strAddResourcesInOnboarding=="No"){
					if(parent.parent.objRecord.GetRecordId() < 0){
						m_blnAllowEditRes=false;
					}
				}
			}
		}
		
		function Load()
		{
			var objData=document.getElementById("griddata");
			
			if(objData){
				var strData=objData.value;
				var strOwnerFieldHeaders="";
				var strOwnerFieldAligns="";
				var strOwnerFieldWidths="";
				var strOwnerFieldTypes="";
				var strOwnerFieldSorts="";
				var strNameColWidth="*";

				
				if(m_lngFieldID==881){
					strOwnerFieldHeaders="Owner,Location,";
					strOwnerFieldAligns="Left,Left,";
					strOwnerFieldWidths="10,*,";
					strOwnerFieldTypes="ro,ro,";
					strOwnerFieldSorts="str,str,";
					COL_ID_ALLOW_MULTIPLE=11;
					strNameColWidth="10";
				}
				
				if(!mDataGrid){
					mDataGrid = new dhtmlXGridObject('gridbox');
					mDataGrid.setImagePath("../../js/codebasegrid/imgs/");
					mDataGrid.setHeader(","+g_MqRef.RESX['LIST_HEADER_RESOURCE_TYPE']+","+g_MqRef.RESX['LIST_HEADER_RESOURCE_PROVISIONED']+",Status,"+g_MqRef.RESX['LIST_HEADER_ASSET_NAME']+",,Serial Number,Asset Tag," + strOwnerFieldHeaders + ",");
					
					if(m_blnAllowEditRes){
						mDataGrid.setInitWidthsP("6,0,6,8," + strNameColWidth + ",0,10,10," + strOwnerFieldWidths + "6,0");
					}else{
						//hide the columns allowing edit
						mDataGrid.setInitWidthsP("6,0,0,0," + strNameColWidth + ",0,10,10," + strOwnerFieldWidths + "0,0");
						mDataGrid.setNoHeader(true);
					}
					mDataGrid.setColAlign("center,Left,center,Left,Left,Left,Left,Left," + strOwnerFieldAligns + "Left,Left");
					mDataGrid.setColTypes("ro,ro,img,ro,ro,ro,ro,ro," + strOwnerFieldTypes + "ro,ro");
					mDataGrid.setColSorting("na,str,str,str,str,str,str,str," + strOwnerFieldSorts + "na,str");
					mDataGrid.init();
					mDataGrid.setSkin("dhx_skyblue");
				}else{
					mDataGrid.clearAll();
				}
					
				//mDataGrid.groupBy(1);	
				
				mDataGrid.attachEvent("onMouseOver", function(){ return false; });
				if(m_blnAllowEditRes){
					mDataGrid.attachEvent("onRowSelect", "EditResInfo");
				}else{
					var objGrid=document.getElementById("gridbox");
					if(objGrid){
						objGrid.style.height="385px";
					}
				}
				if(strData!=""){						
					mDataGrid.parse(strData);
				}
			}
		}

		function EditResInfo(lngResID)
		{
			var strUrl=GetVDURL("connect", "View=Resources%2FEditAsset&UEID=" + lngResID + "&SrcFld=" + m_lngFieldID);
					
			parent.parent.OpenModalWindow(strUrl, 970, 770);

			if(mDataGrid){
				mDataGrid.clearSelection();
			}
		}

		function GetVDURL(strBaseVD, strAddRedirQS)
		{
			var co = parent.objRequest.Get(parent.parent.mstrCurrentLocation + "wcProdInv.asp?WCI=wciGetDiffVDURL&Base=" + strBaseVD + 
												"&AddQS=" + g_MqRef.MqStr.MqEncodeURIComponent(strAddRedirQS));
			if (co!=parent.objRequest.CANCEL_PROCESS){

				var objResponse=parent.objRequest.Response(co);
											
				if (objResponse){
					if (objResponse.HasErrors()){
						objResponse.ProcessErrors("",true,window);
					}else{
						return co;
					}
				}
			}
						
			return true;
		}
		
		function ResTypeError(sourceImg)
		{
			sourceImg.src="../../theme/images/images/res_default_small.jpg";
			sourceImg.onerror="";
			return true;
		}
			
		function GetValueIDsInList()
		{
			if(mDataGrid){
				var arrRows=new Array();
				var strRows=mDataGrid.getAllRowIds(";");
				if(strRows!=""){
					var arrRowsTemp=strRows.split(";");
					for(x=0;x<arrRowsTemp.length;x++){
						var intID=mDataGrid.cellById(arrRowsTemp[x],5).getValue();
						var strStatus=mDataGrid.cellById(arrRowsTemp[x],COL_ID_ASSET_STATUS).getValue();
						var intAllowsMultipleInst;
						if(arrRows[intID]){
							if(arrRows[intID][2]){
								arrRows[intID][2]=arrRows[intID][2]+1;
							}
							if(strStatus=="Lost" || strStatus=="Retired" || strStatus=="Repair"){
								if(arrRows[intID][1]){
									arrRows[intID][1]="1";
								}
							}
						}else{
							if(strStatus=="Lost" || strStatus=="Retired" || strStatus=="Repair"){
								intAllowsMultipleInst="1";
							}else{
								intAllowsMultipleInst=mDataGrid.cells(arrRowsTemp[x], COL_ID_ALLOW_MULTIPLE).getValue();
							}
							arrRows[intID]=new Array(intID, intAllowsMultipleInst, 1);
						}
					}
				}
				return arrRows;
			}
		}
		
		function ToggleGrid(blnExpand)
		{
			if(mDataGrid){
				if(blnExpand){
					mDataGrid.expandAllGroups();
				}else{
					mDataGrid.collapseAllGroups();
				}
			}
		}

	</script>
</head>
<body onload="Load();">

	<div id="gridbox" name="gridbox" style="width:98%; height:360px; background-color:white;margin:10px;border:1px solid #666666; border-radius: 4px; behavior: url(../../theme/css/border-radius.htc);"></div>
	
	<WC@XML_LIST_FORMAT_78>
		<row id="{tblDts_nID}">
			<cell>&amp;lt;img src="viewicon.asp?Rec={tblDts_nID}&amp;amp;Proj=15" width="24" onerror="ResTypeError(this);" /&amp;gt;</cell>
			<cell>{tblDts_Level_2_Name}</cell>
			<cell>../../theme/images/images/res_status_{tblProvisioningStatus_Status}_small.jpg</cell>
			<cell>{tblAssetSubStatus_SubStatus}</cell>
			<cell>{tblDts_tBriefDescription}</cell>
			<cell>{tblDts_Level_2}</cell>
			<cell>{tblDts_SN}</cell>
			<cell>{tblDts_Asset_Tag}</cell>
			<cell>
				&amp;lt;div class="actionButtonsHover" id="actionButtons{tblDts_nID}" name="actionButtons{tblDts_nID}"&amp;gt;
					&amp;lt;img src="../../theme/images/buttons/edit.png" onclick="EditResInfo({tblDts_nID});(arguments[0]||event).cancelBubble=true" style="cursor:hand;cursor:pointer;" title="Edit Information" class="actionButton" onmouseover="this.className='actionButtonHover'" onmouseout="this.className='actionButton'" /&amp;gt;
					&amp;lt;img src="../../theme/images/buttons/delete.png" onclick="parent.m_o1tMLst78.RemoveR({tblDts_nID});(arguments[0]||event).cancelBubble=true" style="cursor:hand;cursor:pointer;" title="Delete" class="actionButton" onmouseover="this.className='actionButtonHover'" onmouseout="this.className='actionButton'" /&amp;gt;
				&amp;lt;/div&amp;gt;
			</cell>	
			<cell>{tblDts_Allow_Multiple_Instances_Per_Role_or_Employee}</cell>
		</row>
	</WC@XML_LIST_FORMAT_78>
	
	<WC@XML_LIST_FORMAT_881>
		<row id="{tblDts_nID}">
			<cell>&amp;lt;img src="viewicon.asp?Rec={tblDts_nID}&amp;amp;Proj=15" width="32" onerror="ResTypeError(this);" /&amp;gt;</cell>
			<cell>{tblDts_Level_2_Name}</cell>
			<cell>../../theme/images/images/res_status_{tblProvisioningStatus_Status}_small.jpg</cell>
			<cell>{tblAssetSubStatus_SubStatus}</cell>
			<cell>{tblDts_tBriefDescription}</cell>
			<cell>{tblDts_Level_2}</cell>
			<cell>{tblDts_SN}</cell>
			<cell>{tblDts_Asset_Tag}</cell>
			<cell>{tblAssetOwner_Owner}</cell>
			<cell>{tblAssetLocation_Location}</cell>
			<cell>
				&amp;lt;div class="actionButtonsHover" id="actionButtons{tblDts_nID}" name="actionButtons{tblDts_nID}"&amp;gt;
					&amp;lt;img src="../../theme/images/buttons/edit.png" onclick="EditResInfo({tblDts_nID});(arguments[0]||event).cancelBubble=true" style="cursor:hand;cursor:pointer;" title="Edit Information" class="actionButton" onmouseover="this.className='actionButtonHover'" onmouseout="this.className='actionButton'" /&amp;gt;
					&amp;lt;img src="../../theme/images/buttons/delete.png" onclick="parent.m_o1tMLst78.RemoveR({tblDts_nID});(arguments[0]||event).cancelBubble=true" style="cursor:hand;cursor:pointer;" title="Delete" class="actionButton" onmouseover="this.className='actionButtonHover'" onmouseout="this.className='actionButton'" /&amp;gt;
				&amp;lt;/div&amp;gt;
			</cell>	
			<cell>{tblDts_Allow_Multiple_Instances_Per_Role_or_Employee}</cell>
		</row>
	</WC@XML_LIST_FORMAT_881>
	
	<WC@XML_LIST_FORMAT_878>
		<row id="{tblDts_nID}">
			<cell>&amp;lt;img src="viewicon.asp?Rec={tblDts_nID}&amp;amp;Proj=15" width="24" onerror="ResTypeError(this);" /&amp;gt;</cell>
			<cell>{tblDts_Level_2_Name}</cell>
			<cell>../../theme/images/images/res_status_{tblProvisioningStatus_Status}_small.jpg</cell>
			<cell>{tblAssetSubStatus_SubStatus}</cell>
			<cell>{tblDts_tBriefDescription}</cell>
			<cell>{tblDts_Level_2}</cell>
			<cell>{tblDts_SN}</cell>
			<cell>{tblDts_Asset_Tag}</cell>
			<cell>
				&amp;lt;div class="actionButtonsHover" id="actionButtons{tblDts_nID}" name="actionButtons{tblDts_nID}"&amp;gt;
					&amp;lt;img src="../../theme/images/buttons/edit.png" onclick="EditResInfo({tblDts_nID});(arguments[0]||event).cancelBubble=true" style="cursor:hand;cursor:pointer;" title="Edit Information" class="actionButton" onmouseover="this.className='actionButtonHover'" onmouseout="this.className='actionButton'" /&amp;gt;
					&amp;lt;img src="../../theme/images/buttons/delete.png" onclick="parent.m_o1tMLst878.RemoveR({tblDts_nID});(arguments[0]||event).cancelBubble=true" style="cursor:hand;cursor:pointer;" title="Delete" class="actionButton" onmouseover="this.className='actionButtonHover'" onmouseout="this.className='actionButton'" /&amp;gt;
				&amp;lt;/div&amp;gt;
			</cell>	
			<cell>{tblDts_Allow_Multiple_Instances_Per_Role_or_Employee}</cell>
		</row>
	</WC@XML_LIST_FORMAT_878>
	<textarea id="griddata" name="griddata" style="display:none;"><WC@RES_LIST></WC@RES_LIST></textarea>
</body>
</html>
