sales listing under transacitons
This commit is contained in:
3
app/assets/javascripts/transactions/sales.coffee
Normal file
3
app/assets/javascripts/transactions/sales.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
3
app/assets/stylesheets/transactions/sales.scss
Normal file
3
app/assets/stylesheets/transactions/sales.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the transactions/Sales controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
74
app/controllers/transactions/sales_controller.rb
Normal file
74
app/controllers/transactions/sales_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
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
|
||||
2
app/helpers/transactions/sales_helper.rb
Normal file
2
app/helpers/transactions/sales_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Transactions::SalesHelper
|
||||
end
|
||||
5
app/models/transactions.rb
Normal file
5
app/models/transactions.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
module Transactions
|
||||
def self.table_name_prefix
|
||||
'transactions_'
|
||||
end
|
||||
end
|
||||
27
app/views/transactions/sales/_form.html.erb
Normal file
27
app/views/transactions/sales/_form.html.erb
Normal file
@@ -0,0 +1,27 @@
|
||||
<%= simple_form_for(@transactions_sale) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.association :cashier %>
|
||||
<%= f.input :cashier_name %>
|
||||
<%= f.input :requested_by %>
|
||||
<%= f.input :requested_at %>
|
||||
<%= f.input :receipt_no %>
|
||||
<%= f.input :receipt_date %>
|
||||
<%= f.association :customer %>
|
||||
<%= f.input :payment_status %>
|
||||
<%= f.input :sale_status %>
|
||||
<%= f.input :total_amount %>
|
||||
<%= f.input :total_discount %>
|
||||
<%= f.input :total_tax %>
|
||||
<%= f.input :tax_type %>
|
||||
<%= f.input :grand_total %>
|
||||
<%= f.input :rounding_adjustment %>
|
||||
<%= f.input :amount_received %>
|
||||
<%= f.input :amount_changed %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! transactions_sale, :id, :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, :created_at, :updated_at
|
||||
json.url transactions_sale_url(transactions_sale, format: :json)
|
||||
6
app/views/transactions/sales/edit.html.erb
Normal file
6
app/views/transactions/sales/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing Transactions Sale</h1>
|
||||
|
||||
<%= render 'form', transactions_sale: @transactions_sale %>
|
||||
|
||||
<%= link_to 'Show', @transactions_sale %> |
|
||||
<%= link_to 'Back', transactions_sales_path %>
|
||||
59
app/views/transactions/sales/index.html.erb
Normal file
59
app/views/transactions/sales/index.html.erb
Normal file
@@ -0,0 +1,59 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<h1>Transactions Sales</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cashier</th>
|
||||
<th>Cashier name</th>
|
||||
<th>Requested by</th>
|
||||
<th>Requested at</th>
|
||||
<th>Receipt no</th>
|
||||
<th>Receipt date</th>
|
||||
<th>Customer</th>
|
||||
<th>Payment status</th>
|
||||
<th>Sale status</th>
|
||||
<th>Total amount</th>
|
||||
<th>Total discount</th>
|
||||
<th>Total tax</th>
|
||||
<th>Tax type</th>
|
||||
<th>Grand total</th>
|
||||
<th>Rounding adjustment</th>
|
||||
<th>Amount received</th>
|
||||
<th>Amount changed</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @transactions_sales.each do |transactions_sale| %>
|
||||
<tr>
|
||||
<td><%= transactions_sale.cashier %></td>
|
||||
<td><%= transactions_sale.cashier_name %></td>
|
||||
<td><%= transactions_sale.requested_by %></td>
|
||||
<td><%= transactions_sale.requested_at %></td>
|
||||
<td><%= transactions_sale.receipt_no %></td>
|
||||
<td><%= transactions_sale.receipt_date %></td>
|
||||
<td><%= transactions_sale.customer %></td>
|
||||
<td><%= transactions_sale.payment_status %></td>
|
||||
<td><%= transactions_sale.sale_status %></td>
|
||||
<td><%= transactions_sale.total_amount %></td>
|
||||
<td><%= transactions_sale.total_discount %></td>
|
||||
<td><%= transactions_sale.total_tax %></td>
|
||||
<td><%= transactions_sale.tax_type %></td>
|
||||
<td><%= transactions_sale.grand_total %></td>
|
||||
<td><%= transactions_sale.rounding_adjustment %></td>
|
||||
<td><%= transactions_sale.amount_received %></td>
|
||||
<td><%= transactions_sale.amount_changed %></td>
|
||||
<td><%= link_to 'Show', transactions_sale %></td>
|
||||
<td><%= link_to 'Edit', edit_transactions_sale_path(transactions_sale) %></td>
|
||||
<td><%= link_to 'Destroy', transactions_sale, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Transactions Sale', new_transactions_sale_path %>
|
||||
1
app/views/transactions/sales/index.json.jbuilder
Normal file
1
app/views/transactions/sales/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @transactions_sales, partial: 'transactions_sales/transactions_sale', as: :transactions_sale
|
||||
5
app/views/transactions/sales/new.html.erb
Normal file
5
app/views/transactions/sales/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New Transactions Sale</h1>
|
||||
|
||||
<%= render 'form', transactions_sale: @transactions_sale %>
|
||||
|
||||
<%= link_to 'Back', transactions_sales_path %>
|
||||
89
app/views/transactions/sales/show.html.erb
Normal file
89
app/views/transactions/sales/show.html.erb
Normal file
@@ -0,0 +1,89 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Cashier:</strong>
|
||||
<%= @transactions_sale.cashier %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Cashier name:</strong>
|
||||
<%= @transactions_sale.cashier_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Requested by:</strong>
|
||||
<%= @transactions_sale.requested_by %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Requested at:</strong>
|
||||
<%= @transactions_sale.requested_at %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Receipt no:</strong>
|
||||
<%= @transactions_sale.receipt_no %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Receipt date:</strong>
|
||||
<%= @transactions_sale.receipt_date %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Customer:</strong>
|
||||
<%= @transactions_sale.customer %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Payment status:</strong>
|
||||
<%= @transactions_sale.payment_status %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Sale status:</strong>
|
||||
<%= @transactions_sale.sale_status %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Total amount:</strong>
|
||||
<%= @transactions_sale.total_amount %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Total discount:</strong>
|
||||
<%= @transactions_sale.total_discount %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Total tax:</strong>
|
||||
<%= @transactions_sale.total_tax %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Tax type:</strong>
|
||||
<%= @transactions_sale.tax_type %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Grand total:</strong>
|
||||
<%= @transactions_sale.grand_total %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Rounding adjustment:</strong>
|
||||
<%= @transactions_sale.rounding_adjustment %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Amount received:</strong>
|
||||
<%= @transactions_sale.amount_received %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Amount changed:</strong>
|
||||
<%= @transactions_sale.amount_changed %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_transactions_sale_path(@transactions_sale) %> |
|
||||
<%= link_to 'Back', transactions_sales_path %>
|
||||
1
app/views/transactions/sales/show.json.jbuilder
Normal file
1
app/views/transactions/sales/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "transactions_sales/transactions_sale", transactions_sale: @transactions_sale
|
||||
Reference in New Issue
Block a user