diff --git a/app/controllers/admin/asks_controller.rb b/app/controllers/admin/asks_controller.rb index 3f15796..51d74ff 100644 --- a/app/controllers/admin/asks_controller.rb +++ b/app/controllers/admin/asks_controller.rb @@ -32,7 +32,7 @@ class Admin::AsksController < OrbitAdminController @categories = @module_app.categories @filter_fields = filter_fields(@categories, @tags) # 列表欄位 - @table_fields = [:situation, :category, :title, 'ask.name', 'ask.created_at'] + @table_fields = [:situation, :category, 'ask.name', 'ask.phone', 'ask.appointment'] # 列表排序 # debugger if filter2("situation").blank? and filter2("identity").blank? @@ -98,7 +98,7 @@ class Admin::AsksController < OrbitAdminController :mail_sentdate=>@mail_sentdate, :module_app=>@module_app, :mail_to=>@group_mail, - :mail_subject=>Site.first.title_translations["zh_tw"]+" #{t('ask.reply')}:"+email_er.title, + :mail_subject=>" #{t('ask.reply')}:", :template=>'admin/asks/email', :template_data=>{ "reply" => email_er.reply diff --git a/app/controllers/asks_controller.rb b/app/controllers/asks_controller.rb index 7ec9ed3..ee17f40 100644 --- a/app/controllers/asks_controller.rb +++ b/app/controllers/asks_controller.rb @@ -52,16 +52,17 @@ class AsksController < ApplicationController :mail_sentdate=>@mail_sentdate, :module_app=>@module_app, :mail_to=>@group_mail, - :mail_subject=>Site.first.title_translations["zh_tw"]+" #{t('ask.new_question')}:"+email_er.title, + :mail_subject=>Site.first.title_translations["zh_tw"]+" #{t('ask.new_question')}:", :template=>'asks/email', :template_data=>{ - "title" => email_er.title, + # "title" => email_er.title, "name" => email_er.name, "identity" => email_er[:identity], "mail" => email_er.mail, "phone" => email_er.phone, - "fax" => email_er.fax, - "content" => email_er.content + # "fax" => email_er.fax, + # "content" => email_er.content + "appointment" => email_er.appointment } ) diff --git a/app/models/ask_question.rb b/app/models/ask_question.rb index bc5b44b..82b71b0 100644 --- a/app/models/ask_question.rb +++ b/app/models/ask_question.rb @@ -13,6 +13,8 @@ class AskQuestion field :fax, type: String field :title, type: String field :content, type: String + field :appointment, type:DateTime + field :sex field :reply, type: String field :comment, type: String diff --git a/app/views/admin/asks/_form.html.erb b/app/views/admin/asks/_form.html.erb index 25008a0..5ce06b7 100644 --- a/app/views/admin/asks/_form.html.erb +++ b/app/views/admin/asks/_form.html.erb @@ -11,20 +11,21 @@ - - + - + + - + diff --git a/app/views/admin/asks/_index.html.erb b/app/views/admin/asks/_index.html.erb index bbb4841..10f8a41 100644 --- a/app/views/admin/asks/_index.html.erb +++ b/app/views/admin/asks/_index.html.erb @@ -19,7 +19,7 @@ <% end %> - - - + + <% end %> diff --git a/app/views/asks/email.html.erb b/app/views/asks/email.html.erb index f29e4ed..63a9d35 100644 --- a/app/views/asks/email.html.erb +++ b/app/views/asks/email.html.erb @@ -4,20 +4,20 @@ -

<%= @data['title'] %>

+
<%= AskQuestion.human_attribute_name(:name) %>:<%= @ask_question.name %><%= AskQuestion.human_attribute_name(:identity) %>: + <%= AskQuestion.human_attribute_name(:mail) %>:<%= @ask_question.mail %> <%= AskQuestion.human_attribute_name(:phone) %>:<%= @ask_question.phone %><%= AskQuestion.human_attribute_name(:fax) %>:<%= @ask_question.fax %>
<%= AskQuestion.human_attribute_name(:title) %>:<%= @ask_question.title %><%= AskQuestion.human_attribute_name(:appointment) %>:<%= @ask_question.appointment.strftime("%Y-%m-%d %H:%M") %>
<%= AskQuestion.human_attribute_name(:content) %>:
<%= @ask_question.content.gsub(/[(\n)(\r)]/, "\n" => "
", "\r" => "" ).html_safe %>
<%= b.category.title %> + + + <%= b.name %> +
+ +
<%= b.name %><%= format_value b.created_at %><%= b.phone %><%= b.appointment.strftime("%Y-%m-%d %H:%M") %>
- + @@ -26,14 +26,14 @@ - + - - - + + +
<%= AskQuestion.human_attribute_name(:name) %>: <%= @data['name'] %>
<%= AskQuestion.human_attribute_name(:mail) %>: <%= @data['mail'] %><%= AskQuestion.human_attribute_name(:phone) %>: <%= @data['phone'] %>
<%= AskQuestion.human_attribute_name(:content) %>:<%= @data['content'].gsub(/[(\n)(\r)]/, "\n" => "
", "\r" => "" ).html_safe %>
<%= AskQuestion.human_attribute_name(:name) %>:<%= @data['name'].gsub(/[(\n)(\r)]/, "\n" => "
", "\r" => "" ).html_safe %>

此為系統自動發信,請勿直接回覆

diff --git a/app/views/asks/index.html.erb b/app/views/asks/index.html.erb index 8d70228..8515066 100644 --- a/app/views/asks/index.html.erb +++ b/app/views/asks/index.html.erb @@ -5,6 +5,18 @@ @module_app = data["module_app"] %> +<%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %> + + +<%= javascript_include_tag "lib/bootstrap-datetimepicker" %> +<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> + + + <%= javascript_include_tag 'validator' %>
@@ -23,13 +35,25 @@ <%= f.text_field :name, data: {"fv-validation" => "required;", "fv-messages" => "必填欄位;"} %>
- +
+ <%= f.label :sex, class: 'control-label required' %> +
+ + +
+
+ +
<%= f.label :mail, class: 'control-label required' %> @@ -44,27 +68,34 @@ <%= f.text_field :phone %>
- +
+ <%= f.label :appointment, class: 'control-label' %> +
+ <%= f.datetime_picker :appointment %> +
+
+ + -
+ -
+
<%= f.label :recaptcha, class: 'control-label' %> diff --git a/app/views/asks/thank.html.erb b/app/views/asks/thank.html.erb index 0ffe327..1dea08e 100644 --- a/app/views/asks/thank.html.erb +++ b/app/views/asks/thank.html.erb @@ -1,7 +1,6 @@ -<% data = action_data - @acknowledgement = data["acknowledgement"] -%> + +
- <%= @acknowledgement[:content].gsub(/[(\n)(\r)]/, "\n" => "
", "\r" => "" ).html_safe %> -
+

我們已經收到您的預約,期待您的蒞臨,謝謝

+
\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index b343ca1..b1294df 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,6 +3,7 @@ en: is_waiting: Pending is_processed: Processed is_referral: Rreferral + sex: Sex ask: ask: Ask all_articles: All @@ -25,5 +26,7 @@ en: mongoid: attributes: ask_question: + male: Man + female: Woman ask_category_id: Ask Category identity: Identity \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 80b7c6b..c53e619 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -5,15 +5,16 @@ zh_tw: is_waiting: 待處理 is_processed: 已處理 is_referral: 轉介其他單位 - module_name: ask: 發問 recaptcha: errors: verification_failed: 驗證碼錯誤 ask: - name: 發問人 + name: 預約客戶 + appointment: 預約時間 created_at: 發問時間 + phone: 聯絡電話 status: 狀態 ask: 發問 all_articles: 全部 @@ -40,10 +41,14 @@ zh_tw: ask_question: ask_category_id: 諮詢類別 recaptcha: 驗證碼 + sex: 性別 name: 姓名 identity: 身份 mail: Email phone: 聯絡電話 + male: 男 + female: 女 + appointment: 預約時間 fax: 傳真 title: 主旨 reply: 回覆