next_sgad 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +34 -0
- data/Rakefile +37 -0
- data/app/assets/config/next_sgad_manifest.js +2 -0
- data/app/assets/javascripts/next_sgad/activities.js +2 -0
- data/app/assets/javascripts/next_sgad/application.js +108 -0
- data/app/assets/javascripts/next_sgad/assessments.js +2 -0
- data/app/assets/javascripts/next_sgad/attendances.js +2 -0
- data/app/assets/javascripts/next_sgad/configurations.js +2 -0
- data/app/assets/javascripts/next_sgad/departments.js +2 -0
- data/app/assets/javascripts/next_sgad/employee_goals.js +2 -0
- data/app/assets/javascripts/next_sgad/employees.js +2 -0
- data/app/assets/javascripts/next_sgad/functions.js +7 -0
- data/app/assets/javascripts/next_sgad/goals.js +2 -0
- data/app/assets/javascripts/next_sgad/jquery.orgchart.min.js +2 -0
- data/app/assets/javascripts/next_sgad/justifications.js +2 -0
- data/app/assets/javascripts/next_sgad/positions.js +2 -0
- data/app/assets/javascripts/next_sgad/results.js +2 -0
- data/app/assets/stylesheets/next_sgad/activities.css +4 -0
- data/app/assets/stylesheets/next_sgad/application.css +77 -0
- data/app/assets/stylesheets/next_sgad/assessments.css +4 -0
- data/app/assets/stylesheets/next_sgad/attendances.css +4 -0
- data/app/assets/stylesheets/next_sgad/configurations.css +4 -0
- data/app/assets/stylesheets/next_sgad/departments.css +4 -0
- data/app/assets/stylesheets/next_sgad/employee_goals.css +4 -0
- data/app/assets/stylesheets/next_sgad/employees.css +4 -0
- data/app/assets/stylesheets/next_sgad/functions.css +4 -0
- data/app/assets/stylesheets/next_sgad/goals.css +4 -0
- data/app/assets/stylesheets/next_sgad/jquery.orgchart.min.css +2 -0
- data/app/assets/stylesheets/next_sgad/justifications.css +4 -0
- data/app/assets/stylesheets/next_sgad/positions.css +4 -0
- data/app/assets/stylesheets/next_sgad/results.css +4 -0
- data/app/controllers/next_sgad/activities_controller.rb +63 -0
- data/app/controllers/next_sgad/application_controller.rb +5 -0
- data/app/controllers/next_sgad/assessments_controller.rb +62 -0
- data/app/controllers/next_sgad/attendances_controller.rb +62 -0
- data/app/controllers/next_sgad/configurations_controller.rb +62 -0
- data/app/controllers/next_sgad/departments_controller.rb +62 -0
- data/app/controllers/next_sgad/employee_goals_controller.rb +62 -0
- data/app/controllers/next_sgad/employees_controller.rb +62 -0
- data/app/controllers/next_sgad/functions_controller.rb +62 -0
- data/app/controllers/next_sgad/goals_controller.rb +62 -0
- data/app/controllers/next_sgad/justifications_controller.rb +62 -0
- data/app/controllers/next_sgad/positions_controller.rb +78 -0
- data/app/controllers/next_sgad/results_controller.rb +62 -0
- data/app/helpers/next_sgad/activities_helper.rb +4 -0
- data/app/helpers/next_sgad/application_helper.rb +4 -0
- data/app/helpers/next_sgad/assessments_helper.rb +4 -0
- data/app/helpers/next_sgad/attendances_helper.rb +4 -0
- data/app/helpers/next_sgad/configurations_helper.rb +4 -0
- data/app/helpers/next_sgad/departments_helper.rb +4 -0
- data/app/helpers/next_sgad/employee_goals_helper.rb +4 -0
- data/app/helpers/next_sgad/employees_helper.rb +4 -0
- data/app/helpers/next_sgad/functions_helper.rb +4 -0
- data/app/helpers/next_sgad/goals_helper.rb +4 -0
- data/app/helpers/next_sgad/justifications_helper.rb +4 -0
- data/app/helpers/next_sgad/positions_helper.rb +55 -0
- data/app/helpers/next_sgad/results_helper.rb +4 -0
- data/app/jobs/next_sgad/application_job.rb +4 -0
- data/app/mailers/next_sgad/application_mailer.rb +6 -0
- data/app/models/next_sgad/activity.rb +4 -0
- data/app/models/next_sgad/application_record.rb +18 -0
- data/app/models/next_sgad/assessment.rb +128 -0
- data/app/models/next_sgad/attendance.rb +70 -0
- data/app/models/next_sgad/configuration.rb +4 -0
- data/app/models/next_sgad/department.rb +20 -0
- data/app/models/next_sgad/employee.rb +28 -0
- data/app/models/next_sgad/employee_goal.rb +36 -0
- data/app/models/next_sgad/function.rb +8 -0
- data/app/models/next_sgad/goal.rb +37 -0
- data/app/models/next_sgad/justification.rb +47 -0
- data/app/models/next_sgad/position.rb +36 -0
- data/app/models/next_sgad/result.rb +27 -0
- data/app/models/next_sgad/setting.rb +13 -0
- data/app/views/layouts/next_sgad/application.html.erb +14 -0
- data/app/views/next_sgad/activities/_form.html.erb +27 -0
- data/app/views/next_sgad/activities/edit.html.erb +6 -0
- data/app/views/next_sgad/activities/index.html.erb +29 -0
- data/app/views/next_sgad/activities/new.html.erb +5 -0
- data/app/views/next_sgad/activities/show.html.erb +14 -0
- data/app/views/next_sgad/assessments/_form.html.erb +27 -0
- data/app/views/next_sgad/assessments/edit.html.erb +6 -0
- data/app/views/next_sgad/assessments/index.html.erb +29 -0
- data/app/views/next_sgad/assessments/new.html.erb +5 -0
- data/app/views/next_sgad/assessments/show.html.erb +14 -0
- data/app/views/next_sgad/attendances/_form.html.erb +37 -0
- data/app/views/next_sgad/attendances/edit.html.erb +6 -0
- data/app/views/next_sgad/attendances/index.html.erb +33 -0
- data/app/views/next_sgad/attendances/new.html.erb +5 -0
- data/app/views/next_sgad/attendances/show.html.erb +24 -0
- data/app/views/next_sgad/configurations/_form.html.erb +32 -0
- data/app/views/next_sgad/configurations/edit.html.erb +6 -0
- data/app/views/next_sgad/configurations/index.html.erb +31 -0
- data/app/views/next_sgad/configurations/new.html.erb +5 -0
- data/app/views/next_sgad/configurations/show.html.erb +19 -0
- data/app/views/next_sgad/departments/_form.html.erb +32 -0
- data/app/views/next_sgad/departments/edit.html.erb +6 -0
- data/app/views/next_sgad/departments/index.html.erb +33 -0
- data/app/views/next_sgad/departments/new.html.erb +5 -0
- data/app/views/next_sgad/departments/show.html.erb +24 -0
- data/app/views/next_sgad/employee_goals/_form.html.erb +42 -0
- data/app/views/next_sgad/employee_goals/edit.html.erb +6 -0
- data/app/views/next_sgad/employee_goals/index.html.erb +35 -0
- data/app/views/next_sgad/employee_goals/new.html.erb +5 -0
- data/app/views/next_sgad/employee_goals/show.html.erb +29 -0
- data/app/views/next_sgad/employees/_form.html.erb +27 -0
- data/app/views/next_sgad/employees/_organigrama.html.erb +7 -0
- data/app/views/next_sgad/employees/edit.html.erb +6 -0
- data/app/views/next_sgad/employees/index.html.erb +31 -0
- data/app/views/next_sgad/employees/new.html.erb +5 -0
- data/app/views/next_sgad/employees/show.html.erb +19 -0
- data/app/views/next_sgad/functions/_form.html.erb +22 -0
- data/app/views/next_sgad/functions/edit.html.erb +6 -0
- data/app/views/next_sgad/functions/index.html.erb +27 -0
- data/app/views/next_sgad/functions/new.html.erb +5 -0
- data/app/views/next_sgad/functions/show.html.erb +9 -0
- data/app/views/next_sgad/goals/_form.html.erb +62 -0
- data/app/views/next_sgad/goals/edit.html.erb +6 -0
- data/app/views/next_sgad/goals/index.html.erb +41 -0
- data/app/views/next_sgad/goals/new.html.erb +5 -0
- data/app/views/next_sgad/goals/show.html.erb +49 -0
- data/app/views/next_sgad/justifications/_form.html.erb +22 -0
- data/app/views/next_sgad/justifications/edit.html.erb +6 -0
- data/app/views/next_sgad/justifications/index.html.erb +27 -0
- data/app/views/next_sgad/justifications/new.html.erb +5 -0
- data/app/views/next_sgad/justifications/show.html.erb +9 -0
- data/app/views/next_sgad/positions/_form.html.erb +43 -0
- data/app/views/next_sgad/positions/edit.html.erb +6 -0
- data/app/views/next_sgad/positions/index.html.erb +94 -0
- data/app/views/next_sgad/positions/new.html.erb +5 -0
- data/app/views/next_sgad/positions/organigram.html.erb +1 -0
- data/app/views/next_sgad/positions/show.html.erb +34 -0
- data/app/views/next_sgad/results/_form.html.erb +37 -0
- data/app/views/next_sgad/results/edit.html.erb +6 -0
- data/app/views/next_sgad/results/index.html.erb +33 -0
- data/app/views/next_sgad/results/new.html.erb +5 -0
- data/app/views/next_sgad/results/show.html.erb +24 -0
- data/config/initializers/core_extentions.rb +1 -0
- data/config/initializers/initializer.rb +1 -0
- data/config/initializers/m.rb +1 -0
- data/config/initializers/semper.rb +1 -0
- data/config/routes.rb +16 -0
- data/db/migrate/20171014174705_create_next_sgad_departments.rb +11 -0
- data/db/migrate/20171014175212_create_next_sgad_employees.rb +11 -0
- data/db/migrate/20171014175507_create_next_sgad_positions.rb +13 -0
- data/db/migrate/20171014183337_create_next_sgad_configurations.rb +11 -0
- data/db/migrate/20171015073528_add_next_sgad_department_to_department.rb +6 -0
- data/db/migrate/20171019142918_remove_table_configurations.rb +5 -0
- data/db/migrate/20171019143336_create_next_sgad_settings.rb +11 -0
- data/db/migrate/20171022113005_add_paygrade_to_next_sgad_employee.rb +6 -0
- data/db/migrate/20171024154422_create_next_sgad_assessments.rb +10 -0
- data/db/migrate/20171024172007_create_next_sgad_goals.rb +18 -0
- data/db/migrate/20171024181227_create_next_sgad_employee_goals.rb +16 -0
- data/db/migrate/20171024192907_corrects_references.rb +8 -0
- data/db/migrate/20171024193750_copies_info_from_old_references.rb +8 -0
- data/db/migrate/20171025093224_change_column_year_from_assessments.rb +6 -0
- data/db/migrate/20171025134655_add_goal_type_to_employee_goals.rb +8 -0
- data/db/migrate/20171025135319_addname_to_next_sgad_employee_goals.rb +5 -0
- data/db/migrate/20171025153545_add_position_reference_to_goals.rb +4 -0
- data/db/migrate/20171026055530_add_position_to_next_sgad_goals.rb +5 -0
- data/db/migrate/20171026060110_add_position_to_next_sgad_employee.rb +5 -0
- data/db/migrate/20171026060351_copies_posiiton_id_to_employees.rb +9 -0
- data/db/migrate/20171026061315_remove_old_reference_columns.rb +8 -0
- data/db/migrate/20171026115447_add_description_to_next_sgad_goals.rb +6 -0
- data/db/migrate/20171026142240_add_position_to_next_sgad_employee_goals.rb +5 -0
- data/db/migrate/20171027210543_create_next_sgad_functions.rb +9 -0
- data/db/migrate/20171027210912_add_function_to_next_sgad_positions.rb +5 -0
- data/db/migrate/20171027213833_create_join_table_goal_position.rb +8 -0
- data/db/migrate/20171027221550_create_join_table_employee_position.rb +8 -0
- data/db/migrate/20171027223737_add_efective_to_next_sgad_positions.rb +5 -0
- data/db/migrate/20171027230032_remove_position_from_next_sgad_employee.rb +6 -0
- data/db/migrate/20171027230033_clear_data.rb +7 -0
- data/db/migrate/20171028061909_add_description_to_next_sgad_functions.rb +5 -0
- data/db/migrate/20171028140106_add_percentages_to_next_sagad_assessments.rb +6 -0
- data/db/migrate/20171029074321_rename_paygrade_and_level_from_employee.rb +7 -0
- data/db/migrate/20171029103212_add_email_to_next_sgad_employee.rb +5 -0
- data/db/migrate/20171029154047_add_coment_to_next_sgad_employee_goals.rb +6 -0
- data/db/migrate/20171029160044_add_amount_to_next_sgad_employee_goals.rb +5 -0
- data/db/migrate/20171101112232_change_self_assessment_from_next_sgad_employee_goals.rb +13 -0
- data/db/migrate/20171106113735_add_first_name_to_next_sgad_employees.rb +24 -0
- data/db/migrate/20171110103155_add_number_to_next_sgad_functions.rb +5 -0
- data/db/migrate/20171111081148_create_next_sgad_justifications.rb +9 -0
- data/db/migrate/20171111093506_create_next_sgad_attendances.rb +13 -0
- data/db/migrate/20171111093524_add_references_to_justifications_and_attendences.rb +10 -0
- data/db/migrate/20171111094154_create_join_table_attendance_justification.rb +8 -0
- data/db/migrate/20171111121753_create_next_sgad_results.rb +13 -0
- data/db/migrate/20171111121935_resolts_relationship.rb +9 -0
- data/db/migrate/20171112004221_add_attendance_percentage_to_next_sgad_assessment.rb +14 -0
- data/db/migrate/20171112121440_add_status_to_next_sgad_justifications.rb +7 -0
- data/db/migrate/20171112172436_add_department_to_attendances.rb +6 -0
- data/db/migrate/20171113125224_add_configuration_columns_to_nexts_sgad_assessment.rb +18 -0
- data/db/migrate/20171113143825_add_max_number_of_absences_for_five_to_next_sgad_assessments.rb +9 -0
- data/db/migrate/20171114135601_change_column_status_from_result.rb +6 -0
- data/db/migrate/20171115085324_create_next_sgad_activities.rb +10 -0
- data/db/migrate/20171115110522_add_column_nature_and_value_to_results.rb +7 -0
- data/db/migrate/20171115111821_remove_unused_columns.rb +19 -0
- data/db/migrate/20171115140048_corrects_status.rb +6 -0
- data/db/migrate/20171115160122_add_justification_status_to_next_sgad_attendances.rb +5 -0
- data/db/migrate/20171115161157_migrate_fill_justification_columns.rb +7 -0
- data/lib/concerns/models/employee.rb +25 -0
- data/lib/generators/initializer/USAGE +8 -0
- data/lib/generators/initializer/initializer_generator.rb +6 -0
- data/lib/generators/initializer/templates/initializer.rb +1 -0
- data/lib/generators/initializer_generator.rb +6 -0
- data/lib/generators/views/USAGE +8 -0
- data/lib/generators/views/views_generator.rb +3 -0
- data/lib/next_sgad/engine.rb +13 -0
- data/lib/next_sgad/version.rb +3 -0
- data/lib/next_sgad.rb +5 -0
- data/lib/tasks/next_sgad_tasks.rake +4 -0
- metadata +268 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_dependency "next_sgad/application_controller"
|
|
2
|
+
|
|
3
|
+
module NextSgad
|
|
4
|
+
class FunctionsController < ::ApplicationController
|
|
5
|
+
before_action :set_function, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /functions
|
|
8
|
+
def index
|
|
9
|
+
@functions = Function.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /functions/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /functions/new
|
|
17
|
+
def new
|
|
18
|
+
@function = Function.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /functions/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /functions
|
|
26
|
+
def create
|
|
27
|
+
@function = Function.new(function_params)
|
|
28
|
+
|
|
29
|
+
if @function.save
|
|
30
|
+
redirect_to @function, notice: 'Function was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /functions/1
|
|
37
|
+
def update
|
|
38
|
+
if @function.update(function_params)
|
|
39
|
+
redirect_to @function, notice: 'Function was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /functions/1
|
|
46
|
+
def destroy
|
|
47
|
+
@function.destroy
|
|
48
|
+
redirect_to functions_url, notice: 'Function was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
53
|
+
def set_function
|
|
54
|
+
@function = Function.find(params[:id])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
|
58
|
+
def function_params
|
|
59
|
+
params.require(:function).permit(:name)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_dependency "next_sgad/application_controller"
|
|
2
|
+
|
|
3
|
+
module NextSgad
|
|
4
|
+
class GoalsController < ::ApplicationController
|
|
5
|
+
before_action :set_goal, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /goals
|
|
8
|
+
def index
|
|
9
|
+
@goals = Goal.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /goals/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /goals/new
|
|
17
|
+
def new
|
|
18
|
+
@goal = Goal.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /goals/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /goals
|
|
26
|
+
def create
|
|
27
|
+
@goal = Goal.new(goal_params)
|
|
28
|
+
|
|
29
|
+
if @goal.save
|
|
30
|
+
redirect_to @goal, notice: 'Goal was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /goals/1
|
|
37
|
+
def update
|
|
38
|
+
if @goal.update(goal_params)
|
|
39
|
+
redirect_to @goal, notice: 'Goal was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /goals/1
|
|
46
|
+
def destroy
|
|
47
|
+
@goal.destroy
|
|
48
|
+
redirect_to goals_url, notice: 'Goal was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
53
|
+
def set_goal
|
|
54
|
+
@goal = Goal.find(params[:id])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
|
58
|
+
def goal_params
|
|
59
|
+
params.require(:goal).permit(:name, :goal_type, :status, :nature, :unit, :target, :percentage_on_the_type, :percentage)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_dependency "next_sgad/application_controller"
|
|
2
|
+
|
|
3
|
+
module NextSgad
|
|
4
|
+
class JustificationsController < ::ApplicationController
|
|
5
|
+
before_action :set_justification, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /justifications
|
|
8
|
+
def index
|
|
9
|
+
@justifications = Justification.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /justifications/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /justifications/new
|
|
17
|
+
def new
|
|
18
|
+
@justification = Justification.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /justifications/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /justifications
|
|
26
|
+
def create
|
|
27
|
+
@justification = Justification.new(justification_params)
|
|
28
|
+
|
|
29
|
+
if @justification.save
|
|
30
|
+
redirect_to @justification, notice: 'Justification was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /justifications/1
|
|
37
|
+
def update
|
|
38
|
+
if @justification.update(justification_params)
|
|
39
|
+
redirect_to @justification, notice: 'Justification was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /justifications/1
|
|
46
|
+
def destroy
|
|
47
|
+
@justification.destroy
|
|
48
|
+
redirect_to justifications_url, notice: 'Justification was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
53
|
+
def set_justification
|
|
54
|
+
@justification = Justification.find(params[:id])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
|
58
|
+
def justification_params
|
|
59
|
+
params.require(:justification).permit(:documents)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require_dependency "next_sgad/application_controller"
|
|
2
|
+
|
|
3
|
+
module NextSgad
|
|
4
|
+
class PositionsController < ::ApplicationController
|
|
5
|
+
before_action :set_position, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /positions
|
|
8
|
+
def index
|
|
9
|
+
@positions = Position.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /positions/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /positions/new
|
|
17
|
+
def new
|
|
18
|
+
@position = Position.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /positions/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /positions
|
|
26
|
+
def create
|
|
27
|
+
@position = Position.new(position_params)
|
|
28
|
+
|
|
29
|
+
if @position.save
|
|
30
|
+
redirect_to @position, notice: 'Position was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /positions/1
|
|
37
|
+
def update
|
|
38
|
+
if @position.update(position_params)
|
|
39
|
+
redirect_to @position, notice: 'Position was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /positions/1
|
|
46
|
+
def destroy
|
|
47
|
+
@position.destroy
|
|
48
|
+
redirect_to positions_url, notice: 'Position was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def orgchart
|
|
52
|
+
@o = (Department.all + Position.all + Employee.all).group_by{|x| [x.class.name, x.id]}
|
|
53
|
+
@positions = Position.all.group_by{|p| p.position_id}
|
|
54
|
+
@root = Position.find_by(id: params[:root_id]) || Position.where(position_id: nil).first
|
|
55
|
+
if @root.present?
|
|
56
|
+
@return = org_data(@root, @o, @positions)
|
|
57
|
+
else
|
|
58
|
+
@return = {}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
respond_to do |format|
|
|
62
|
+
format.html
|
|
63
|
+
format.json{render json: @return}
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
69
|
+
def set_position
|
|
70
|
+
@position = Position.find(params[:id])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Only allow a trusted parameter "white list" through.
|
|
74
|
+
def position_params
|
|
75
|
+
params.require(:position).permit(:name, :description, :position_id, :employee_id, :department_id, :number)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_dependency "next_sgad/application_controller"
|
|
2
|
+
|
|
3
|
+
module NextSgad
|
|
4
|
+
class ResultsController < ::ApplicationController
|
|
5
|
+
before_action :set_result, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /results
|
|
8
|
+
def index
|
|
9
|
+
@results = Result.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /results/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /results/new
|
|
17
|
+
def new
|
|
18
|
+
@result = Result.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /results/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /results
|
|
26
|
+
def create
|
|
27
|
+
@result = Result.new(result_params)
|
|
28
|
+
|
|
29
|
+
if @result.save
|
|
30
|
+
redirect_to @result, notice: 'Result was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /results/1
|
|
37
|
+
def update
|
|
38
|
+
if @result.update(result_params)
|
|
39
|
+
redirect_to @result, notice: 'Result was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /results/1
|
|
46
|
+
def destroy
|
|
47
|
+
@result.destroy
|
|
48
|
+
redirect_to results_url, notice: 'Result was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
53
|
+
def set_result
|
|
54
|
+
@result = Result.find(params[:id])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
|
58
|
+
def result_params
|
|
59
|
+
params.require(:result).permit(:note, :state, :created_by, :result_type, :attachment, :assessment_id, :employee_id, :employee_goal_id, :goal_id, :result_value, :result_nature)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module NextSgad
|
|
2
|
+
module PositionsHelper
|
|
3
|
+
# var datascource = {
|
|
4
|
+
# 'name': 'Lao Lao',
|
|
5
|
+
# 'title': 'general manager',
|
|
6
|
+
# 'relationship': { 'children_num': 5 },
|
|
7
|
+
# 'children': [
|
|
8
|
+
# { 'title': 'Bo Miao', 'name': '<span role="img" class="QhTRn" style="background-image: url("https://bitbucket.org/account/IltonFloraIngui/avatar/32/");"><img aria-hidden="true" src="/account/IltonFloraIngui/avatar/32/" class="cbFzAg"></span>', 'relationship': { 'children_num': 0, 'parent_num': 1,'sibling_num': 7 }},
|
|
9
|
+
# { 'name': 'Su Miao', 'title': 'department manager', 'relationship': { 'children_num': 2, 'parent_num': 1,'sibling_num': 7 },
|
|
10
|
+
# 'children': [
|
|
11
|
+
# { 'name': 'Tie Hua', 'title': 'senior engineer', 'relationship': { 'children_num': 0, 'parent_num': 1,'sibling_num': 1 }},
|
|
12
|
+
# { 'name': 'Hei Hei', 'title': 'senior engineer', 'relationship': { 'children_num': 2, 'parent_num': 1,'sibling_num': 1 },
|
|
13
|
+
# 'children': [
|
|
14
|
+
# { 'name': 'Pang Pang', 'title': 'engineer', 'relationship': { 'children_num': 0, 'parent_num': 1,'sibling_num': 1 }},
|
|
15
|
+
# { 'name': 'Xiang Xiang', 'title': 'UE engineer', 'relationship': { 'children_num': 0, 'parent_num': 1,'sibling_num': 1 }}
|
|
16
|
+
# ]
|
|
17
|
+
# }
|
|
18
|
+
# ]
|
|
19
|
+
# },
|
|
20
|
+
# { 'name': 'Yu Wei', 'title': 'department manager', 'relationship': { 'children_num': 0, 'parent_num': 1,'sibling_num': 7 }},
|
|
21
|
+
# { 'name': 'Chun Miao', 'title': 'department manager', 'relationship': { 'children_num': 0, 'parent_num': 1,'sibling_num': 7 }},
|
|
22
|
+
# { 'name': 'Yu Tie', 'title': 'department manager', 'relationship': { 'children_num': 0, 'parent_num': 1,'sibling_num': 7 }}
|
|
23
|
+
# ]
|
|
24
|
+
# };
|
|
25
|
+
# Return de position data as the data above
|
|
26
|
+
def org_data(position, aux_data, positions)
|
|
27
|
+
data = {}
|
|
28
|
+
child_positions = positions[:position.id] || []
|
|
29
|
+
children = []
|
|
30
|
+
child_positions_size = child_positions.size
|
|
31
|
+
sibling_num = (positions[:position.position_id] || []).size - 1
|
|
32
|
+
sibling_num = 0 if sibling_num < 0
|
|
33
|
+
parent_num = position.position_id.present? ? 1 : 0
|
|
34
|
+
employee = aux_data[[NextSgad::Position.name, position.employee_id]]&.last
|
|
35
|
+
department = aux_data[[NextSgad::Department.name, position.department_id]]&.last
|
|
36
|
+
data[:id] = postion.id
|
|
37
|
+
data[:name] = employee&.name || 'N/A'
|
|
38
|
+
data[:avatar] = employee&.avatar if employee&.avatar.present?
|
|
39
|
+
data[:ocupation] = position.name
|
|
40
|
+
data[:department] = department&.name if department.present?
|
|
41
|
+
data[:level] = employee&.level if employee.present?
|
|
42
|
+
data[:paygrade] = employee&.paygrade if employee.present?
|
|
43
|
+
data[:department_id] = department&.id if department.present?
|
|
44
|
+
data[:employee_id] = employee&.id if employee.present?
|
|
45
|
+
data[:employee_number] = employee&.number if employee.present?
|
|
46
|
+
|
|
47
|
+
child_positions.each do |child|
|
|
48
|
+
children << org_data(child, aux_data, positions)
|
|
49
|
+
end
|
|
50
|
+
data[:children] = children if child_positions_size > 0
|
|
51
|
+
data[:relationship] = {children_num: child_positions_size, sibling_num: sibling_num, parent_num: parent_num}
|
|
52
|
+
data
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module NextSgad
|
|
2
|
+
class ApplicationRecord < ActiveRecord::Base
|
|
3
|
+
self.abstract_class = true
|
|
4
|
+
|
|
5
|
+
def create_number
|
|
6
|
+
tipo = self.class.name
|
|
7
|
+
return unless tipo.eql?(NextSgad::Position.name) || tipo.eql?(NextSgad::Employee.name) || tipo.eql?(NextSgad::Department.name)
|
|
8
|
+
i = self.class.all.map{|i| i.number.to_s.gsub(/\D/, '').to_i}.compact.sort.last || 0
|
|
9
|
+
i = i + 1
|
|
10
|
+
self.number = "#{self.class::INITIAL_LETTER}#{i.to_s.rjust(8, '0')}"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create_number!
|
|
14
|
+
self.create_number
|
|
15
|
+
self.save
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
module NextSgad
|
|
2
|
+
class Assessment < ApplicationRecord
|
|
3
|
+
has_many :employee_goals, dependent: :destroy
|
|
4
|
+
has_many :goals, dependent: :destroy
|
|
5
|
+
has_many :attendances, dependent: :destroy
|
|
6
|
+
enum status: {draft: 0, active: 2, closed: 3}
|
|
7
|
+
|
|
8
|
+
validates_uniqueness_of :year
|
|
9
|
+
validates_presence_of :status, :skills_percentage, :year
|
|
10
|
+
validates :skills_percentage, :objectives_percentage, :attendance_percentage, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
|
|
11
|
+
validate :percentages_values
|
|
12
|
+
validates :number_of_four_hours_delay_to_absence, :number_of_three_hours_delay_to_absence, :number_of_two_hours_delay_to_absence,
|
|
13
|
+
:number_of_one_hour_delay_to_absence, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 365}
|
|
14
|
+
|
|
15
|
+
def employee_assessment(employee)
|
|
16
|
+
(skills_assessment(employee) + objectives_assessment(employee) + attendance_assessment(employee)).round(1)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def skills_assessment(employee)
|
|
20
|
+
this_employee_goals = employee_goals.skill.where(employee_id: employee.id)
|
|
21
|
+
return 0 if this_employee_goals.size <= 0
|
|
22
|
+
(skills_percentage/100) * (this_employee_goals.sum(&:final_assessment)/this_employee_goals.size)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def objectives_assessment(employee)
|
|
26
|
+
this_employee_goals = employee_goals.objective.where(employee_id: employee.id)
|
|
27
|
+
return 0 if this_employee_goals.size <= 0
|
|
28
|
+
(objectives_percentage/100) * (this_employee_goals.sum(&:final_assessment)/this_employee_goals.size)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def attendance_assessment(employee)
|
|
32
|
+
assessments_values = []
|
|
33
|
+
NextSgad::Attendance.where(employee_id: employee.id).where("extract(year from date) = ?", year).group_by {|a| a.date.month}.each do |month, attendances_array_by_month|
|
|
34
|
+
absences_number = 0
|
|
35
|
+
attendances_array_by_month.group_by(&:status).each do |status, attendances_array|
|
|
36
|
+
|
|
37
|
+
divide_by = case status
|
|
38
|
+
when 'four_hours_late'
|
|
39
|
+
number_of_four_hours_delay_to_absence
|
|
40
|
+
when 'three_hours_late'
|
|
41
|
+
number_of_three_hours_delay_to_absence
|
|
42
|
+
|
|
43
|
+
when 'two_hours_late'
|
|
44
|
+
number_of_two_hours_delay_to_absence
|
|
45
|
+
|
|
46
|
+
when 'one_hour_late'
|
|
47
|
+
number_of_one_hour_delay_to_absence
|
|
48
|
+
|
|
49
|
+
when 'absence'
|
|
50
|
+
1
|
|
51
|
+
else
|
|
52
|
+
0
|
|
53
|
+
end
|
|
54
|
+
if divide_by > 0
|
|
55
|
+
absences_number = absences_number + (attendances_array.size/divide_by).floor
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
attendance_assessment_value = 0
|
|
59
|
+
|
|
60
|
+
[max_absences_for_five, max_absences_for_four, max_absences_for_three, max_absences_for_two, max_absences_for_one].each_with_index do |v, index|
|
|
61
|
+
if absences_number <= v
|
|
62
|
+
attendance_assessment_value = 5 - index
|
|
63
|
+
break
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
assessments_values << (attendance_percentage/100) * attendance_assessment_value
|
|
68
|
+
end
|
|
69
|
+
if assessments_values.present?
|
|
70
|
+
assessments_values.sum {|e| e}/assessments_values.size
|
|
71
|
+
else
|
|
72
|
+
0
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def attendance_assessment_by_month(employee)
|
|
77
|
+
data = {}
|
|
78
|
+
NextSgad::Attendance.where(employee_id: employee.id).where("extract(year from date) = ?", year).group_by {|a| a.date.strftime('%B')}.each do |month, attendances_array_by_month|
|
|
79
|
+
absences_number = 0
|
|
80
|
+
attendances_array_by_month.group_by(&:status).each do |status, attendances_array|
|
|
81
|
+
|
|
82
|
+
divide_by = case status
|
|
83
|
+
when 'four_hours_late'
|
|
84
|
+
number_of_four_hours_delay_to_absence
|
|
85
|
+
when 'three_hours_late'
|
|
86
|
+
number_of_three_hours_delay_to_absence
|
|
87
|
+
|
|
88
|
+
when 'two_hours_late'
|
|
89
|
+
number_of_two_hours_delay_to_absence
|
|
90
|
+
|
|
91
|
+
when 'one_hour_late'
|
|
92
|
+
number_of_one_hour_delay_to_absence
|
|
93
|
+
|
|
94
|
+
when 'absence'
|
|
95
|
+
1
|
|
96
|
+
else
|
|
97
|
+
0
|
|
98
|
+
end
|
|
99
|
+
if divide_by > 0
|
|
100
|
+
absences_number = absences_number + (attendances_array.size/divide_by).floor
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
attendance_assessment_value = 0
|
|
104
|
+
|
|
105
|
+
[max_absences_for_five, max_absences_for_four, max_absences_for_three, max_absences_for_two, max_absences_for_one].each_with_index do |v, index|
|
|
106
|
+
if absences_number <= v
|
|
107
|
+
attendance_assessment_value = 5 - index
|
|
108
|
+
break
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
data[month] = [attendances_array_by_month.size, attendances_array_by_month.select(&:has_justification?).size, (attendance_percentage/100) * attendance_assessment_value]
|
|
113
|
+
end
|
|
114
|
+
p data
|
|
115
|
+
return data
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
private
|
|
119
|
+
def percentages_values
|
|
120
|
+
return if skills_percentage.nil? || objectives_percentage.nil? || attendance_percentage.nil?
|
|
121
|
+
if skills_percentage + objectives_percentage + attendance_percentage != 100
|
|
122
|
+
errors.add(:skills_percentage, 'A soma dos Objectivos, Competências e Assiduidade deve ser 100%')
|
|
123
|
+
errors.add(:objectives_percentage, 'A soma dos Objectivos, Competências e Assiduidade deve ser 100%')
|
|
124
|
+
errors.add(:attendance_percentage, 'A soma dos Objectivos, Competências e Assiduidade deve ser 100%')
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|