118 lines
4.0 KiB
Plaintext
118 lines
4.0 KiB
Plaintext
<% content_for :page_specific_css do %>
|
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
|
<%= stylesheet_link_tag "lib/main-list" %>
|
|
<% end %>
|
|
<% content_for :page_specific_javascript do %>
|
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
|
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
|
<% end %>
|
|
|
|
<div class="input-area">
|
|
|
|
<!-- Module Tabs -->
|
|
<div class="nav-name"><strong><%= params[:action] == "new" ? t("bus_booking.new_bus") : t("bus_booking.edit_bus") %></strong></div>
|
|
<ul class="nav nav-pills module-nav">
|
|
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
|
|
</ul>
|
|
<!-- Module -->
|
|
<div class="tab-content module-area">
|
|
|
|
<!-- Basic Module -->
|
|
<div class="tab-pane fade in active" id="basic">
|
|
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t("bus_booking.departure_time") %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :departure_time, :no_label => true, :new_record => @bus.new_record? %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Date Time Picker -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t("bus_booking.reservation_end_time") %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :reservation_end_time, :no_label => true, :new_record => @bus.new_record? %>
|
|
<div class='validator_error_class text-error hide'>Reservation end time cannot be later than departure time.</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t("bus_booking.capacity") %></label>
|
|
<div class="controls">
|
|
<%= f.number_field :capacity, :value => (@bus.new_record? ? 20 : @bus.capacity), :class => "span1" %>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Language Tabs -->
|
|
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
|
<ul class="nav nav-pills language-nav">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<li class="<%= 'active' if i == 0 %>">
|
|
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
<!-- Language -->
|
|
<div class="tab-content language-area">
|
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
|
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
|
|
|
<!-- Title-->
|
|
<div class="control-group input-title">
|
|
<label class="control-label muted"><%= t("bus_booking.bus_route") %></label>
|
|
<div class="controls">
|
|
<%= f.fields_for :bus_route_translations do |f| %>
|
|
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@bus.bus_route_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Content -->
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted"><%= t("bus_booking.remark") %></label>
|
|
<div class="controls">
|
|
<div class="textarea">
|
|
<%= f.fields_for :remark_translations do |f| %>
|
|
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@bus.remark_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<div class="form-actions">
|
|
<%= f.hidden_field :created_by, :value => current_user.id %>
|
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
|
<%= link_to t('cancel'), admin_bus_bookings_path, :class=>"btn" %>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(".main-forms").on("submit",function(){
|
|
$(".validator_error_class").addClass("hide");
|
|
var d = new Date($("#bus_departure_time").val()),
|
|
d1 = new Date($("#bus_reservation_end_time").val());
|
|
|
|
if((d - d1) > 0){
|
|
$(this).submit();
|
|
}else{
|
|
$(".validator_error_class").removeClass("hide");
|
|
return false;
|
|
}
|
|
})
|
|
</script>
|
|
|
|
|
|
|
|
|