_institution.html.erb
5.44 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
<h1><%= _('New Institution') %></h1>
<% if environment.enabled?('admin_must_approve_new_communities') %>
<div class='explanation'>
<%= _("Note that the creation of communities 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 %>
<% unless flash[:errors].nil? %>
<div class="errorExplanation" id="errorExplanation">
<h2> <%= _("Can`t create new Institution: #{flash[:errors].length} errors") %> </h2>
<ul>
<% flash[:errors].each do |error| %>
<li> <%= error %> </li>
<% end %>
</ul>
</div>
<% end %>
<div id = 'create_institution_errors' class='errorExplanation hide-field'></div>
<div>
<div class="fields-required">
<span class="errorExplanation"><%= _("All fields with (*) are mandatory") %></span>
</div>
<br/>
<%= labelled_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| %>
<span class=''>
<div class='formfield type-radio'>
<label>
<%= _("Private Institution") %>
<%= radio_button_tag("institutions[type]" ,"PrivateInstitution", true)%>
</label>
<label> <%= _("Public Institution") %>
<%= radio_button_tag("institutions[type]", "PublicInstitution") %>
</label>
</div>
</span>
<%= required f.text_field(:name) %>
<%= content_tag :span, _("Institution name already exists"), :id=>"already_exists_text", :class=>"errorExplanation hide-field" %>
<span class='required-field'>
<div class="formfield type-text">
<%= inst.label "corporate_name", _("Corporate Name"), :class=>"formlabel" %>
<%= required inst.text_field(:corporate_name) %>
</div>
</span>
<span class='optional-field'>
<div class="formfield type-text">
<%= hidden_field_tag "acronym_translate", _("Acronym") %>
<%= hidden_field_tag "fantasy_name_translate", _("Fantasy name") %>
<%= inst.label("acronym" ,_("Acronym"), :class=>"formlabel") %>
<%= inst.text_field(:acronym) %>
</div>
</span>
<%= required select_country(_('Country'), 'community', 'country', {:class => 'type-select', :id => "community_country"}) %>
<span class='required-field'>
<div class="formfield">
<label for="community_state" class="formlabel"><%= _("State") %></label>
<%= f.select(:state, [[_('Select a state'), '-1']] | @state_list.collect {|state| [state.name, state.name]}) %>
</div>
</span>
<%= required f.text_field(:city) %>
<span class='required-field'>
<div class="formfield type-text">
<%= inst.label("cnpj" ,_("CNPJ"), :class=>"formlabel") %>
<%= required inst.text_field(:cnpj, :placeholder=>"99.999.999/9999-99", :class=>"intitution_cnpj_field") %>
</div>
</span>
<span class='required-field public-institutions-fields'>
<div class="formfield type-text">
<%= inst.label("governmental_sphere_id" ,_("Governmental Sphere:"), :class=>"formlabel") %>
<%= inst.select(:governmental_sphere, [[_("Select a Governmental Sphere"), 0]]|GovernmentalSphere.all.map {|s| [s.name, s.id]}, {:selected=>0})%>
</div>
</span>
<span class='required-field public-institutions-fields'>
<div class="formfield type-text">
<%= inst.label("governmental_power_id" ,_("Governmental Power:"), :class=>"formlabel") %>
<%= inst.select(:governmental_power, [[_("Select a Governmental Power"), 0]]|GovernmentalPower.all.map {|g| [g.name, g.id]}, {:selected=>0})%>
</div>
</span>
<span class='required-field public-institutions-fields'>
<div class="formfield type-text">
<%= inst.label("juridical_nature_id" ,_("Juridical Nature:"), :class=>"formlabel") %>
<%= inst.select(:juridical_nature, [[_("Select a Juridical Nature"), 0]]|JuridicalNature.all.map {|j| [j.name, j.id]}, {:selected=>0})%>
</div>
</span>
<span class='required-field public-institutions-fields'>
<div class="formfield type-text">
<%= _("SISP?") %>
<% if @show_sisp_field %>
<%= inst.label("sisp" ,_("Yes")) %>
<%= inst.radio_button(:sisp, true) %>
<%= inst.label("sisp" ,_("No")) %>
<%= inst.radio_button(:sisp, false, :checked=>"checked") %>
<% else %>
<%= inst.label("sisp", _("No")) %>
<% end %>
</div>
</span>
<br />
<% if @url_token == "create_institution_admin" %>
<%= submit_button :save, _('Save') %>
<%= button(:cancel, _("Cancel"), {:controller => "admin_panel", :action => 'index'}) %>
<%else%>
<div>
<%= 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') %>
</div>
<%= hidden_field_tag :institution_error_message, _("Could not send the form data to the server") %>
<%end%>
<% end %>
<% end %>
</div>
<%= hidden_field_tag :loading_message, _("Creating institution") %>