Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 1 | pscript.onload_Setup = function() { |
| 2 | var parent = $i('setup_div'); |
| 3 | add_space_holder(parent); |
| 4 | |
| 5 | var callback = function(r,rt){ |
| 6 | |
| 7 | // header |
| 8 | parent.page_head = new PageHeader(parent,'Setup'); |
| 9 | |
| 10 | // sections |
| 11 | var setup_data = new SetupData(r.message); |
| 12 | pscript.setup_make_sections(setup_data); |
| 13 | |
| 14 | remove_space_holder(); |
| 15 | } |
| 16 | $c_obj('Setup Wizard Control','get_country','',callback); |
| 17 | } |
| 18 | |
| 19 | pscript.setup_set_height = function() { |
| 20 | var parent = $i('setup_div'); |
| 21 | $y(parent.tray.body, {height: get_window_height() - parent.page_head.wrapper.offsetHeight + 'px', overflow:'auto'}) |
| 22 | } |
| 23 | |
| 24 | // Make sections |
| 25 | // =================================================== |
| 26 | |
| 27 | pscript.setup_make_sections = function(setup_data) { |
| 28 | var parent = $i('setup_div'); |
| 29 | parent.tray = new TrayPage(parent) |
| 30 | |
| 31 | // list of setup data |
| 32 | var lst = [setup_data.system, setup_data.general, setup_data.accounts, setup_data.selling, setup_data.buying, setup_data.stock, setup_data.hr, setup_data.maintenance, setup_data.production]; |
| 33 | |
| 34 | for(var s=0; s<lst.length; s++){ |
| 35 | var lbl = keys(lst[s])[0]; |
| 36 | |
| 37 | var ti = parent.tray.add_item(lbl, null, null, 1) |
| 38 | new SetupItem(ti.body, lbl, lst[s][lbl]); |
| 39 | |
| 40 | if(s==0) ti.expand(); |
| 41 | } |
| 42 | |
| 43 | setTimeout(pscript.setup_set_height, 100); |
| 44 | resize_observers.push(pscript.setup_set_height); |
| 45 | } |
| 46 | |
| 47 | // Setup Item |
| 48 | // =================================================== |
| 49 | SetupItem = function(parent, lbl, link_list) { |
| 50 | this.icons = {'System':'back_img Setup', 'General':'back_img Home', 'Accounts':'back_img Accounts', 'Selling':'back_img Selling', 'Stock':'back_img Stock', 'Buying':'back_img Buying', 'Maintenance':'back_img Maintenance', 'Production':'back_img Production', 'HR':'back_img HR'}; |
| 51 | this.make_item_body(parent, lbl, link_list); |
| 52 | } |
| 53 | |
| 54 | |
| 55 | // Make body for item in setup wizard |
| 56 | // =================================================== |
| 57 | SetupItem.prototype.make_item_body = function(parent, lbl, link_list){ |
| 58 | // item link area |
| 59 | this.link_area = parent; |
| 60 | this.render_item_body(lbl, link_list); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | // Render item body |
| 65 | // =================================================== |
| 66 | SetupItem.prototype.render_item_body = function(lbl, link_list) { |
| 67 | var me = this; |
| 68 | // set item header |
| 69 | |
| 70 | link_list.sort(function(a, b) { return a[0] > b[0]; }); |
| 71 | |
| 72 | // show links for item |
| 73 | for(var i=0; i<link_list.length; i++){ |
| 74 | var wrapper = $a(this.link_area, 'div','',{marginBottom:'4px', padding:'2px'}); |
| 75 | $(wrapper).hover( |
| 76 | function() { $y(this,{backgroundColor:'#EEF'}) } |
| 77 | ,function() { $y(this,{backgroundColor:''}) } |
| 78 | ) |
| 79 | var tab = make_table($a(wrapper,'div'), 1, 2, '100%', [200/7+'%', 500/7+'%']) |
| 80 | |
| 81 | var dt= $a($td(tab,0,0), 'span', 'link_type'); |
| 82 | dt.innerHTML = link_list[i][0]; |
| 83 | dt.label = link_list[i][0]; |
| 84 | dt.arg = link_list[i][1]; |
| 85 | dt.nm = link_list[i][2]; |
| 86 | |
| 87 | if(dt.arg == 1) dt.cn = link_list[i][3]; |
| 88 | else if(dt.arg == 2) dt.cb=link_list[i][3]; |
| 89 | |
| 90 | // execute when link is clicked |
| 91 | dt.onclick = function(){ |
| 92 | me.link_action(this) |
| 93 | } |
| 94 | |
| 95 | // description |
| 96 | $y($td(tab,0,1), {color:'#777'}); |
| 97 | $td(tab,0,1).innerHTML = link_list[i][4]; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | |
| 102 | // Execute when link is clicked |
| 103 | // ---------------------------- |
| 104 | SetupItem.prototype.link_action = function(obj) { |
| 105 | var me = this; |
| 106 | var obj = obj; |
| 107 | |
| 108 | // if object links to a doc browser |
| 109 | if(obj.arg == 1){ |
| 110 | if(in_list(profile.can_read, obj.nm)){ |
| 111 | if(obj.cn !='') |
| 112 | loaddocbrowser(obj.nm, obj.nm, obj.cn); |
| 113 | else |
| 114 | loaddocbrowser(obj.nm); |
| 115 | } |
| 116 | else |
| 117 | msgprint('No read permission',1); |
| 118 | } |
| 119 | |
| 120 | // if obj links to a page |
| 121 | else if(obj.arg == 2){ |
| 122 | me.show_page(obj); |
| 123 | } |
| 124 | |
| 125 | // if object links to a single doctype |
| 126 | else if(obj.arg == 3){ |
| 127 | newdoc(obj.nm); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | |
| 132 | // Show page for corresponding link |
| 133 | // -------------------------------- |
| 134 | SetupItem.prototype.show_page = function(obj) { |
| 135 | var me = obj; |
| 136 | var callback = function(r,rt) |
| 137 | { |
| 138 | if(r.message){ |
| 139 | if(me.cb == '') |
| 140 | loadpage(me.nm); |
| 141 | else |
| 142 | show_chart_browser(me.nm,me.cb); |
| 143 | } |
| 144 | else |
| 145 | msgprint('No read permission',1); |
| 146 | } |
| 147 | $c_obj('Setup Wizard Control','get_page_lst',me.nm,callback); |
| 148 | } |
| 149 | |
| 150 | |
| 151 | // Setup Data |
| 152 | // ======================================================================================================================================================= |
| 153 | SetupData = function(cnty){ |
| 154 | |
| 155 | // arg : 1 - Docbrowser, 2 - Page, 3 - DocType |
| 156 | |
| 157 | //[label, arg, name, callback/col_name, description] |
| 158 | |
| 159 | this.system = {'System':[['Global Defaults',3,'Manage Account','','Set global default values'], |
| 160 | ['Manage Series',3,'Naming Series','','Manage numbering series for transactions'], |
| 161 | ['Custom Field',1,'Custom Field','dt'+NEWLINE+'label'+NEWLINE+'fieldtype'+NEWLINE+'options','Add and manage custom fields on forms'], |
| 162 | ['Email Settings',3,'Email Settings','','Outgoing email server and address'], |
| 163 | ['Notification Settings',3,'Notification Control','','Automatic emails set at selected events'], |
Anand Doshi | 633edbe | 2011-12-08 19:34:01 +0530 | [diff] [blame] | 164 | ['Email Digest', 1, 'Email Digest', '', 'Schedule Daily / Weekly / Monthly Summary e-mails'], |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 165 | ['Company',1,'Company','id'+NEWLINE+'is_active'+NEWLINE+'email','Manage list of companies'], |
| 166 | ['Fiscal Year',1,'Fiscal Year','id'+NEWLINE+'company'+NEWLINE+'is_active'+NEWLINE+'year','Manage list of fiscal years'], |
| 167 | ['Personalize',3,'Personalize','','Set your banner'], |
| 168 | ['Manage Trash',2,'Trash','','Restore trashed items'], |
| 169 | ['Import Data',2,'Import Data','','Import data from CSV files'], |
| 170 | ['Manage Users',2,'My Company','','Add / remove users and manage their roles'], |
Nabin Hait | 40de491 | 2012-01-09 12:54:20 +0530 | [diff] [blame] | 171 | //['Web Forms',2,'Webforms','', 'Code to embed forms in yor website'], |
Anand Doshi | 633edbe | 2011-12-08 19:34:01 +0530 | [diff] [blame] | 172 | ['Permissions Manager',2,'Permission Engine','', 'Manage all permissions from one tool'], |
Anand Doshi | a04afc9 | 2011-11-23 13:51:52 +0530 | [diff] [blame] | 173 | //['Property Setter',1,'Property Setter','', 'Customize properties of a Form (DocType) or Field'], |
| 174 | ['Customize Form View',3,'DocLayer','', 'Customize properties of a Form (DocType) or Field'], |
| 175 | ['Print Formats', 1, 'Print Format', '', 'Manage Print Formats'], |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 176 | ['Letter Head',1,'Letter Head','','Manage different letter heads for Prints'], |
| 177 | ['SMS Settings',3,'SMS Settings','','Integrate your personalized SMS gateway which support http web service'], |
Brahma K | 8ccaed3 | 2011-09-07 11:26:17 +0530 | [diff] [blame] | 178 | ['SMS Center',3,'SMS Center','','Send mass sms to your leads, contacts and partners'], |
| 179 | ['Features Setup',3,'Features Setup','','Displays fields based on features selected'] |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 180 | ]}; |
| 181 | |
| 182 | |
| 183 | this.general = {'General':[['Authorization Rule',1,'Authorization Rule','','Set rules based on amounts'], |
| 184 | ['Print Heading',1,'Print Heading','','Manage headings for printing transactions'], |
| 185 | ['Term',1,'Term','','Manage template of standard Terms for order / invoices etc'], |
| 186 | ['Currency',1,'Currency','','Manage list of currencies'], |
Nabin Hait | ed6b489 | 2011-11-23 13:17:54 +0530 | [diff] [blame] | 187 | ['Address',1,'Address','','Manage Address of customers, suppliers'], |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 188 | ['Country',1,'Country','','Country master'], |
| 189 | ['State',1,'State','','State master'], |
Rushabh Mehta | 64b6c2c | 2011-06-22 16:38:11 +0530 | [diff] [blame] | 190 | ['Rename Tool',3,'Rename Tool','','Rename a record'], |
nabinhait | de9826c | 2011-07-20 18:02:59 +0530 | [diff] [blame] | 191 | ['Bulk Rename Tool',3,'Bulk Rename Tool','','Rename multiple records at a time'], |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 192 | ['Activty Type',1,'Activity Type','','Types of activities that you can select in your Timesheet'], |
| 193 | ['City',1,'City','','City master']]}; |
| 194 | |
| 195 | this.selling = {'Selling':[['Customer Group',2,'Sales Browser','Customer Group','Manage customer categories'], |
| 196 | ['Territory',2,'Sales Browser','Territory','Manage sales territories'], |
| 197 | ['Customer',1,'Customer','customer_group'+NEWLINE+'country','Customer master'], |
| 198 | ['Sales Person',2,'Sales Browser','Sales Person','Manage sales persons'], |
| 199 | ['Sales Partner',1,'Sales Partner','', 'Manage sales partners'], |
| 200 | ['Campaign',1,'Campaign','id'+NEWLINE+'campaign_name'+NEWLINE+'description','Manage sales / marketing campaigns'], |
| 201 | ['Sales BOM',1,'Sales BOM','id'+NEWLINE+'is_active'+NEWLINE+'new_item_name'+NEWLINE+'description'+NEWLINE+'item_group','Manage Sales Bill of Material (Main item + accessories)'], |
| 202 | ['Price List',1,'Price List','','Price list master']]}; |
| 203 | |
| 204 | this.accounts = {'Accounts':[['Chart of Accounts',2,'Accounts Browser','Account','Manage chart of accounts'], |
| 205 | ['Chart of Cost Centers',2,'Accounts Browser','Cost Center','Manage chart of cost centers'], |
| 206 | ['POS Setting',1,'POS Setting','','Manage Point of Sales default Settings.']]}; |
| 207 | |
| 208 | // if country = india; show india related doctypes |
| 209 | //------------------------------------------------- |
| 210 | |
| 211 | if(cnty == 'India'){ |
| 212 | var lst1 = [['TDS Rate Chart',1,'TDS Rate Chart','', 'TDS rate master'],['TDS Category',1,'TDS Category','id'+NEWLINE+'module','TDS categories']]; |
| 213 | for(var i =0; i<lst1.length;i++) |
| 214 | this.accounts['Accounts'].push(lst1[i]); |
| 215 | } |
| 216 | //-------------------------------------------------- |
| 217 | |
| 218 | var lst = [['Monthly Distribution',1,'Budget Distribution','id'+NEWLINE+'fiscal_year'+NEWLINE+'distribution_id','Manage budget distributions (seasonalities)'], |
| 219 | ['Sales Other Charges',1,'Other Charges','','Manage your charge structures (taxes + charges) for sales'], |
| 220 | ['Purchase Other Charges',1,'Purchase Other Charges','','Manage your charge structures (taxes + charges) for purchase'], |
| 221 | ['Mode of Payment',1,'Mode of Payment','','Mode of payment master']]; |
| 222 | |
| 223 | for(var i =0; i<lst.length;i++) |
| 224 | this.accounts['Accounts'].push(lst[i]); |
| 225 | |
| 226 | this.stock = {'Stock':[['Item Group',2,'Sales Browser','Item Group','Manage item classifications'], |
| 227 | ['Item',1,'Item','name'+NEWLINE+'item_group'+NEWLINE+'description','Item master'], |
| 228 | ['Brand',1,'Brand','id'+NEWLINE+'description','Brand master'], |
| 229 | ['Batch',1,'Batch','name'+NEWLINE+'start_date'+NEWLINE+'item'+NEWLINE+'expiry_date','Manage batches'], |
| 230 | ['Price List',1,'Price List','','Price list master'], |
| 231 | ['UOM',1,'UOM','','Unit of measure (UOM) master'], |
| 232 | ['Warehouse Type',1,'Warehouse Type','','Warehouse classifications'], |
| 233 | ['Warehouse',1,'Warehouse','','Warehouse master']]}; |
| 234 | |
| 235 | this.buying = {'Buying':[['Supplier Type',1,'Supplier Type','','Manage supplier classifications'], |
| 236 | ['Supplier',1,'Supplier','id'+NEWLINE+'supplier_type'+NEWLINE+'supplier_status'+NEWLINE+'company','Supplier master']]}; |
| 237 | |
Nabin Hait | b50c022 | 2012-01-05 12:21:03 +0530 | [diff] [blame] | 238 | this.maintenance = {'Maintenance':[['Serial No',1,'Serial No','item_code'+NEWLINE+'status'+NEWLINE+'pr_no'+NEWLINE+'delivery_note_no'+NEWLINE+'customer_name','Manage unique serial numbers for items']]}; |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 239 | |
| 240 | this.production = {'Production':[['Bill of Materials',1,'Bill Of Materials','id'+NEWLINE+'item'+NEWLINE+'description'+NEWLINE+'operating_cost'+NEWLINE+'maintained_by','Muti-level bill of materials and operations'], |
| 241 | ['Workstation',1,'Workstation','id'+NEWLINE+'workstation_name'+NEWLINE+'warehouse'+NEWLINE+'description','Workstation master']]}; |
| 242 | |
| 243 | this.hr = {'HR':[['Department',1,'Department','','Company department master'], |
| 244 | ['Designation',1,'Designation','','Company designation master'], |
| 245 | ['Branch',1,'Branch','','Manage branches for your company'], |
| 246 | ['Grade',1,'Grade','','Manage employee grades'], |
| 247 | ['Employment Type',1,'Employment Type','','Manage types of employment'], |
| 248 | ['Employee',1,'Employee','employee_name'+NEWLINE+'employment_type'+NEWLINE+'status'+NEWLINE+'branch'+NEWLINE+'designation'+NEWLINE+'department'+NEWLINE+'grade'+NEWLINE+'reports_to','Employee master'], |
| 249 | ['Earning Type',1,'Earning Type','taxable'+NEWLINE+'exemption_limit','Types of salary earning master'], |
| 250 | ['Deduction Type',1,'Deduction Type','','Types of salary deduction master'], |
| 251 | ['Expense Type',1,'Expense Type','', 'Types of expense master'], |
| 252 | |
| 253 | ['Salary Structure',1,'Salary Structure','employee'+NEWLINE+'is_active'+NEWLINE+'fiscal_year'+NEWLINE+'from_date'+NEWLINE+'ctc'+NEWLINE+'total_earning'+NEWLINE+'total_deduction'+NEWLINE+'total','Salary structure template'], |
| 254 | ['Holiday List',1,'Holiday List','fiscal_year','List of holidays'], |
| 255 | ['Leave Type',1,'Leave Type','max_days_allowed'+NEWLINE+'is_carry_forward'+NEWLINE+'is_encash','Leave type master'], |
| 256 | ['KRA Template',1,'KRA Template','','Template of Key Result Areas (KRAs)']]}; |
| 257 | } |