1 //<script type="text/javascript">
3 Pman.Dialog.Projects = {
12 this.dialog = new Ext.LayoutDialog(Ext.get(document.body).createChild({tag:'div'}), {
14 title: "Edit Project",
27 // tabPosition: 'top',
33 this.dialog.addKeyListener(27, this.dialog.hide, this.dialog);
34 this.dialog.addButton("Cancel", this.dialog.hide, this.dialog);
36 this.dialog.addButton("Save", this.save, this);
37 this.layout = this.dialog.getLayout();
38 this.layout.beginUpdate();
40 var dg = Pman.Dialog.Projects;
42 this.form = new Ext.form.Form({
45 actionfailed : function(f, act) {
46 dg.dialog.el.unmask();
48 Pman.standardActionFailed(f,act);
51 actioncomplete: function(f, act) {
52 dg.dialog.el.unmask();
53 //console.log('load completed');
54 // error messages?????
57 if (act.type == 'load') {
59 dg.data = act.result.data;
65 if (act.type == 'submit') { // only submitted here if we are
68 dg.callback.call(this, act.result.data);
80 //?? will this work...
81 this.form.addxtype.apply(this.form,[
88 qtip : "Enter Project Code",
94 fieldLabel : "Project Name",
97 qtip : "Enter Project Name",
106 qtip : "Project type",
107 fieldLabel : "Project type",
113 store: new Ext.data.SimpleStore({
115 fields: [ 'code', 'desc' ],
116 data: Pman.Dialog.Projects.getTypes()
123 forceSelection: true,
126 // queryParam: 'query[project]',
127 // loadingText: "Searching...",
136 xtype: 'ComboBoxAdder',
137 fieldLabel: "Client",
138 name : 'client_id_name',
140 qtip : "Select Client",
144 store: new Ext.data.Store({
146 proxy: new Ext.data.HttpProxy({
147 url: baseURL + '/Roo/Companies.html',
150 reader: Pman.Readers.Companies,
152 loadexception : Pman.loadException
157 hiddenName: 'client_id',
159 forceSelection: true,
161 triggerAction: 'all',
162 tpl: new Ext.Template(
163 '<div class="x-grid-cell-text x-btn button">',
164 '<b>{name}</b> {address}',
167 queryParam: 'query[name]',
168 loadingText: "Searching...",
175 adderclick : function()
178 Pman.Dialog.Companies.show( { id: 0 }, function(data) {
179 cb.setFromData(data);
183 if (!f.el.getValue().length) {
199 name : 'team_id_name',
201 qtip : "Select Team",
205 store: new Ext.data.Store({
207 proxy: new Ext.data.HttpProxy({
208 url: baseURL + '/Roo/Groups.html',
212 reader: Pman.Readers.Groups,
214 beforeload: function(g, o) {
215 o.params = o.params ? o.params : {};
217 o.params['query[group_pulldown]'] = 1;
220 loadexception : Pman.loadException
226 hiddenName: 'team_id',
228 forceSelection: true,
230 triggerAction: 'all' ,
231 queryParam: 'query[name]',
232 loadingText: "Searching...",
240 if (!f.el.getValue().length) {
252 // Office (is related to team leader?!?)
257 name : 'file_location',
258 fieldLabel : "File Location",
260 qtip : "Where are the files stored?",
268 // Client? - pick from contacts..
271 // office in charge..
272 // email list????? == oru project list..
281 fieldLabel : "Remarks",
284 qtip : "Enter Project Remarks",
294 style: 'width:393px;padding:0 0 2 10;',
301 qtip : "Enter Date Opened",
303 altFormats : 'Y-m-d|d/m/Y',
314 name : 'open_by_name',
316 qtip : "Select Person Who opened",
320 store: new Ext.data.Store({
322 proxy: new Ext.data.HttpProxy({
323 url: baseURL + '/Roo/Person.html',
326 reader: Pman.Readers.Person,
328 beforeload : function(st,o)
330 // compnay myst be set..
332 o.params.company_id = Pman.Login.authUser.company_id * 1;
336 loadexception : Pman.loadException
344 hiddenName: 'open_by',
346 forceSelection: true,
347 doForce : function(){
348 if(this.el.dom.value.length > 0){
350 this.lastSelectionText === undefined ? "" : this.lastSelectionText;
351 this.applyEmptyText();
352 if (!this.el.dom.value.length) {
353 this.setFromData({ id: 0, name: '----' });
359 triggerAction: 'all',
360 tpl: new Ext.Template(
361 '<div class="x-grid-cell-text x-btn button">',
362 '<b>{name}</b> {role}',
365 queryParam: 'query[name]',
366 loadingText: "Searching...",
383 var ef = this.dialog.getLayout().getEl().createChild({tag: 'div'});
384 ef.dom.style.margin = 10;
386 this.form.render(ef.dom);
388 var vp = this.dialog.getLayout().add('center', new Ext.ContentPanel(ef, {
390 //title: 'Org Details',
400 this.layout.endUpdate();
403 show : function(data, callback)
405 this.callback= callback;
410 this.form.setValues(data);
413 this.form.findField('client_id').setFromData({
415 name: data.client_id_name
417 this.form.findField('team_id').setFromData({
419 name: data.team_id_name
421 this.form.findField('open_by').setFromData({
423 name: data.open_by_name
432 this.form.doAction('submit', {
433 url: baseURL + '/Roo/Projects.html',
445 [ 'U' , "Project (Unconfirmed)" ],
447 [ 'C' , "Project (Closed)" ],
448 [ 'N' , "Non-Project" ],
449 [ 'X' , "Non-Project (Closed)" ]