wn.pages['setup-wizard'].onload = function(wrapper) {
erpnext.wiz = new wn.wiz.Wizard({
parent: wrapper,
title: wn._("ERPNext Setup Guide"),
slides: [
// User
{
title: wn._("The First User"),
fields: [
{"fieldname": "first_name", "label": wn._("First Name"), "fieldtype": "Data", reqd:1},
{"fieldname": "last_name", "label": wn._("Last Name"), "fieldtype": "Data", reqd:1},
],
help: wn._('The first user will become the System Manager (you can change that later).')
},
// Organization
{
title: wn._("The Organization"),
fields: [
{fieldname:'company_name', label: wn._('Company Name'), fieldtype:'Data', reqd:1,
placeholder: 'e.g. "My Company LLC"'},
{fieldname:'company_abbr', label: wn._('Company Abbreviation'), fieldtype:'Data',
placeholder:'e.g. "MC"',reqd:1},
{fieldname:'company_tagline', label: wn._('What does it do?'), fieldtype:'Data',
placeholder:'e.g. "Build tools for builders"',reqd:1},
],
help: wn._('The name of your company for which you are setting up this system.'),
onload: function(slide) {
slide.get_input("company_name").on("change", function() {
var parts = slide.get_input("company_name").val().split(" ");
var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join("");
slide.get_input("company_abbr").val(abbr.toUpperCase());
});
}
},
// Country
{
title: wn._("Country, Timezone and Currency"),
fields: [
{fieldname:'country', label: wn._('Country'), reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'currency', label: wn._('Default Currency'), reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'timezone', label: wn._('Time Zone'), reqd:1,
options: "", fieldtype: 'Select'},
],
help: wn._('Select your home country and check the timezone and currency.'),
onload: function(slide, form) {
wn.call({
method:"webnotes.country_info.get_country_timezone_info",
callback: function(data) {
erpnext.country_info = data.message.country_info;
erpnext.all_timezones = data.message.all_timezones;
slide.get_input("country").empty()
.add_options([""].concat(keys(erpnext.country_info).sort()));
slide.get_input("currency").empty()
.add_options(wn.utils.unique([""].concat($.map(erpnext.country_info,
function(opts, country) { return opts.currency; }))).sort());
slide.get_input("timezone").empty()
.add_options([""].concat(erpnext.all_timezones));
}
})
slide.get_input("country").on("change", function() {
var country = slide.get_input("country").val();
var $timezone = slide.get_input("timezone");
$timezone.empty();
// add country specific timezones first
if(country){
var timezone_list = erpnext.country_info[country].timezones || [];
$timezone.add_options(timezone_list.sort());
slide.get_input("currency").val(erpnext.country_info[country].currency);
}
// add all timezones at the end, so that user has the option to change it to any timezone
$timezone.add_options([""].concat(erpnext.all_timezones));
});
}
},
// Logo
{
title: wn._("Logo and Letter Heads"),
help: wn._('Upload your letter head and logo - you can edit them later.'),
html: '