_institution.html.erb
7.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<div class="form-description">
<div class="spb-row no-margin-top">
<% if environment.enabled?('admin_must_approve_new_communities') %>
<div class='spb-col spb-col-12 explanation'>
<%= _("Note that the creation of institutions in this environment is restricted. Your request to create this new community will be sent to %{environment} administrators and will be approved or rejected according to their methods and criteria.") % { :environment => environment.name }%>
</div>
<% end %>
</div>
<div class="spb-row spb-col spb-col-12 required-field">
<%= _("The highlighted fields are mandatory") %>
</div>
</div>
<div class="spb-row spb-col spb-col-12">
<div class="errorExplanation" id="create_institution_errors">
<% unless flash[:errors].blank? %>
<h2><%= _("Can`t create new Institution: #{flash[:errors].length} errors") %></h2>
<ul>
<% flash[:errors].each do |error| %>
<li><%= error %></li>
<% end %>
</ul>
<% end %>
</div>
</div>
<%= form_for :community, :url => {:action=>"new_institution"}, :html => { :multipart => true, :id=>"institution_form" } do |f| %>
<%= hidden_field_tag "edit_institution_page", false %>
<%= fields_for :institutions do |inst| %>
<div class="spb-row no-margin-top">
<div class='spb-col'>
<%= labelled_radio_button _('Public Institution'), 'institutions[type]', 'PublicInstitution', true %>
</div>
<div class="spb-col">
<%= labelled_radio_button _('Private Institution'), 'institutions[type]', 'PrivateInstitution' %>
</div>
</div>
<div class="spb-row">
<div class="spb-col">
<label for="community_name" class="formlabel">
<%= _("Corporate Name") %><!-- razão social -->
<span class="required-field">(*)</span>
</label>
<%= f.text_field(:name, :class => flash[:error_community_name], :maxlength => 250, :value => params[:community][:name]) %>
<%= content_tag :span, _("Institution name already exists"), :id=>"already_exists_text", :class=>"errorExplanation hide-field" %>
</div>
<div class="public-institutions-fields">
<div class="spb-col">
<%= hidden_field_tag "acronym_translate", _("Acronym") %>
<%= hidden_field_tag "fantasy_name_translate", _("Fantasy name") %>
<%= inst.label("acronym" ,_("Acronym"), :class=>"formlabel", id: "institution_acronym_label") %>
<%= inst.text_field(:acronym, :value => params[:institutions][:acronym], :maxlength => 12) %>
</div>
</div>
</div>
<div class="spb-row">
<div class="spb-col spb-col-12">
<%= inst.label "corporate_name", _("Fantasy name"), :class=>"formlabel" %><!-- Nome fantasia -->
<%= inst.text_field(:corporate_name, :value => params[:institutions][:corporate_name], :size => 55, :maxlength => 250) %>
</div>
</div>
<div class="spb-row">
<div class="spb-col">
<label for="community_country" class="formlabel">
<%= _("Country") %>
<span class="required-field">(*)</span>
</label>
<%= select("community", "country", [[_('Select a country'), -1]] + country_helper.countries, {:class => "type-select #{flash[:error_community_country]}"}) %>
</div>
<div class="spb-col">
<label for="community_state" class="formlabel">
<%= _("State") %>
<span class="required-field">(*)</span>
</label>
<%= select("community", "state", [[_('Select a state'), '']] + @state_options, {:class => "type-select #{flash[:error_community_state]}"}) %>
</div>
<div class="spb-col">
<label class="formlabel" for="community_city">
<%= _("City") %>
<span class="required-field">(*)</span>
</label>
<%= f.text_field(:city, :class => flash[:error_community_city], :value => params[:community][:city], :maxlength => 250) %>
</div>
</div>
<div class="spb-row">
<div class="spb-col spb-col-12">
<label class="formlabel" for="institutions_cnpj">
<%= _("CNPJ") %>
<span id="cnpj_required_field_mark" class="required-field"></span>
</label>
<%= inst.text_field(:cnpj, :placeholder=>"99.999.999/9999-99", :class=>"intitution_cnpj_field", :value => params[:institutions][:cnpj]) %>
</div>
</div>
<div class="spb-row public-institutions-fields">
<div class="spb-col spb-col-6">
<label class="formlabel" for="institutions_governmental_sphere_id">
<%= _("Governmental Sphere") %>
<span class="required-field">(*)</span>
</label>
<%= inst.select(:governmental_sphere, @governmental_sphere, :selected=>params[:institutions][:governmental_sphere], :class => flash[:error_institution_governmental_sphere])%>
</div>
</div>
<div class="spb-row public-institutions-fields">
<div class="spb-col spb-col-6">
<label class="formlabel" for="institutions_governmental_power_id">
<%= _("Governmental Power") %>
<span class="required-field">(*)</span>
</label>
<%= inst.select(:governmental_power, @governmental_power, :selected=>params[:institutions][:governmental_sphere], :class => flash[:error_institution_governmental_power])%>
</div>
</div>
<div class="spb-row public-institutions-fields">
<div class="spb-col spb-col-6">
<label class="formlabel" for="institutions_juridical_nature_id">
<%= _("Juridical Nature") %>
<span class="required-field">(*)</span>
</label>
<%= inst.select(:juridical_nature, @juridical_nature, :selected=>params[:institutions][:juridical_nature], :class => flash[:error_institution_juridical_nature])%>
</div>
</div>
<% if @show_admin_fields %>
<div class="spb-row public-institutions-fields">
<div class="spc-col spb-col-12 sisp-fields">
<div class="spb-col spb-col-3">
<div class="spb-col spb-col-12">
<%= _("SISP?") %>
</div>
<div class="spb-col spb-col-5">
<%= inst.radio_button(:sisp, true, :class => "#{flash[:error_institution_sisp]}" ) %>
<%= inst.label :sisp ,_("Yes"), :value => true %>
</div>
<div class="spb-col spb-col-6">
<%= inst.radio_button(:sisp, false, :checked=>"checked", :class => "#{flash[:error_institution_sisp]}") %>
<%= inst.label :sisp ,_("No"), :value => false %>
</div>
</div>
</div>
</div>
<div class="spb-row public-institutions-fields">
<div class="spb-col spb-col-12">
<%= inst.label("siorg_code" ,_("SIORG Code"), :class=>"formlabel") %>
<%= inst.text_field(:siorg_code, :value => params[:institutions][:siorg_code]) %>
</div>
</div>
<% end %>
<div class="spb-row modal-form-actions">
<div class="spb-col spb-col-6">
<% if @url_token == "create_institution_admin" %>
<%= submit_button :save, _('Save') %>
<%= button(:cancel, _("Cancel"), {:controller => "admin_panel", :action => 'index'}) %>
<% else %>
<%= link_to(_('Save'), '#', :id=>'save_institution_button', :class=>'button with-text icon-add') %>
<%= link_to(_('Cancel'), '#', :id=>"cancel_institution_button", :class=>'button with-text icon-cancel', "data-dismiss".to_sym => "modal") %>
<%= hidden_field_tag :institution_error_message, _("Could not send the form data to the server") %>
<% end %>
</div>
</div>
<% end %>
<% end %>
</div>
<%= hidden_field_tag :loading_message, _("Creating institution") %>