/** * Load admin scripts and styles * * @param string * * @return void */ public function admin_scripts($hook) { // var_dump( $hook ); $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_script('jquery-chosen', WPERP_ASSETS . "/vendor/chosen/chosen.jquery{$suffix}.js", array('jquery'), date('Ymd'), true); wp_enqueue_script('wp-erp-popup', WPERP_ASSETS . "/js/jquery-popup{$suffix}.js", array('jquery'), date('Ymd'), true); wp_enqueue_script('wp-erp-script', WPERP_ASSETS . "/js/erp{$suffix}.js", array('jquery', 'backbone', 'underscore', 'wp-util', 'jquery-ui-datepicker'), date('Ymd'), true); wp_localize_script('wp-erp-script', 'wpErp', array('nonce' => wp_create_nonce('erp-nonce'), 'ajaxurl' => admin_url('admin-ajax.php'), 'set_logo' => __('Set company logo', 'wp-erp'), 'upload_logo' => __('Upload company logo', 'wp-erp'), 'remove_logo' => __('Remove company logo', 'wp-erp'), 'update_location' => __('Update Location', 'wp-erp'), 'create' => __('Create', 'wp-erp'), 'update' => __('Update', 'wp-erp'), 'confirmMsg' => __('Are you sure?', 'wpuf'), 'ajaxurl' => admin_url('admin-ajax.php'), 'plupload' => array('url' => admin_url('admin-ajax.php') . '?nonce=' . wp_create_nonce('erp_featured_img'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true))); // load country/state JSON on new company page if ('toplevel_page_erp-company' == $hook || isset($_GET['action']) && in_array($_GET['action'], array('new', 'edit'))) { wp_enqueue_script('post'); wp_enqueue_media(); $country = \WeDevs\ERP\Countries::instance(); wp_localize_script('wp-erp-script', 'wpErpCountries', $country->load_country_states()); } wp_enqueue_style('jquery-ui', WPERP_ASSETS . '/vendor/jquery-ui/jquery-ui-1.9.1.custom.css'); wp_enqueue_style('jquery-chosen', WPERP_ASSETS . "/vendor/chosen/chosen{$suffix}.css"); wp_enqueue_style('wp-erp-styles', WPERP_ASSETS . '/css/admin/admin.css', false, date('Ymd')); }
/** * Load admin scripts and styles * * @param string * * @return void */ public function admin_scripts($hook) { // var_dump( $hook ); $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_script('jquery-chosen', WPERP_ASSETS . "/vendor/chosen/chosen.jquery{$suffix}.js", array('jquery'), date('Ymd'), true); wp_enqueue_script('wp-erp-popup', WPERP_ASSETS . "/js/jquery-popup{$suffix}.js", array('jquery'), date('Ymd'), true); wp_enqueue_script('wp-erp-script', WPERP_ASSETS . "/js/erp{$suffix}.js", array('jquery', 'backbone', 'underscore', 'wp-util', 'jquery-ui-datepicker'), date('Ymd'), true); wp_localize_script('wp-erp-script', 'wpErp', array('nonce' => wp_create_nonce('erp-nonce'), 'ajaxurl' => admin_url('admin-ajax.php'), 'set_logo' => __('Set company logo', 'wp-erp'), 'upload_logo' => __('Upload company logo', 'wp-erp'), 'remove_logo' => __('Remove company logo', 'wp-erp'), 'update_location' => __('Update Location', 'wp-erp'), 'create' => __('Create', 'wp-erp'), 'update' => __('Update', 'wp-erp'))); // load country/state JSON on new company page if ('toplevel_page_erp-company' == $hook && isset($_GET['action']) && in_array($_GET['action'], array('new', 'edit'))) { wp_enqueue_script('post'); wp_enqueue_media(); $country = \WeDevs\ERP\Countries::instance(); wp_localize_script('wp-erp-script', 'wpErpCountries', $country->load_country_states()); } wp_enqueue_style('jquery-ui', WPERP_ASSETS . '/vendor/jquery-ui/jquery-ui-1.9.1.custom.css'); wp_enqueue_style('jquery-chosen', WPERP_ASSETS . "/vendor/chosen/chosen{$suffix}.css"); wp_enqueue_style('wp-erp-styles', WPERP_ASSETS . '/css/admin/admin.css', false, date('Ymd')); }
<?php if (isset($_GET['msg']) && $_GET['msg'] == 'updated') { ?> <div class="updated"> <p><?php _e('Company information has been updated!', 'wp-erp'); ?> </p> </div> <?php } ?> <?php $country = \WeDevs\ERP\Countries::instance(); ?> <form action="" method="post" id="erp-new-company"> <div class="erp-single-container"> <div class="erp-area-left"> <div id="titlediv" style="margin-bottom: 20px;"> <div id="titlewrap"> <label class="screen-reader-text" id="title-prompt-text" for="title"><?php _e('Enter company name here', 'wp-erp'); ?> </label> <input type="text" name="name" size="30" value="<?php echo esc_attr($company->name); ?> " id="title" autocomplete="off">
public function admin_scripts($hook) { $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_media(); wp_enqueue_style('erp-tiptip'); wp_enqueue_script('erp-tiptip'); wp_enqueue_script('wp-erp-crm', WPERP_CRM_ASSETS . "/js/crm{$suffix}.js", array('wp-erp-script', 'erp-admin-timepicker'), date('Ymd'), true); $localize_script = apply_filters('erp_crm_localize_script', array('nonce' => wp_create_nonce('wp-erp-crm-nonce'), 'popup' => array('customer_title' => __('Add New Customer', 'wp-erp'), 'customer_update_title' => __('Edit Customer', 'wp-erp'), 'customer_social_title' => __('Customer Social Profile', 'wp-erp'), 'customer_assing_group' => __('Add to Contact groups', 'wp-erp')), 'add_submit' => __('Add New', 'wp-erp'), 'update_submit' => __('Update', 'wp-erp'), 'save_submit' => __('Save', 'wp-erp'), 'customer_upload_photo' => __('Upload Photo', 'wp-erp'), 'customer_set_photo' => __('Set Photo', 'wp-erp'), 'confirm' => __('Are you sure?', 'wp-erp'), 'delConfirmCustomer' => __('Are you sure to delete this customer?', 'wp-erp'), 'delConfirm' => __('Are you sure to delete this?', 'wp-erp'), 'checkedConfirm' => __('Alteast one item must be checked', 'wp-erp'), 'contact_filter' => erp_crm_get_serach_key())); // if it's an customer page if ('crm_page_erp-sales-customers' == $hook || 'crm_page_erp-sales-companies' == $hook) { wp_enqueue_style('erp-admin-timepicker'); wp_enqueue_script('erp-admin-timepicker'); wp_enqueue_script('erp-vuejs'); wp_enqueue_script('erp-trix-editor'); wp_enqueue_style('erp-trix-editor'); wp_enqueue_script('underscore'); wp_enqueue_style('wp-erp-nprogress', WPERP_CRM_ASSETS . '/css/nprogress.css'); wp_enqueue_script('wp-erp-nprogress', WPERP_CRM_ASSETS . "/js/nprogress{$suffix}.js", array('jquery'), date('Ymd'), true); wp_enqueue_script('wp-erp-crm-vue-customer', WPERP_CRM_ASSETS . "/js/crm-app{$suffix}.js", array('wp-erp-nprogress', 'wp-erp-script', 'erp-vuejs', 'underscore', 'erp-select2', 'erp-tiptip'), date('Ymd'), true); wp_enqueue_script('wp-erp-crm-vue-save-search', WPERP_CRM_ASSETS . "/js/save-search{$suffix}.js", array('wp-erp-script', 'erp-vuejs', 'underscore', 'erp-select2', 'erp-tiptip'), date('Ymd'), true); wp_enqueue_script('post'); $customer = new Contact(); $country = \WeDevs\ERP\Countries::instance(); wp_localize_script('wp-erp-crm-vue-customer', 'wpCRMvue', ['ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('wp-erp-crm-customer-feed'), 'current_user_id' => get_current_user_id(), 'confirm' => __('Are you sure?', 'wp-erp'), 'date_format' => get_option('date_format')]); wp_localize_script('wp-erp-crm-vue-save-search', 'wpCRMSaveSearch', ['ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('wp-erp-crm-save-search'), 'searchFields' => erp_crm_get_serach_key()]); $localize_script['customer_empty'] = $customer->to_array(); $localize_script['wpErpCountries'] = $country->load_country_states(); } wp_localize_script('wp-erp-crm', 'wpErpCrm', $localize_script); }
/** * Get the employee nationalit * * @return string */ public function get_nationality() { if (!empty($this->user->nationality)) { $countries = \WeDevs\ERP\Countries::instance()->get_countries(); if (array_key_exists($this->user->nationality, $countries)) { return $countries[$this->user->nationality]; } } }
function erp_crm_get_serach_key() { return ['first_name' => ['title' => __('First Name', 'wp-erp'), 'type' => 'text', 'text' => '', 'condval' => '', 'condition' => ['' => __('is', 'wp-erp'), '!' => __('is not', 'wp-erp'), '~' => __('contains', 'wp-erp'), '!~' => __('not contains', 'wp-erp'), '^' => __('begins with', 'wp-erp'), '$' => __('ends with', 'wp-erp')]], 'last_name' => ['title' => __('Last Name', 'wp-erp'), 'type' => 'text', 'text' => '', 'condval' => '', 'condition' => ['' => __('is', 'wp-erp'), '!' => __('is not', 'wp-erp'), '~' => __('contains', 'wp-erp'), '!~' => __('not contains', 'wp-erp'), '^' => __('begins with', 'wp-erp'), '$' => __('ends with', 'wp-erp')]], 'email' => ['title' => __('Email', 'wp-erp'), 'type' => 'text', 'text' => '', 'condval' => '', 'condition' => ['~' => __('contains', 'wp-erp'), '!~' => __('not contains', 'wp-erp'), '^' => __('begins with', 'wp-erp'), '$' => __('ends with', 'wp-erp')]], 'phone' => ['title' => __('Phone', 'wp-erp'), 'type' => 'text', 'text' => '', 'condval' => '', 'condition' => ['' => __('has', 'wp-erp'), '~' => __('contains', 'wp-erp'), '!~' => __('not contains', 'wp-erp'), '^' => __('begins with', 'wp-erp'), '$' => __('ends with', 'wp-erp')]], 'mobile' => ['title' => __('Mobile', 'wp-erp'), 'type' => 'text', 'text' => '', 'condval' => '', 'condition' => ['' => __('has', 'wp-erp'), '~' => __('contains', 'wp-erp'), '!~' => __('not contains', 'wp-erp'), '^' => __('begins with', 'wp-erp'), '$' => __('ends with', 'wp-erp')]], 'website' => ['title' => __('Website', 'wp-erp'), 'type' => 'text', 'text' => '', 'condval' => '', 'condition' => ['' => __('has', 'wp-erp'), '~' => __('contains', 'wp-erp'), '!~' => __('not contains', 'wp-erp'), '^' => __('begins with', 'wp-erp'), '$' => __('ends with', 'wp-erp')]], 'city' => ['title' => __('City', 'wp-erp'), 'type' => 'text', 'text' => '', 'condval' => '', 'condition' => ['' => __('from', 'wp-erp'), '!' => __('not from', 'wp-erp'), '~' => __('contains', 'wp-erp'), '!~' => __('not contains', 'wp-erp')]], 'country_state' => ['title' => __('Country/State', 'wp-erp'), 'type' => 'dropdown', 'text' => '', 'condval' => '', 'condition' => ['' => __('from', 'wp-erp'), '!' => __('not from', 'wp-erp')], 'options' => \WeDevs\ERP\Countries::instance()->country_dropdown_options()]]; }
/** * Get State name by country and state code * * @since 1.0 * * @param string $country * @param string $state * * @return string */ function erp_get_state_name($country, $state) { $load_cuntries_states = \WeDevs\ERP\Countries::instance(); $states = $load_cuntries_states->states; // Handle full state name $full_state = $country && $state && isset($states[$country][$state]) ? $states[$country][$state] : $state; return $full_state; }
/** * Get formatted address of the company * * @return string address */ public function get_formatted_address() { $country = Countries::instance(); return $country->get_formatted_address(array('address_1' => $this->address['address_1'], 'address_2' => $this->address['address_2'], 'city' => $this->address['city'], 'state' => $this->address['state'], 'postcode' => $this->address['zip'], 'country' => $this->address['country'])); }
<li> <?php erp_html_form_input(array('label' => __('Other Email', 'wp-erp'), 'name' => 'personal[other_email]', 'value' => '{{ data.personal.other_email }}', 'type' => 'email')); ?> </li> <li> <?php erp_html_form_input(array('label' => __('Date of Birth', 'wp-erp'), 'name' => 'work[date_of_birth]', 'value' => '{{ data.work.date_of_birth }}', 'class' => 'erp-date-field')); ?> </li> <li data-selected="{{ data.personal.nationality }}"> <?php erp_html_form_input(array('label' => __('Nationality', 'wp-erp'), 'name' => 'personal[nationality]', 'value' => '{{ data.personal.nationality }}', 'class' => 'erp-hrm-select2', 'type' => 'select', 'options' => \WeDevs\ERP\Countries::instance()->get_countries())); ?> </li> <li data-selected="{{ data.personal.gender }}"> <?php erp_html_form_input(array('label' => __('Gender', 'wp-erp'), 'name' => 'personal[gender]', 'value' => '{{ data.personal.gender }}', 'class' => 'erp-hrm-select2', 'type' => 'select', 'options' => erp_hr_get_genders())); ?> </li> <li data-selected="{{ data.personal.marital_status }}"> <?php erp_html_form_input(array('label' => __('Marital Status', 'wp-erp'), 'name' => 'personal[marital_status]', 'value' => '{{ data.personal.marital_status }}', 'class' => 'erp-hrm-select2', 'type' => 'select', 'options' => erp_hr_get_marital_statuses())); ?> </li>