diff --git a/app/controllers/asks_controller.rb b/app/controllers/asks_controller.rb index 2ea9edd..8686aca 100644 --- a/app/controllers/asks_controller.rb +++ b/app/controllers/asks_controller.rb @@ -101,7 +101,7 @@ class AsksController < ApplicationController end end end - [category_id, + [category_id, { setting: ask_setting, custom_fields: custom_fields.to_h @@ -285,6 +285,7 @@ class AsksController < ApplicationController 'switch_form' => switch_form, 'ask_setting' => ask_setting, 'default_ask_setting' => @default_ask_setting, + 'question_status' => @params['type'], 'email_regex' => email_regex } elsif @layout_type == 'published_index' @@ -335,7 +336,7 @@ class AsksController < ApplicationController end end end - [category_id, + [category_id, { setting: ask_setting, custom_fields: custom_fields.to_h @@ -444,7 +445,7 @@ class AsksController < ApplicationController if !file.blank? if v['type']=='image' all_to_save += [[k,AskImage.new(file: file,ask_question_id: @ask_question.id)]] - else + else all_to_save += [[k,AskFile.new(file: file,ask_question_id: @ask_question.id)]] end end @@ -594,6 +595,7 @@ class AsksController < ApplicationController "identity" => email_er[:identity], "mail" => email_er.mail, "phone" => email_er.phone, + "serial_number" => email_er.get_serial_number, # "fax" => email_er.fax, # "content" => email_er.content "appointment" => email_er.appointment, @@ -619,6 +621,7 @@ class AsksController < ApplicationController "identity" => email_er[:identity], "mail" => email_er.mail, "phone" => email_er.phone, + "serial_number" => email_er.get_serial_number, # "fax" => email_er.fax, # "content" => email_er.content "appointment" => email_er.appointment, @@ -633,6 +636,17 @@ class AsksController < ApplicationController # email_er.email.deliver end + def get_history + question = AskQuestion.where(:serial_number => params["ticket_id"].to_i, :mail => params["email"]).first + if !question.nil? + @histories = question.ask_status_histories + @status_mapping = AskTicketStatus.default_sorting.map{|a| [a.key, a.title]}.to_h + else + @histories = [] + end + render :partial => "history" + end + def create_params params.require(:ask_question).permit! end @@ -896,4 +910,4 @@ class AsksController < ApplicationController end.join switch_form end -end \ No newline at end of file +end diff --git a/app/views/asks/_history.html.erb b/app/views/asks/_history.html.erb new file mode 100644 index 0000000..b771484 --- /dev/null +++ b/app/views/asks/_history.html.erb @@ -0,0 +1,36 @@ +<% if @histories.count > 0 %> + + + + + + + + + + + + <% @histories.each do |ask_status_history| %> + + + + + + + + <% end %> + +
<%= t('status') %><%= t('ask.modified_by') %><%= t('ask.remark') %><%= t('ask.attachment') %><%= t('ask.updated_at') %>
+ <%= @status_mapping[ask_status_history.status] %> + + <%= ask_status_history.modified_by_name %> + + <%= ask_status_history.comment %> + + <%= link_to(ask_status_history[:file], ask_status_history.file.url) if ask_status_history.file.present? %> + + <%= ask_status_history.created_at.strftime("%Y-%m-%d %H:%M:%S") %> +
+<% else %> +

<%= t('no_history_records') %>

\ No newline at end of file diff --git a/app/views/asks/email.html.erb b/app/views/asks/email.html.erb index ba25546..2a3b2a2 100644 --- a/app/views/asks/email.html.erb +++ b/app/views/asks/email.html.erb @@ -9,6 +9,10 @@ <%= link_to t("edit"), @data['edit_url'] %> <% end %> + + + + <% question = AskQuestion.find(@data['ask_question_id']) rescue nil %> <% if question %> <% @@ -95,6 +99,10 @@ <% end %> <% else %> + + + + diff --git a/app/views/asks/index.html.erb b/app/views/asks/index.html.erb index 338d609..2bf2709 100644 --- a/app/views/asks/index.html.erb +++ b/app/views/asks/index.html.erb @@ -119,11 +119,49 @@ <%# javascript_include_tag "jquery.ui.datepicker.monthyearpicker" %> <%= javascript_include_tag 'validator' %> -
- <%= @switch_form.html_safe %> -
+ +<% if data['question_status'] == 'status' %> +
+
+
+ + +
+
+ + +
+
+ " /> +
+ +
+
+
+<% else %> +
<%= t("ask.check_status") %> +
+ <%= @switch_form.html_safe %> +
+<% end %>
<%= t("ask.serial_number") %>:<%= @data['serial_number'] %>
<%= t("ask.serial_number") %>:<%= @data['serial_number'] %>
<%= AskQuestion.human_attribute_name(:name) %>: <%= @data['name'] %>