From 907fd671c8054b7c28d7a4b859914224355f219a Mon Sep 17 00:00:00 2001 From: phyusin Date: Wed, 4 Apr 2018 11:55:45 +0630 Subject: [PATCH] check foreigner lists --- app/views/origami/surveys/_form.html.erb | 128 +++++++++++++++++- app/views/transactions/surveys/index.html.erb | 9 +- 2 files changed, 128 insertions(+), 9 deletions(-) diff --git a/app/views/origami/surveys/_form.html.erb b/app/views/origami/surveys/_form.html.erb index 1322f677..967a5837 100755 --- a/app/views/origami/surveys/_form.html.erb +++ b/app/views/origami/surveys/_form.html.erb @@ -32,17 +32,19 @@ <%= f.input :total_customer, input_html: { value: @survey_data.total_customer, class: 'col-md-11'} %> <%= f.input :local , input_html: { value: @survey_data.local, class: 'col-md-11' }%> -
- Foreigner -
+ + +
+ +
- + <% Lookup.where("lookup_type = ?", "country" ).each do |ct| %> + <%end %>
@@ -243,7 +245,11 @@ \ No newline at end of file diff --git a/app/views/transactions/surveys/index.html.erb b/app/views/transactions/surveys/index.html.erb index 66defdc0..7e750faa 100644 --- a/app/views/transactions/surveys/index.html.erb +++ b/app/views/transactions/surveys/index.html.erb @@ -56,6 +56,7 @@ <% total_female = 0 %> <% total_local = 0 %> <% total_customer = 0 %> + <% total_foreigner = 0 %> <% if !@surveys.nil? %> <% @surveys.each do |survey| %> <% total_child = total_child.to_i + survey.child.to_i %> @@ -80,8 +81,11 @@ <% foreigner_lists = foreign.split(",") %> <% if !foreigner_lists.empty? %> <% foreigner_lists.each do |fgn| %> + <% unless fgn.match(/[^[:digit:]]+/) + total_foreigner = total_foreigner.to_i + fgn.to_i + end %> <% if !fgn.scan(/\D/).empty? %> - <%= fgn %> :<% end %> <%= fgn.to_i unless fgn.match(/[^[:digit:]]+/) %>
+ <%= fgn %> :<% end %> <%= fgn.to_i unless fgn.match(/[^[:digit:]]+/) %>
<% end %> <% end %> <% end %> @@ -97,7 +101,8 @@ <%= total_male %> <%= total_female %> <%= total_customer %> - <%= total_local %> + <%= total_local %> + <%= total_foreigner %>