class Settings::TaxProfilesController < ApplicationController before_action :set_settings_tax_profile, only: [:show, :edit, :update, :destroy] # GET /settings/tax_profiles # GET /settings/tax_profiles.json def index @settings_tax_profiles = TaxProfile.all end # GET /settings/tax_profiles/1 # GET /settings/tax_profiles/1.json def show end # GET /settings/tax_profiles/new def new @settings_tax_profile = TaxProfile.new end # GET /settings/tax_profiles/1/edit def edit end # POST /settings/tax_profiles # POST /settings/tax_profiles.json def create @settings_tax_profile = TaxProfile.new(settings_tax_profile_params) @settings_tax_profile.created_by = current_login_employee.name respond_to do |format| if @settings_tax_profile.save format.html { redirect_to settings_tax_profiles_path, notice: 'Tax profile was successfully created.' } format.json { render :show, status: :created, location: @settings_tax_profile } else format.html { render :new } format.json { render json: @settings_tax_profile.errors, status: :unprocessable_entity } end end end # PATCH/PUT /settings/tax_profiles/1 # PATCH/PUT /settings/tax_profiles/1.json def update respond_to do |format| if @settings_tax_profile.update(settings_tax_profile_params) format.html { redirect_to settings_tax_profiles_path, notice: 'Tax profile was successfully updated.' } format.json { render :show, status: :ok, location: @settings_tax_profile } else format.html { render :edit } format.json { render json: @settings_tax_profile.errors, status: :unprocessable_entity } end end end # DELETE /settings/tax_profiles/1 # DELETE /settings/tax_profiles/1.json def destroy @settings_tax_profile.destroy respond_to do |format| format.html { redirect_to settings_tax_profiles_url, notice: 'Tax profile was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_settings_tax_profile @settings_tax_profile = TaxProfile.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def settings_tax_profile_params params.require(:tax_profile).permit(:name, :rate, :inclusive, :order_by, :created_by) end end