
<?php require "_header.php"; ?>
 <script type="text/javascript" language="javascript"> 


var customerstore = new Ext.data.Store({
		url: 'data/getcust.php',          
		reader: new Ext.data.JsonReader({			
	fields: ['customer_id','cust_id','date1','customer_orgname','status','user_id','customer_id','user_name','assign_user_id'],
			root: 'rows1'
		}),autoLoad:true
	}); 

Ext.QuickTips.init();
	
Ext.onReady(function() {
	
	
	var colModel = new Ext.grid.ColumnModel([
		new Ext.grid.RowNumberer(),
		{ 
			header: "customer_id", 
			dataIndex:'customer_id', 
			sortable: true, 
			hidden: true 
		},
		{
			header: "Edit",	
			width:30,
		    renderer: function(value, metaData, record, rowIndex, colIndex, store) 
			{
    	   		return '<a href="addedit-custsupport.php?customer_id='+ record.get('customer_id') +'">Edit</a>';
			}
		},{ 
			id: 'customer_orgname',
			header: "Customer Name",
			width: 250,
			dataIndex: 'customer_orgname',
			align: 'left',
			//hidden: true 
        },{ 
			id:'date1',
			dataIndex: 'date1',
			header: 'Date ',
			align: 'left',
			width: 70
		},{ 
			id:'status',
			dataIndex: 'status',
			header: 'Status ',
			align: 'left',
			width:70
		},{ 
			id:'user_id',
			dataIndex: 'user_name',
			header: 'User Name ',
			align: 'left',
			width: 70
		},{ 
			id:'assign_user_id',
			dataIndex: 'user_name',
			header: 'Asign To',
			align: 'left',
			width: 70
		}
    ]);
	
	var grid = new Ext.grid.GridPanel({
		ds: customerstore,
		cm: colModel,
		sm: new Ext.grid.RowSelectionModel({
			singleSelect: true,
		}),
		height: 265,
		border: true
	});
	
	grid.on('render', function(){
		grid.tip = new Ext.ToolTip({
    		view: grid.getView(),
    		target: grid.getView().mainBody,

    		delegate: '.x-grid3-row',
    		trackMouse: true,
    		renderTo: document.body,
    		listeners: {
     			beforeshow: function updateTipBody(tip) {
      				tip.body.dom.innerHTML = "Please click here to edit record.";
     			}
    		}

   		});
  	});
	
	var customer_form = new Ext.FormPanel({	
		id: 'customer_form',
		frame: true,
		autoHeight:true,
		//url: 'save-medicien-in-group.php',
    	labelAlign: 'left',
  		bodyStyle:'padding:5px',
   		layout: 'column',
    	items: [{
				columnWidth: 1,
				layout: 'fit',
				items:[grid]
			}
        ]
    });

	var customerWindow = new Ext.Window({
        title: 'Customer Support Detail',
		width:650,		
		//height:350,
		autoHeight:true,		
		modal:true,
		border: false,
		layout: 'fit',
		//closeAction:'close',
		collapsible:true,
		items: customer_form,
		buttonAlign: 'center',
		buttons:[
		
			{
				text: 'Close', 
				iconCls: 'icon-close',
				tabIndex:8,
				name:'btnclose',
				id:'btnclose',										 							
				handler: function (){
					location.href="home.php";
				}
			}
		]
	});
	
	//var varWidth =  (screen.width - customerWindow.width)/2;
	//customerWindow.setPosition(varWidth,((screen.height/4)-100));
	customerWindow.show();
	
});// JavaScript Document

</script>
<div align="center"><div id="main-content" align="center"></div></div> 
<?php require "_footer.php";?>