/** * Get the marital status * * @return string */ public function get_marital_status() { if (!empty($this->user->marital_status)) { $statuses = erp_hr_get_marital_statuses(); if (array_key_exists($this->user->marital_status, $statuses)) { return $statuses[$this->user->marital_status]; } } }
<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> <li> <?php erp_html_form_input(array('label' => __('Driving License', 'wp-erp'), 'name' => 'personal[driving_license]', 'value' => '{{ data.personal.driving_license }}')); ?> </li> <li> <?php erp_html_form_input(array('label' => __('Hobbies', 'wp-erp'), 'name' => 'personal[hobbies]', 'value' => '{{ data.personal.hobbies }}')); ?> </li>
/** * Add log when udpate policy * * @since 0.1 * * @param integer $policy_id * @param array $fields * * @return void */ public function update_policy($policy_id, $fields) { if (!$policy_id) { return; } $old_policy = \WeDevs\ERP\HRM\Models\Leave_Policies::find($policy_id)->toArray(); unset($old_policy['created_at'], $old_policy['updated_at'], $fields['instant_apply']); $old_policy['effective_date'] = erp_format_date($old_policy['effective_date'], 'Y-m-d'); $fields['effective_date'] = erp_format_date($fields['effective_date'], 'Y-m-d'); if (isset($fields['activate']) && $fields['activate'] == 1) { unset($fields['execute_day'], $old_policy['execute_day']); } $changes = $this->get_array_diff($fields, $old_policy, true); if (empty($changes['old_val']) && empty($changes['new_val'])) { $message = false; } else { array_walk($changes, function (&$key) { if (isset($key['color'])) { $key['calender_color'] = sprintf('<div style="width:60px; height:20px; background-color:%s"></div>', $key['color']); unset($key['color']); } if (isset($key['department'])) { if ($key['department'] == '-1') { $key['department'] = __('All Department', 'wp-erp'); } else { $department = new \WeDevs\ERP\HRM\Department(intval($key['department'])); $key['department'] = $department->title; } } if (isset($key['designation'])) { if ($key['designation'] == '-1') { $key['designation'] = __('All Designation', 'wp-erp'); } else { $designation = new \WeDevs\ERP\HRM\Designation(intval($key['designation'])); $key['designation'] = $designation->title; } } if (isset($key['location'])) { if ($key['location'] == '-1') { $key['location'] = __('All Location', 'wp-erp'); } else { $location = erp_company_get_location_dropdown_raw(); $key['location'] = $location[$key['location']]; } } if (isset($key['gender'])) { $gender = erp_hr_get_genders(__('All', 'wp-erp')); $key['gender'] = $gender[$key['gender']]; } if (isset($key['marital'])) { $marital = erp_hr_get_marital_statuses(__('All', 'wp-erp')); $key['marital'] = $marital[$key['marital']]; } if (isset($key['activate'])) { $activate = array('1' => __('Immediately', 'wp-erp'), '2' => __('After X Days', 'wp-erp'), '3' => __('Manually', 'wp-erp')); if ($key['activate'] == 2) { $key['activation'] = str_replace('X', $key['execute_day'], $activate[$key['activate']]); } else { $key['activation'] = $activate[$key['activate']]; } unset($key['activate']); unset($key['execute_day']); } if (isset($key['effective_date'])) { $key['policy_effective_date'] = erp_format_date($key['effective_date']); unset($key['effective_date']); } }); $message = sprintf('<strong>%s</strong> policy has been edited', $old_policy['name']); } if ($message) { erp_log()->add(['sub_component' => 'leave', 'message' => $message, 'created_by' => get_current_user_id(), 'changetype' => 'edit', 'old_value' => $changes['old_val'] ? base64_encode(maybe_serialize($changes['old_val'])) : '', 'new_value' => $changes['new_val'] ? base64_encode(maybe_serialize($changes['new_val'])) : '']); } }
<div class="row" data-selected="{{ data.location }}"> <?php erp_html_form_input(array('label' => __('Location', 'wp-erp'), 'name' => 'location', 'value' => '{{ data.location }}', 'type' => 'select', 'options' => array('-1' => __('All Location', 'wp-erp')) + erp_company_get_location_dropdown_raw())); ?> </div> <div class="row" data-selected="{{ data.gender }}"> <?php erp_html_form_input(array('label' => __('Gender', 'wp-erp'), 'name' => 'gender', 'value' => '{{ data.gender }}', 'type' => 'select', 'options' => erp_hr_get_genders(__('All', 'wp-erp')))); ?> </div> <div class="row" data-selected="{{ data.marital }}"> <?php erp_html_form_input(array('label' => __('Marital Status', 'wp-erp'), 'name' => 'maritial', 'value' => '{{ data.marital }}', 'class' => 'erp-hrm-select2-add-more erp-hr-desi-drop-down', 'type' => 'select', 'options' => erp_hr_get_marital_statuses(__('All', 'wp-erp')))); ?> </div> <div class="row"> <?php erp_html_form_input(array('label' => __('Effective Date', 'wp-erp'), 'name' => 'effective_date', 'value' => '{{ data.effective_date }}', 'class' => 'erp-leave-date-field', 'help' => __('The date when the policy will be applicable from', 'wp-erp'))); ?> </div> <div class="row" data-selected="{{ data.activate }}"> <?php erp_html_form_input(array('label' => __('Activate', 'wp-erp'), 'name' => 'rateTransitions', 'value' => '{{ data.activate }}', 'class' => 'erp-hrm-select2-add-more erp-hr-desi-drop-down erp-hr-leave-period', 'type' => 'select', 'help' => __('', 'wp-erp'), 'options' => array('1' => __('Immediately', 'wp-erp'), '2' => __('After X Days', 'wp-erp'), '3' => __('Manually', 'wp-erp')))); ?> </div>