Ext.namespace('Parafiada.Person');

Parafiada.Person.CreateWindow = function(userId, gridId) {
	var win = Parafiada.Helper.CreateWindow("Pozostaw kontakt", 560, 240, 'close', true);
	win.add( new Parafiada.Person.Form(userId, gridId, win));
	win.show();
}

// Form ---------------------------------------------------------------------
Parafiada.Person.Form = function(userId, gridId, win) {
	var form = new Ext.form.FormPanel({
		baseCls: 'x-plain',
		layout: 'absolute',
		defaultType: 'textfield',
		items: [{
			xtype: 'formgroup',
			height: 240,
			layout: 'form',
			defaultType: 'textfield',
			bodyStyle: 'padding: 10px;',
			bodyBorder: true,
			items: [{
				fieldLabel: 'Adres e-mail',
				allowBlank: false,
				width: 410,
				name: 'email'
			},{
				fieldLabel: 'Telefon',
				allowBlank: false,
				width: 410,
				name: 'telephone'
			},
			{
				xtype		: 'textarea',
				fieldLabel	: 'Uwagi',
				allowBlank	: true,
				width		: 410,
				height		: 100,
				name		: 'notes'
			}]
		}]
	});
	
	form.addButton('Wyślij', OTN.Helper.btnSave_Click_with_confirm, {
		formObj: form,
		windowObj: win,
		url: '/default/iframe/savecontact/id/' + userId
	});
	form.addButton('Anuluj', function(){
		win.close();
	});
	return form;
};
