
// distruggere FP se esiste
// prendere il nome della finestra
$thisPERSONAL = $PARAM[0];
$thisDATE = $PARAM[1]."-".$PARAM[2]."-".$PARAM[3];
$thisStatus=$PARAM[4];
$thisTIME = $PARAM[5].":".$PARAM[6];
$mysql12 = new Mysql();
$mysql12 ->Database='AID11';
$mysql12 ->connect();
$resMysql12 = $mysql12 ->query("SELECT * FROM  OS_DATA_CLIENT_APP_VALIDATE");
$lineaValidate = mysql_fetch_array($resMysql12, MYSQL_ASSOC);
mysql_free_result($resMysql12);
if ($thisStatus==1 || $thisStatus==2)
	$thisAppId=$PARAM[7];

$this->resultPunto("dojo.debug('MODULE: APP2 DATE: ".$thisDATE." TIME ".$thisTIME." STATUS: ".$thisStatus." APP ID: ".$thisAppId." ');");

$thisName='APP';

$nameFP="Appuntamento";

//$this->resultPunto("if (Ext.getCmp('EXT_WINAPP')) {dojo.debug('Destroy EXT_WINAPP');Ext.getCmp('EXT_WINAPP').destroy();}");
//$this->resultPunto("var AID11DIVAPP =document.createElement('div');AID11DIVAPP.id='IDAID11DIVAPP';AID11DIVAPP.setAttribute('id','IDAID11DIVAPP');AID11DIVAPP.style['width']='700px';AID11DIVAPP.style['height']='300px';AID11DIVAPP.style['left']='40px';AID11DIVAPP.style['top']='40px';AID11DIVAPP.style['id']='IDAID11DIVAPP';document.getElementById('DIVAID11BIDKERNEL').appendChild(AID11DIVAPP);");



// buttoni
switch ($thisStatus)
{
case 0: // nuovo app
	$this->resultPunto("buttons = [{text: 'Richiedi appuntamento',handler: function(){furoros.Runmodule('11','EVENT_BUTTON_CLICK','APP','WIDAID11CPCONFIGINT:APP:APP:".$thisName.":ACTION_VALIDATE:1');}},{text: 'Conferma appuntamento',handler: function(){furoros.Runmodule('11','EVENT_BUTTON_CLICK','APP','WIDAID11CPCONFIGINT:APP:APP:".$thisName.":ACTION_VALIDATE:2');}},{text: 'Annulla',handler: function(){Ext.getCmp('APP_WIN').destroy();}}];");
break;
case 1: // STATO da confermare
	$this->resultPunto("buttons = [{text: 'Conferma appuntamento',handler: function(){furoros.Runmodule('11','EVENT_BUTTON_CLICK','APP','WIDAID11CPCONFIGINT:APP:APP:".$thisName.":ACTION_VALIDATE:3:".$thisAppId."');}},{text: 'Disdica appuntamento',handler: function(){furoros.Runmodule('11','EVENT_BUTTON_CLICK','APP','WIDAID11CPCONFIGINT:APP:APP:".$thisName.":ACTION_VALIDATE:4:".$thisAppId."');}},{text: 'Annulla',handler: function(){win.destroy();}}];");
break;
case 2: // stato confermato
	$this->resultPunto("buttons = [{text: 'Disdica appuntamento',handler: function(){furoros.Runmodule('11','EVENT_BUTTON_CLICK','APP','WIDAID11CPCONFIGINT:APP:APP:".$thisName.":ACTION_VALIDATE:4:".$thisAppId."');}},{text: 'Annulla',handler: function(){win.destroy();}}];");
break;
}

$this->resultPunto("if (Ext.getCmp('APP_WIN')) Ext.getCmp('APP_WIN').destroy();var window = new Ext.Window({id:'APP_WIN',title: 'Appuntamento',width: 500,height:430,minWidth: 300,minHeight: 200,layout: 'fit',plain:true,bodyStyle:'padding:0px;',buttonAlign:'left',items: {xtype:'tabpanel',id:'APP_TAB',layoutOnTabChange: true,hideBorders:true,activeTab: 0,defaults:{autoHeight:true, bodyStyle:'padding:0px'}, items:[{title:'Appuntamento',layout:'form',defaults: {},defaultType: 'textfield',items: {xtype:'form',id:'form',tbar:[{text:'Azzerrare tutto',handler:function(){Ext.getCmp('APP_COMBO_CLIENT').reset();Ext.getCmp('APP_COMBO_CAT').reset();Ext.getCmp('APP_COMBO_SPEC').reset();Ext.getCmp('APP_COMBO_PERSONAL').reset();Ext.getCmp('APP_COMBO_ROOM').reset();}},{xtype:'combo',fieldLabel: 'Tipo',displayField:'state',typeAhead: true,mode: 'local',triggerAction: 'all',emptyText:'Appuntamento normale',selectOnFocus:true}],labelAlign: 'top',frame:true,bodyStyle:'padding:0px 0px 0',items: [{layout:'column',items:[{columnWidth:.5,layout: 'form',items: [{xtype:'combo',fieldLabel: 'Cliente',displayField:'state',typeAhead: true,mode: 'local',triggerAction: 'all',emptyText:'Scegli cliente...',selectOnFocus:true,id:'APP_COMBO_CLIENT'},{xtype:'combo',fieldLabel: 'Categoria',displayField:'state',typeAhead: true,mode: 'local',triggerAction: 'all',emptyText:'Scegli categoria...',selectOnFocus:true,id:'APP_COMBO_CAT'}, {xtype:'combo',fieldLabel: 'Trattamento',displayField:'state',typeAhead: true,mode: 'local',triggerAction: 'all',emptyText:'Scegli trattamento...',selectOnFocus:true,id:'APP_COMBO_SPEC'}, {xtype:'combo',fieldLabel: 'Personale',displayField:'state',typeAhead: true,mode: 'local',triggerAction: 'all',emptyText:'Scegli personale...',selectOnFocus:true,id:'APP_COMBO_PERSONAL'}, {xtype:'combo',fieldLabel: 'Stanza',displayField:'state',typeAhead: true,mode: 'local',triggerAction: 'all',emptyText:'Scegli stanza...',selectOnFocus:true,id:'APP_COMBO_ROOM'}]},{columnWidth:.5,layout: 'form',items: [{xtype:'datefield',fieldLabel: 'Data'},{xtype:'timefield',fieldLabel: 'Ora'},{xtype:'fieldset',checkboxToggle:true,title: 'Ulteriore sconto',autoHeight:true,defaults: {width: 210},defaultType: 'textfield',collapsed: true,items :[{xtype:'textfield',fieldLabel: 'Prezzo trattamento, &#8364;',value:'10',name: 'APP_SCONTO'}]}]}]}]}},{title: 'Nuovo cliente',items: {xtype:'form',id:'form',labelAlign: 'top',frame:true,bodyStyle:'padding:0px 0px 0',items: [{layout:'column',items:[{columnWidth:.5,layout: 'form',items: [{xtype:'textfield',vtype:'alpha',fieldLabel: 'Nome',name: 'APP_NAME',id:'APP_NAME',allowBlank:false,anchor:'95%'},{xtype:'textfield',fieldLabel: 'Cellulare',name: 'APP_CEL',id: 'APP_CEL',anchor:'95%'}, {xtype:'textfield',fieldLabel: 'Indirizzo',name: 'APP_ADDRESS',id:'APP_ADDRESS',anchor:'95%'}, {xtype:'datefield',fieldLabel: 'Data di nascita',name: 'APP_BIRTHDAY',id:'APP_BIRTHDAY',anchor:'95%'}, {xtype:'textfield',fieldLabel: 'Professione',name: 'APP_PROFESSION',id:'APP_PROFESSION',anchor:'95%'}]},{columnWidth:.5,layout: 'form',items: [{xtype:'textfield',vtype:'alpha',fieldLabel: 'Cognome',name: 'APP_SECONDNAME',id:'APP_SECONDNAME',anchor:'95%'},{xtype:'textfield',fieldLabel: 'Telefono',name: 'APP_TEL',id: 'APP_TEL',vtype:'email1',anchor:'95%'}, {xtype:'textfield',fieldLabel: 'CAP',name: 'APP_CAP',id:'APP_CAP',anchor:'95%'}, {xtype:'combo',emptyText:'Scegli sesso...',items:[{text:'M'},{text:'F'}],fieldLabel: 'Sesso',name: 'APP_SEX',id:'APP_SEX',anchor:'95%'}, {xtype:'textfield',fieldLabel: 'Citta&apos;',name: 'APP_TOWN',id:'APP_TOWN',anchor:'95%'}]}]},{xtype:'textfield',fieldLabel: 'E-Mail',name: 'APP_MAIL',id:'APP_MAIL',vtype:'email',anchor:'47%'}],buttons: [{text: 'Aggiungi'},{text: 'Vai all&apos;archivio clienti'}]}},{title: 'Riccorrenze',items: {xtype:'form',id:'form_RC',labelAlign: 'left',frame:true,bodyStyle:'padding:0px 0px 0',items: [{xtype:'fieldset',checkboxToggle:true,title: 'Appuntamento riccorrente',autoHeight:true,defaults: {width: 210},defaultType: 'textfield',collapsed: true,items :[{xtype:'checkbox',fieldLabel: 'Lunedi',boxLabel: '&nbsp;',name:'APP_RC_D1'},{xtype:'checkbox',fieldLabel: 'Martedi',boxLabel: '&nbsp;',name: 'APP_RC_D2'},{xtype:'checkbox',fieldLabel: 'Mercoledi',boxLabel: '&nbsp;',name: 'APP_RC_D3'},{xtype:'checkbox',fieldLabel: 'Giovedi',boxLabel: '&nbsp;',name: 'APP_RC_D4'},{xtype:'checkbox',fieldLabel: 'Venerdi',boxLabel: '&nbsp;',name: 'APP_RC_D5'},{xtype:'checkbox',fieldLabel: 'Sabato',boxLabel: '&nbsp;',name: 'APP_RC_D6'},{xtype:'datefield',fieldLabel: 'Fino a',boxLabel: '&nbsp;',name: 'APP_RC_DATE_END',width:100}]}]}}]},buttons: buttons});window.show();");





//$this->resultPunto("if (dojo.byId('IDAID11DIVAPP')) dojo.byId('IDAID11DIVAPP').destroy();");
//$this->resultPunto("if (Ext.getCmp('EXT_WINAPP')) {dojo.debug('Destroy WINAPP');Ext.getCmp('EXT_WINAPP').destroy();}");
//$this->resultPunto("if (Ext.getCmp('EXT_WINAPP')) {dojo.debug('Destroy WINAPP');Ext.getCmp('EXT_WINAPP').destroy();}");
//$this->resultPunto("if (dojo.widget.byId('WIDAID11FPCONFIG')) {dojo.debug('Destroy WIDGET');dojo.widget.byId('WIDAID11FPCONFIG').destroy();}");
//$this->resultPunto("if ($('IDAID11DIVAPP')) {dojo.debug('Destroy WINAPP');obj1=document.getElementById('IDAID11DIVAPP');obj2=document.getElementById('DIVAID11BIDKERNEL');obj2.removeChild(obj1);}");
// creare FP
