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