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            "triggerAction" : "all",
100            "fieldLabel" : "Type",
101            "forceSelection" : true,
102            "selectOnFocus" : true,
103            "pageSize" : 20,
104            "emptyText" : "Select Type",
105            "displayField" : "display_name",
106            "hiddenName" : "comptype",
107            "minChars" : 2,
108            "valueField" : "name",
109            "xtype" : "ComboBox",
110            "typeAhead" : false,
111            "width" : 200,
112            "$ xns" : "Roo.form",
113            "name" : "comptype_display_name",
114            "qtip" : "Select type",
115            "queryParam" : "query[name]",
116            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> : {display_name}</div>",
117            "loadingText" : "Searching...",
118            "items" : [
119             {
120              "listeners" : {
121               "|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"
122              },
123              "xtype" : "Store",
124              "remoteSort" : true,
125              "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
126              "$ xns" : "Roo.data",
127              "* prop" : "store",
128              "items" : [
129               {
130                "$ url" : "baseURL + '/Roo/core_enum.php'",
131                "xtype" : "HttpProxy",
132                "method" : "GET",
133                "$ xns" : "Roo.data",
134                "* prop" : "proxy"
135               },
136               {
137                "id" : "id",
138                "root" : "data",
139                "xtype" : "JsonReader",
140                "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]",
141                "$ xns" : "Roo.data",
142                "* prop" : "reader",
143                "totalProperty" : "total"
144               }
145              ]
146             }
147            ]
148           },
149           {
150            "fieldLabel" : "Company Name",
151            "xtype" : "TextField",
152            "allowBlank" : true,
153            "width" : 300,
154            "$ xns" : "Roo.form",
155            "name" : "name",
156            "qtip" : "Enter Company Name"
157           },
158           {
159            "fieldLabel" : "Phone",
160            "xtype" : "TextField",
161            "allowBlank" : true,
162            "width" : 300,
163            "$ xns" : "Roo.form",
164            "name" : "tel",
165            "qtip" : "Enter Phone Number"
166           },
167           {
168            "fieldLabel" : "Fax",
169            "xtype" : "TextField",
170            "allowBlank" : true,
171            "width" : 300,
172            "$ xns" : "Roo.form",
173            "name" : "fax",
174            "qtip" : "Enter Fax Number"
175           },
176           {
177            "fieldLabel" : "Email",
178            "xtype" : "TextField",
179            "allowBlank" : true,
180            "width" : 300,
181            "$ xns" : "Roo.form",
182            "name" : "email",
183            "qtip" : "Enter Email Address"
184           },
185           {
186            "fieldLabel" : "Url",
187            "xtype" : "TextField",
188            "allowBlank" : true,
189            "width" : 300,
190            "$ xns" : "Roo.form",
191            "name" : "url",
192            "qtip" : "Enter Url"
193           },
194           {
195            "fieldLabel" : "Address",
196            "xtype" : "TextField",
197            "allowBlank" : true,
198            "width" : 300,
199            "$ xns" : "Roo.form",
200            "name" : "address",
201            "qtip" : "Enter Address"
202           },
203           {
204            "fieldLabel" : "Remarks",
205            "xtype" : "TextArea",
206            "allowBlank" : true,
207            "width" : 300,
208            "$ xns" : "Roo.form",
209            "height" : 120,
210            "name" : "remarks",
211            "qtip" : "Enter remarks"
212           }
213          ]
214         },
215         {
216          "labelAlign" : "top",
217          "xtype" : "Column",
218          "width" : 200,
219          "$ xns" : "Roo.form",
220          "items" : [
221           {
222            "fieldLabel" : "Background Colour",
223            "xtype" : "ColorField",
224            "$ xns" : "Roo.form",
225            "name" : "background_color"
226           },
227           {
228            "fieldLabel" : "Logo Image",
229            "xtype" : "DisplayField",
230            "style" : "border: 1px solid #ccc;",
231            "$ 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}",
232            "icon" : "rootURL + 'images/default/dd/drop-add.gif'",
233            "width" : 170,
234            "$ xns" : "Roo.form",
235            "height" : 170,
236            "name" : "logo_id"
237           },
238           {
239            "listeners" : {
240             "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}"
241            },
242            "text" : "Add Image",
243            "xtype" : "Button",
244            "$ xns" : "Roo"
245           }
246          ]
247         },
248         {
249          "xtype" : "Hidden",
250          "$ xns" : "Roo.form",
251          "name" : "id"
252         }
253        ]
254       }
255      ]
256     },
257     {
258      "listeners" : {
259       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
260      },
261      "text" : "Cancel",
262      "xtype" : "Button",
263      "$ xns" : "Roo",
264      "* prop" : "buttons[]"
265     },
266     {
267      "listeners" : {
268       "click" : "function (_self, e)\n{\n    // do some checks?\n    \n    \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
269      },
270      "text" : "Save",
271      "xtype" : "Button",
272      "$ xns" : "Roo",
273      "* prop" : "buttons[]"
274     }
275    ]
276   }
277  ]
278 }