From 483a813e74bdfd5490b9cf49b35ab2d26130c3d7 Mon Sep 17 00:00:00 2001 From: bohung Date: Sun, 9 Aug 2020 10:50:11 +0800 Subject: [PATCH] Add contract show page and inviting show page. Add overview show page. --- .../venue_management_contracts_controller.rb | 1 + .../venue_management_invitings_controller.rb | 9 +- .../admin/venue_managements_controller.rb | 1 + .../venue_managements_controller.rb | 20 ++- .../_index.html.erb | 4 +- .../_index.html.erb | 2 +- .../venue_management_invitings/index.html.erb | 1 + .../admin/venue_managements/export.xlsx.axlsx | 31 +++-- .../venue_managements/show_contract.html.erb | 117 ++++++++++++++++++ .../venue_managements/show_data.html.erb | 88 +++++++++++++ .../venue_managements/show_inviting.html.erb | 76 ++++++++++++ config/locales/en.yml | 3 + config/locales/zh_tw.yml | 3 + 13 files changed, 341 insertions(+), 15 deletions(-) create mode 100644 app/views/venue_managements/show_contract.html.erb create mode 100644 app/views/venue_managements/show_inviting.html.erb diff --git a/app/controllers/admin/venue_management_contracts_controller.rb b/app/controllers/admin/venue_management_contracts_controller.rb index de86848..6e8d568 100644 --- a/app/controllers/admin/venue_management_contracts_controller.rb +++ b/app/controllers/admin/venue_management_contracts_controller.rb @@ -30,6 +30,7 @@ class Admin::VenueManagementContractsController < Admin::VenueAdminController 'vm_contract.note', ] @contracts = VenueManagementContract.order(updated_at: :desc).page(params[:page]).per(10) + @venue_management_page_url = Page.where(:module =>"venue_management").last.url rescue "" end def new diff --git a/app/controllers/admin/venue_management_invitings_controller.rb b/app/controllers/admin/venue_management_invitings_controller.rb index 3abd408..8424a3f 100644 --- a/app/controllers/admin/venue_management_invitings_controller.rb +++ b/app/controllers/admin/venue_management_invitings_controller.rb @@ -22,7 +22,14 @@ class Admin::VenueManagementInvitingsController < Admin::VenueAdminController 'vm_inviting.contractor_manager', 'vm_inviting.bid_result', ] - @invitings = VenueManagementInviting.order(updated_at: :desc).page(params[:page]).per(10) + @tags = @module_app.tags + @filter_fields = {} + @filter_fields['vm_inviting.type'] = @tags.map{|t| {:title => t.name,:id => t.id} } + @invitings = VenueManagementInviting.with_tags(filters("tag")).order(updated_at: :desc).page(params[:page]).per(10) + @venue_management_page_url = Page.where(:module =>"venue_management").last.url rescue "" + if request.xhr? + render :partial => 'index' + end end def new diff --git a/app/controllers/admin/venue_managements_controller.rb b/app/controllers/admin/venue_managements_controller.rb index 04e2820..e1a76ce 100644 --- a/app/controllers/admin/venue_managements_controller.rb +++ b/app/controllers/admin/venue_managements_controller.rb @@ -56,6 +56,7 @@ class Admin::VenueManagementsController < Admin::VenueAdminController @venue_management = VenueManagementMain.find(params[:id]) @venue_management_signups = VenueManagementSignup.where(:venue_management_main_id => params[:id]) + @site_in_use_locales = Site.first.in_use_locales filename = @venue_management.title.parameterize.underscore + "_export.xlsx" respond_to do |format| format.xlsx { diff --git a/app/controllers/venue_managements_controller.rb b/app/controllers/venue_managements_controller.rb index 678c6a2..e988270 100644 --- a/app/controllers/venue_managements_controller.rb +++ b/app/controllers/venue_managements_controller.rb @@ -71,11 +71,27 @@ class VenueManagementsController < ApplicationController 'time_now' => time_now, 'contribute_time_range' => VenueManagementMain.time_range(venue_management.contribute_start_date, venue_management.contribute_end_date), 'sign_up_time_range' => VenueManagementMain.time_range(venue_management.signup_start_date, venue_management.signup_end_date), - 'venue_management_time_range' => VenueManagementMain.time_range(venue_management.venue_management_start_date, venue_management.venue_management_end_date) + 'venue_management_time_range' => VenueManagementMain.time_range(venue_management.venue_management_start_date, venue_management.venue_management_end_date), + 'params' => params } end - + def show_inviting + params = OrbitHelper.params + venue_management_inviting = VenueManagementInviting.find(params[:uid]) rescue nil + { + 'venue_management_inviting' => venue_management_inviting, + 'params' => params + } + end + def show_contract + params = OrbitHelper.params + venue_management_contract = VenueManagementContract.find(params[:uid]) rescue nil + { + 'venue_management_contract' => venue_management_contract, + 'params' => params + } + end def show params = OrbitHelper.params diff --git a/app/views/admin/venue_management_contracts/_index.html.erb b/app/views/admin/venue_management_contracts/_index.html.erb index 8af69d2..e6ab6c7 100644 --- a/app/views/admin/venue_management_contracts/_index.html.erb +++ b/app/views/admin/venue_management_contracts/_index.html.erb @@ -19,7 +19,7 @@ <%= contract.venue_management_main.title %> <% end %> - <%= link_to contract.case_no, admin_venue_management_contract_path(contract.id), :target => '_blank' %> + <%= link_to contract.case_no, (@venue_management_page_url.blank? ? "#" : "/#{I18n.locale}"+@venue_management_page_url+"/#{contract.case_no.strip}-#{contract.id}?method=show_contract"), :target => '_self' %>