diff --git a/app/assets/javascripts/property_hire_calendar_frontend.js b/app/assets/javascripts/property_hire_calendar_frontend.js index 7544049..c42ec90 100644 --- a/app/assets/javascripts/property_hire_calendar_frontend.js +++ b/app/assets/javascripts/property_hire_calendar_frontend.js @@ -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 = `
+
${propertyTitle}
+
${eventTitle}
+
`; + return { html: html }; + }, dateClick: function(ev) { var calendar = this; var calendar_dom = $(this.el); @@ -858,4 +868,4 @@ var AgendaView = function(calendar){ renderMonth(); } -} \ No newline at end of file +} diff --git a/app/models/p_hire.rb b/app/models/p_hire.rb index 09e1d93..4d0c5f2 100644 --- a/app/models/p_hire.rb +++ b/app/models/p_hire.rb @@ -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"} diff --git a/app/views/admin/property_hires/show_booking_details.html.erb b/app/views/admin/property_hires/show_booking_details.html.erb index afde49a..3798a24 100644 --- a/app/views/admin/property_hires/show_booking_details.html.erb +++ b/app/views/admin/property_hires/show_booking_details.html.erb @@ -67,16 +67,18 @@ +<% manager = can_edit_or_delete?(property) %> Back -<% if can_edit_or_delete?(@booking.property) %> +<% if manager || @booking.hiring_person_id == current_user.member_profile.id.to_s %> <%= t("property_hire.edit") %> - <% if @booking.passed %> - " class="btn btn-warning"><%= t("property_hire.reject") %> - <% else %> - " class="btn btn-success"><%= t("property_hire.accept") %> - <% end %> <%= t("property_hire.delete") %> <% end %> +<% if manager %> + <% if @booking.passed %> + " class="btn btn-warning"><%= t("property_hire.reject") %> + <% else %> + " class="btn btn-success"><%= t("property_hire.accept") %> + <% end %> +<% end %> - diff --git a/app/views/property_hires/view_calendar.html.erb b/app/views/property_hires/view_calendar.html.erb index 47b96ef..6d79be6 100644 --- a/app/views/property_hires/view_calendar.html.erb +++ b/app/views/property_hires/view_calendar.html.erb @@ -53,4 +53,5 @@ \ No newline at end of file