diff --git a/app/assets/stylesheets/shared/background.css.erb b/app/assets/stylesheets/custom/guest_background.css.erb similarity index 100% rename from app/assets/stylesheets/shared/background.css.erb rename to app/assets/stylesheets/custom/guest_background.css.erb diff --git a/app/assets/stylesheets/custom/guest_footer.css b/app/assets/stylesheets/custom/guest_footer.css new file mode 100644 index 000000000..a66c1b547 --- /dev/null +++ b/app/assets/stylesheets/custom/guest_footer.css @@ -0,0 +1,9 @@ +.app-footer { + position: fixed; + bottom: 0; + width: 100%; + height: 30px; /* Set the fixed height of the footer here */ + line-height: 30px; /* Vertically center the text there */ + background-color: #f5f5f5; + opacity: .8; +} diff --git a/app/assets/stylesheets/guest.scss b/app/assets/stylesheets/guest.scss index 61ffb4d76..f20019c83 100644 --- a/app/assets/stylesheets/guest.scss +++ b/app/assets/stylesheets/guest.scss @@ -3,5 +3,6 @@ *= require font-awesome *= require @coreui/coreui/dist/css/coreui.min *= require toastr/build/toastr.min - *= require shared/background + *= require custom/guest_background + *= require custom/guest_footer */ diff --git a/app/controllers/account/addresses_controller.rb b/app/controllers/account/addresses_controller.rb index c09bd4411..49e4bf96c 100644 --- a/app/controllers/account/addresses_controller.rb +++ b/app/controllers/account/addresses_controller.rb @@ -5,7 +5,6 @@ class AddressesController < ApplicationController include LastUpdateFromMernis before_action :set_address, only: %i[edit update destroy] - before_action :check_formality, only: %i[edit update destroy] before_action :set_elapsed_time, only: %i[save_from_mernis] def index @@ -13,13 +12,13 @@ def index end def new - @address = current_user.addresses.new + @address = current_user.addresses.informal.new end def edit; end def create - @address = current_user.addresses.new(address_params) + @address = current_user.addresses.informal.new(address_params) @address.save ? redirect_with('success') : render(:new) end @@ -39,17 +38,13 @@ def save_from_mernis private def set_address - @address = current_user.addresses.find(params[:id]) - end - - def check_formality - redirect_with('warning') if @address.formal? + @address = current_user.addresses.informal.find(params[:id]) end def set_elapsed_time formal_address = current_user.addresses.formal return if formal_address.blank? - elapsed_time(formal_address) + elapsed_time(formal_address.first) end def redirect_with(message) @@ -57,7 +52,7 @@ def redirect_with(message) end def address_params - params.require(:address).permit(:name, :phone_number, :full_address, :district_id) + params.require(:address).permit(:phone_number, :full_address, :district_id) end end end diff --git a/app/controllers/account/duties_controller.rb b/app/controllers/account/duties_controller.rb new file mode 100644 index 000000000..8fca853ac --- /dev/null +++ b/app/controllers/account/duties_controller.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module Account + class DutiesController < ApplicationController + before_action :set_user + before_action :set_employee + before_action :set_duty, only: %i[show edit update destroy] + + def show + @positions = @duty.positions.includes(:administrative_function) + end + + def new + @duty = @employee.duties.new + end + + def create + @duty = @employee.duties.new(duty_params) + @duty.save ? redirect_to([@user, @employee, @duty], notice: t('.success')) : render(:new) + end + + def edit; end + + def update + @duty.update(duty_params) ? redirect_to([@user, @employee, @duty], notice: t('.success')) : render(:edit) + end + + def destroy + @duty.destroy ? redirect_to([@user, @employee], notice: t('.success')) : redirect_with('warning') + end + + private + + def set_user + @user = User.friendly.find(params[:user_id]) + not_found unless @user + end + + def set_employee + @employee = @user.employees.find(params[:employee_id]) + not_found unless @employee + end + + def set_duty + @duty = @employee.duties.find(params[:id]) + not_found unless @duty + end + + def duty_params + params.require(:duty).permit(:temporary, :start_date, :end_date, :unit_id) + end + end +end diff --git a/app/controllers/account/employees_controller.rb b/app/controllers/account/employees_controller.rb new file mode 100644 index 000000000..f84ce1dab --- /dev/null +++ b/app/controllers/account/employees_controller.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module Account + class EmployeesController < ApplicationController + before_action :set_user + before_action :set_employee, only: %i[show edit update destroy] + + def show + @duties = @employee.duties.includes(:unit) + end + + def new + @employee = @user.employees.new + end + + def create + @employee = @user.employees.new(employee_params) + @employee.save ? redirect_to([@user, @employee], notice: t('.success')) : render(:new) + end + + def edit; end + + def update + @employee.update(employee_params) ? redirect_to([@user, @employee], notice: t('.success')) : render(:edit) + end + + def destroy + @employee.destroy ? redirect_to(@user, notice: t('.success')) : redirect_with('warning') + end + + private + + def set_user + @user = User.friendly.find(params[:user_id]) + not_found unless @user + end + + def set_employee + @employee = @user.employees.find(params[:id]) + not_found unless @employee + end + + def employee_params + params.require(:employee).permit(:active, :title_id) + end + end +end diff --git a/app/controllers/account/identities_controller.rb b/app/controllers/account/identities_controller.rb index 8c5f65e4e..ca989c5b4 100644 --- a/app/controllers/account/identities_controller.rb +++ b/app/controllers/account/identities_controller.rb @@ -5,11 +5,10 @@ class IdentitiesController < ApplicationController include LastUpdateFromMernis before_action :set_identity, only: %i[edit update destroy] - before_action :check_formality, only: %i[edit update destroy] before_action :set_elapsed_time, only: %i[save_from_mernis] def index - @identities = current_user.identities + @identities = current_user.identities.includes(:student) end def new @@ -39,17 +38,13 @@ def save_from_mernis private def set_identity - @identity = current_user.identities.find(params[:id]) - end - - def check_formality - redirect_with('warning') if @identity.formal? + @identity = current_user.identities.informal.find(params[:id]) end def set_elapsed_time - formal_identity = current_user.identities.formal + formal_identity = current_user.identities.user_identity return if formal_identity.blank? - elapsed_time(formal_identity) + elapsed_time(formal_identity.first) end def redirect_with(message) @@ -58,7 +53,7 @@ def redirect_with(message) def identity_params params.require(:identity).permit( - :name, :first_name, :last_name, :mothers_name, :fathers_name, :gender, :marital_status, :place_of_birth, + :first_name, :last_name, :mothers_name, :fathers_name, :gender, :marital_status, :place_of_birth, :date_of_birth, :registered_to ) end diff --git a/app/controllers/account/positions_controller.rb b/app/controllers/account/positions_controller.rb new file mode 100644 index 000000000..284630e37 --- /dev/null +++ b/app/controllers/account/positions_controller.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module Account + class PositionsController < ApplicationController + before_action :set_user + before_action :set_employee + before_action :set_duty + before_action :set_position, only: %i[edit update destroy] + + def new + @position = @duty.positions.new + end + + def create + @position = @duty.positions.new(position_params) + @position.save ? redirect_to([@user, @employee, @duty], notice: t('.success')) : render(:new) + end + + def edit; end + + def update + @position.update(position_params) ? redirect_to([@user, @employee, @duty], notice: t('.success')) : render(:edit) + end + + def destroy + @position.destroy ? redirect_to([@user, @employee, @duty], notice: t('.success')) : redirect_with('warning') + end + + private + + def set_user + @user = User.friendly.find(params[:user_id]) + not_found unless @user + end + + def set_employee + @employee = @user.employees.find(params[:employee_id]) + not_found unless @employee + end + + def set_duty + @duty = @user.duties.find(params[:duty_id]) + not_found unless @duty + end + + def set_position + @position = @user.positions.find(params[:id]) + not_found unless @position + end + + def position_params + params.require(:position).permit(:administrative_function_id) + end + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5272b121f..89241d239 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -36,5 +36,6 @@ def not_found def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up, keys: %i[id_number email]) + devise_parameter_sanitizer.permit(:account_update, keys: %i[email]) end end diff --git a/app/controllers/concerns/last_update_from_mernis.rb b/app/controllers/concerns/last_update_from_mernis.rb index 0a00b2944..d58a9b908 100644 --- a/app/controllers/concerns/last_update_from_mernis.rb +++ b/app/controllers/concerns/last_update_from_mernis.rb @@ -4,7 +4,7 @@ module LastUpdateFromMernis extend ActiveSupport::Concern def elapsed_time(resource) - elapsed_time = (Time.zone.now - resource.first.updated_at) / 1.day + elapsed_time = (Time.zone.now - resource.updated_at) / 1.day redirect_with('wait') if elapsed_time.present? && elapsed_time < 7 end end diff --git a/app/controllers/public_profile_controller.rb b/app/controllers/public_profile_controller.rb index 652ec3d4a..f9110edbb 100644 --- a/app/controllers/public_profile_controller.rb +++ b/app/controllers/public_profile_controller.rb @@ -2,26 +2,46 @@ class PublicProfileController < ApplicationController skip_before_action :authenticate_user! - before_action :set_employee, only: :show - before_action :check_identity + before_action :set_user, only: %i[show vcard] + before_action :set_employee, only: %i[show vcard] + before_action :check_identity, only: %i[show vcard] def show; end def index; end + def vcard + send_data vcard_content(@identity), type: 'text/vcard; charset=utf-8; header=present', filename: 'contact.vcf' + end + private + def set_user + @user = User.friendly.find(params[:id]) + not_found unless @user + end + def set_employee - @employee = Employee.friendly.find(params[:id]) + @employee = @user.employees.active.first + not_found unless @employee end def check_identity - identities = @employee.user.identities.formal + @identity = @user.identities.user_identity + not_found unless @identity + end - if identities.any? - @identity = identities.first - else - redirect_to root_path - end + def vcard_content(identity) + <<~VCARD + BEGIN:VCARD + VERSION:3.0 + N:#{identity.last_name};#{identity.first_name};;; + FN:#{identity.first_name} #{identity.last_name} + ORG:Ondokuz Mayıs Üniversitesi + TITLE:#{identity.user.title} + TEL;TYPE=WORK,VOICE:+90 (362) 312-1919 + EMAIL:#{identity.user.email} + END:VCARD + VCARD end end diff --git a/app/controllers/user/registrations_controller.rb b/app/controllers/user/registrations_controller.rb index 09624dcc6..245d617d0 100644 --- a/app/controllers/user/registrations_controller.rb +++ b/app/controllers/user/registrations_controller.rb @@ -6,6 +6,7 @@ class RegistrationsController < Devise::RegistrationsController # before_action :configure_sign_up_params, only: [:create] # before_action :configure_account_update_params, only: [:update] + before_action :update_slug, only: :update after_action :update_password_change_time, only: :update # GET /resource/sign_up @@ -67,5 +68,11 @@ def update def update_password_change_time current_user.update!(password_changed_at: Time.zone.now) end + + def update_slug + # rubocop:disable Lint/UselessAssignment + slug = nil if params[:email].present? + # rubocop:enable Lint/UselessAssignment + end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4d9be1b43..add64550a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -15,7 +15,9 @@ def index end end - def show; end + def show + @employees = @user.employees.includes(:title).order(active: :desc) + end def new @user = User.new @@ -39,7 +41,7 @@ def destroy private def set_user - @user = User.find(params[:id]) + @user = User.friendly.find(params[:id]) end def set_identities diff --git a/app/helpers/date_helper.rb b/app/helpers/date_helper.rb new file mode 100644 index 000000000..60f37bb4c --- /dev/null +++ b/app/helpers/date_helper.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module DateHelper + def as_date(date = nil) + date&.strftime('%d.%m.%Y') + end + + def as_date_and_time(date = nil) + date&.strftime('%d.%m.%Y - %H:%M') + end +end diff --git a/app/helpers/membership_notifications_helper.rb b/app/helpers/membership_notifications_helper.rb index 0565c895c..ffef8ddb4 100644 --- a/app/helpers/membership_notifications_helper.rb +++ b/app/helpers/membership_notifications_helper.rb @@ -9,7 +9,10 @@ def profile_completion_rate(user) end def password_change_progress_bar(user) - last_password_change = Time.zone.now - user.password_changed_at - last_password_change * 100 / 1.month.to_i + last_password_change(user) * 100 + end + + def last_password_change(user) + (Time.zone.now - user.password_changed_at) / 1.month.to_i end end diff --git a/app/models/accounts/address.rb b/app/models/accounts/address.rb index d09713436..b783a0d9a 100644 --- a/app/models/accounts/address.rb +++ b/app/models/accounts/address.rb @@ -1,17 +1,19 @@ # frozen_string_literal: true class Address < ApplicationRecord + self.inheritance_column = nil + # relations belongs_to :user belongs_to :district # validations - validates :name, presence: true + validates :type, presence: true, uniqueness: { scope: :user } validates :full_address, presence: true - validates_with AddressValidator, on: :create + validates_with AddressAndIdentityValidator, on: :create # enums - enum name: { formal: 1, home: 2, work: 3, other: 4 } + enum type: { formal: 1, informal: 2 } # delegations delegate :id_number, to: :user diff --git a/app/models/accounts/employee.rb b/app/models/accounts/employee.rb index 3849df25e..bb61c0652 100644 --- a/app/models/accounts/employee.rb +++ b/app/models/accounts/employee.rb @@ -22,15 +22,6 @@ class Employee < ApplicationRecord scope :active, -> { where(active: true) } scope :passive, -> { where(active: false) } - # permalinks - extend FriendlyId - friendly_id :username_slug, use: :slugged - - def username_slug - username, domain = user.email.split('@') - username if domain.eql?('omu.edu.tr') - end - # custom methods def academic? title.branch.eql?('ÖE') diff --git a/app/models/accounts/identity.rb b/app/models/accounts/identity.rb index 59adc31c8..db2a9ad94 100644 --- a/app/models/accounts/identity.rb +++ b/app/models/accounts/identity.rb @@ -1,27 +1,33 @@ # frozen_string_literal: true class Identity < ApplicationRecord + self.inheritance_column = nil + # relations belongs_to :user belongs_to :student, optional: true # validations - validates :name, presence: true + validates :type, presence: true validates :first_name, presence: true validates :last_name, presence: true validates :gender, presence: true validates :place_of_birth, presence: true validates :date_of_birth, presence: true - validates_with IdentityValidator, on: :create + validates :student_id, uniqueness: true, allow_blank: true + validates_with AddressAndIdentityValidator, on: :create # enums - enum name: { formal: 1, informal: 2 } + enum type: { formal: 1, informal: 2 } enum gender: { male: 1, female: 2, other: 3 } enum marital_status: { single: 1, married: 2, divorced: 3, unknown: 4 } + # scopes + scope :user_identity, -> { formal.find_by(student_id: nil) } + # callbacks before_save do - self.name = 'informal' if name.blank? + self.type = 'informal' if type.blank? self.first_name = first_name.capitalize_all self.last_name = last_name.upcase_tr self.mothers_name = mothers_name.capitalize_all if mothers_name diff --git a/app/models/user.rb b/app/models/user.rb index 43b5453c6..b5603fcf9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -29,6 +29,7 @@ class User < ApplicationRecord has_many :projects, dependent: :destroy # validations + validates :email, presence: true, uniqueness: true validates :id_number, presence: true, uniqueness: true, numericality: { only_integer: true }, length: { is: 11 } validates_with EmailAddress::ActiveRecordValidator, field: :email @@ -45,6 +46,15 @@ def build_identity_information KpsIdentitySaveJob.perform_later(self) end + # permalinks + extend FriendlyId + friendly_id :permalink, use: :slugged + + def permalink + username, domain = email.split('@') if email + username if domain.eql?('omu.edu.tr') + end + # custom methods def accounts (students + employees).flatten @@ -53,4 +63,8 @@ def accounts def self.most_publishing where.not(articles_count: nil).order('articles_count desc').limit(10) end + + def title + employees.active.first.try(:title).try(:name) + end end diff --git a/app/services/kps/omu/adres.rb b/app/services/kps/omu/adres.rb index ee81a4edd..0bfd63f54 100644 --- a/app/services/kps/omu/adres.rb +++ b/app/services/kps/omu/adres.rb @@ -25,7 +25,7 @@ def sorgula(queried_id_number) elsif yerlesim_yeri[:yurt_disi_adresi].present? yerlesim_yeri[:yurt_disi_adresi] end - + # return a hash, ready to use for building an Address. address_information = { full_address: yerlesim_yeri[:acik_adres], diff --git a/app/services/yoksis/v4/universiteleri_birimler.rb b/app/services/yoksis/v4/universiteleri_birimler.rb new file mode 100644 index 000000000..8f2204bf2 --- /dev/null +++ b/app/services/yoksis/v4/universiteleri_birimler.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Services + module Yoksis + module V4 + # client = Services::Yoksis::V4::UniversiteBirimler.new + class UniversiteBirimler + def initialize + wsdl = 'http://servisler.yok.gov.tr/ws/UniversiteBirimlerv4?WSDL' + + @client = Savon.client( + wsdl: wsdl, + convert_request_keys_to: :camelcase, + basic_auth: [Rails.application.credentials.yoksis[:user], Rails.application.credentials.yoksis[:password]] + ) + end + + # alias: list_countries + def universiteleri_getirv4 + @client.call(__method__).body + end + + alias universities universiteleri_getirv4 + end + end + end +end diff --git a/app/validators/address_and_identity_validator.rb b/app/validators/address_and_identity_validator.rb new file mode 100644 index 000000000..f821be3f7 --- /dev/null +++ b/app/validators/address_and_identity_validator.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class AddressAndIdentityValidator < ActiveModel::Validator + def validate(record) + @record = record + @records = record.user.send(record.class.name.tableize.to_sym) + + restrict_formal if record.formal? && record.try(:student_id).nil? + restrict_informal if record.informal? + end + + private + + def restrict_formal + add_to_base_error('max_formal', 1) if @records.formal.present? || @records.formal.try(:user_identity).present? + end + + def restrict_informal + add_to_base_error('max_informal', 1) if @records.informal.any? + end + + def message(key, limit) + I18n.t(key, limit: limit, scope: %I[validators #{@record.class.name.downcase}]) + end + + def add_to_base_error(key, limit) + @record.errors[:base] << message(key, limit) + end +end diff --git a/app/validators/address_validator.rb b/app/validators/address_validator.rb deleted file mode 100644 index f2d03487f..000000000 --- a/app/validators/address_validator.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -class AddressValidator < ActiveModel::Validator - def validate(record) - record.errors[:base] << I18n.t('max_total', limit: 5, scope: %i[validators address]) if record.user.addresses.size > 5 - record.errors[:base] << I18n.t('max_legal', limit: 1, scope: %i[validators address]) if record.user.addresses.formal.size >= 1 && record.formal? - end -end diff --git a/app/validators/identity_validator.rb b/app/validators/identity_validator.rb deleted file mode 100644 index 612d4e513..000000000 --- a/app/validators/identity_validator.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -class IdentityValidator < ActiveModel::Validator - def validate(record) - record.errors[:base] << I18n.t('max_total', limit: 2, scope: %i[validators identity]) if record.user.identities.size > 2 - record.errors[:base] << I18n.t('max_legal', limit: 1, scope: %i[validators identity]) if record.user.identities.formal.size >= 1 && record.formal? - end -end diff --git a/app/views/account/addresses/_form.html.erb b/app/views/account/addresses/_form.html.erb index 8ae03673d..97f85e438 100644 --- a/app/views/account/addresses/_form.html.erb +++ b/app/views/account/addresses/_form.html.erb @@ -12,9 +12,6 @@ <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> -
- <%= f.input :name, collection: enum_options_for_select(f.object.class, :name) %> -
<%= f.association :district, collection: City.includes(:districts).order(:name), as: :grouped_select, group_method: :districts, group_label_method: :name %>
diff --git a/app/views/account/addresses/index.html.erb b/app/views/account/addresses/index.html.erb index 115f767c9..9e56ecf00 100644 --- a/app/views/account/addresses/index.html.erb +++ b/app/views/account/addresses/index.html.erb @@ -1,7 +1,6 @@
<%= link_to_new(new_address_path, t('.new_address')) %> <%= link_to (@addresses.formal.present? ? t('.update_from_mernis') : t('.create_from_mernis') ), save_from_mernis_addresses_path, class: "btn btn-outline-primary btn-sm" %> -
@@ -11,6 +10,12 @@
<%= fa_icon 'id-card' %> <%= t('.card_header') %> + <% if address.informal? %> +
+ <%= link_to_edit(edit_address_path(address)) %> + <%= link_to_destroy(address_path(address)) %> +
+ <% end %>
@@ -19,9 +24,7 @@ diff --git a/app/views/account/duties/_form.html.erb b/app/views/account/duties/_form.html.erb new file mode 100644 index 000000000..785150f48 --- /dev/null +++ b/app/views/account/duties/_form.html.erb @@ -0,0 +1,35 @@ +
+
+
+
+ <%= fa_icon 'calendar' %> + <%= form_title %> +
+
+ <%= simple_form_for([@user, @employee, duty]) do |f| %> +
+
+ <%= f.error_notification %> +
+
+ <%= f.input :unit_id, collection: Unit.all, required: true %> +
+
+ <%= f.input :start_date, required: true %> +
+
+ <%= f.input :end_date, required: true %> +
+
+ <%= f.input :temporary, required: true %> +
+
+ <%= f.button :submit, class: 'btn btn-outline-success btn-sm' %> + <%= link_to_back(:back) %> +
+
+ <% end %> +
+
+
+
diff --git a/app/views/account/duties/edit.html.erb b/app/views/account/duties/edit.html.erb new file mode 100644 index 000000000..d34d25075 --- /dev/null +++ b/app/views/account/duties/edit.html.erb @@ -0,0 +1 @@ +<%= render 'form', duty: @duty, form_title: t('.form_title') %> diff --git a/app/views/account/duties/new.html.erb b/app/views/account/duties/new.html.erb new file mode 100644 index 000000000..d34d25075 --- /dev/null +++ b/app/views/account/duties/new.html.erb @@ -0,0 +1 @@ +<%= render 'form', duty: @duty, form_title: t('.form_title') %> diff --git a/app/views/account/duties/show.html.erb b/app/views/account/duties/show.html.erb new file mode 100644 index 000000000..8789def25 --- /dev/null +++ b/app/views/account/duties/show.html.erb @@ -0,0 +1,74 @@ +
+
+
+
+ <%= fa_icon 'university' %><%= @duty.unit.name %> +
+ <%= link_to_edit(edit_user_employee_duty_path(@user, @employee, @duty)) %> + <%= link_to_destroy(user_employee_duty_path(@user, @employee, @duty)) %> +
+
+ +
+
<%= fa_icon('gavel', text: t('activerecord.enums.address.names.formal')) if address.formal? %> - <%= fa_icon('home', text: t('activerecord.enums.address.names.home')) if address.home? %> - <%= fa_icon('building', text: t('activerecord.enums.address.names.work')) if address.work? %> - <%= fa_icon('address-book', text: t('activerecord.enums.address.names.other')) if address.other? %> + <%= fa_icon('home', text: t('activerecord.enums.address.names.informal')) if address.informal? %>
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
<%= t('.user_id') %><%= link_to(@user.email, @user) %>
<%= t('.employee_id') %><%= link_to(@employee.title.name, [@user, @employee]) %>
<%= t('.unit_id') %><%= @duty.unit.name %>
<%= t('.tenure_status') %><%= @duty.temporary? ? t('.temporary') : t('.tenure') %>
<%= t('.start_date') %><%= @duty.start_date %>
<%= t('.end_date') %><%= @duty.end_date %>
+
+
+ +
+
+ <%= fa_icon 'university', text: t('.positions') %> +
+ <%= link_to_new new_user_employee_duty_position_path(@user, @employee, @duty), t('.new_position_link') %> +
+
+
+ + + + + + + + + <% @positions.each do |position| %> + + + + + <% end %> + +
<%= t('.position') %><%= t('actions') %>
<%= position.administrative_function.name %> + <%= link_to_edit(edit_user_employee_duty_position_path(@user, @employee, @duty, position)) %> + <%= link_to_destroy(user_employee_duty_position_path(@user, @employee, @duty, position)) %> +
+
+
+ + diff --git a/app/views/account/employees/_form.html.erb b/app/views/account/employees/_form.html.erb new file mode 100644 index 000000000..181e6d7c0 --- /dev/null +++ b/app/views/account/employees/_form.html.erb @@ -0,0 +1,30 @@ +
+
+
+
+ <%= fa_icon 'calendar' %> + <%= form_title %> +
+
+ <%= simple_form_for([@user, employee]) do |f| %> +
+
+ <%= f.error_notification %> + <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> +
+
+ <%= f.input :title_id, collection: Title.all, required: true %> +
+
+ <%= f.input :active, required: true %> +
+
+ <%= f.button :submit, class: 'btn btn-outline-success btn-sm' %> + <%= link_to_back(:back) %> +
+
+ <% end %> +
+
+
+
diff --git a/app/views/account/employees/edit.html.erb b/app/views/account/employees/edit.html.erb new file mode 100644 index 000000000..82a56f0bf --- /dev/null +++ b/app/views/account/employees/edit.html.erb @@ -0,0 +1 @@ +<%= render 'form', employee: @employee, form_title: t('.form_title') %> diff --git a/app/views/account/employees/new.html.erb b/app/views/account/employees/new.html.erb new file mode 100644 index 000000000..82a56f0bf --- /dev/null +++ b/app/views/account/employees/new.html.erb @@ -0,0 +1 @@ +<%= render 'form', employee: @employee, form_title: t('.form_title') %> diff --git a/app/views/account/employees/show.html.erb b/app/views/account/employees/show.html.erb new file mode 100644 index 000000000..9aa916385 --- /dev/null +++ b/app/views/account/employees/show.html.erb @@ -0,0 +1,73 @@ +
+
+
+
+ <%= fa_icon 'university' %><%= @employee.title.name %> +
+ <%= link_to_edit(edit_user_employee_path(@user, @employee)) %> + <%= link_to_destroy(user_employee_path(@user, @employee)) %> +
+
+ +
+ + + + + + + + + + + + + + + + + + + +
<%= t('.id_number') %><%= @user.id_number %>
<%= t('.user_id') %><%= link_to(@user.email, user_path(@user)) %>
<%= t('.title_id') %><%= @employee.title.name %>
<%= t('.is_active') %><%= @employee.active? ? t('yes') : t('no') %>
+
+
+ +
+
+ <%= fa_icon 'university', text: t('.duties') %> +
+ <%= link_to_new new_user_employee_duty_path(@user, @employee), t('.new_duty_link') %> +
+
+
+ + + + + + + + + + + + <% @duties.each do |duty| %> + + + + + + + + <% end %> + +
<%= t('.tenure_status') %><%= t('.start_date') %><%= t('.end_date') %><%= t('.unit_id') %><%= t('actions') %>
<%= duty.temporary? ? t('.temporary') : t('.tenure') %><%= duty.start_date %><%= duty.end_date %><%= duty.unit.name %> + <%= link_to_show(user_employee_duty_path(@user, @employee, duty)) %> + <%= link_to_edit(edit_user_employee_duty_path(@user, @employee, duty)) %> + <%= link_to_destroy(user_employee_duty_path(@user, @employee, duty)) %> +
+
+
+
+
diff --git a/app/views/account/identities/index.html.erb b/app/views/account/identities/index.html.erb index 8aaf6c1eb..73196a871 100644 --- a/app/views/account/identities/index.html.erb +++ b/app/views/account/identities/index.html.erb @@ -9,7 +9,15 @@
<%= fa_icon 'id-card' %> - <%= t('.card_header') %> + <% if identity.formal? %> + <%= identity.student_id.present? ? t('.student_identity') : t('.user_identity') %> + <% else %> + <%= t('.informal_identity') %> +
+ <%= link_to_edit(edit_identity_path(identity)) %> + <%= link_to_destroy(identity_path(identity)) %> +
+ <% end %>
@@ -58,6 +66,12 @@ + <% if identity.student_id.present? %> + + + + + <% end %>
<%= t('.registered_to') %> <%= identity.registered_to %>
<%= t('.department') %><%= identity.student.unit.name %> / <%= identity.student.student_number %>
diff --git a/app/views/account/positions/_form.html.erb b/app/views/account/positions/_form.html.erb new file mode 100644 index 000000000..810f324f6 --- /dev/null +++ b/app/views/account/positions/_form.html.erb @@ -0,0 +1,26 @@ +
+
+
+
+ <%= fa_icon 'calendar' %> + <%= form_title %> +
+
+ <%= simple_form_for([@user, @employee, @duty, position]) do |f| %> +
+
+ <%= f.error_notification %> +
+
+ <%= f.input :administrative_function_id, collection: AdministrativeFunction.all, required: true %> +
+
+ <%= f.button :submit, class: 'btn btn-outline-success btn-sm' %> + <%= link_to_back(:back) %> +
+
+ <% end %> +
+
+
+
diff --git a/app/views/account/positions/edit.html.erb b/app/views/account/positions/edit.html.erb new file mode 100644 index 000000000..1ff88f68b --- /dev/null +++ b/app/views/account/positions/edit.html.erb @@ -0,0 +1 @@ +<%= render 'form', position: @position, form_title: t('.form_title') %> diff --git a/app/views/account/positions/new.html.erb b/app/views/account/positions/new.html.erb new file mode 100644 index 000000000..1ff88f68b --- /dev/null +++ b/app/views/account/positions/new.html.erb @@ -0,0 +1 @@ +<%= render 'form', position: @position, form_title: t('.form_title') %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index d15299ef2..7b8af6744 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -3,7 +3,7 @@
<%= fa_icon 'password' %> - <%= t('.change_password') %> + <%= t('.account_settings') %>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> @@ -12,7 +12,7 @@ <%= f.error_notification %>
- <%= f.input :email, autofocus: true, disabled: true %> + <%= f.input :email, autofocus: true %>
<%= f.input :password, autocomplete: 'off', hint: t('.leave_blank'), required: false %> diff --git a/app/views/home/components/_membership_notifications.html.erb b/app/views/home/components/_membership_notifications.html.erb index 9179aed2b..a5a749246 100644 --- a/app/views/home/components/_membership_notifications.html.erb +++ b/app/views/home/components/_membership_notifications.html.erb @@ -11,10 +11,14 @@

<% unless current_user.addresses.any? %> -

<%= link_to t('.address_information'), addresses_path %> <%= t('.seems_missing') %>

+ <% end %> <% unless current_user.identities.any? %> -

<%= link_to t('.identity_information'), identities_path %> <%= t('.seems_missing') %>

+ <% end %>
@@ -26,8 +30,14 @@
<%= distance_of_time_in_words(Time.zone.now, current_user.password_changed_at) %>
<%= t('.last_password_change') %>
-
-
- - +
+ + <% if last_password_change(current_user) > 1 %> +
+ + <% end %> + + diff --git a/app/views/home/components/_user_and_account_statistics.html.erb b/app/views/home/components/_user_and_account_statistics.html.erb index b35e9e806..831808e69 100644 --- a/app/views/home/components/_user_and_account_statistics.html.erb +++ b/app/views/home/components/_user_and_account_statistics.html.erb @@ -5,7 +5,7 @@ <%= fa_icon('user') %>
<%= User.count %>
- Kayıtlı Kullanıcı + <%= t('.registered_users') %>
@@ -14,7 +14,7 @@ <%= fa_icon('id-card-o') %>
<%= Identity.count %>
- Kimlik Bilgileri + <%= t('.identities') %>
@@ -23,7 +23,7 @@ <%= fa_icon('location-arrow') %>
<%= Address.count %>
- Adres Bilgileri + <%= t('.addresses') %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9ef2adc56..3065407b3 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,7 +14,7 @@ <%= image_tag 'baum-logo.svg', height: '36', width: '134', alt: 'BAUM Logo', class: 'navbar-brand-full' %> <% end %> -