Pman.Dialog.CoreCompanies.bjs
[Pman.Core] / Pman.Dialog.CoreCompanies.bjs
1 {
2  "name" : "Pman.Dialog.CoreCompanies",
3  "parent" : "",
4  "title" : "",
5  "path" : "/home/edward/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  "items" : [
37   {
38    "modal" : true,
39    "shadow" : true,
40    "collapsible" : false,
41    "title" : "Add / Edit Organization",
42    "xtype" : "LayoutDialog",
43    "autoCreate" : true,
44    "width" : 750,
45    "$ xns" : "Roo",
46    "closable" : false,
47    "height" : 400,
48    "draggable" : false,
49    "items" : [
50     {
51      "alwaysShowTabs" : false,
52      "autoScroll" : false,
53      "xtype" : "LayoutRegion",
54      "hideTabs" : true,
55      "$ xns" : "Roo",
56      "* prop" : "center",
57      "closeOnTab" : true,
58      "titlebar" : false
59     },
60     {
61      "region" : "center",
62      "fitToFrame" : true,
63      "xtype" : "ContentPanel",
64      "autoCreate" : true,
65      "$ xns" : "Roo",
66      "items" : [
67       {
68        "listeners" : {
69         "actionfailed" : "function(f, act) {\n    _this.dialog.el.unmask();\n    // error msg???\n    Pman.standardActionFailed(f,act);\n              \n}",
70         "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}",
71         "rendered" : "function (form)\n{\n    _this.form = form;\n}"
72        },
73        "$ url" : "baseURL + '/Roo/Companies.php'",
74        "fileUpload" : true,
75        "xtype" : "Form",
76        "labelWidth" : 160,
77        "$ xns" : "Roo.form",
78        "items" : [
79         {
80          "xtype" : "Column",
81          "width" : 500,
82          "$ xns" : "Roo.form",
83          "items" : [
84           {
85            "fieldLabel" : "Company ID (for filing Ref.)",
86            "xtype" : "TextField",
87            "allowBlank" : true,
88            "width" : 100,
89            "$ xns" : "Roo.form",
90            "name" : "code",
91            "qtip" : "Enter code"
92           },
93           {
94            "listeners" : {
95             "render" : "function (_self)\n{\n    _this.etypeCombo = _self;\n}"
96            },
97            "alwaysQuery" : true,
98            "listWidth" : 250,
99            "Boolean allowBlank" : false,
100            "triggerAction" : "all",
101            "fieldLabel" : "Type",
102            "forceSelection" : true,
103            "selectOnFocus" : true,
104            "pageSize" : 20,
105            "emptyText" : "Select Type",
106            "displayField" : "display_name",
107            "hiddenName" : "comptype",
108            "minChars" : 2,
109            "valueField" : "name",
110            "xtype" : "ComboBox",
111            "typeAhead" : false,
112            "width" : 200,
113            "$ xns" : "Roo.form",
114            "name" : "comptype_display_name",
115            "qtip" : "Select type",
116            "queryParam" : "query[name]",
117            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> : {display_name}</div>",
118            "loadingText" : "Searching...",
119            "items" : [
120             {
121              "listeners" : {
122               "|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"
123              },
124              "xtype" : "Store",
125              "remoteSort" : true,
126              "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
127              "$ xns" : "Roo.data",
128              "* prop" : "store",
129              "items" : [
130               {
131                "$ url" : "baseURL + '/Roo/core_enum.php'",
132                "xtype" : "HttpProxy",
133                "method" : "GET",
134                "$ xns" : "Roo.data",
135                "* prop" : "proxy"
136               },
137               {
138                "id" : "id",
139                "root" : "data",
140                "xtype" : "JsonReader",
141                "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]",
142                "$ xns" : "Roo.data",
143                "* prop" : "reader",
144                "totalProperty" : "total"
145               }
146              ]
147             }
148            ]
149           },
150           {
151            "fieldLabel" : "Company Name",
152            "xtype" : "TextField",
153            "allowBlank" : false,
154            "width" : 300,
155            "$ xns" : "Roo.form",
156            "name" : "name",
157            "qtip" : "Enter Company Name"
158           },
159           {
160            "fieldLabel" : "Phone",
161            "xtype" : "TextField",
162            "allowBlank" : true,
163            "width" : 300,
164            "$ xns" : "Roo.form",
165            "name" : "tel",
166            "qtip" : "Enter Phone Number"
167           },
168           {
169            "fieldLabel" : "Fax",
170            "xtype" : "TextField",
171            "allowBlank" : true,
172            "width" : 300,
173            "$ xns" : "Roo.form",
174            "name" : "fax",
175            "qtip" : "Enter Fax Number"
176           },
177           {
178            "fieldLabel" : "Email",
179            "xtype" : "TextField",
180            "allowBlank" : true,
181            "width" : 300,
182            "$ xns" : "Roo.form",
183            "name" : "email",
184            "qtip" : "Enter Email Address"
185           },
186           {
187            "fieldLabel" : "Url",
188            "xtype" : "TextField",
189            "allowBlank" : true,
190            "width" : 300,
191            "$ xns" : "Roo.form",
192            "name" : "url",
193            "qtip" : "Enter Url"
194           },
195           {
196            "fieldLabel" : "Address",
197            "xtype" : "TextField",
198            "allowBlank" : true,
199            "width" : 300,
200            "$ xns" : "Roo.form",
201            "name" : "address",
202            "qtip" : "Enter Address"
203           },
204           {
205            "fieldLabel" : "Remarks",
206            "xtype" : "TextArea",
207            "allowBlank" : true,
208            "width" : 300,
209            "$ xns" : "Roo.form",
210            "height" : 120,
211            "name" : "remarks",
212            "qtip" : "Enter remarks"
213           }
214          ]
215         },
216         {
217          "labelAlign" : "top",
218          "xtype" : "Column",
219          "width" : 200,
220          "$ xns" : "Roo.form",
221          "items" : [
222           {
223            "fieldLabel" : "Background Colour",
224            "xtype" : "ColorField",
225            "$ xns" : "Roo.form",
226            "name" : "background_color"
227           },
228           {
229            "fieldLabel" : "Logo Image",
230            "xtype" : "DisplayField",
231            "style" : "border: 1px solid #ccc;",
232            "$ 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}",
233            "icon" : "rootURL + 'images/default/dd/drop-add.gif'",
234            "width" : 170,
235            "$ xns" : "Roo.form",
236            "height" : 170,
237            "name" : "logo_id"
238           },
239           {
240            "listeners" : {
241             "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 : 'Companies',\n        imgtype : 'LOGO'\n    }, function(data) {\n        if  (data) {\n            _t.setValue(data.id);\n        }\n        \n    });\n}"
242            },
243            "text" : "Add Image",
244            "xtype" : "Button",
245            "$ xns" : "Roo"
246           }
247          ]
248         },
249         {
250          "xtype" : "Hidden",
251          "$ xns" : "Roo.form",
252          "name" : "id"
253         }
254        ]
255       }
256      ]
257     },
258     {
259      "listeners" : {
260       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
261      },
262      "text" : "Cancel",
263      "xtype" : "Button",
264      "$ xns" : "Roo",
265      "* prop" : "buttons[]"
266     },
267     {
268      "listeners" : {
269       "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_enum.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            Roo.log(res);\n        }\n    });\n    \n    return;\n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
270      },
271      "text" : "Save",
272      "xtype" : "Button",
273      "$ xns" : "Roo",
274      "* prop" : "buttons[]"
275     }
276    ]
277   }
278  ]
279 }