2015-02-12 13:28:28 +00:00
frappe . provide ( "erpnext.wiz" ) ;
2015-01-29 12:39:11 +00:00
frappe . pages [ 'setup-wizard' ] . on _page _load = function ( wrapper ) {
2013-10-08 12:29:11 +00:00
if ( sys _defaults . company ) {
2014-02-14 10:17:51 +00:00
frappe . set _route ( "desktop" ) ;
2013-10-08 12:29:11 +00:00
return ;
}
2013-10-07 12:52:29 +00:00
$ ( ".navbar:first" ) . toggle ( false ) ;
2013-10-08 12:29:11 +00:00
$ ( "body" ) . css ( { "padding-top" : "30px" } ) ;
2014-04-17 13:18:59 +00:00
2013-12-24 13:21:32 +00:00
var wizard _settings = {
2013-10-08 12:29:11 +00:00
page _name : "setup-wizard" ,
2013-10-04 12:18:05 +00:00
parent : wrapper ,
2013-10-08 12:29:11 +00:00
on _complete : function ( wiz ) {
2015-02-12 13:28:28 +00:00
erpnext . wiz . setup _account ( wiz ) ;
2013-10-08 12:29:11 +00:00
} ,
2014-04-17 13:18:59 +00:00
title : _ _ ( "Welcome" ) ,
2015-02-12 13:28:28 +00:00
working _html : erpnext . wiz . working _html ,
complete _html : erpnext . wiz . complete _html ,
2013-10-04 12:18:05 +00:00
slides : [
2015-02-12 13:28:28 +00:00
erpnext . wiz . welcome . slide ,
erpnext . wiz . region . slide ,
erpnext . wiz . user . slide ,
erpnext . wiz . org . slide ,
erpnext . wiz . branding . slide ,
erpnext . wiz . taxes . slide ,
erpnext . wiz . customers . slide ,
erpnext . wiz . suppliers . slide ,
erpnext . wiz . items . slide ,
2013-10-04 12:18:05 +00:00
]
2013-12-24 13:21:32 +00:00
}
2014-04-17 13:18:59 +00:00
2015-02-12 13:28:28 +00:00
erpnext . wiz . wizard = new erpnext . wiz . Wizard ( wizard _settings )
2013-10-04 12:18:05 +00:00
}
2015-01-29 12:39:11 +00:00
frappe . pages [ 'setup-wizard' ] . on _page _show = function ( wrapper ) {
2015-02-12 13:28:28 +00:00
if ( frappe . get _route ( ) [ 1 ] ) {
erpnext . wiz . wizard . show ( frappe . get _route ( ) [ 1 ] ) ;
}
2013-10-04 12:18:05 +00:00
2015-02-12 13:28:28 +00:00
}
2013-10-04 12:18:05 +00:00
2015-02-12 13:28:28 +00:00
erpnext . wiz . Wizard = Class . extend ( {
2013-10-04 12:18:05 +00:00
init : function ( opts ) {
$ . extend ( this , opts ) ;
2014-04-17 13:18:59 +00:00
this . make ( ) ;
2013-10-08 12:29:11 +00:00
this . slides = this . slides ;
2013-10-04 12:18:05 +00:00
this . slide _dict = { } ;
2014-04-17 13:18:59 +00:00
this . welcomed = true ;
frappe . set _route ( this . page _name , "0" ) ;
} ,
make : function ( ) {
this . parent = $ ( '<div class="setup-wizard-wrapper">' ) . appendTo ( this . parent ) ;
2013-10-08 12:29:11 +00:00
} ,
get _message : function ( html ) {
2015-01-19 12:04:33 +00:00
return $ ( repl ( ' < div data - state = "setup-complete" > \
< div style = "padding: 40px;" class = "text-center" > % ( html ) s < / d i v > \
2013-10-08 12:29:11 +00:00
< / d i v > ' , { h t m l : h t m l } ) )
} ,
show _working : function ( ) {
this . hide _current _slide ( ) ;
2014-02-14 10:17:51 +00:00
frappe . set _route ( this . page _name ) ;
2014-04-18 05:10:17 +00:00
this . current _slide = { "$wrapper" : this . get _message ( this . working _html ( ) ) . appendTo ( this . parent ) } ;
2013-10-08 12:29:11 +00:00
} ,
show _complete : function ( ) {
this . hide _current _slide ( ) ;
2014-04-18 05:10:17 +00:00
this . current _slide = { "$wrapper" : this . get _message ( this . complete _html ( ) ) . appendTo ( this . parent ) } ;
2013-10-04 12:18:05 +00:00
} ,
show : function ( id ) {
2013-10-08 12:29:11 +00:00
if ( ! this . welcomed ) {
2014-02-14 10:17:51 +00:00
frappe . set _route ( this . page _name ) ;
2013-10-08 12:29:11 +00:00
return ;
}
2013-10-04 12:18:05 +00:00
id = cint ( id ) ;
2014-04-17 13:18:59 +00:00
if ( this . current _slide && this . current _slide . id === id )
2013-10-04 12:18:05 +00:00
return ;
if ( ! this . slide _dict [ id ] ) {
2015-02-12 13:28:28 +00:00
this . slide _dict [ id ] = new erpnext . wiz . WizardSlide ( $ . extend ( this . slides [ id ] , { wiz : this , id : id } ) ) ;
2013-10-04 12:18:05 +00:00
this . slide _dict [ id ] . make ( ) ;
}
2014-04-17 13:18:59 +00:00
2013-10-08 12:29:11 +00:00
this . hide _current _slide ( ) ;
2014-04-17 13:18:59 +00:00
2013-10-04 12:18:05 +00:00
this . current _slide = this . slide _dict [ id ] ;
this . current _slide . $wrapper . toggle ( true ) ;
} ,
2013-10-08 12:29:11 +00:00
hide _current _slide : function ( ) {
if ( this . current _slide ) {
this . current _slide . $wrapper . toggle ( false ) ;
this . current _slide = null ;
}
} ,
get _values : function ( ) {
var values = { } ;
$ . each ( this . slide _dict , function ( id , slide ) {
$ . extend ( values , slide . values )
} )
return values ;
}
2013-10-04 12:18:05 +00:00
} ) ;
2015-02-12 13:28:28 +00:00
erpnext . wiz . WizardSlide = Class . extend ( {
2013-10-04 12:18:05 +00:00
init : function ( opts ) {
$ . extend ( this , opts ) ;
2014-05-03 10:52:25 +00:00
this . $wrapper = $ ( "<div>" )
. appendTo ( this . wiz . parent )
. attr ( "data-slide-id" , this . id ) ;
2013-10-04 12:18:05 +00:00
} ,
make : function ( ) {
var me = this ;
2014-04-17 13:18:59 +00:00
if ( this . $body ) this . $body . remove ( ) ;
2014-04-21 06:12:22 +00:00
if ( this . before _load ) {
this . before _load ( this ) ;
}
2015-02-12 13:28:28 +00:00
this . $body = $ ( frappe . render _template ( "setup_wizard_page" , {
help : _ _ ( this . help ) ,
title : _ _ ( this . title ) ,
main _title : _ _ ( this . wiz . title ) ,
step : this . id + 1 ,
name : this . name ,
css _class : this . css _class || "" ,
slides _count : this . wiz . slides . length
} ) ) . appendTo ( this . $wrapper ) ;
2014-04-17 13:18:59 +00:00
this . body = this . $body . find ( ".form" ) [ 0 ] ;
2013-10-04 12:18:05 +00:00
if ( this . fields ) {
2014-02-14 10:17:51 +00:00
this . form = new frappe . ui . FieldGroup ( {
2013-10-04 12:18:05 +00:00
fields : this . fields ,
2013-10-07 12:52:29 +00:00
body : this . body ,
no _submit _on _enter : true
2013-10-04 12:18:05 +00:00
} ) ;
this . form . make ( ) ;
} else {
$ ( this . body ) . html ( this . html )
}
2014-04-17 13:18:59 +00:00
2013-10-04 12:18:05 +00:00
if ( this . id > 0 ) {
2014-04-17 13:18:59 +00:00
this . $prev = this . $body . find ( '.prev-btn' ) . removeClass ( "hide" )
. click ( function ( ) {
frappe . set _route ( me . wiz . page _name , me . id - 1 + "" ) ;
2013-10-08 12:29:11 +00:00
} )
2013-12-24 13:21:32 +00:00
. css ( { "margin-right" : "10px" } ) ;
2013-10-04 12:18:05 +00:00
}
if ( this . id + 1 < this . wiz . slides . length ) {
2014-04-17 13:18:59 +00:00
this . $next = this . $body . find ( '.next-btn' ) . removeClass ( "hide" )
. click ( function ( ) {
2013-10-08 12:29:11 +00:00
me . values = me . form . get _values ( ) ;
2014-04-17 13:18:59 +00:00
if ( me . values === null )
2013-10-08 12:29:11 +00:00
return ;
2014-05-13 11:22:26 +00:00
if ( me . validate && ! me . validate ( ) )
return ;
2014-04-17 13:18:59 +00:00
frappe . set _route ( me . wiz . page _name , me . id + 1 + "" ) ;
2013-10-08 12:29:11 +00:00
} )
2013-10-04 12:18:05 +00:00
} else {
2014-04-17 13:18:59 +00:00
this . $complete = this . $body . find ( '.complete-btn' ) . removeClass ( "hide" )
. click ( function ( ) {
2013-10-08 12:29:11 +00:00
me . values = me . form . get _values ( ) ;
2014-04-17 13:18:59 +00:00
if ( me . values === null )
2013-10-08 12:29:11 +00:00
return ;
2014-05-13 11:22:26 +00:00
if ( me . validate && ! me . validate ( ) )
return ;
2014-04-17 13:18:59 +00:00
me . wiz . on _complete ( me . wiz ) ;
2013-12-24 13:21:32 +00:00
} )
2013-10-04 12:18:05 +00:00
}
2014-04-17 13:18:59 +00:00
2013-10-04 12:18:05 +00:00
if ( this . onload ) {
this . onload ( this ) ;
}
} ,
get _input : function ( fn ) {
return this . form . get _input ( fn ) ;
2015-01-15 06:36:42 +00:00
} ,
get _field : function ( fn ) {
return this . form . get _field ( fn ) ;
2013-10-04 12:18:05 +00:00
}
2015-02-12 13:28:28 +00:00
} ) ;
$ . extend ( erpnext . wiz , {
welcome : {
slide : {
name : "welcome" ,
title : _ _ ( "Welcome to ERPNext" ) ,
icon : "icon-world" ,
help : _ _ ( "Let's prepare the system for first use." ) ,
fields : [
{ fieldname : "language" , label : _ _ ( "Select Your Language" ) , reqd : 1 ,
fieldtype : "Select" } ,
] ,
onload : function ( slide ) {
if ( ! erpnext . wiz . welcome . data ) {
erpnext . wiz . welcome . load _languages ( slide ) ;
} else {
erpnext . wiz . welcome . setup _fields ( slide ) ;
}
} ,
css _class : "single-column"
} ,
load _languages : function ( slide ) {
frappe . call ( {
method : "erpnext.setup.page.setup_wizard.setup_wizard.load_languages" ,
callback : function ( r ) {
erpnext . wiz . welcome . data = r . message ;
erpnext . wiz . welcome . setup _fields ( slide ) ;
slide . get _field ( "language" )
. set _input ( erpnext . wiz . welcome . data . default _language || "english" ) ;
}
} ) ;
} ,
setup _fields : function ( slide ) {
var select = slide . get _field ( "language" ) ;
select . df . options = erpnext . wiz . welcome . data . languages ;
select . refresh ( ) ;
erpnext . wiz . welcome . bind _events ( slide ) ;
} ,
bind _events : function ( slide ) {
slide . get _input ( "language" ) . unbind ( "change" ) . on ( "change" , function ( ) {
var lang = $ ( this ) . val ( ) || "english" ;
frappe . _messages = { } ;
frappe . call ( {
method : "erpnext.setup.page.setup_wizard.setup_wizard.load_messages" ,
args : {
language : lang
} ,
callback : function ( r ) {
// TODO save values!
// re-render all slides
$ . each ( slide . wiz . slide _dict , function ( key , s ) {
s . make ( ) ;
} ) ;
// select is re-made after language change
var select = slide . get _field ( "language" ) ;
select . set _input ( lang ) ;
}
} )
} ) ;
} ,
} ,
region : {
slide : {
title : _ _ ( "Region" ) ,
icon : "icon-flag" ,
help : _ _ ( "Select your Country, Time Zone and Currency" ) ,
fields : [
{ fieldname : "country" , label : _ _ ( "Country" ) , reqd : 1 ,
fieldtype : "Select" } ,
{ fieldname : "timezone" , label : _ _ ( "Time Zone" ) , reqd : 1 ,
fieldtype : "Select" } ,
{ fieldname : "currency" , label : _ _ ( "Currency" ) , reqd : 1 ,
fieldtype : "Select" } ,
] ,
onload : function ( slide ) {
frappe . call ( {
method : "frappe.geo.country_info.get_country_timezone_info" ,
callback : function ( data ) {
erpnext . wiz . region . data = data . message ;
erpnext . wiz . region . setup _fields ( slide ) ;
erpnext . wiz . region . bind _events ( slide ) ;
}
} ) ;
} ,
css _class : "single-column"
} ,
setup _fields : function ( slide ) {
var data = erpnext . wiz . region . data ;
slide . get _input ( "country" ) . empty ( )
. add _options ( [ "" ] . concat ( keys ( data . country _info ) . sort ( ) ) ) ;
slide . get _input ( "currency" ) . empty ( )
. add _options ( frappe . utils . unique ( [ "" ] . concat ( $ . map ( data . country _info ,
function ( opts , country ) { return opts . currency ; } ) ) ) . sort ( ) ) ;
slide . get _input ( "timezone" ) . empty ( )
. add _options ( [ "" ] . concat ( data . all _timezones ) ) ;
if ( data . default _country ) {
slide . set _input ( "country" , data . default _country ) ;
}
} ,
bind _events : function ( slide ) {
slide . get _input ( "country" ) . on ( "change" , function ( ) {
var country = slide . get _input ( "country" ) . val ( ) ;
var $timezone = slide . get _input ( "timezone" ) ;
var data = erpnext . wiz . region . data ;
$timezone . empty ( ) ;
// add country specific timezones first
if ( country ) {
var timezone _list = data . country _info [ country ] . timezones || [ ] ;
$timezone . add _options ( timezone _list . sort ( ) ) ;
slide . get _field ( "currency" ) . set _input ( data . 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 ( data . all _timezones ) ) ;
slide . get _field ( "timezone" ) . set _input ( $timezone . val ( ) ) ;
// temporarily set date format
frappe . boot . sysdefaults . date _format = ( data . country _info [ country ] . date _format
|| "dd-mm-yyyy" ) ;
} ) ;
}
} ,
user : {
slide : {
title : _ _ ( "The First User: You" ) ,
icon : "icon-user" ,
fields : [
{ "fieldname" : "first_name" , "label" : _ _ ( "First Name" ) , "fieldtype" : "Data" ,
reqd : 1 } ,
{ "fieldname" : "last_name" , "label" : _ _ ( "Last Name" ) , "fieldtype" : "Data" } ,
{ "fieldname" : "email" , "label" : _ _ ( "Email Address" ) , "fieldtype" : "Data" ,
reqd : 1 , "description" : _ _ ( "You will use it to Login" ) , "options" : "Email" } ,
{ "fieldname" : "password" , "label" : _ _ ( "Password" ) , "fieldtype" : "Password" ,
reqd : 1 } ,
{ fieldtype : "Attach Image" , fieldname : "attach_user" ,
label : _ _ ( "Attach Your Picture" ) } ,
] ,
help : _ _ ( 'The first user will become the System Manager (you can change this later).' ) ,
onload : function ( slide ) {
if ( user !== "Administrator" ) {
slide . form . fields _dict . password . $wrapper . toggle ( false ) ;
slide . form . fields _dict . email . $wrapper . toggle ( false ) ;
slide . form . fields _dict . first _name . set _input ( frappe . boot . user . first _name ) ;
slide . form . fields _dict . last _name . set _input ( frappe . boot . user . last _name ) ;
var user _image = frappe . get _cookie ( "user_image" ) ;
if ( user _image ) {
var $attach _user = slide . form . fields _dict . attach _user . $wrapper ;
$attach _user . find ( ".missing-image" ) . toggle ( false ) ;
$attach _user . find ( "img" ) . attr ( "src" , user _image ) . toggle ( true ) ;
}
delete slide . form . fields _dict . email ;
delete slide . form . fields _dict . password ;
}
} ,
css _class : "single-column"
} ,
} ,
org : {
slide : {
title : _ _ ( "The Organization" ) ,
icon : "icon-building" ,
fields : [
{ fieldname : 'company_name' , label : _ _ ( 'Company Name' ) , fieldtype : 'Data' , reqd : 1 ,
placeholder : _ _ ( 'e.g. "My Company LLC"' ) } ,
{ fieldname : 'company_abbr' , label : _ _ ( 'Company Abbreviation' ) , fieldtype : 'Data' ,
description : _ _ ( 'Max 5 characters' ) , placeholder : _ _ ( 'e.g. "MC"' ) , reqd : 1 } ,
{ fieldname : 'company_tagline' , label : _ _ ( 'What does it do?' ) , fieldtype : 'Data' ,
placeholder : _ _ ( 'e.g. "Build tools for builders"' ) , reqd : 1 } ,
{ fieldname : 'bank_account' , label : _ _ ( 'Bank Account' ) , fieldtype : 'Data' ,
placeholder : _ _ ( 'e.g. "XYZ National Bank"' ) , reqd : 1 } ,
{ fieldname : 'chart_of_accounts' , label : _ _ ( 'Chart of Accounts' ) ,
options : "" , fieldtype : 'Select' } ,
// TODO remove this
{ fieldtype : "Section Break" } ,
{ fieldname : 'fy_start_date' , label : _ _ ( 'Financial Year Start Date' ) , fieldtype : 'Date' ,
description : _ _ ( 'Your financial year begins on' ) , reqd : 1 } ,
{ fieldname : 'fy_end_date' , label : _ _ ( 'Financial Year End Date' ) , fieldtype : 'Date' ,
description : _ _ ( 'Your financial year ends on' ) , reqd : 1 } ,
] ,
help : _ _ ( 'The name of your company for which you are setting up this system.' ) ,
onload : function ( slide ) {
erpnext . wiz . org . load _chart _of _accounts ( slide ) ;
erpnext . wiz . org . bind _events ( slide ) ;
} ,
css _class : "single-column"
} ,
load _chart _of _accounts : function ( slide ) {
var country = slide . wiz . get _values ( ) . country ;
frappe . call ( {
method : "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.get_charts_for_country" ,
args : { "country" : country } ,
callback : function ( r ) {
if ( r . message ) {
slide . get _input ( "chart_of_accounts" ) . empty ( )
. add _options ( r . message ) ;
if ( r . message . length === 1 ) {
var field = slide . get _field ( "chart_of_accounts" ) ;
field . set _value ( r . message [ 0 ] ) ;
field . df . hidden = 1 ;
field . refresh ( ) ;
}
}
}
} )
} ,
bind _events : 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 _field ( "company_abbr" ) . set _input ( abbr . slice ( 0 , 5 ) . toUpperCase ( ) ) ;
} ) . val ( frappe . boot . sysdefaults . company _name || "" ) . trigger ( "change" ) ;
slide . get _input ( "company_abbr" ) . on ( "change" , function ( ) {
if ( slide . get _input ( "company_abbr" ) . val ( ) . length > 5 ) {
msgprint ( "Company Abbreviation cannot have more than 5 characters" ) ;
slide . get _field ( "company_abbr" ) . set _input ( "" ) ;
}
} ) ;
// TODO remove this
slide . get _input ( "fy_start_date" ) . on ( "change" , function ( ) {
var year _end _date =
frappe . datetime . add _days ( frappe . datetime . add _months (
frappe . datetime . user _to _obj ( slide . get _input ( "fy_start_date" ) . val ( ) ) , 12 ) , - 1 ) ;
slide . get _input ( "fy_end_date" ) . val ( frappe . datetime . obj _to _user ( year _end _date ) ) ;
} ) ;
}
} ,
branding : {
slide : {
icon : "icon-bookmark" ,
title : _ _ ( "The Brand" ) ,
help : _ _ ( 'Upload your letter head and logo. (you can edit them later).' ) ,
fields : [
{ fieldtype : "Attach Image" , fieldname : "attach_letterhead" ,
label : _ _ ( "Attach Letterhead" ) ,
description : _ _ ( "Keep it web friendly 900px (w) by 100px (h)" )
} ,
{ fieldtype : "Column Break" } ,
{ fieldtype : "Attach Image" , fieldname : "attach_logo" ,
label : _ _ ( "Attach Logo" ) ,
description : _ _ ( "100px by 100px" ) } ,
] ,
css _class : "two-column"
} ,
} ,
taxes : {
slide : {
icon : "icon-money" ,
"title" : _ _ ( "Add Taxes" ) ,
"help" : _ _ ( "List your tax heads (e.g. VAT, Excise; they should have unique names) and their standard rates. This will create a standard template, which you can edit and add more later." ) ,
"fields" : [ ] ,
before _load : function ( slide ) {
slide . fields = [ ] ;
for ( var i = 1 ; i < 4 ; i ++ ) {
slide . fields = slide . fields . concat ( [
{ fieldtype : "Section Break" } ,
{ fieldtype : "Data" , fieldname : "tax_" + i , label : _ _ ( "Tax" ) + " " + i ,
placeholder : _ _ ( "e.g. VAT" ) + " " + i } ,
{ fieldtype : "Column Break" } ,
{ fieldtype : "Float" , fieldname : "tax_rate_" + i , label : _ _ ( "Rate (%)" ) , placeholder : _ _ ( "e.g. 5" ) } ,
] ) ;
}
} ,
css _class : "two-column"
} ,
} ,
customers : {
slide : {
icon : "icon-group" ,
"title" : _ _ ( "Your Customers" ) ,
"help" : _ _ ( "List a few of your customers. They could be organizations or individuals." ) ,
"fields" : [ ] ,
before _load : function ( slide ) {
slide . fields = [ ] ;
for ( var i = 1 ; i < 6 ; i ++ ) {
slide . fields = slide . fields . concat ( [
{ fieldtype : "Section Break" } ,
{ fieldtype : "Data" , fieldname : "customer_" + i , label : _ _ ( "Customer" ) + " " + i ,
placeholder : _ _ ( "Customer Name" ) } ,
{ fieldtype : "Column Break" } ,
{ fieldtype : "Data" , fieldname : "customer_contact_" + i ,
label : _ _ ( "Contact Name" ) + " " + i , placeholder : _ _ ( "Contact Name" ) }
] )
}
} ,
css _class : "two-column"
} ,
} ,
suppliers : {
slide : {
icon : "icon-group" ,
"title" : _ _ ( "Your Suppliers" ) ,
"help" : _ _ ( "List a few of your suppliers. They could be organizations or individuals." ) ,
"fields" : [ ] ,
before _load : function ( slide ) {
slide . fields = [ ] ;
for ( var i = 1 ; i < 6 ; i ++ ) {
slide . fields = slide . fields . concat ( [
{ fieldtype : "Section Break" } ,
{ fieldtype : "Data" , fieldname : "supplier_" + i , label : _ _ ( "Supplier" ) + " " + i ,
placeholder : _ _ ( "Supplier Name" ) } ,
{ fieldtype : "Column Break" } ,
{ fieldtype : "Data" , fieldname : "supplier_contact_" + i ,
label : _ _ ( "Contact Name" ) + " " + i , placeholder : _ _ ( "Contact Name" ) } ,
] )
}
} ,
css _class : "two-column"
} ,
} ,
items : {
slide : {
icon : "icon-barcode" ,
"title" : _ _ ( "Your Products or Services" ) ,
"help" : _ _ ( "List your products or services that you buy or sell. Make sure to check the Item Group, Unit of Measure and other properties when you start." ) ,
"fields" : [ ] ,
before _load : function ( slide ) {
slide . fields = [ ] ;
for ( var i = 1 ; i < 6 ; i ++ ) {
slide . fields = slide . fields . concat ( [
{ fieldtype : "Section Break" , show _section _border : true } ,
{ fieldtype : "Data" , fieldname : "item_" + i , label : _ _ ( "Item" ) + " " + i ,
placeholder : _ _ ( "A Product or Service" ) } ,
{ fieldtype : "Select" , label : _ _ ( "Group" ) , fieldname : "item_group_" + i ,
options : [ _ _ ( "Products" ) , _ _ ( "Services" ) ,
_ _ ( "Raw Material" ) , _ _ ( "Consumable" ) , _ _ ( "Sub Assemblies" ) ] } ,
{ fieldtype : "Select" , fieldname : "item_uom_" + i , label : _ _ ( "UOM" ) ,
options : [ _ _ ( "Unit" ) , _ _ ( "Nos" ) , _ _ ( "Box" ) , _ _ ( "Pair" ) , _ _ ( "Kg" ) , _ _ ( "Set" ) ,
_ _ ( "Hour" ) , _ _ ( "Minute" ) ] } ,
{ fieldtype : "Check" , fieldname : "is_sales_item_" + i , label : _ _ ( "We sell this Item" ) , default : 1 } ,
{ fieldtype : "Check" , fieldname : "is_purchase_item_" + i , label : _ _ ( "We buy this Item" ) } ,
{ fieldtype : "Column Break" } ,
{ fieldtype : "Attach Image" , fieldname : "item_img_" + i , label : _ _ ( "Attach Image" ) } ,
] )
}
} ,
css _class : "two-column"
} ,
} ,
working _html : function ( ) {
return frappe . render _template ( "setup_wizard_message" , {
image : "/assets/frappe/images/ui/bubble-tea-smile.svg" ,
title : _ _ ( "Setting Up" ) ,
message : _ _ ( 'Sit tight while your system is being setup. This may take a few moments.' )
} ) ;
} ,
complete _html : function ( ) {
return frappe . render _template ( "setup_wizard_message" , {
image : "/assets/frappe/images/ui/bubble-tea-happy.svg" ,
title : _ _ ( 'Setup Complete' ) ,
message : _ _ ( 'Your setup is complete. Refreshing.' ) + ".."
} ) ;
} ,
setup _account : function ( wiz ) {
var values = wiz . get _values ( ) ;
wiz . show _working ( ) ;
return frappe . call ( {
method : "erpnext.setup.page.setup_wizard.setup_wizard.setup_account" ,
args : values ,
callback : function ( r ) {
wiz . show _complete ( ) ;
setTimeout ( function ( ) {
if ( user === "Administrator" ) {
msgprint ( _ _ ( "Login with your new User ID" ) + ": " + values . email ) ;
setTimeout ( function ( ) {
frappe . app . logout ( ) ;
} , 2000 ) ;
} else {
window . location = "/desk" ;
}
} , 2000 ) ;
} ,
error : function ( r ) {
var d = msgprint ( _ _ ( "There were errors." ) ) ;
d . custom _onhide = function ( ) {
frappe . set _route ( erpnext . wiz . page _name , "0" ) ;
} ;
}
} ) ;
} ,
} ) ;