Pman.Dialog.CoreCompanies.bjs
[Pman.Core] / Pman.Dialog.CoreCompanies.bjs
1 {
2  "items" : [
3   {
4    "$ xns" : "Roo",
5    "autoCreate" : true,
6    "closable" : false,
7    "collapsible" : false,
8    "draggable" : false,
9    "height" : 400,
10    "items" : [
11     {
12      "$ xns" : "Roo",
13      "* prop" : "center",
14      "alwaysShowTabs" : false,
15      "autoScroll" : false,
16      "closeOnTab" : true,
17      "hideTabs" : true,
18      "titlebar" : false,
19      "xtype" : "LayoutRegion"
20     },
21     {
22      "$ xns" : "Roo",
23      "autoCreate" : true,
24      "fitToFrame" : true,
25      "items" : [
26       {
27        "$ url" : "baseURL + '/Roo/core_company.php'",
28        "$ xns" : "Roo.form",
29        "fileUpload" : true,
30        "items" : [
31         {
32          "$ xns" : "Roo.form",
33          "items" : [
34           {
35            "$ xns" : "Roo.form",
36            "allowBlank" : true,
37            "fieldLabel" : "Company ID (for filing Ref.)",
38            "name" : "code",
39            "qtip" : "Enter code",
40            "width" : 100,
41            "xtype" : "TextField"
42           },
43           {
44            "$ xns" : "Roo.form",
45            "Boolean allowBlank" : false,
46            "alwaysQuery" : true,
47            "displayField" : "display_name",
48            "emptyText" : "Select Type",
49            "fieldLabel" : "Type",
50            "forceSelection" : true,
51            "hiddenName" : "comptype_id",
52            "items" : [
53             {
54              "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
55              "$ xns" : "Roo.data",
56              "* prop" : "store",
57              "items" : [
58               {
59                "$ url" : "baseURL + '/Roo/core_enum.php'",
60                "$ xns" : "Roo.data",
61                "* prop" : "proxy",
62                "method" : "GET",
63                "xtype" : "HttpProxy"
64               },
65               {
66                "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]",
67                "$ xns" : "Roo.data",
68                "* prop" : "reader",
69                "id" : "id",
70                "root" : "data",
71                "totalProperty" : "total",
72                "xtype" : "JsonReader"
73               }
74              ],
75              "listeners" : {
76               "|beforeload" : [
77                "function (_self, o){",
78                "    o.params = o.params || {};",
79                "    // set more here",
80                "    //o.params['query[empty_etype]'] = 1;",
81                "    o.params.etype = 'COMPTYPE';",
82                "}",
83                ""
84               ]
85              },
86              "remoteSort" : true,
87              "xtype" : "Store"
88             }
89            ],
90            "listWidth" : 250,
91            "listeners" : {
92             "render" : [
93              "function (_self)",
94              "{",
95              "    _this.etypeCombo = _self;",
96              "}"
97             ]
98            },
99            "loadingText" : "Searching...",
100            "minChars" : 2,
101            "name" : "comptype_id_display_name",
102            "pageSize" : 20,
103            "qtip" : "Select type",
104            "queryParam" : "query[name]",
105            "selectOnFocus" : true,
106            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> : {display_name}</div>",
107            "triggerAction" : "all",
108            "typeAhead" : false,
109            "valueField" : "id",
110            "width" : 200,
111            "xtype" : "ComboBox"
112           },
113           {
114            "$ xns" : "Roo.form",
115            "allowBlank" : false,
116            "fieldLabel" : "Company Name",
117            "name" : "name",
118            "qtip" : "Enter Company Name",
119            "width" : 300,
120            "xtype" : "TextField"
121           },
122           {
123            "$ xns" : "Roo.form",
124            "allowBlank" : true,
125            "fieldLabel" : "Phone",
126            "name" : "tel",
127            "qtip" : "Enter Phone Number",
128            "width" : 300,
129            "xtype" : "TextField"
130           },
131           {
132            "$ xns" : "Roo.form",
133            "allowBlank" : true,
134            "fieldLabel" : "Fax",
135            "name" : "fax",
136            "qtip" : "Enter Fax Number",
137            "width" : 300,
138            "xtype" : "TextField"
139           },
140           {
141            "$ xns" : "Roo.form",
142            "allowBlank" : true,
143            "fieldLabel" : "Email",
144            "name" : "email",
145            "qtip" : "Enter Email Address",
146            "width" : 300,
147            "xtype" : "TextField"
148           },
149           {
150            "$ xns" : "Roo.form",
151            "allowBlank" : true,
152            "fieldLabel" : "Url",
153            "name" : "url",
154            "qtip" : "Enter Url",
155            "width" : 300,
156            "xtype" : "TextField"
157           },
158           {
159            "$ xns" : "Roo.form",
160            "allowBlank" : true,
161            "fieldLabel" : "Address",
162            "name" : "address",
163            "qtip" : "Enter Address",
164            "width" : 300,
165            "xtype" : "TextArea"
166           },
167           {
168            "$ xns" : "Roo.form",
169            "allowBlank" : true,
170            "fieldLabel" : "Remarks",
171            "height" : 120,
172            "name" : "remarks",
173            "qtip" : "Enter remarks",
174            "width" : 300,
175            "xtype" : "TextArea"
176           }
177          ],
178          "width" : 500,
179          "xtype" : "Column"
180         },
181         {
182          "$ xns" : "Roo.form",
183          "items" : [
184           {
185            "$ xns" : "Roo.form",
186            "fieldLabel" : "Background Colour",
187            "name" : "background_color",
188            "xtype" : "ColorField"
189           },
190           {
191            "$ valueRenderer" : [
192             "function(v) {",
193             "    //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';",
194             "    if (!v) {",
195             "        return \"No Image Available\" + '<BR/>';",
196             "    }",
197             "    return String.format('<a target=\"_new\" href=\"{1}\"><img src=\"{0}\" width=\"150\"></a>', ",
198             "            baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg',",
199             "            baseURL + '/Images/'+v+'/logo.jpg'           // fixme - put escaped company name..",
200             "    );",
201             "}"
202            ],
203            "$ xns" : "Roo.form",
204            "fieldLabel" : "Logo Image",
205            "height" : 170,
206            "icon" : "rootURL + 'images/default/dd/drop-add.gif'",
207            "name" : "logo_id",
208            "style" : "border: 1px solid #ccc;",
209            "width" : 170,
210            "xtype" : "DisplayField"
211           },
212           {
213            "$ xns" : "Roo",
214            "listeners" : {
215             "click" : [
216              "function (_self, e)",
217              "{",
218              "    var _t = _this.form.findField('logo_id');",
219              "                         ",
220              "    Pman.Dialog.Image.show({",
221              "        onid :_this.data.id,",
222              "        ontable : 'pressrelease_terminals',",
223              "        imgtype : 'LOGO'",
224              "    }, function(data) {",
225              "        if  (data) {",
226              "            _t.setValue(data.id);",
227              "        }",
228              "        ",
229              "    });",
230              "}"
231             ]
232            },
233            "text" : "Add Image",
234            "xtype" : "Button"
235           }
236          ],
237          "labelAlign" : "top",
238          "width" : 200,
239          "xtype" : "Column"
240         },
241         {
242          "$ xns" : "Roo.form",
243          "name" : "id",
244          "xtype" : "Hidden"
245         }
246        ],
247        "labelWidth" : 160,
248        "listeners" : {
249         "actioncomplete" : [
250          "function(f, act) {",
251          "    _this.dialog.el.unmask();",
252          "    //console.log('load completed'); ",
253          "    // error messages?????",
254          "    if(act.type == 'setdata'){",
255          "        this.load({ method: 'GET', params: { '_id' : _this.data.id }});",
256          "        return;",
257          "    }",
258          "   ",
259          "    if (act.type == 'load') {",
260          "        _this.data = act.result.data;",
261          "        var meth = _this.data.comptype == 'OWNER' ? 'disable' : 'enable';",
262          "     ",
263          "            ",
264          "        if (_this.form.findField('comptype')) {",
265          "            _this.form.findField('comptype')[meth]();",
266          "        }",
267          "         ",
268          "       // _this.loaded();",
269          "        return;",
270          "    }",
271          "    ",
272          "    ",
273          "    if (act.type == 'submit') { // only submitted here if we are ",
274          "        _this.dialog.hide();",
275          "       ",
276          "        if (_this.callback) {",
277          "            _this.callback.call(this, act.result.data);",
278          "        }",
279          "        return; ",
280          "    }",
281          "    // unmask?? ",
282          "}"
283         ],
284         "actionfailed" : [
285          "function(f, act) {",
286          "    _this.dialog.el.unmask();",
287          "    // error msg???",
288          "    Pman.standardActionFailed(f,act);",
289          "              ",
290          "}"
291         ],
292         "rendered" : [
293          "function (form)",
294          "{",
295          "    _this.form = form;",
296          "}"
297         ]
298        },
299        "xtype" : "Form"
300       }
301      ],
302      "region" : "center",
303      "xtype" : "ContentPanel"
304     },
305     {
306      "$ xns" : "Roo",
307      "* prop" : "buttons[]",
308      "listeners" : {
309       "click" : [
310        "function (_self, e)",
311        "{",
312        "    _this.dialog.hide();",
313        "}"
314       ]
315      },
316      "text" : "Cancel",
317      "xtype" : "Button"
318     },
319     {
320      "$ xns" : "Roo",
321      "* prop" : "buttons[]",
322      "listeners" : {
323       "click" : [
324        "function (_self, e)",
325        "{",
326        "    if(!_this.form.isValid()){",
327        "        Roo.MessageBox.alert('Error', 'Please Correct all the errors in red');",
328        "        return;",
329        "    }",
330        "    ",
331        "    new Pman.Request({",
332        "        url : baseURL + '/Roo/Core_company.php',",
333        "        method : 'POST',",
334        "        params : {",
335        "          id : _this.form.findField('id').getValue() * 1,",
336        "          name : _this.form.findField('name').getValue(),",
337        "          _check_name : 1",
338        "        }, ",
339        "        success : function(res) {",
340        "            _this.dialog.el.mask(\"Saving\");",
341        "            _this.form.doAction(\"submit\");",
342        "        },",
343        "        failure : function(res) {",
344        "            Roo.MessageBox.confirm(",
345        "                \"Confirm\", ",
346        "                \"The company name has been used. Save it anyway?\", ",
347        "                function(res) {",
348        "                    if(res != 'yes') {",
349        "                        return;",
350        "                    }",
351        "                    ",
352        "                    _this.dialog.el.mask(\"Saving\");",
353        "                    _this.form.doAction(\"submit\");",
354        "                }",
355        "            );",
356        "        }",
357        "    });",
358        "    ",
359        "    return;",
360        "    ",
361        "}"
362       ]
363      },
364      "text" : "Save",
365      "xtype" : "Button"
366     }
367    ],
368    "modal" : true,
369    "shadow" : true,
370    "title" : "Add / Edit Organization",
371    "width" : 750,
372    "xtype" : "LayoutDialog"
373   }
374  ],
375  "modOrder" : "001",
376  "name" : "Pman.Dialog.CoreCompanies",
377  "named_strings" : {
378   "address_fieldLabel" : "dd7bf230fde8d4836917806aff6a6b27",
379   "address_qtip" : "32c4e9483403d60115b21519178e5384",
380   "background_color_fieldLabel" : "35cb9e66ff801a819684ee0fbeabaeeb",
381   "code_fieldLabel" : "b33457e7e1cd5dbf1db34a0c60fcb75f",
382   "code_qtip" : "733640ec0c9367df1b4d85eb286ed9ae",
383   "comptype_id_display_name_emptyText" : "023a5dfa857c4aa0156e6685231a1dbd",
384   "comptype_id_display_name_fieldLabel" : "a1fa27779242b4902f7ae3bdd5c6d508",
385   "comptype_id_display_name_loadingText" : "1243daf593fa297e07ab03bf06d925af",
386   "comptype_id_display_name_qtip" : "8535bcc0f05358a583bb432bbadf7e0d",
387   "email_fieldLabel" : "ce8ae9da5b7cd6c3df2929543a9af92d",
388   "email_qtip" : "9f86c00615b1a210935ac28ff8ebbb22",
389   "fax_fieldLabel" : "9810aa2b9f44401be4bf73188ef2b67d",
390   "fax_qtip" : "cf3a5d25d39613ad5bbc2f5eb0f9b675",
391   "logo_id_fieldLabel" : "bc87ef2144ae15ef4f78211e73948051",
392   "name_fieldLabel" : "e7b47c58815acf1d3afa59a84b5db7fb",
393   "name_qtip" : "4ef6052d74436756f08e95fd63949653",
394   "remarks_fieldLabel" : "231bc72756b5e6de492aaaa1577f61b1",
395   "remarks_qtip" : "c54b90756cfbeff9217293b567cb2eb0",
396   "tel_fieldLabel" : "bcc254b55c4a1babdf1dcb82c207506b",
397   "tel_qtip" : "bc3a4c40d007b8d610a16312970e5cb3",
398   "url_fieldLabel" : "02a3a357710cc2a5dfdfb74ed012fb59",
399   "url_qtip" : "8c04eb09879a05470fae436ba76e3bb9"
400  },
401  "parent" : "",
402  "path" : "/home/leon/gitlive/web.MediaOutreach/Pman/Core/Pman.Dialog.CoreCompanies.bjs",
403  "permname" : "",
404  "strings" : {
405   "023a5dfa857c4aa0156e6685231a1dbd" : "Select Type",
406   "02a3a357710cc2a5dfdfb74ed012fb59" : "Url",
407   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
408   "231bc72756b5e6de492aaaa1577f61b1" : "Remarks",
409   "32c4e9483403d60115b21519178e5384" : "Enter Address",
410   "35cb9e66ff801a819684ee0fbeabaeeb" : "Background Colour",
411   "4ef6052d74436756f08e95fd63949653" : "Enter Company Name",
412   "72b9d3d2e231f1de7a2bd70737f644aa" : "Add / Edit Organization",
413   "733640ec0c9367df1b4d85eb286ed9ae" : "Enter code",
414   "8535bcc0f05358a583bb432bbadf7e0d" : "Select type",
415   "8c04eb09879a05470fae436ba76e3bb9" : "Enter Url",
416   "9810aa2b9f44401be4bf73188ef2b67d" : "Fax",
417   "9f86c00615b1a210935ac28ff8ebbb22" : "Enter Email Address",
418   "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
419   "b33457e7e1cd5dbf1db34a0c60fcb75f" : "Company ID (for filing Ref.)",
420   "b9c49611cfda3259a2b837b39489e650" : "Add Image",
421   "bc3a4c40d007b8d610a16312970e5cb3" : "Enter Phone Number",
422   "bc87ef2144ae15ef4f78211e73948051" : "Logo Image",
423   "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
424   "c54b90756cfbeff9217293b567cb2eb0" : "Enter remarks",
425   "c9cc8cce247e49bae79f15173ce97354" : "Save",
426   "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
427   "cf3a5d25d39613ad5bbc2f5eb0f9b675" : "Enter Fax Number",
428   "dd7bf230fde8d4836917806aff6a6b27" : "Address",
429   "e7b47c58815acf1d3afa59a84b5db7fb" : "Company Name",
430   "ea4788705e6873b424c65e91c2846b19" : "Cancel"
431  },
432  "title" : ""
433 }