Merge branch 'master' of http://git.roojs.com:8081/Pman.MTrack
[Pman.MTrack] / Pman.Dialog.MTrackTicket.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.MTrackTicket = {
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 : 450,
36             modal : true,
37             resizable : true,
38             title : "Edit or Create Ticket",
39             width : 700,
40             items : [
41                 {
42                     xtype: 'ContentPanel',
43                     xns: Roo,
44                     region : 'center',
45                     items : [
46                         {
47                             xtype: 'Form',
48                             xns: Roo.form,
49                             listeners : {
50                                 actioncomplete : function(_self,action)
51                                 {
52                                     if (action.type == 'setdata') {
53                                   
54                                        this.load({ method: 'GET', params: { '_id' : _this.data.id  || 0}});
55                                           
56                                        return;
57                                     }
58                                     if (action.type == 'load') {
59                                        if (!_this.data.id) {
60                                             this.setValues(_this.data);
61                                         }
62                                         return;
63                                     }
64                                     
65                                     
66                                     if (action.type =='submit') {
67                                     
68                                        
69                                         _this.dialog.hide();
70                                     
71                                          if (_this.callback) {
72                                             _this.callback.call(_this, _this.form.getValues());
73                                          }
74                                          _this.form.reset();
75                                          return;
76                                     }
77                                 },
78                                 rendered : function (form)
79                                 {
80                                     _this.form= form;
81                                 }
82                             },
83                             method : 'POST',
84                             style : 'margin:10px;width:1000px;margin-top:0px;',
85                             url : baseURL + '/Roo/mtrack_ticket.php',
86                             items : [
87                                 {
88                                     xtype: 'Column',
89                                     xns: Roo.form,
90                                     width : 210,
91                                     items : [
92                                         {
93                                             xtype: 'FieldSet',
94                                             xns: Roo.form,
95                                             labelAlign : 'top',
96                                             legend : "Properties",
97                                             style : 'width:190px;',
98                                             items : [
99                                                 {
100                                                     xtype: 'ComboBox',
101                                                     xns: Roo.form,
102                                                     allowBlank : 'false',
103                                                     displayField : 'name',
104                                                     editable : 'false',
105                                                     emptyText : "Select Project",
106                                                     fieldLabel : 'Project',
107                                                     forceSelection : true,
108                                                     hiddenName : 'project_id',
109                                                     listWidth : 400,
110                                                     loadingText : "Searching...",
111                                                     minChars : 2,
112                                                     name : 'project_id_name',
113                                                     pageSize : 20,
114                                                     qtip : "Select Projects",
115                                                     queryParam : 'query[name]',
116                                                     selectOnFocus : true,
117                                                     tpl : '<div class="x-grid-cell-text x-btn button "><b>{name}</b> </div>',
118                                                     triggerAction : 'all',
119                                                     typeAhead : true,
120                                                     valueField : 'id',
121                                                     width : 180,
122                                                     store : {
123                                                         xtype: 'Store',
124                                                         xns: Roo.data,
125                                                         listeners : {
126                                                             beforeload : function (_self, o){
127                                                                 o.params = o.params || {};
128                                                                 // set more here
129                                                             }
130                                                         },
131                                                         remoteSort : true,
132                                                         sortInfo : { direction : 'ASC', field: 'name' },
133                                                         proxy : {
134                                                             xtype: 'HttpProxy',
135                                                             xns: Roo.data,
136                                                             method : 'GET',
137                                                             url : baseURL + '/Roo/Projects.php'
138                                                         },
139                                                         reader : {
140                                                             xtype: 'JsonReader',
141                                                             xns: Roo.data,
142                                                             id : 'id',
143                                                             root : 'data',
144                                                             totalProperty : 'total',
145                                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
146                                                         }
147                                                     }
148                                                 },
149                                                 {
150                                                     xtype: 'ComboBox',
151                                                     xns: Roo.form,
152                                                     alwaysQuery : true,
153                                                     displayField : 'name',
154                                                     editable : 'false',
155                                                     emptyText : "Select milestone",
156                                                     fieldLabel : 'Milestone',
157                                                     forceSelection : true,
158                                                     hiddenName : 'milestone_id',
159                                                     listWidth : 400,
160                                                     loadingText : "Searching...",
161                                                     minChars : 2,
162                                                     name : 'milestone_id_name',
163                                                     pageSize : 20,
164                                                     qtip : "Select mtrack_milestone",
165                                                     queryParam : 'query[name]',
166                                                     selectOnFocus : true,
167                                                     tpl : '<div class="x-grid-cell-text x-btn button  RdYlGn-q{seqid}-{seqmax}"><b>{name}</b> </div>',
168                                                     triggerAction : 'all',
169                                                     typeAhead : true,
170                                                     valueField : 'id',
171                                                     width : 180,
172                                                     store : {
173                                                         xtype: 'Store',
174                                                         xns: Roo.data,
175                                                         listeners : {
176                                                             beforeload : function (_self, o){
177                                                                 o.params = o.params || {};
178                                                                 // set more here
179                                                                 o.params.etype = 'milestone';
180                                                                 o.params.project_id = _this.form.findField('project_id').getValue();
181                                                                 if (!o.params.project_id) {
182                                                                     Roo.MessageBox.alert("Error", "Select Project");
183                                                                     return false;
184                                                                 }
185                                                             }
186                                                         },
187                                                         remoteSort : true,
188                                                         sortInfo : { direction : 'ASC', field: 'startdate' },
189                                                         proxy : {
190                                                             xtype: 'HttpProxy',
191                                                             xns: Roo.data,
192                                                             method : 'GET',
193                                                             url : baseURL + '/Roo/mtrack_milestone.php'
194                                                         },
195                                                         reader : {
196                                                             xtype: 'JsonReader',
197                                                             xns: Roo.data,
198                                                             id : 'id',
199                                                             root : 'data',
200                                                             totalProperty : 'total',
201                                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
202                                                         }
203                                                     }
204                                                 },
205                                                 {
206                                                     xtype: 'ComboBox',
207                                                     xns: Roo.form,
208                                                     allowBlank : false,
209                                                     alwaysQuery : true,
210                                                     displayField : 'name',
211                                                     editable : 'false',
212                                                     emptyText : "Select Priority",
213                                                     fieldLabel : 'Priority',
214                                                     forceSelection : true,
215                                                     hiddenName : 'priority_id',
216                                                     listWidth : 400,
217                                                     loadingText : "Searching...",
218                                                     minChars : 2,
219                                                     name : 'priority_id_name',
220                                                     pageSize : 20,
221                                                     qtip : "Select core_enum",
222                                                     queryParam : 'query[etype]',
223                                                     selectOnFocus : true,
224                                                     tpl : '<div class="x-grid-cell-text x-btn button  RdYlGn-q{seqid}-{seqmax}"><b>{name}</b> </div>',
225                                                     triggerAction : 'all',
226                                                     typeAhead : true,
227                                                     valueField : 'id',
228                                                     width : 180,
229                                                     store : {
230                                                         xtype: 'Store',
231                                                         xns: Roo.data,
232                                                         listeners : {
233                                                             beforeload : function (_self, o){
234                                                                 o.params = o.params || {};
235                                                                 // set more here
236                                                                     o.params.etype = 'priority';
237                                                             }
238                                                         },
239                                                         remoteSort : true,
240                                                         sortInfo : { direction : 'ASC', field: 'seqid' },
241                                                         proxy : {
242                                                             xtype: 'HttpProxy',
243                                                             xns: Roo.data,
244                                                             method : 'GET',
245                                                             url : baseURL + '/Roo/core_enum.php'
246                                                         },
247                                                         reader : {
248                                                             xtype: 'JsonReader',
249                                                             xns: Roo.data,
250                                                             id : 'id',
251                                                             root : 'data',
252                                                             totalProperty : 'total',
253                                                             fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
254                                                         }
255                                                     }
256                                                 },
257                                                 {
258                                                     xtype: 'ComboBox',
259                                                     xns: Roo.form,
260                                                     allowBlank : false,
261                                                     alwaysQuery : true,
262                                                     displayField : 'name',
263                                                     editable : 'false',
264                                                     emptyText : "Select Severity",
265                                                     fieldLabel : 'Severity',
266                                                     forceSelection : true,
267                                                     hiddenName : 'severity_id',
268                                                     listWidth : 400,
269                                                     loadingText : "Searching...",
270                                                     minChars : 2,
271                                                     name : 'severity_id_name',
272                                                     pageSize : 20,
273                                                     qtip : "Select core_enum",
274                                                     queryParam : 'query[etype]',
275                                                     selectOnFocus : true,
276                                                     tpl : '<div class="x-grid-cell-text x-btn button RdYlGn-q{seqid}-{seqmax}"><b>{name}</b> </div>',
277                                                     triggerAction : 'all',
278                                                     typeAhead : true,
279                                                     valueField : 'id',
280                                                     width : 180,
281                                                     store : {
282                                                         xtype: 'Store',
283                                                         xns: Roo.data,
284                                                         listeners : {
285                                                             beforeload : function (_self, o){
286                                                                 o.params = o.params || {};
287                                                                 // set more here
288                                                                     o.params.etype = 'severity';
289                                                             }
290                                                         },
291                                                         remoteSort : true,
292                                                         sortInfo : { direction : 'ASC', field: 'seqid' },
293                                                         proxy : {
294                                                             xtype: 'HttpProxy',
295                                                             xns: Roo.data,
296                                                             method : 'GET',
297                                                             url : baseURL + '/Roo/core_enum.php'
298                                                         },
299                                                         reader : {
300                                                             xtype: 'JsonReader',
301                                                             xns: Roo.data,
302                                                             id : 'id',
303                                                             root : 'data',
304                                                             totalProperty : 'total',
305                                                             fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
306                                                         }
307                                                     }
308                                                 },
309                                                 {
310                                                     xtype: 'ComboBox',
311                                                     xns: Roo.form,
312                                                     allowBlank : false,
313                                                     alwaysQuery : true,
314                                                     displayField : 'name',
315                                                     editable : 'false',
316                                                     emptyText : "Select Classification",
317                                                     fieldLabel : 'Classification',
318                                                     forceSelection : true,
319                                                     hiddenName : 'classification_id',
320                                                     listWidth : 400,
321                                                     loadingText : "Searching...",
322                                                     minChars : 2,
323                                                     name : 'classification_id_name',
324                                                     pageSize : 20,
325                                                     qtip : "Select core_enum",
326                                                     queryParam : 'query[etype]',
327                                                     selectOnFocus : true,
328                                                     tpl : '<div class="x-grid-cell-text x-btn button RdYlGn-q{seqid}-{seqmax}"><b>{name}</b> </div>',
329                                                     triggerAction : 'all',
330                                                     typeAhead : true,
331                                                     valueField : 'id',
332                                                     width : 180,
333                                                     store : {
334                                                         xtype: 'Store',
335                                                         xns: Roo.data,
336                                                         listeners : {
337                                                             beforeload : function (_self, o){
338                                                                 o.params = o.params || {};
339                                                                 // set more here
340                                                                     o.params.etype = 'classification';
341                                                             }
342                                                         },
343                                                         remoteSort : true,
344                                                         sortInfo : { direction : 'ASC', field: 'seqid' },
345                                                         proxy : {
346                                                             xtype: 'HttpProxy',
347                                                             xns: Roo.data,
348                                                             method : 'GET',
349                                                             url : baseURL + '/Roo/core_enum.php'
350                                                         },
351                                                         reader : {
352                                                             xtype: 'JsonReader',
353                                                             xns: Roo.data,
354                                                             id : 'id',
355                                                             root : 'data',
356                                                             totalProperty : 'total',
357                                                             fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}]
358                                                         }
359                                                     }
360                                                 }
361                                             ]
362                                         },
363                                         {
364                                             xtype: 'FieldSet',
365                                             xns: Roo.form,
366                                             legend : "Resources",
367                                             style : 'width: 190px',
368                                             items : [
369                                                 {
370                                                     xtype: 'Column',
371                                                     xns: Roo.form,
372                                                     labelAlign : 'top',
373                                                     width : 190,
374                                                     items : [
375                                                         {
376                                                             xtype: 'ComboBox',
377                                                             xns: Roo.form,
378                                                             allowBlank : 'false',
379                                                             alwaysQuery : true,
380                                                             displayField : 'name',
381                                                             editable : 'false',
382                                                             emptyText : "Select Person",
383                                                             fieldLabel : 'Developer',
384                                                             forceSelection : true,
385                                                             hiddenName : 'developer_id',
386                                                             listWidth : 400,
387                                                             loadingText : "Searching...",
388                                                             minChars : 2,
389                                                             name : 'developer_id_name',
390                                                             pageSize : 20,
391                                                             qtip : "Select Person",
392                                                             queryParam : 'query[name]',
393                                                             selectOnFocus : true,
394                                                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> &lt;{email}&gt; </div>',
395                                                             triggerAction : 'all',
396                                                             typeAhead : true,
397                                                             valueField : 'id',
398                                                             width : 180,
399                                                             store : {
400                                                                 xtype: 'Store',
401                                                                 xns: Roo.data,
402                                                                 listeners : {
403                                                                     beforeload : function (_self, o){
404                                                                         o.params = o.params || {};
405                                                                         
406                                                                         // set more here
407                                                                         o.params['query[project_id]'] = _this.form.findField('project_id').getValue();
408                                                                         if (!o.params['query[project_id]']) {
409                                                                             Roo.MessageBox.alert("Error", "Select Project");
410                                                                             return false;
411                                                                         }
412                                                                         o.params['query[role]'] = 'DEVELOPER';
413                                                                     }
414                                                                 },
415                                                                 remoteSort : true,
416                                                                 sortInfo : { direction : 'ASC', field: 'name' },
417                                                                 proxy : {
418                                                                     xtype: 'HttpProxy',
419                                                                     xns: Roo.data,
420                                                                     method : 'GET',
421                                                                     url : baseURL + '/Roo/Person.php'
422                                                                 },
423                                                                 reader : {
424                                                                     xtype: 'JsonReader',
425                                                                     xns: Roo.data,
426                                                                     id : 'id',
427                                                                     root : 'data',
428                                                                     totalProperty : 'total',
429                                                                     fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
430                                                                 }
431                                                             }
432                                                         },
433                                                         {
434                                                             xtype: 'ComboBox',
435                                                             xns: Roo.form,
436                                                             allowBlank : 'false',
437                                                             alwaysQuery : true,
438                                                             displayField : 'name',
439                                                             editable : 'false',
440                                                             emptyText : "Select Person",
441                                                             fieldLabel : 'Owner',
442                                                             forceSelection : true,
443                                                             hiddenName : 'owner_id',
444                                                             listWidth : 400,
445                                                             loadingText : "Searching...",
446                                                             minChars : 2,
447                                                             name : 'owner_id_name',
448                                                             pageSize : 20,
449                                                             qtip : "Select Person",
450                                                             queryParam : 'query[name]',
451                                                             selectOnFocus : true,
452                                                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
453                                                             triggerAction : 'all',
454                                                             typeAhead : true,
455                                                             valueField : 'id',
456                                                             width : 180,
457                                                             store : {
458                                                                 xtype: 'Store',
459                                                                 xns: Roo.data,
460                                                                 listeners : {
461                                                                     beforeload : function (_self, o){
462                                                                         o.params = o.params || {};
463                                                                         // set more here
464                                                                         o.params['query[project_id]']= _this.form.findField('project_id').getValue();
465                                                                         if (!o.params['query[project_id]'])  {
466                                                                             Roo.MessageBox.alert("Error", "Select Project");
467                                                                             return false;
468                                                                         }
469                                                                     }
470                                                                 },
471                                                                 remoteSort : true,
472                                                                 sortInfo : { direction : 'ASC', field: 'name' },
473                                                                 proxy : {
474                                                                     xtype: 'HttpProxy',
475                                                                     xns: Roo.data,
476                                                                     method : 'GET',
477                                                                     url : baseURL + '/Roo/Person.php'
478                                                                 },
479                                                                 reader : {
480                                                                     xtype: 'JsonReader',
481                                                                     xns: Roo.data,
482                                                                     id : 'id',
483                                                                     root : 'data',
484                                                                     totalProperty : 'total',
485                                                                     fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
486                                                                 }
487                                                             }
488                                                         }
489                                                     ]
490                                                 },
491                                                 {
492                                                     xtype: 'Column',
493                                                     xns: Roo.form,
494                                                     labelAlign : 'right',
495                                                     labelWidth : 100,
496                                                     width : 190,
497                                                     items : [
498                                                         {
499                                                             xtype: 'NumberField',
500                                                             xns: Roo.form,
501                                                             style : 'align:right;',
502                                                             fieldLabel : 'Estimated',
503                                                             name : 'estimated',
504                                                             width : 75
505                                                         }
506                                                     ]
507                                                 }
508                                             ]
509                                         }
510                                     ]
511                                 },
512                                 {
513                                     xtype: 'Column',
514                                     xns: Roo.form,
515                                     style : 'margin-left:10px',
516                                     width : 430,
517                                     items : [
518                                         {
519                                             xtype: 'FieldSet',
520                                             xns: Roo.form,
521                                             legend : "Summary / Details",
522                                             style : 'width:410px',
523                                             items : [
524                                                 {
525                                                     xtype: 'Column',
526                                                     xns: Roo.form,
527                                                     labelAlign : 'top',
528                                                     width : 400,
529                                                     items : [
530                                                         {
531                                                             xtype: 'TextField',
532                                                             xns: Roo.form,
533                                                             fieldLabel : 'Summary',
534                                                             name : 'summary',
535                                                             width : 400
536                                                         }
537                                                     ]
538                                                 },
539                                                 {
540                                                     xtype: 'Row',
541                                                     xns: Roo.form,
542                                                     labelWidth : 70,
543                                                     style : 'float:left; width:400px',
544                                                     width : 400,
545                                                     items : [
546                                                         {
547                                                             xtype: 'Checkbox',
548                                                             xns: Roo.form,
549                                                             listeners : {
550                                                                 check : function (_self, checked)
551                                                                 {
552                                                                 
553                                                                     if (!_this.form) {
554                                                                         return;
555                                                                     }
556                                                                     if (checked) {
557                                                                     
558                                                                          _this.form.findField('view_as').setValue('text');
559                                                                      }
560                                                                          
561                                                                     
562                                                                     
563                                                                      if (this.radio) {
564                                                                         return;
565                                                                     }
566                                                                      var md = _this.form.findField('view_as_markdown');
567                                                                 
568                                                                     md.radio = true;
569                                                                     md.setValue(checked ? 0 : 1);
570                                                                     
571                                                                     md.radio = false;
572                                                                 }
573                                                             },
574                                                             boxLabel : 'text',
575                                                             fieldLabel : 'View as',
576                                                             name : 'view_as_text',
577                                                             value : 1,
578                                                             width : 100
579                                                         },
580                                                         {
581                                                             xtype: 'Row',
582                                                             xns: Roo.form,
583                                                             hideLabels : true,
584                                                             style : 'float: left',
585                                                             width : 100,
586                                                             items : [
587                                                                 {
588                                                                     xtype: 'Checkbox',
589                                                                     xns: Roo.form,
590                                                                     listeners : {
591                                                                         check : function (_self, checked)
592                                                                         {
593                                                                                if (!_this.form) {
594                                                                                 return;
595                                                                             }
596                                                                             
597                                                                                 if (checked) {
598                                                                             
599                                                                                  _this.form.findField('view_as').setValue('markdown');
600                                                                              }
601                                                                             
602                                                                              if (this.radio) {
603                                                                                 return;
604                                                                             }
605                                                                              var md = _this.form.findField('view_as_text');
606                                                                         
607                                                                             md.radio = true;
608                                                                             md.setValue(checked ? 0 : 1);
609                                                                             md.radio = false;
610                                                                         }
611                                                                     },
612                                                                     boxLabel : 'markdown',
613                                                                     name : 'view_as_markdown',
614                                                                     value : 1
615                                                                 }
616                                                             ]
617                                                         }
618                                                     ]
619                                                 },
620                                                 {
621                                                     xtype: 'Column',
622                                                     xns: Roo.form,
623                                                     labelAlign : 'top',
624                                                     width : 400,
625                                                     items : [
626                                                         {
627                                                             xtype: 'TextArea',
628                                                             xns: Roo.form,
629                                                             fieldLabel : 'Description',
630                                                             height : 250,
631                                                             name : 'description',
632                                                             width : 400
633                                                         }
634                                                     ]
635                                                 }
636                                             ]
637                                         }
638                                     ]
639                                 },
640                                 {
641                                     xtype: 'Hidden',
642                                     xns: Roo.form,
643                                     name : 'id'
644                                 },
645                                 {
646                                     xtype: 'Hidden',
647                                     xns: Roo.form,
648                                     name : 'view_as'
649                                 }
650                             ]
651                         }
652                     ]
653                 }
654             ],
655             center : {
656                 xtype: 'LayoutRegion',
657                 xns: Roo
658             },
659             buttons : [
660                 {
661                     xtype: 'Button',
662                     xns: Roo,
663                     listeners : {
664                         click : function (_self, e)
665                         {
666                             _this.dialog.hide();
667                         }
668                     },
669                     text : "Cancel"
670                 },
671                 {
672                     xtype: 'Button',
673                     xns: Roo,
674                     listeners : {
675                         click : function (_self, e)
676                         {
677                             // do some checks?
678                              
679                             
680                          
681                             _this.form.doAction("submit");
682                         
683                         }
684                     },
685                     text : "Save"
686                 }
687             ]
688         });
689     }
690 };