From 376af85c64b4360f1941981b481a3121bf7e422b Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 26 Jun 2017 19:02:36 +0630 Subject: [PATCH 1/2] update credit --- .../transactions/credit_notes_controller.rb | 18 +++++ app/models/sale.rb | 2 +- app/views/layouts/_header.html.erb | 1 + .../transactions/credit_notes/index.html.erb | 70 +++++++++++++++++++ config/routes.rb | 1 + 5 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 app/views/transactions/credit_notes/index.html.erb diff --git a/app/controllers/transactions/credit_notes_controller.rb b/app/controllers/transactions/credit_notes_controller.rb index e69de29b..0f370c96 100644 --- a/app/controllers/transactions/credit_notes_controller.rb +++ b/app/controllers/transactions/credit_notes_controller.rb @@ -0,0 +1,18 @@ +class Transactions::CreditNotesController < ApplicationController + before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy] + + # GET /transactions/sales + # GET /transactions/sales.json + def index + + @sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING) + + + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @sales } + end + + end + end \ No newline at end of file diff --git a/app/models/sale.rb b/app/models/sale.rb index 6b5efbb3..8f7f17d8 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -22,7 +22,7 @@ class Sale < ApplicationRecord "monthly" => 1, "yearly" => 2 } - + SALE_STATUS_OUTSTANDING = "outstanding" SALE_STATUS_COMPLETED = "completed" def generate_invoice_from_booking(booking_id, requested_by) diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 5505bad7..05b74b7a 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -33,6 +33,7 @@