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