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