Commit 3652d72e authored by Hussain Kashef's avatar Hussain Kashef

reserve flow works but no frontend changes yet

parent c04eb8eb
Pipeline #63435 failed with stage
in 18 minutes
......@@ -4,7 +4,6 @@ $(() => {
conditionalField();
tableRowSelectable();
volunteerForm();
clientForm();
groupOfferForm();
emailTemplate();
inplaceFields();
......
function clientForm() {
console.log("helloy")
}
\ No newline at end of file
......@@ -85,7 +85,10 @@ class ClientsController < ApplicationController
end
def reserve
@client.update(reserved_by: current_user)
@client.update(reserved_by: current_user.id, reserved_at: Time.now)
respond_to do |format|
format.js
end
end
private
......
tr
td.index-action-cell.hidden-print
= button_link icon_span(:show), client, title: 'Anzeigen'
= button_link t('reserve'), new_assignment_url(client_id: client, volunteer_id: @volunteer)
- if policy(Client).superadmin_privileges?
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_client_path(client_id: client, volunteer_id: @volunteer), id: "reserve_client#{client.id}", remote: true, method: :put
td= t("salutation.#{client.salutation}") if client.salutation?
td= link_to client.contact.full_name, edit_client_path(client)
td= client.contact.city
td= client.contact.postal_code
td= client.birth_year&.year
td
- client.relatives.each do |relative|
= relative
br
td= nationality_name(client.nationality)
td.language-skill-index
- [client.language_skills.german, client.language_skills.native_languages].flatten.each do |language|
span= language.full_language_skills
td= client.goals
td= client.interests
- if policy(Client).superadmin_privileges?
td= link_to client.involved_authority.full_name, profile_url_path(client.involved_authority) if client.involved_authority
td= client.competent_authority
td= client.other_authorities
td.no-wrap= l(client.created_at.to_date)
- if policy(Client).show_comments?
= td_truncate_content_modal(client.comments, 'Bemerkungen')
\ No newline at end of file
......@@ -53,36 +53,6 @@ nav.navbar.section-navigation
th= t_attr(:comments, Client)
tbody
- @need_accompanying.each do |client|
tr
td.index-action-cell.hidden-print
= button_link icon_span(:show), client, title: 'Anzeigen'
= button_link t('reserve'), new_assignment_url(client_id: client, volunteer_id: @volunteer)
- if policy(Client).superadmin_privileges?
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
td= client.contact.postal_code
td= client.birth_year&.year
td
- client.relatives.each do |relative|
= relative
br
td= nationality_name(client.nationality)
td.language-skill-index
- [client.language_skills.german, client.language_skills.native_languages].flatten.each do |language|
span= language.full_language_skills
td= client.goals
td= client.interests
- if policy(Client).superadmin_privileges?
td= link_to client.involved_authority.full_name, profile_url_path(client.involved_authority) if client.involved_authority
td= client.competent_authority
td= client.other_authorities
td.no-wrap= l(client.created_at.to_date)
- if policy(Client).show_comments?
= td_truncate_content_modal(client.comments, 'Bemerkungen')
= render 'need_accompanying', client: client
= bootstrap_paginate(@need_accompanying)
......@@ -65,7 +65,7 @@ Rails.application.routes.draw do
resources :clients, concerns: [:search, :reactivate] do
resources :journals, except: [:show]
patch :set_terminated, on: :member
put :reserve, on: :member
end
resources :events do
......@@ -118,9 +118,6 @@ Rails.application.routes.draw do
end
resources :volunteers, except: [:destroy], concerns: [:search, :reactivate] do
resources :clients do
get :reserve, on: :member
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
add_column :clients, :reserved_by, :bigint, index: true
add_column :clients, :reserved_at, :datetime
end
end
end
\ No newline at end of file
......@@ -219,6 +219,7 @@ ActiveRecord::Schema.define(version: 20191024143050) do
t.datetime "reactivated_at"
t.text "other_authorities"
t.bigint "reserved_by"
t.datetime "reserved_at"
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"
......
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