class Transactions::SalesController < ApplicationController before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy] # GET /transactions/sales # GET /transactions/sales.json def index @transactions_sales = Sale.all end # GET /transactions/sales/1 # GET /transactions/sales/1.json def show end # GET /transactions/sales/new def new @transactions_sale = Sale.new end # GET /transactions/sales/1/edit def edit end # POST /transactions/sales # POST /transactions/sales.json def create @transactions_sale = Sale.new(transactions_sale_params) respond_to do |format| if @transactions_sale.save format.html { redirect_to @transactions_sale, notice: 'Sale was successfully created.' } format.json { render :show, status: :created, location: @transactions_sale } else format.html { render :new } format.json { render json: @transactions_sale.errors, status: :unprocessable_entity } end end end # PATCH/PUT /transactions/sales/1 # PATCH/PUT /transactions/sales/1.json def update respond_to do |format| if @transactions_sale.update(transactions_sale_params) format.html { redirect_to @transactions_sale, notice: 'Sale was successfully updated.' } format.json { render :show, status: :ok, location: @transactions_sale } else format.html { render :edit } format.json { render json: @transactions_sale.errors, status: :unprocessable_entity } end end end # DELETE /transactions/sales/1 # DELETE /transactions/sales/1.json def destroy @transactions_sale.destroy respond_to do |format| format.html { redirect_to transactions_sales_url, notice: 'Sale was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_transactions_sale @transactions_sale = Sale.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def transactions_sale_params params.require(:transactions_sale).permit(:cashier_id, :cashier_name, :requested_by, :requested_at, :receipt_no, :receipt_date, :customer_id, :payment_status, :sale_status, :total_amount, :total_discount, :total_tax, :tax_type, :grand_total, :rounding_adjustment, :amount_received, :amount_changed) end end