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 : 300
187                                 },
188                                 {
189                                     xtype: 'TextField',
190                                     xns: Roo.form,
191                                     fieldLabel : 'Role',
192                                     name : 'role',
193                                     width : 200
194                                 },
195                                 {
196                                     xtype: 'TextField',
197                                     xns: Roo.form,
198                                     fieldLabel : 'Phone',
199                                     name : 'phone',
200                                     width : 200
201                                 },
202                                 {
203                                     xtype: 'TextField',
204                                     xns: Roo.form,
205                                     fieldLabel : 'Fax',
206                                     name : 'fax',
207                                     width : 200
208                                 },
209                                 {
210                                     xtype: 'TextField',
211                                     xns: Roo.form,
212                                     fieldLabel : 'Email',
213                                     name : 'email',
214                                     width : 200
215                                 },
216                                 {
217                                     xtype: 'TextField',
218                                     xns: Roo.form,
219                                     fieldLabel : 'Passwd',
220                                     name : 'passwd',
221                                     width : 200
222                                 },
223                                 {
224                                     xtype: 'ComboBox',
225                                     xns: Roo.form,
226                                     allowBlank : 'false',
227                                     editable : 'false',
228                                     emptyText : "Select Person",
229                                     forceSelection : true,
230                                     listWidth : 400,
231                                     loadingText : "Searching...",
232                                     minChars : 2,
233                                     pageSize : 20,
234                                     qtip : "Select Person",
235                                     selectOnFocus : true,
236                                     triggerAction : 'all',
237                                     typeAhead : true,
238                                     width : 300,
239                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
240                                     queryParam : 'query[name]',
241                                     fieldLabel : 'Owner',
242                                     valueField : 'id',
243                                     displayField : 'name',
244                                     hiddenName : 'owner_id',
245                                     name : 'owner_id_name',
246                                     store : {
247                                         xtype: 'Store',
248                                         xns: Roo.data,
249                                         remoteSort : true,
250                                         sortInfo : { direction : 'ASC', field: 'id' },
251                                         listeners : {
252                                             beforeload : function (_self, o){
253                                                 o.params = o.params || {};
254                                                 // set more here
255                                             }
256                                         },
257                                         proxy : {
258                                             xtype: 'HttpProxy',
259                                             xns: Roo.data,
260                                             method : 'GET',
261                                             url : baseURL + '/Roo/Person.php'
262                                         },
263                                         reader : {
264                                             xtype: 'JsonReader',
265                                             xns: Roo.data,
266                                             id : 'id',
267                                             root : 'data',
268                                             totalProperty : 'total',
269                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
270                                         }
271                                     }
272                                 },
273                                 {
274                                     xtype: 'TextField',
275                                     xns: Roo.form,
276                                     fieldLabel : 'Lang',
277                                     name : 'lang',
278                                     width : 200
279                                 },
280                                 {
281                                     xtype: 'TextField',
282                                     xns: Roo.form,
283                                     fieldLabel : 'No reset sent',
284                                     name : 'no_reset_sent',
285                                     width : 75
286                                 },
287                                 {
288                                     xtype: 'TextField',
289                                     xns: Roo.form,
290                                     fieldLabel : 'Action type',
291                                     name : 'action_type',
292                                     width : 200
293                                 },
294                                 {
295                                     xtype: 'ComboBox',
296                                     xns: Roo.form,
297                                     allowBlank : 'false',
298                                     editable : 'false',
299                                     emptyText : "Select Projects",
300                                     forceSelection : true,
301                                     listWidth : 400,
302                                     loadingText : "Searching...",
303                                     minChars : 2,
304                                     pageSize : 20,
305                                     qtip : "Select Projects",
306                                     selectOnFocus : true,
307                                     triggerAction : 'all',
308                                     typeAhead : true,
309                                     width : 300,
310                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
311                                     queryParam : 'query[name]',
312                                     fieldLabel : 'Project',
313                                     valueField : 'id',
314                                     displayField : 'name',
315                                     hiddenName : 'project_id',
316                                     name : 'project_id_name',
317                                     store : {
318                                         xtype: 'Store',
319                                         xns: Roo.data,
320                                         remoteSort : true,
321                                         sortInfo : { direction : 'ASC', field: 'id' },
322                                         listeners : {
323                                             beforeload : function (_self, o){
324                                                 o.params = o.params || {};
325                                                 // set more here
326                                             }
327                                         },
328                                         proxy : {
329                                             xtype: 'HttpProxy',
330                                             xns: Roo.data,
331                                             method : 'GET',
332                                             url : baseURL + '/Roo/Projects.php'
333                                         },
334                                         reader : {
335                                             xtype: 'JsonReader',
336                                             xns: Roo.data,
337                                             id : 'id',
338                                             root : 'data',
339                                             totalProperty : 'total',
340                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
341                                         }
342                                     }
343                                 },
344                                 {
345                                     xtype: 'TextField',
346                                     xns: Roo.form,
347                                     fieldLabel : 'Deleted by',
348                                     name : 'deleted_by',
349                                     width : 75
350                                 },
351                                 {
352                                     xtype: 'DateField',
353                                     xns: Roo.form,
354                                     fieldLabel : 'Deleted dt',
355                                     name : 'deleted_dt',
356                                     width : 75
357                                 },
358                                 {
359                                     xtype: 'Hidden',
360                                     xns: Roo.form,
361                                     name : 'id'
362                                 }
363                             ]
364                         }
365                     ]
366                 }
367             ],
368             center : {
369                 xtype: 'LayoutRegion',
370                 xns: Roo
371             },
372             buttons : [
373                 {
374                     xtype: 'Button',
375                     xns: Roo,
376                     listeners : {
377                         click : function (_self, e)
378                         {
379                             _this.dialog.hide();
380                         }
381                     },
382                     text : "Cancel"
383                 },
384                 {
385                     xtype: 'Button',
386                     xns: Roo,
387                     listeners : {
388                         click : function (_self, e)
389                         {
390                             // do some checks?
391                              
392                             
393                             _this.dialog.el.mask("Saving");
394                             _this.form.doAction("submit");
395                         
396                         }
397                     },
398                     text : "Save"
399                 }
400             ]
401         });
402     }
403 };