class PosConfigsController < ApplicationController ##--- Breadcrum_rails add_breadcrumb I18n.t("breadcrumbs." + controller_name), :pos_configs_path before_action :set_pos_config, only: [:show, :edit, :update, :destroy] # GET /pos_configs # GET /pos_configs.json def index @pos_config = PosConfig.first.blank? ? PosConfig.new : PosConfig.first end # POST /pos_configs # POST /pos_configs.json def create @pos_config = PosConfig.new(pos_config_params) respond_to do |format| if @pos_config.save format.html { redirect_to root_path, notice: 'Configuración de parametros generales guardada correctamente.' } format.json { render :show, status: :created, location: @pos_config } else format.html { render action: "index" } format.json { render json: @pos_config.errors, status: :unprocessable_entity } end end end # PATCH/PUT /pos_configs/1 # PATCH/PUT /pos_configs/1.json def update respond_to do |format| @pos_config.audit_comment = "Se actualizó parametros generales" if @pos_config.update(pos_config_params) format.html { redirect_to root_path, notice: 'Configuración de parametros generales guardada correctamente.' } format.json { render :show, status: :ok, location: @pos_config } else format.html { render action: "index" } format.json { render json: @pos_config.errors, status: :unprocessable_entity } end end end private # Use callbacks to share common setup or constraints between actions. def set_pos_config @pos_config = PosConfig.first end # Never trust parameters from the scary internet, only allow the white list through. def pos_config_params params[:pos_config] params.require(:pos_config).permit(:cancel_partial_payment, :refund_sale, :days_cancel_sale, :days_cancel_purchase, :tax_percent, :time_zone, :gain_margin, :ticket_description, :reserve_sale_percent, :days_cancel_reserved, :commission_percent, :ticket_footer, :ticket_img, :ticket_img_cache, :haggle_in_sale_percent) end end