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: 'ComboBox',
218                                     xns: Roo.form,
219                                     allowBlank : 'false',
220                                     editable : 'false',
221                                     emptyText : "Select Projects",
222                                     forceSelection : true,
223                                     listWidth : 400,
224                                     loadingText : "Searching...",
225                                     minChars : 2,
226                                     pageSize : 20,
227                                     qtip : "Select Projects",
228                                     selectOnFocus : true,
229                                     triggerAction : 'all',
230                                     typeAhead : true,
231                                     width : 300,
232                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
233                                     queryParam : 'query[name]',
234                                     fieldLabel : 'Project',
235                                     valueField : 'id',
236                                     displayField : 'name',
237                                     hiddenName : 'project_id',
238                                     name : 'project_id_name',
239                                     store : {
240                                         xtype: 'Store',
241                                         xns: Roo.data,
242                                         remoteSort : true,
243                                         sortInfo : { direction : 'ASC', field: 'id' },
244                                         listeners : {
245                                             beforeload : function (_self, o){
246                                                 o.params = o.params || {};
247                                                 // set more here
248                                             }
249                                         },
250                                         proxy : {
251                                             xtype: 'HttpProxy',
252                                             xns: Roo.data,
253                                             method : 'GET',
254                                             url : baseURL + '/Roo/Projects.php'
255                                         },
256                                         reader : {
257                                             xtype: 'JsonReader',
258                                             xns: Roo.data,
259                                             id : 'id',
260                                             root : 'data',
261                                             totalProperty : 'total',
262                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
263                                         }
264                                     }
265                                 },
266                                 {
267                                     xtype: 'TextField',
268                                     xns: Roo.form,
269                                     fieldLabel : 'Deleted by',
270                                     name : 'deleted_by',
271                                     width : 75
272                                 },
273                                 {
274                                     xtype: 'DateField',
275                                     xns: Roo.form,
276                                     fieldLabel : 'Deleted dt',
277                                     name : 'deleted_dt',
278                                     width : 75
279                                 },
280                                 {
281                                     xtype: 'Hidden',
282                                     xns: Roo.form,
283                                     name : 'id'
284                                 }
285                             ]
286                         }
287                     ]
288                 }
289             ],
290             center : {
291                 xtype: 'LayoutRegion',
292                 xns: Roo
293             },
294             buttons : [
295                 {
296                     xtype: 'Button',
297                     xns: Roo,
298                     listeners : {
299                         click : function (_self, e)
300                         {
301                             _this.dialog.hide();
302                         }
303                     },
304                     text : "Cancel"
305                 },
306                 {
307                     xtype: 'Button',
308                     xns: Roo,
309                     listeners : {
310                         click : function (_self, e)
311                         {
312                             // do some checks?
313                              
314                             
315                             _this.dialog.el.mask("Saving");
316                             _this.form.doAction("submit");
317                         
318                         }
319                     },
320                     text : "Save"
321                 }
322             ]
323         });
324     }
325 };