edit and view button permission fix

This commit is contained in:
rulingcom 2025-02-24 21:10:52 +08:00
parent 6997636dbd
commit f76b22ec6b
4 changed files with 27 additions and 8 deletions

View File

@ -199,6 +199,16 @@ var Calendar = function(dom, property_id, valid_range, currentView, display_hire
c.dialog.show({"x": originalEvent.clientX,"y": originalEvent.clientY});
}
},
eventContent: function(arg) {
let propertyTitle = arg.event.extendedProps.property_title || '';
let eventTitle = arg.event.title;
let html = `<div class="fc-event-title-container">
<div class="event-property">${propertyTitle}</div>
<div class="fc-event-title">${eventTitle}</div>
</div>`;
return { html: html };
},
dateClick: function(ev) {
var calendar = this;
var calendar_dom = $(this.el);
@ -858,4 +868,4 @@ var AgendaView = function(calendar){
renderMonth();
}
}
}

View File

@ -60,7 +60,13 @@ class PHire
classNames = ["mybooking"]
viewButton = true
end
if viewButton === false
if Admin::PropertyHiresController.helpers.check_if_user_is_manager?
viewButton = true
end
end
end
label = self.send(self.property.calendar_label_field_name) rescue ""
title = startt.strftime("%H:%M") + " ~ " + endt.strftime("%H:%M") + " " + label
fields_to_show = Property::FIELDSNAME.select{|k,v| self.property.send(k)["for_display"] == "true"}

View File

@ -67,16 +67,18 @@
</tr>
</tbody>
</table>
<% manager = can_edit_or_delete?(property) %>
<a href="" onclick="window.history.back();return false;" class="btn btn-warning">Back</a>
<% if can_edit_or_delete?(@booking.property) %>
<% if manager || @booking.hiring_person_id == current_user.member_profile.id.to_s %>
<a href="<%= edit_hire_admin_property_hire_path(@booking) %>" class="btn btn-info"><%= t("property_hire.edit") %></a>
<% if @booking.passed %>
<a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "reject") %>" class="btn btn-warning"><%= t("property_hire.reject") %></a>
<% else %>
<a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "accept") %>" class="btn btn-success"><%= t("property_hire.accept") %></a>
<% end %>
<a href="<%= delete_booking_details_admin_property_hire_path(@booking, :page => params[:page]) %>" class="btn btn-danger" data-method="delete" data-confirm="Are you sure?"><%= t("property_hire.delete") %></a>
<% end %>
<% if manager %>
<% if @booking.passed %>
<a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "reject") %>" class="btn btn-warning"><%= t("property_hire.reject") %></a>
<% else %>
<a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "accept") %>" class="btn btn-success"><%= t("property_hire.accept") %></a>
<% end %>
<% end %>

View File

@ -53,4 +53,5 @@
<script type="text/javascript">
var property_id = "<%= property.id.to_s %>";
var calendar = new Calendar("#calendar",property_id,false);
</script>