Pman.Dialog.CorePersonContact.js
[Pman.Core] / Pman.Dialog.CorePersonContact.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.CorePersonContact = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             closable : false,
34             collapsible : false,
35             height : 630,
36             resizable : false,
37             title : "Edit / Create Person",
38             width : 500,
39             items : [
40                 {
41                     xtype: 'ContentPanel',
42                     xns: Roo,
43                     region : 'center',
44                     items : [
45                         {
46                             xtype: 'Form',
47                             xns: Roo.form,
48                             listeners : {
49                                 actioncomplete : function(_self,action)
50                                 {
51                                     if (action.type == 'setdata') {
52                                        //_this.dialog.el.mask("Loading");
53                                        //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
54                                        return;
55                                     }
56                                     if (action.type == 'load') {
57                                         _this.dialog.el.unmask();
58                                         return;
59                                     }
60                                     if (action.type =='submit') {
61                                     
62                                         _this.dialog.el.unmask();
63                                         _this.dialog.hide();
64                                     
65                                          if (_this.callback) {
66                                             _this.callback.call(_this, _this.form.getValues());
67                                          }
68                                          _this.form.reset();
69                                          return;
70                                     }
71                                 },
72                                 rendered : function (form)
73                                 {
74                                     _this.form= form;
75                                 }
76                             },
77                             method : 'POST',
78                             style : 'margin:10px;',
79                             url : baseURL + '/Roo/Person.php',
80                             items : [
81                                 {
82                                     xtype: 'ComboBox',
83                                     xns: Roo.form,
84                                     allowBlank : 'false',
85                                     editable : 'false',
86                                     emptyText : "Select Companies",
87                                     forceSelection : true,
88                                     listWidth : 400,
89                                     loadingText : "Searching...",
90                                     minChars : 2,
91                                     pageSize : 20,
92                                     qtip : "Select Companies",
93                                     selectOnFocus : true,
94                                     triggerAction : 'all',
95                                     typeAhead : true,
96                                     width : 300,
97                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{code}</b> </div>',
98                                     queryParam : 'query[code]',
99                                     fieldLabel : 'Company',
100                                     valueField : 'id',
101                                     displayField : 'code',
102                                     hiddenName : 'company_id',
103                                     name : 'company_id_code',
104                                     store : {
105                                         xtype: 'Store',
106                                         xns: Roo.data,
107                                         remoteSort : true,
108                                         sortInfo : { direction : 'ASC', field: 'id' },
109                                         listeners : {
110                                             beforeload : function (_self, o){
111                                                 o.params = o.params || {};
112                                                 // set more here
113                                             }
114                                         },
115                                         proxy : {
116                                             xtype: 'HttpProxy',
117                                             xns: Roo.data,
118                                             method : 'GET',
119                                             url : baseURL + '/Roo/Companies.php'
120                                         },
121                                         reader : {
122                                             xtype: 'JsonReader',
123                                             xns: Roo.data,
124                                             id : 'id',
125                                             root : 'data',
126                                             totalProperty : 'total',
127                                             fields : [{"name":"id","type":"int"},{"name":"code","type":"string"}]
128                                         }
129                                     }
130                                 },
131                                 {
132                                     xtype: 'ComboBox',
133                                     xns: Roo.form,
134                                     allowBlank : 'false',
135                                     editable : 'false',
136                                     emptyText : "Select Office",
137                                     forceSelection : true,
138                                     listWidth : 400,
139                                     loadingText : "Searching...",
140                                     minChars : 2,
141                                     pageSize : 20,
142                                     qtip : "Select Office",
143                                     selectOnFocus : true,
144                                     triggerAction : 'all',
145                                     typeAhead : true,
146                                     width : 300,
147                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
148                                     queryParam : 'query[name]',
149                                     fieldLabel : 'Office',
150                                     valueField : 'id',
151                                     displayField : 'name',
152                                     hiddenName : 'office_id',
153                                     name : 'office_id_name',
154                                     store : {
155                                         xtype: 'Store',
156                                         xns: Roo.data,
157                                         remoteSort : true,
158                                         sortInfo : { direction : 'ASC', field: 'id' },
159                                         listeners : {
160                                             beforeload : function (_self, o){
161                                                 o.params = o.params || {};
162                                                 // set more here
163                                             }
164                                         },
165                                         proxy : {
166                                             xtype: 'HttpProxy',
167                                             xns: Roo.data,
168                                             method : 'GET',
169                                             url : baseURL + '/Roo/Office.php'
170                                         },
171                                         reader : {
172                                             xtype: 'JsonReader',
173                                             xns: Roo.data,
174                                             id : 'id',
175                                             root : 'data',
176                                             totalProperty : 'total',
177                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
178                                         }
179                                     }
180                                 },
181                                 {
182                                     xtype: 'TextField',
183                                     xns: Roo.form,
184                                     fieldLabel : 'Name',
185                                     name : 'name',
186                                     width : 200
187                                 },
188                                 {
189                                     xtype: 'TextField',
190                                     xns: Roo.form,
191                                     fieldLabel : 'Phone',
192                                     name : 'phone',
193                                     width : 200
194                                 },
195                                 {
196                                     xtype: 'TextField',
197                                     xns: Roo.form,
198                                     fieldLabel : 'Fax',
199                                     name : 'fax',
200                                     width : 200
201                                 },
202                                 {
203                                     xtype: 'TextField',
204                                     xns: Roo.form,
205                                     fieldLabel : 'Email',
206                                     name : 'email',
207                                     width : 200
208                                 },
209                                 {
210                                     xtype: 'TextField',
211                                     xns: Roo.form,
212                                     fieldLabel : 'Role',
213                                     name : 'role',
214                                     width : 200
215                                 },
216                                 {
217                                     xtype: 'TextField',
218                                     xns: Roo.form,
219                                     fieldLabel : 'Active',
220                                     name : 'active',
221                                     width : 75
222                                 },
223                                 {
224                                     xtype: 'TextArea',
225                                     xns: Roo.form,
226                                     fieldLabel : 'Remarks',
227                                     name : 'remarks',
228                                     width : 200,
229                                     height : 100
230                                 },
231                                 {
232                                     xtype: 'TextField',
233                                     xns: Roo.form,
234                                     fieldLabel : 'Passwd',
235                                     name : 'passwd',
236                                     width : 200
237                                 },
238                                 {
239                                     xtype: 'ComboBox',
240                                     xns: Roo.form,
241                                     allowBlank : 'false',
242                                     editable : 'false',
243                                     emptyText : "Select Person",
244                                     forceSelection : true,
245                                     listWidth : 400,
246                                     loadingText : "Searching...",
247                                     minChars : 2,
248                                     pageSize : 20,
249                                     qtip : "Select Person",
250                                     selectOnFocus : true,
251                                     triggerAction : 'all',
252                                     typeAhead : true,
253                                     width : 300,
254                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
255                                     queryParam : 'query[name]',
256                                     fieldLabel : 'Owner',
257                                     valueField : 'id',
258                                     displayField : 'name',
259                                     hiddenName : 'owner_id',
260                                     name : 'owner_id_name',
261                                     store : {
262                                         xtype: 'Store',
263                                         xns: Roo.data,
264                                         remoteSort : true,
265                                         sortInfo : { direction : 'ASC', field: 'id' },
266                                         listeners : {
267                                             beforeload : function (_self, o){
268                                                 o.params = o.params || {};
269                                                 // set more here
270                                             }
271                                         },
272                                         proxy : {
273                                             xtype: 'HttpProxy',
274                                             xns: Roo.data,
275                                             method : 'GET',
276                                             url : baseURL + '/Roo/Person.php'
277                                         },
278                                         reader : {
279                                             xtype: 'JsonReader',
280                                             xns: Roo.data,
281                                             id : 'id',
282                                             root : 'data',
283                                             totalProperty : 'total',
284                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
285                                         }
286                                     }
287                                 },
288                                 {
289                                     xtype: 'TextField',
290                                     xns: Roo.form,
291                                     fieldLabel : 'Lang',
292                                     name : 'lang',
293                                     width : 200
294                                 },
295                                 {
296                                     xtype: 'TextField',
297                                     xns: Roo.form,
298                                     fieldLabel : 'No reset sent',
299                                     name : 'no_reset_sent',
300                                     width : 75
301                                 },
302                                 {
303                                     xtype: 'TextField',
304                                     xns: Roo.form,
305                                     fieldLabel : 'Action type',
306                                     name : 'action_type',
307                                     width : 200
308                                 },
309                                 {
310                                     xtype: 'ComboBox',
311                                     xns: Roo.form,
312                                     allowBlank : 'false',
313                                     editable : 'false',
314                                     emptyText : "Select Projects",
315                                     forceSelection : true,
316                                     listWidth : 400,
317                                     loadingText : "Searching...",
318                                     minChars : 2,
319                                     pageSize : 20,
320                                     qtip : "Select Projects",
321                                     selectOnFocus : true,
322                                     triggerAction : 'all',
323                                     typeAhead : true,
324                                     width : 300,
325                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
326                                     queryParam : 'query[name]',
327                                     fieldLabel : 'Project',
328                                     valueField : 'id',
329                                     displayField : 'name',
330                                     hiddenName : 'project_id',
331                                     name : 'project_id_name',
332                                     store : {
333                                         xtype: 'Store',
334                                         xns: Roo.data,
335                                         remoteSort : true,
336                                         sortInfo : { direction : 'ASC', field: 'id' },
337                                         listeners : {
338                                             beforeload : function (_self, o){
339                                                 o.params = o.params || {};
340                                                 // set more here
341                                             }
342                                         },
343                                         proxy : {
344                                             xtype: 'HttpProxy',
345                                             xns: Roo.data,
346                                             method : 'GET',
347                                             url : baseURL + '/Roo/Projects.php'
348                                         },
349                                         reader : {
350                                             xtype: 'JsonReader',
351                                             xns: Roo.data,
352                                             id : 'id',
353                                             root : 'data',
354                                             totalProperty : 'total',
355                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
356                                         }
357                                     }
358                                 },
359                                 {
360                                     xtype: 'TextField',
361                                     xns: Roo.form,
362                                     fieldLabel : 'Deleted by',
363                                     name : 'deleted_by',
364                                     width : 75
365                                 },
366                                 {
367                                     xtype: 'DateField',
368                                     xns: Roo.form,
369                                     fieldLabel : 'Deleted dt',
370                                     name : 'deleted_dt',
371                                     width : 75
372                                 },
373                                 {
374                                     xtype: 'Hidden',
375                                     xns: Roo.form,
376                                     name : 'id'
377                                 }
378                             ]
379                         }
380                     ]
381                 }
382             ],
383             center : {
384                 xtype: 'LayoutRegion',
385                 xns: Roo
386             },
387             buttons : [
388                 {
389                     xtype: 'Button',
390                     xns: Roo,
391                     listeners : {
392                         click : function (_self, e)
393                         {
394                             _this.dialog.hide();
395                         }
396                     },
397                     text : "Cancel"
398                 },
399                 {
400                     xtype: 'Button',
401                     xns: Roo,
402                     listeners : {
403                         click : function (_self, e)
404                         {
405                             // do some checks?
406                              
407                             
408                             _this.dialog.el.mask("Saving");
409                             _this.form.doAction("submit");
410                         
411                         }
412                     },
413                     text : "Save"
414                 }
415             ]
416         });
417     }
418 };