added second file and counselor panel working.
This commit is contained in:
parent
9d42443a29
commit
85d753d49d
|
@ -106,10 +106,18 @@ class MemberCounselorsController < CUserController
|
||||||
@hpsfile = HpsFile.new
|
@hpsfile = HpsFile.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def resultupload
|
||||||
|
@hpsresult = HpsResult.new
|
||||||
|
end
|
||||||
|
|
||||||
def editfileupload
|
def editfileupload
|
||||||
@hpsfile = HpsFile.find(params[:id])
|
@hpsfile = HpsFile.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def editresultupload
|
||||||
|
@hpsresult = HpsResult.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
def file_upload
|
def file_upload
|
||||||
hpsfile = HpsFile.new(hps_file_params)
|
hpsfile = HpsFile.new(hps_file_params)
|
||||||
hpsfile.hps_member = current_counselor_user
|
hpsfile.hps_member = current_counselor_user
|
||||||
|
@ -119,20 +127,88 @@ class MemberCounselorsController < CUserController
|
||||||
redirect_to member_dash_path(current_counselor_user.account)
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def result_upload
|
||||||
|
hpsresult = HpsResult.new(hps_result_params)
|
||||||
|
hpsresult.hps_member = current_counselor_user
|
||||||
|
city = HpsCity.find(current_counselor_user.hps_city_id)
|
||||||
|
hpsresult.hps_city = city
|
||||||
|
hpsresult.save
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
|
end
|
||||||
|
|
||||||
def update_file_upload
|
def update_file_upload
|
||||||
hpsfile = HpsFile.find(params[:id])
|
hpsfile = HpsFile.find(params[:id])
|
||||||
hpsfile.update_attributes(hps_file_params)
|
hpsfile.update_attributes(hps_file_params)
|
||||||
redirect_to member_dash_path(current_counselor_user.account)
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_result_upload
|
||||||
|
hpsresult = HpsResult.find(params[:id])
|
||||||
|
hpsresult.update_attributes(hps_result_params)
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
|
end
|
||||||
|
|
||||||
def deletefileupload
|
def deletefileupload
|
||||||
hpsfile = HpsFile.find(params[:id])
|
hpsfile = HpsFile.find(params[:id])
|
||||||
hpsfile.destroy
|
hpsfile.destroy
|
||||||
redirect_to member_dash_path(current_counselor_user.account)
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deleteresultupload
|
||||||
|
hpsresult = HpsResult.find(params[:id])
|
||||||
|
hpsresult.destroy
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
if current_counselor_user.user_type == 0 || current_counselor_user.user_type == 1
|
||||||
@files = current_counselor_user.hps_files
|
@files = current_counselor_user.hps_files
|
||||||
|
@results = current_counselor_user.hps_results
|
||||||
|
else
|
||||||
|
@records = current_counselor_user.hps_counseling_records
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def newrecord
|
||||||
|
@record = HpsCounselingRecord.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_record_upload
|
||||||
|
record = HpsCounselingRecord.new(hps_record_params)
|
||||||
|
record.hps_member = current_counselor_user
|
||||||
|
record.save
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_info
|
||||||
|
@objects = []
|
||||||
|
case params[:get_info]
|
||||||
|
when "counties"
|
||||||
|
@objects = HpsCity.find(params[:id]).hps_counties.asc(:old_id)
|
||||||
|
when "schools"
|
||||||
|
@objects = HpsCounty.find(params[:id]).hps_schools.asc(:old_id)
|
||||||
|
end
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def editrecord
|
||||||
|
@record = HpsCounselingRecord.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_record_upload
|
||||||
|
record = HpsCounselingRecord.find(params[:id])
|
||||||
|
record.update_attributes(hps_record_params)
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
|
end
|
||||||
|
|
||||||
|
def showrecord
|
||||||
|
@record = HpsCounselingRecord.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def deleterecord
|
||||||
|
record = HpsCounselingRecord.find(params[:id])
|
||||||
|
record.destroy
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -141,4 +217,12 @@ class MemberCounselorsController < CUserController
|
||||||
params.require(:hps_file).permit!
|
params.require(:hps_file).permit!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hps_result_params
|
||||||
|
params.require(:hps_result).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
def hps_record_params
|
||||||
|
params.require(:hps_counseling_record).permit!
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -0,0 +1,46 @@
|
||||||
|
class HpsCounselingRecord
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :hps_city_id
|
||||||
|
field :hps_county_id
|
||||||
|
field :hps_school_id
|
||||||
|
field :other_text
|
||||||
|
|
||||||
|
field :counseling_date, type: DateTime
|
||||||
|
field :counseling_method, type: Array, default: []
|
||||||
|
field :counseling_method_description
|
||||||
|
field :event_title
|
||||||
|
field :purpose_for_county, type: Array, default: []
|
||||||
|
field :purpose_for_county_extra
|
||||||
|
field :purpose_for_school, type: Array, default: []
|
||||||
|
field :purpose_for_school_extra
|
||||||
|
field :minutes_of_event
|
||||||
|
field :evaluation_of_event
|
||||||
|
|
||||||
|
belongs_to :hps_member
|
||||||
|
|
||||||
|
def get_title
|
||||||
|
city = HpsCity.find(self.hps_city_id) rescue nil
|
||||||
|
county = HpsCounty.find(self.hps_county_id) rescue nil
|
||||||
|
school = HpsSchool.find(self.hps_school_id) rescue nil
|
||||||
|
s = ""
|
||||||
|
s = s + city.name + "/" if !city.nil?
|
||||||
|
s = s + county.name + "/" if !county.nil?
|
||||||
|
s = s + school.name if !school.nil?
|
||||||
|
s
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_city
|
||||||
|
HpsCity.find(self.hps_city_id) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_county
|
||||||
|
HpsCounty.find(self.hps_county_id) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_school
|
||||||
|
HpsSchool.find(self.hps_school_id) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -37,6 +37,8 @@ class HpsMember
|
||||||
# validates :password, :on => [:create]
|
# validates :password, :on => [:create]
|
||||||
|
|
||||||
has_many :hps_files, :dependent => :destroy
|
has_many :hps_files, :dependent => :destroy
|
||||||
|
has_many :hps_results, :dependent => :destroy
|
||||||
|
has_many :hps_counseling_records, :dependent => :destroy
|
||||||
|
|
||||||
def get_user_type
|
def get_user_type
|
||||||
case self.user_type
|
case self.user_type
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
class HpsResult
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
mount_uploader :file, AssetUploader
|
||||||
|
|
||||||
|
field :title
|
||||||
|
field :download_count, type: Integer, :default => 0
|
||||||
|
field :year, type: Integer
|
||||||
|
field :old_id
|
||||||
|
|
||||||
|
belongs_to :hps_member
|
||||||
|
belongs_to :hps_city
|
||||||
|
end
|
|
@ -1,6 +1,7 @@
|
||||||
<%= csrf_meta_tag %>
|
<%= csrf_meta_tag %>
|
||||||
<script type="text/javascript" src="/assets/jquery_ujs.js"></script>
|
<script type="text/javascript" src="/assets/jquery_ujs.js"></script>
|
||||||
<table width="100%" border="1">
|
<table width="100%" border="1">
|
||||||
|
<caption>執行計畫書 <a style="float: right;" href="<%= upload_cuser_file_path %>" class="btn btn-primary">Upload File</a></caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="100px" >Date</th>
|
<th width="100px" >Date</th>
|
||||||
|
@ -28,5 +29,36 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<table width="100%" border="1">
|
||||||
|
<caption>成果報告 <a style="float: right;" href="<%= upload_cuser_result_path %>" class="btn btn-primary">Upload Result</a></caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="100px" >Date</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th width="200px">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% if !@results.blank? %>
|
||||||
|
<% @results.each_with_index do |file,idx| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= file.created_at.strftime("%y/%m/%d") %></td>
|
||||||
|
<td><%= file.title %></td>
|
||||||
|
<td>
|
||||||
|
<a href="<%= file.file.url %>" target="_blank">Download</a>
|
||||||
|
<a href="<%= edit_upload_cuser_result_path(file) %>">Edit</a>
|
||||||
|
<a style="color: red;" href="<%= delete_upload_cuser_result_path(file) %>" data-method="delete" data-confirm="Are you sure?">Delete</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">No files uploaded.</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<br />
|
<br />
|
||||||
<a href="<%= upload_cuser_file_path %>" class="btn btn-primary">Upload File</a>
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
<script type="text/javascript" src="/assets/jquery_ujs.js"></script>
|
||||||
|
<table width="100%" border="1">
|
||||||
|
<caption>輔導記錄單 <a href="<%= new_counselor_record_path %>" style="float: right;" class="btn btn-primary">New Record</a></caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="100px" >新增日期</th>
|
||||||
|
<th>輔導縣市/地區/學校</th>
|
||||||
|
<th width="200px">功能</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% if !@records.blank? %>
|
||||||
|
<% @records.each_with_index do |record,idx| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= record.created_at.strftime("%y/%m/%d") %></td>
|
||||||
|
<td><%= record.get_title %></td>
|
||||||
|
<td>
|
||||||
|
<a href="<%= edit_counselor_record_path(record) %>">Edit</a>
|
||||||
|
<a href="<%= show_counselor_record_path(record) %>">View</a>
|
||||||
|
<a style="color: red;" href="<%= delete_counselor_record_path(record) %>" data-method="delete" data-confirm="Are you sure?">Delete</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">No records found.</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br />
|
|
@ -32,18 +32,14 @@
|
||||||
<% case current_counselor_user.user_type %>
|
<% case current_counselor_user.user_type %>
|
||||||
<% when 0 %>
|
<% when 0 %>
|
||||||
<% title = HpsCity.find(current_counselor_user.hps_city_id).name + " " + HpsCounty.find(current_counselor_user.hps_county_id).name + " " + HpsSchool.find(current_counselor_user.hps_school_id).name %>
|
<% title = HpsCity.find(current_counselor_user.hps_city_id).name + " " + HpsCounty.find(current_counselor_user.hps_county_id).name + " " + HpsSchool.find(current_counselor_user.hps_school_id).name %>
|
||||||
<div id="year-span"><%= title %> <span>105</span>推動計劃書</div>
|
<input type="text" id="hps_file_title" name="hps_file[title]" value="<%= title %> 105推動計劃書">
|
||||||
<input type="hidden" id="hps_file_title" name="hps_file[title]" value="<%= title %> 105推動計劃書">
|
|
||||||
<% when 1 %>
|
<% when 1 %>
|
||||||
<div id="year-span"><span>105</span>健康促進縣市推動計劃書</div>
|
<input type="text" id="hps_file_title" name="hps_file[title]" value="105健康促進縣市推動計劃書">
|
||||||
<input type="hidden" id="hps_file_title" name="hps_file[title]" value="105健康促進縣市推動計劃書">
|
|
||||||
<% when 2 %>
|
<% when 2 %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% year = @hpsfile.title.scan(/\d/).join() %>
|
<input type="text" id="hps_file_title" name="hps_file[title]" value="<%= @hpsfile.title %>">
|
||||||
<div id="year-span"><%= @hpsfile.title.gsub(year, "<span>#{year}</span>").html_safe %></div>
|
|
||||||
<input type="hidden" id="hps_file_title" name="hps_file[title]" value="<%= @hpsfile.title %>">
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -58,8 +54,8 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$("#hps_file_year").on("change",function(){
|
$("#hps_file_year").on("change",function(){
|
||||||
var val = $(this).val();
|
var val = $(this).val(),
|
||||||
$("#year-span span").text(val);
|
x = $("#hps_file_title").val().replace(/\d+/, val)
|
||||||
$("#hps_file_title").val($("#year-span").text());
|
$("#hps_file_title").val(x);
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
|
@ -0,0 +1,133 @@
|
||||||
|
|
||||||
|
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||||
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||||
|
|
||||||
|
<h3>輔導記錄單</h3>
|
||||||
|
<table width="100%" border="1">
|
||||||
|
<tr>
|
||||||
|
<td>新增日期</td>
|
||||||
|
<td id="date-time"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>*縣市</td>
|
||||||
|
<td>
|
||||||
|
<%= f.select :hps_city_id, options_for_select(HpsCity.all.asc(:old_id).collect{|city| [city.name, city.id]}, @record.hps_city_id), {:prompt => "Select City"}, {:class => "selectable"} %>
|
||||||
|
<%
|
||||||
|
opts = []
|
||||||
|
if !@record.new_record?
|
||||||
|
opts = HpsCity.find(@record.hps_city_id).hps_counties.asc(:old_id).collect{|sc| [sc.name, sc.id]}
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<%= f.select :hps_county_id, options_for_select(opts,@record.hps_county_id), {}, {:class => "selectable"} %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>*對象</td>
|
||||||
|
<td>
|
||||||
|
<%
|
||||||
|
opts = []
|
||||||
|
if !@record.new_record?
|
||||||
|
opts = HpsCounty.find(@record.hps_county_id).hps_schools.asc(:old_id).collect{|sc| [sc.name, sc.id]}
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
學校<%= f.select :hps_school_id, options_for_select(opts, @record.hps_school_id), {} %> 其他單位<%= f.text_field :other_text %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>輔導日期</td>
|
||||||
|
<td>
|
||||||
|
<%= f.datetime_picker :counseling_date, :no_label => true, :new_record => @record.new_record? %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>方式</td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" <%= @record.counseling_method.include?("整體規劃輔導") ? "checked=checked" : "" %> name="hps_counseling_record[counseling_method][]" value="整體規劃輔導">整體規劃輔導
|
||||||
|
<input type="checkbox" <%= @record.counseling_method.include?("個別議題輔導") ? "checked=checked" : "" %> name="hps_counseling_record[counseling_method][]" value="個別議題輔導">個別議題輔導
|
||||||
|
<%= f.text_field :counseling_method_description %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>會議/活動名稱</td>
|
||||||
|
<td>
|
||||||
|
<%= f.text_field :event_title %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
縣市輔導項目(可複選)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% ["(1)參與縣市共識會議", "(2)協助縣市整體方向或策略規劃", "(3)縣市健康促進學校計畫書/報告審查與諮詢", "(4)協助縣市與社區資源連結", "(5)參與縣市增能研習或講座", "(6)參與縣市成果發表會", "(7)縣市成果報告審查與諮詢", "(8)其他(請填寫):"].each_with_index do |v, idx| %>
|
||||||
|
<input type="checkbox" <%= @record.purpose_for_county.include?(v) ? "checked=checked" : "" %> name="hps_counseling_record[purpose_for_county][]" value="<%= v %>"><%= v %>
|
||||||
|
<% if idx < 7 %>
|
||||||
|
<br />
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<%= f.text_area :purpose_for_county_extra %><br />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>學校輔導項目(可複選)</td>
|
||||||
|
<td>
|
||||||
|
<% ["(1)協助問題診斷/需求評估","(2)依據問題/診斷結果擬定策略與指標,討論資料蒐集方法", "(3)協助學校發展健康教學策略", "(4)協助學校發展互動式或參與式家長活動", "(5)協助學校發展社區結盟活動","(6)學校成果分析或報告撰寫諮詢", "(7)其他(請填寫):"].each_with_index do |v, idx| %>
|
||||||
|
<input type="checkbox" <%= @record.purpose_for_school.include?(v) ? "checked=checked" : "" %> name="hps_counseling_record[purpose_for_school][]" value="<%= v %>"><%= v %>
|
||||||
|
<% if idx < 6 %>
|
||||||
|
<br />
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<%= f.text_area :purpose_for_school_extra %><br />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="20%">內容記要(如:所輔導內容、所解決困難、所達成共識、待解決問題…):</td>
|
||||||
|
<td><%= f.text_area :minutes_of_event, :rows => 5, :cols => 100 %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>委員建議(如:對該縣市健康促進計畫推動、輔導學校之建議…):</td>
|
||||||
|
<td><%= f.text_area :evaluation_of_event, :rows => 5, :cols => 100 %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<%= f.submit "Submit", :class => "btn btn-primary" %>
|
||||||
|
<a href="" onclick="window.history.back();return false;" class="btn">Back</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("select.selectable").on("change",function(){
|
||||||
|
var data,
|
||||||
|
id = $(this).attr("id"),
|
||||||
|
val = $(this).val();
|
||||||
|
switch(id){
|
||||||
|
case "hps_counseling_record_hps_city_id":
|
||||||
|
data = {"id" : val, "get_info" : "counties"}
|
||||||
|
break;
|
||||||
|
case "hps_counseling_record_hps_county_id":
|
||||||
|
data = {"id" : val, "get_info" : "schools"}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url : "/cuser/member/get_info",
|
||||||
|
data : data,
|
||||||
|
type : "get",
|
||||||
|
dataType : "html"
|
||||||
|
}).done(function(html){
|
||||||
|
switch(id){
|
||||||
|
case "hps_counseling_record_hps_city_id":
|
||||||
|
$("#hps_counseling_record_hps_county_id").html(html);
|
||||||
|
$("#hps_counseling_record_hps_school_id").html("");
|
||||||
|
break;
|
||||||
|
case "hps_counseling_record_hps_county_id":
|
||||||
|
$("#hps_counseling_record_hps_school_id").html(html);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
setInterval(function(){
|
||||||
|
var dt = new Date(),
|
||||||
|
st = dt.toLocaleDateString() + " " + dt.toLocaleTimeString()
|
||||||
|
$("#date-time").text(st)
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
</script>
|
|
@ -0,0 +1,61 @@
|
||||||
|
<table width="100%" border="1">
|
||||||
|
<tr>
|
||||||
|
<th>學年度</th>
|
||||||
|
<td>
|
||||||
|
<%
|
||||||
|
yearnow = Time.now.strftime("%Y").to_i - 1
|
||||||
|
total = yearnow - 1911
|
||||||
|
min = total - 10
|
||||||
|
%>
|
||||||
|
<%= f.select :year, (0..10).collect{|i|[(total - i),(total - i)]} %>
|
||||||
|
<% if current_counselor_user.user_type == 0 %>
|
||||||
|
<span style="color: red;">此為學年度非年度,例如103年上半年為102學年度,103年下半年為103學年度,請注意填選</span>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>檔案來源</th>
|
||||||
|
<td>
|
||||||
|
<%= f.file_field :file %>
|
||||||
|
<span>
|
||||||
|
<% if !@hpsresult.file.url.nil? %>
|
||||||
|
<br />
|
||||||
|
<a href="<%= @hpsresult.file.url %>" target="_blank"><%= File.basename(@hpsresult.file.url) %></a>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>成果報告名稱</th>
|
||||||
|
<td>
|
||||||
|
<% if @hpsresult.new_record? %>
|
||||||
|
<% case current_counselor_user.user_type %>
|
||||||
|
<% when 0 %>
|
||||||
|
<% title = HpsCity.find(current_counselor_user.hps_city_id).name + " " + HpsCounty.find(current_counselor_user.hps_county_id).name + " " + HpsSchool.find(current_counselor_user.hps_school_id).name %>
|
||||||
|
<input type="text" id="hps_file_title" name="hps_result[title]" value="<%= title %> 105成果報告">
|
||||||
|
<% when 1 %>
|
||||||
|
<input type="text" id="hps_file_title" name="hps_result[title]" value="105健康促進縣市推動計劃書">
|
||||||
|
<% when 2 %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<input type="text" id="hps_file_title" name="hps_result[title]" value="<%= @hpsresult.title %>">
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th> </th>
|
||||||
|
<td>
|
||||||
|
<%= f.submit "Submit", :class => "btn btn-primary" %>
|
||||||
|
<a href="<%= member_dash_path(current_counselor_user.account) %>" class="btn btn-default">Back</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#hps_result_year").on("change",function(){
|
||||||
|
var val = $(this).val(),
|
||||||
|
x = $("#hps_file_title").val().replace(/\d+/, val)
|
||||||
|
$("#hps_file_title").val(x);
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @record, :url => "/cuser/member/#{@record.id}/update_record_upload" do |f| %>
|
||||||
|
<%= render :partial => "new_record_form", :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @hpsresult, :url => "/cuser/member/#{@hpsresult.id.to_s}/update_result_upload" do |f| %>
|
||||||
|
<%= render :partial => "result_form", :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<% case params[:get_info] %>
|
||||||
|
<% when "counties" %>
|
||||||
|
<option>Select County</option>
|
||||||
|
<% when "schools" %>
|
||||||
|
<option>Select School</option>
|
||||||
|
<% end %>
|
||||||
|
<%#= options_for_select(@objects.collect{|obj|[obj.name, obj.id]}) %>
|
||||||
|
<% @objects.each do |obj| %>
|
||||||
|
<option value="<%= obj.id.to_s %>" <%= params[:get_info] == "schools" ? "data-address=#{obj.address}" : "" %>><%= obj.name %></option>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @record, :url => "/cuser/member/new_record_upload" do |f| %>
|
||||||
|
<%= render :partial => "new_record_form", :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @hpsresult, :url => "/cuser/member/result_upload" do |f| %>
|
||||||
|
<%= render :partial => "result_form", :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -3,4 +3,5 @@
|
||||||
<% when 0,1 %>
|
<% when 0,1 %>
|
||||||
<%= render :partial => "body" %>
|
<%= render :partial => "body" %>
|
||||||
<% when 2 %>
|
<% when 2 %>
|
||||||
|
<%= render :partial => "counselor_body" %>
|
||||||
<% end %>
|
<% end %>
|
|
@ -0,0 +1,88 @@
|
||||||
|
<h3>輔導記錄單</h3>
|
||||||
|
<table width="100%" border="1">
|
||||||
|
<tr>
|
||||||
|
<td>新增日期</td>
|
||||||
|
<td id="date-time"><%= @record.created_at.strftime("%Y-%m-%d %H:%M:%S") %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>縣市</td>
|
||||||
|
<td>
|
||||||
|
<%= @record.get_city.name rescue "" %>/<%= @record.get_county.name rescue "" %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>對象</td>
|
||||||
|
<td>
|
||||||
|
<%= @record.get_school.name rescue "" %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>輔導日期</td>
|
||||||
|
<td>
|
||||||
|
<%= @record.created_at.strftime("%Y-%m-%d %H:%M:%S") %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>方式</td>
|
||||||
|
<td>
|
||||||
|
<% @record.counseling_method.each do |methd| %>
|
||||||
|
<%= methd %>
|
||||||
|
<% if methd != "個別議題輔導" %>
|
||||||
|
<br/>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if @record.counseling_method.include?("個別議題輔導") %>
|
||||||
|
<%= @record.counseling_method_description %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>會議/活動名稱</td>
|
||||||
|
<td>
|
||||||
|
<%= @record.event_title %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
縣市輔導項目(可複選)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% @record.purpose_for_county.each do |methd| %>
|
||||||
|
<%= methd %>
|
||||||
|
<% if methd != "(8)其他(請填寫):" %>
|
||||||
|
<br/>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if @record.purpose_for_county.include?("(8)其他(請填寫):") %>
|
||||||
|
<%= @record.purpose_for_county_extra %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>學校輔導項目(可複選)</td>
|
||||||
|
<td>
|
||||||
|
<% @record.purpose_for_school.each do |methd| %>
|
||||||
|
<%= methd %>
|
||||||
|
<% if methd != "(7)其他(請填寫):" %>
|
||||||
|
<br/>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% if @record.purpose_for_school.include?("(7)其他(請填寫):") %>
|
||||||
|
<%= @record.purpose_for_school_extra %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="20%">內容記要(如:所輔導內容、所解決困難、所達成共識、待解決問題…):</td>
|
||||||
|
<td><%= @record.minutes_of_event %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>委員建議(如:對該縣市健康促進計畫推動、輔導學校之建議…):</td>
|
||||||
|
<td><%= @record.evaluation_of_event %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<a href="" onclick="window.history.back();return false;" class="btn">Back</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
|
@ -16,11 +16,32 @@ Rails.application.routes.draw do
|
||||||
scope "cuser" do
|
scope "cuser" do
|
||||||
get "download", to: "member_counselors#download"
|
get "download", to: "member_counselors#download"
|
||||||
get "/member_login", to: "member_counselors#login", as: "member_login"
|
get "/member_login", to: "member_counselors#login", as: "member_login"
|
||||||
|
|
||||||
get "/member/fileupload", to: "member_counselors#fileupload", as: "upload_cuser_file"
|
get "/member/fileupload", to: "member_counselors#fileupload", as: "upload_cuser_file"
|
||||||
|
get "/member/resultupload", to: "member_counselors#resultupload", as: "upload_cuser_result"
|
||||||
|
|
||||||
get "/member/:id/editfileupload", to: "member_counselors#editfileupload", as: "edit_upload_cuser_file"
|
get "/member/:id/editfileupload", to: "member_counselors#editfileupload", as: "edit_upload_cuser_file"
|
||||||
|
get "/member/:id/editresultupload", to: "member_counselors#editresultupload", as: "edit_upload_cuser_result"
|
||||||
|
|
||||||
delete "/member/:id/deletefileupload", to: "member_counselors#deletefileupload", as: "delete_upload_cuser_file"
|
delete "/member/:id/deletefileupload", to: "member_counselors#deletefileupload", as: "delete_upload_cuser_file"
|
||||||
|
delete "/member/:id/deleteresultupload", to: "member_counselors#deleteresultupload", as: "delete_upload_cuser_result"
|
||||||
|
|
||||||
post "/member/file_upload", to: "member_counselors#file_upload"
|
post "/member/file_upload", to: "member_counselors#file_upload"
|
||||||
|
post "/member/result_upload", to: "member_counselors#result_upload"
|
||||||
|
|
||||||
patch "/member/:id/update_file_upload", to: "member_counselors#update_file_upload"
|
patch "/member/:id/update_file_upload", to: "member_counselors#update_file_upload"
|
||||||
|
patch "/member/:id/update_result_upload", to: "member_counselors#update_result_upload"
|
||||||
|
|
||||||
|
patch "/member/:id/update_record_upload", to: "member_counselors#update_record_upload"
|
||||||
|
|
||||||
|
get "/member/newrecord", to: "member_counselors#newrecord", as: "new_counselor_record"
|
||||||
|
get "/member/get_info", to: "member_counselors#get_info"
|
||||||
|
get "/member/:id/editrecord", to: "member_counselors#editrecord", as: "edit_counselor_record"
|
||||||
|
get "/member/:id/showrecord", to: "member_counselors#showrecord", as: "show_counselor_record"
|
||||||
|
delete "/member/:id/deleterecord", to: "member_counselors#deleterecord", as: "delete_counselor_record"
|
||||||
|
|
||||||
|
post "/member/new_record_upload", to: "member_counselors#new_record_upload"
|
||||||
|
|
||||||
get "/member/:account", to: "member_counselors#show", as: "member_dash"
|
get "/member/:account", to: "member_counselors#show", as: "member_dash"
|
||||||
post "/member_counselor/login", to: "member_counselors#loginuser"
|
post "/member_counselor/login", to: "member_counselors#loginuser"
|
||||||
get "/member_counselor/logout", to: "member_counselors#logoutuser", as: "member_logout"
|
get "/member_counselor/logout", to: "member_counselors#logoutuser", as: "member_logout"
|
||||||
|
|
Loading…
Reference in New Issue