#The MIT License (MIT) # #Copyright (c) 2026 rick barrette # #Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: # #The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. # #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # Administration ยป Bonus technicians: who earns the weekly bonus, their role and their QuickBooks customer account class BonusTechniciansController < ApplicationController layout 'admin' self.main_menu = false menu_item :bonus_technicians before_action :require_admin before_action :find_technician, only: [:edit, :update, :destroy] def index @technicians = BonusTechnician.sorted.includes(:customer).to_a end def new @technician = BonusTechnician.new end def create @technician = BonusTechnician.new(technician_params) if @technician.save flash[:notice] = l(:notice_successful_create) redirect_to bonus_technicians_path else render :new, status: :unprocessable_entity end end def edit; end def update if @technician.update(technician_params) flash[:notice] = l(:notice_successful_update) redirect_to bonus_technicians_path else render :edit, status: :unprocessable_entity end end def destroy @technician.destroy flash[:notice] = l(:notice_successful_delete) redirect_to bonus_technicians_path end private def find_technician @technician = BonusTechnician.find(params[:id]) rescue ActiveRecord::RecordNotFound render_404 end def technician_params permitted = params.require(:bonus_technician).permit(:user_id, :customer_id, :role, :probation_until, :active) permitted[:customer_id] = permitted[:customer_id].presence if permitted.key?(:customer_id) permitted end end