steps = array( 'introduction' => array( 'name' => __( 'Introduction', 'erp' ), 'view' => array( $this, 'setup_step_introduction' ), 'handler' => '' ), 'basic' => array( 'name' => __( 'Basic Settings', 'erp' ), 'view' => array( $this, 'setup_step_basic' ), 'handler' => array( $this, 'setup_step_basic_save' ) ), 'department' => array( 'name' => __( 'Departments', 'erp' ), 'view' => array( $this, 'setup_step_departments' ), 'handler' => array( $this, 'setup_step_departments_save' ) ), 'designation' => array( 'name' => __( 'Designations', 'erp' ), 'view' => array( $this, 'setup_step_designation' ), 'handler' => array( $this, 'setup_step_designation_save' ), ), 'workdays' => array( 'name' => __( 'Work Days', 'erp' ), 'view' => array( $this, 'setup_step_workdays' ), 'handler' => array( $this, 'setup_step_workdays_save' ), ), 'next_steps' => array( 'name' => __( 'Ready!', 'erp' ), 'view' => array( $this, 'setup_step_ready' ), 'handler' => '' ) ); $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : ''; wp_enqueue_style( 'jquery-ui', WPERP_ASSETS . '/vendor/jquery-ui/jquery-ui-1.9.1.custom.css' ); wp_enqueue_style( 'erp-setup', WPERP_ASSETS . '/css/setup.css', array( 'dashicons', 'install' ) ); wp_register_script( 'erp-select2', WPERP_ASSETS . '/vendor/select2/select2.full.min.js', false, false, true ); wp_register_script( 'erp-setup', WPERP_ASSETS . "/js/erp$suffix.js", array( 'jquery', 'jquery-ui-datepicker', 'erp-select2' ), date( 'Ymd' ), true ); if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { call_user_func( $this->steps[ $this->step ]['handler'] ); } ob_start(); $this->setup_wizard_header(); $this->setup_wizard_steps(); $this->setup_wizard_content(); $this->setup_wizard_footer(); exit; } public function get_next_step_link() { $keys = array_keys( $this->steps ); return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ], remove_query_arg( 'translation_updated' ) ); } /** * Setup Wizard Header */ public function setup_wizard_header() { ?> > <?php _e( 'WP ERP › Setup Wizard', 'erp' ); ?>

WP ERP

step ) : ?> steps; array_shift( $ouput_steps ); ?>
    $step ) : ?>
'; call_user_func( $this->steps[ $this->step ]['view'] ); echo ''; } public function next_step_buttons() { ?>

It’s completely optional and shouldn’t take longer than three minutes.', 'erp' ); ?>

'gen_financial_month', 'id' => 'gen_financial_month', 'type' => 'select', 'value' => $financial_month, 'options' => erp_months_dropdown(), 'help' => __( 'Financial and tax calculation starts from this month of every year.', 'erp' ), ]); ?>
'gen_com_start', 'type' => 'text', 'value' => $company_started, 'help' => __( 'The date the company officially started.', 'erp' ), 'class' => 'erp-date-field', 'placeholder' => 'YYYY-MM-DD' ]); ?>
'base_currency', 'type' => 'select', 'value' => 'USD', 'options' => erp_get_currencies(), 'desc' => __( 'Format of date to show accross the system.', 'erp' ), ]); ?>
'date_format', 'type' => 'select', 'value' => 'd-m-Y', 'options' => [ 'm-d-Y' => 'mm-dd-yyyy', 'd-m-Y' => 'dd-mm-yyyy', 'm/d/Y' => 'mm/dd/yyyy', 'd/m/Y' => 'dd/mm/yyyy', 'Y-m-d' => 'yyyy-mm-dd', ], 'help' => __( 'Format of date to show accross the system.', 'erp' ), ]); ?>
next_step_buttons(); ?>
$financial_month, 'gen_com_start' => $company_started, 'date_format' => $date_format, 'erp_debug_mode' => 0 ] ); update_option( 'erp_settings_accounting', [ 'base_currency' => $base_currency, ] ); wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } public function setup_step_departments() { ?>

next_step_buttons(); ?>
script_input_duplicator(); } public function script_input_duplicator() { ?> $department ]); } } } wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } public function setup_step_designation() { ?>

next_step_buttons(); ?>
script_input_duplicator(); } public function setup_step_designation_save() { check_admin_referer( 'erp-setup' ); $designations = array_map( 'sanitize_text_field', $_POST['designations'] ); if ( $designations ) { foreach ($designations as $designation) { if ( ! empty( $designation ) ) { erp_hr_create_designation([ 'title' => $designation ]); } } } wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } public function setup_step_workdays() { $working_days = erp_company_get_working_days(); $options = array( '8' => __( 'Full Day', 'erp' ), '4' => __( 'Half Day', 'erp' ), '0' => __( 'Non-working Day', 'erp' ) ); $days = array( 'mon' => __( 'Monday', 'erp' ), 'tue' => __( 'Tuesday', 'erp' ), 'wed' => __( 'Wednesday', 'erp' ), 'thu' => __( 'Thursday', 'erp' ), 'fri' => __( 'Friday', 'erp' ), 'sat' => __( 'Saturday', 'erp' ), 'sun' => __( 'Sunday', 'erp' ) ); ?>

$day ) { ?>
'day[' . $key . ']', 'value' => $working_days[ $key ], 'type' => 'select', 'options' => $options ) ); ?>
next_step_buttons(); ?>
$hour_limit ) { update_option( $day, $hour_limit ); } } wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } public function setup_step_ready() { ?>