Commit c04eb8eb authored by Hussain Kashef's avatar Hussain Kashef

review if process makes sense

parent 7a483b1f
Pipeline #63097 passed with stage
in 37 minutes and 15 seconds
......@@ -4,6 +4,7 @@ $(() => {
conditionalField();
tableRowSelectable();
volunteerForm();
clientForm();
groupOfferForm();
emailTemplate();
inplaceFields();
......
function clientForm() {
console.log("helloy")
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ class ClientsController < ApplicationController
include ContactAttributes
rescue_from Client::NotDestroyableError, with: :user_not_authorized
before_action :set_client, only: [:show, :edit, :update, :destroy, :set_terminated, :reactivate]
before_action :set_client, only: [:show, :edit, :update, :destroy, :set_terminated, :reactivate, :reserve]
before_action :set_social_worker_collection, only: [:new, :create, :edit, :update]
before_action :set_assignments, only: [:show, :edit]
......@@ -84,6 +84,10 @@ class ClientsController < ApplicationController
redirect_to edit_client_path(@client), notice: t("clients.notices.reactivation.#{state}")
end
def reserve
@client.update(reserved_by: current_user)
  • please also add a timestamp field reserved_at - the _by _at combination can be handy and is super easy to implement.

Please register or sign in to reply
end
private
def create_success_notice
......@@ -134,4 +138,5 @@ class ClientsController < ApplicationController
contact_attributes, availability_attributes
)
end
end
......@@ -31,6 +31,7 @@ class ClientPolicy < ApplicationPolicy
alias_method :edit?, :superadmin_or_client_responsible?
alias_method :update?, :superadmin_or_client_responsible?
alias_method :set_terminated?, :superadmin_or_department_managers_record?
alias_method :reserve?, :superadmin_or_department_managers_record?
# suplementary policies
alias_method :superadmin_privileges?, :superadmin?
......
......@@ -29,6 +29,7 @@ nav.navbar.section-navigation
- if policy(Client).superadmin_privileges?
th= sort_link @q, :acceptance, t_attr(:acceptance, Client)
th= sort_link @q, :active, 'Status'
th= sort_link @q, :reserved_by, t_attr(:reserved_by, Client)
th= sort_link @q, :salutation, t_attr(:salutation, Client)
th= sort_link @q, :contact_last_name, t_attr(:full_name, Contact)
th= sort_link @q, :contact_city, t_attr(:city, Contact)
......@@ -60,6 +61,7 @@ nav.navbar.section-navigation
td.button-acceptance = link_to t("acceptance.#{client.acceptance}"), '#',
class: "btn btn-xs btn-acceptance-#{client.acceptance} btn-acceptance-client"
td.button-acceptance= assignment_status_badge(client)
td= button_link t('reserve_client'), reserve_volunteer_client_path(client_id: client, volunteer_id: @volunteer), id: "reserve_client"
td= t("salutation.#{client.salutation}") if client.salutation?
td= link_to client.contact.full_name, edit_client_path(client)
td= client.contact.city
......
......@@ -227,6 +227,7 @@ de:
relatives: Familienangehörige im Haushalt
remember_me: Angemeldet bleiben
reserve: Begleitung erstellen
reserve_client: Reservieren
seeking_clients: Klient/in suchen
semester_long: '%{number}. Semester %{year} (%{begin} - %{end})'
semester_period: '%{begin} - %{end}'
......@@ -349,6 +350,7 @@ de:
permit: Bewilligung
relatives: Verwandte/r
user: User
reserved_by: Reserviert
contact:
<<: *id-generic_keys
extended: Adresszusatz
......
......@@ -65,6 +65,7 @@ Rails.application.routes.draw do
resources :clients, concerns: [:search, :reactivate] do
resources :journals, except: [:show]
patch :set_terminated, on: :member
end
resources :events do
......@@ -117,6 +118,9 @@ Rails.application.routes.draw do
end
resources :volunteers, except: [:destroy], concerns: [:search, :reactivate] do
resources :clients do
get :reserve, on: :member
Please register or sign in to reply
end
put :terminate, on: :member
put :account, on: :member
get :find_client, on: :member, to: 'assignments#find_client'
......
class AddReservedToClient < ActiveRecord::Migration[5.1]
def change
add_column :clients, :reserved_by, :bigint, index: true
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190806075109) do
ActiveRecord::Schema.define(version: 20191024143050) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -218,6 +218,7 @@ ActiveRecord::Schema.define(version: 20190806075109) do
t.bigint "reactivated_by_id"
t.datetime "reactivated_at"
t.text "other_authorities"
t.bigint "reserved_by"
t.index ["acceptance"], name: "index_clients_on_acceptance"
t.index ["accepted_at"], name: "index_clients_on_accepted_at"
t.index ["birth_year"], name: "index_clients_on_birth_year"
......@@ -862,5 +863,6 @@ ActiveRecord::Schema.define(version: 20190806075109) do
add_foreign_key "semester_process_volunteers", "volunteers"
add_foreign_key "trial_feedbacks", "users", column: "author_id"
add_foreign_key "volunteers", "departments"
add_foreign_key "volunteers", "departments", column: "secondary_department_id"
add_foreign_key "volunteers", "users"
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment