WIP: print settings

This commit is contained in:
rulingcom 2025-10-27 23:32:08 +08:00
parent cd7da404bc
commit 8b3049b1c7
7 changed files with 101 additions and 97 deletions

View File

@ -176,6 +176,10 @@ class Admin::PropertyHiresController < OrbitAdminController
end
end
def print_setting
@property = Property.where(:uid => params[:id].split("-").last).first rescue nil
end
def delete_booking_details
booking = PHire.find(params[:id])
property = booking.property

View File

@ -27,6 +27,7 @@ class PHire
field :mobile_phone_of_contact_person
field :contact_person_Email
field :contact_person_department
field :recommendation
belongs_to :property
has_many :p_hire_field_values, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :p_hire_field_values, allow_destroy: true

View File

@ -35,6 +35,7 @@ class Property
field :p_display_end_time, type: DateTime
field :recurring_enable, type: Boolean, :default => false
field :property_color, :default => "#000000"
field :print_format
mount_uploader :image, ImageUploader

View File

@ -816,6 +816,12 @@ ul.list-unstyled li {
</div>
</div>
<% end %>
<div class="form-group">
<%= f.label :recommendation, t("property_hire.recommendation"), :class => "col-sm-#{label_col} control-label" %>
<div class="col-sm-1">
<%= f.text_area :recommendation %>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-<%=label_col%> col-sm-<%=input_col%>">
<% if f.object.id.present? %>

View File

@ -100,6 +100,7 @@
<li><a href="#available_time" data-toggle="tab"><%= t('property_hire.available_time')%></a></li>
<li><a href="#auto_send_email_set" data-toggle="tab"><%= t('property_hire.auto_send_email_set') %></a></li>
<li><a href="#settings" data-toggle="tab"><%= t('property_hire.reservation_fields') %></a></li>
<li><a href="#printsettings" data-toggle="tab"><%= t('property_hire.print_settings') %></a></li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
@ -136,16 +137,6 @@
<%= f.text_field :other_location %>
</div>
</div>
<%
=begin%>
<div class="control-group">
<%= f.label :property_number, t("property_hire.property_number"), :class => "control-label muted" %>
<div class="controls">
<%= f.text_field :property_number %>
</div>
</div>
<%
=end%>
<div class="control-group">
<%= f.label :p_display_start_time, t("property_hire.p_display_start_time"), :class => "control-label muted" %>
<div class="controls">
@ -193,16 +184,6 @@
</div>
</div>
</div>
<%
=begin%>
<div class="control-group">
<%= f.label :purchase_date, t("property_hire.purchase_date"), :class => "control-label muted" %>
<div class="controls">
<%= f.datetime_picker :purchase_date, :no_label => true, :new_record => @property.new_record?, :picker_type => "date", :format => "yyyy/MM/dd" %>
</div>
</div>
<%
=end%>
<div class="control-group">
<%= f.label :owners, t("property_hire.owners"), :class => "control-label muted" %>
<div class="controls">
@ -233,16 +214,6 @@
<%= f.text_field :owner_phone %>
</div>
</div>
<%
=begin%>
<div class="control-group">
<%= f.label :price, t("property_hire.price"), :class => "control-label muted" %>
<div class="controls">
<%= f.text_field :price %>
</div>
</div>
<%
=end%>
</div>
<!-- page_setting -->
<div class="tab-pane fade" id="page_setting">
@ -597,66 +568,66 @@
</ul>
</div>
</div>
<!-- reservation fields -->
<div class="tab-pane fade" id="settings">
<% fields_name = f.object.class::FIELDSNAME %>
<div style="padding: 1.2em;">
<table style="margin: 0;">
<thead>
<th style="padding:0 5px;"><%= t('property_hire.field_name') %></th>
<th style="padding:0 5px;"><%= t('property_hire.name') %></th>
<th style="padding:0 5px;"><%= t('property_hire.placeholder') %></th>
<th style="padding:0 5px;"><%= t('property_hire.disable') %></th>
<th style="padding:0 5px;"><%= t('property_hire.required') %></th>
<th style="padding:0 5px;"><%= t('property_hire.for_label') %></th>
<th style="padding:0 5px;"><%= t('property_hire.for_display') %></th>
</thead>
<tbody>
<% fields_name.each do |field_name| %>
<tr>
<td style="padding:0 5px;">
<%= t("property_hire.#{field_name}") %>
</td>
<td style="padding:0 5px;">
<%= render_custom_text_field(f,field_name,"name") %>
</td>
<td style="padding:0 5px;">
<%= render_custom_text_field(f,field_name,"placeholder") %>
</td>
<td style="padding:0 5px;">
<input type="hidden" name='<%= "#{f.object_name}[#{field_name}][enable]" %>' value="1">
<%= check_box_tag("#{f.object_name}[#{field_name}][enable]", "0" , (f.object.send(field_name)["enable"] == "0" rescue false)) %>
</td>
<td style="padding:0 5px;">
<input type="hidden" name='<%= "#{f.object_name}[#{field_name}][required]" %>' value="false">
<%= check_box_tag("#{f.object_name}[#{field_name}][required]", "true" , (f.object.send(field_name)["required"] == "true" rescue false), class: "for_required") %>
<% for_label = f.object.send(field_name)["required"] == "true" ? true : false %>
</td>
<td style="padding:0 5px;">
<%= f.radio_button :calendar_label_field_name, field_name, {:class => "for_label_selection #{(for_label == true ? '' : 'hide')}" } %>
</td>
<td style="padding:0 5px;">
<input type="hidden" name='<%= "#{f.object_name}[#{field_name}][for_display]" %>' value="false">
<%= check_box_tag("#{f.object_name}[#{field_name}][for_display]", "true" , (f.object.send(field_name)["for_display"] == "true" rescue false), class: "for_display") %>
<% for_label = f.object.send(field_name)["for_display"] == "true" ? true : false %>
</td>
</tr>
<% end %>
</tbody>
</table>
<table style="margin: 0;">
<thead>
<th style="padding:0 5px;"><%= t('property_hire.field_name') %></th>
<th style="padding:0 5px;"><%= t('property_hire.name') %></th>
<th style="padding:0 5px;"><%= t('property_hire.placeholder') %></th>
<th style="padding:0 5px;"><%= t('property_hire.disable') %></th>
<th style="padding:0 5px;"><%= t('property_hire.required') %></th>
<th style="padding:0 5px;"><%= t('property_hire.for_label') %></th>
<th style="padding:0 5px;"><%= t('property_hire.for_display') %></th>
</thead>
<tbody>
<% fields_name.each do |field_name| %>
<tr>
<td style="padding:0 5px;">
<%= t("property_hire.#{field_name}") %>
</td>
<td style="padding:0 5px;">
<%= render_custom_text_field(f,field_name,"name") %>
</td>
<td style="padding:0 5px;">
<%= render_custom_text_field(f,field_name,"placeholder") %>
</td>
<td style="padding:0 5px;">
<input type="hidden" name='<%= "#{f.object_name}[#{field_name}][enable]" %>' value="1">
<%= check_box_tag("#{f.object_name}[#{field_name}][enable]", "0" , (f.object.send(field_name)["enable"] == "0" rescue false)) %>
</td>
<td style="padding:0 5px;">
<input type="hidden" name='<%= "#{f.object_name}[#{field_name}][required]" %>' value="false">
<%= check_box_tag("#{f.object_name}[#{field_name}][required]", "true" , (f.object.send(field_name)["required"] == "true" rescue false), class: "for_required") %>
<% for_label = f.object.send(field_name)["required"] == "true" ? true : false %>
</td>
<td style="padding:0 5px;">
<%= f.radio_button :calendar_label_field_name, field_name, {:class => "for_label_selection #{(for_label == true ? '' : 'hide')}" } %>
</td>
<td style="padding:0 5px;">
<input type="hidden" name='<%= "#{f.object_name}[#{field_name}][for_display]" %>' value="false">
<%= check_box_tag("#{f.object_name}[#{field_name}][for_display]", "true" , (f.object.send(field_name)["for_display"] == "true" rescue false), class: "for_display") %>
<% for_label = f.object.send(field_name)["for_display"] == "true" ? true : false %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<hr style="border-color: black; ">
<div class="control-group">
<% field_name = "enable_notes_selector" %>
<label class="control-label muted"><%= t("property_hire.#{field_name}") %></label>
<div class="controls">
<label for="act_enabled_name" class="checkbox inline">
<%= hidden_field_tag "property[#{field_name}]", "0" %>
<%= f.check_box_tag "property[#{field_name}]", "1" , (@property[field_name] rescue false) %>
Enable
</label>
</div>
</div>
<div class="control-group" id="selector_block">
<% field_name = "enable_notes_selector" %>
<label class="control-label muted"><%= t("property_hire.#{field_name}") %></label>
<div class="controls">
<label for="act_enabled_name" class="checkbox inline">
<%= hidden_field_tag "property[#{field_name}]", "0" %>
<%= f.check_box_tag "property[#{field_name}]", "1" , (@property[field_name] rescue false) %>
Enable
</label>
</div>
<div class="control-group" id="selector_block">
<% field_name = "notes_selector" %>
<label class="control-label muted"><%= t("property_hire.#{field_name}") %></label>
<div class="controls">
@ -718,8 +689,23 @@
</div>
<a id="add_note_select_field" class="btn btn-primary"><%=t(:add)%></a>
</div>
</div>
</div>
<!-- print settings -->
<div class="tab-pane fade" id="printsettings">
<table>
<tbody>
<tr>
<td>
<%= label_tag t('property_hire.print_format') %>
</td>
<td>
<%= f.text_area :print_format,class: 'ckeditor' %>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
@ -762,17 +748,17 @@
</div>
<% end %>
</div>
<!-- Form Actions -->
<div class="form-actions">
<% referer = request.referer rescue nil %>
<% referer = get_referer_url if referer.blank? || request.host != URI.parse(URI.encode(referer)).host %>
<input type="hidden" name="referer_url" value="<%= referer %>">
<% unless @property.new_record? %>
<%= hidden_field_tag("property[id]", @property.id) %>
<% end %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), referer, :class=>"btn" %>
</div>
<!-- Form Actions -->
<div class="form-actions">
<% referer = request.referer rescue nil %>
<% referer = get_referer_url if referer.blank? || request.host != URI.parse(URI.encode(referer)).host %>
<input type="hidden" name="referer_url" value="<%= referer %>">
<% unless @property.new_record? %>
<%= hidden_field_tag("property[id]", @property.id) %>
<% end %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), referer, :class=>"btn" %>
</div>
<script type="text/javascript">
$("#bulletin_display_img").click(function(){$("#image_display_setting").toggleClass("hide")})
$(document).ready(function(){

View File

@ -214,3 +214,6 @@ en:
property_color: Property color
admin_reserve: Reserve
for_display: Display
recommendation: Recommendation
print_format: Print Format
print_settings: Print Settings

View File

@ -235,4 +235,7 @@ zh_tw:
export_reservation_data: Export data
for_label: For Label
property_color: Property color
for_display: Display
for_display: Display
recommendation: 擬辦/註解
print_format: 列印格式
print_settings: 列印格式設定