added color and fix available_for_hire bug and confirm for no period properties

This commit is contained in:
rulingcom 2025-01-14 23:37:25 +08:00
parent 00e64f9ce4
commit 7fc2694054
6 changed files with 28 additions and 11 deletions

View File

@ -74,15 +74,16 @@ class PHire
:note => self.note_for_hire || "",
:start => startt.to_json.gsub('"',''),
:end => endt.to_json.gsub('"',''),
:allDay => false,
:allDay => true,
:diff_day => (self.end_time - self.start_time >= 1),
:color => (self.passed ? "#3788d8" : "#FC4040"),
# :eventColor => (self.passed ? "#3788d8" : "#FC4040"),
:error_message => (self.passed ? nil : "Not approved"),
:s_id=>self.property_day_setting_id.to_s,
:date=>datet,
:recurring=>recurring,
:classNames => classNames,
:view_button => viewButton,
:color => self.property.property_color,
:view_path => "/#{OrbitHelper.get_site_locale}/admin/property_hires/#{self.id.to_s}/show_booking_details",
:view_path_name => I18n.t("property_hire.view")
}

View File

@ -34,6 +34,7 @@ class Property
field :p_display_start_time, type: DateTime
field :p_display_end_time, type: DateTime
field :recurring_enable, type: Boolean, :default => false
field :property_color, :default => "#000000"
mount_uploader :image, ImageUploader
@ -339,6 +340,10 @@ class Property
return 0
end
end
startt = self.start_date.nil? ? stime : self.start_date
endt = self.end_date.nil? ? etime : self.end_date
if DateTime.now >= (self.start_date || DateTime.now - 1.day) && DateTime.now <= (self.end_date || DateTime.now + 1.month)
if self.hours_restriction > 0 && !user.nil?
sd = nil

View File

@ -73,6 +73,7 @@
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<%= stylesheet_link_tag "admin/card" %>
<%= stylesheet_link_tag "jquery.miniColors" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
@ -80,6 +81,7 @@
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<%= javascript_include_tag "jquery.miniColors.min" %>
<% end %>
<!-- Input Area -->
@ -122,6 +124,12 @@
<% end %>
</div>
</div>
<div class="control-group">
<%= f.label :property_color, t("property_hire.property_color"), :class => "control-label muted" %>
<div class="controls">
<%= f.text_field :property_color, :class=>'set_color miniColors color-picker',:value=>(@property.property_color || '#000000') %>
</div>
</div>
<div class="control-group" id="other-location-div" style="<%= @property.new_record? || !@property.property_location.nil? ? "display: none;" : "" %>">
<%= f.label :other_location, t("property_hire.other_location"), :class => "control-label muted" %>
<div class="controls">
@ -762,6 +770,7 @@
<script type="text/javascript">
$("#bulletin_display_img").click(function(){$("#image_display_setting").toggleClass("hide")})
$(document).ready(function(){
$('.color-picker').miniColors();
if($("[type=checkbox][name='property[enable_notes_selector]']:checked").length == 0){
$("#selector_block").css("display","none");
}else{

View File

@ -426,7 +426,7 @@
}
}
var check_only = (start_date == null || end_date == null);
if(check_available(start_date,end_date,interval,recurring_end_date,check_only)){
// if(check_available(start_date,end_date,interval,recurring_end_date,check_only)){
var target = $($("#calendar").data("target"));
target.prev().find("input").val(date_time);
$("#hidden_timepicker").addClass("hide");
@ -435,13 +435,13 @@
var window_height = $(window).height();
var target_offset = target.offset();
scrollTo(target_offset.left - window_width / 2, target_offset.top - window_height / 2);
}else{
if(window.check_message !== ""){
alert(window.check_message.replace(/(<|&lt;)br(>|&gt;)/g,"\n"));
}else{
alert('<%=t("property_hire.unavailability")%>');
}
}
// }else{
// if(window.check_message !== ""){
// alert(window.check_message.replace(/(<|&lt;)br(>|&gt;)/g,"\n"));
// }else{
// alert('<%=t("property_hire.unavailability")%>');
// }
// }
}
function goto_calendar(){
$("#hidden_timepicker").addClass("hide");

View File

@ -212,3 +212,4 @@ en:
all_properties: All Properties
export_reservation_data: Export data
for_label: For Label
property_color: Property color

View File

@ -233,4 +233,5 @@ zh_tw:
month: 月模式
all_properties: All Properties
export_reservation_data: Export data
for_label: For Label
for_label: For Label
property_color: Property color