From 74c2955ef0faaa3eac09df4667ee88a0ae4149c9 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Tue, 22 Aug 2017 11:08:49 +0630 Subject: [PATCH] create productCommission --- .idea/workspace.xml | 300 +++-- .../origami/product_commissions_controller.rb | 74 ++ .../origami/product_commissions_helper.rb | 2 + app/models/product_commission.rb | 2 + app/views/home/dashboard.html.erb | 27 +- app/views/home/index.html.erb | 197 ++-- app/views/layouts/_header.html.erb | 2 +- app/views/origami/home/show.html.erb | 1049 +++++++++-------- .../product_commissions/_form.html.erb | 10 + .../_product_commission.json.jbuilder | 2 + .../origami/product_commissions/edit.html.erb | 6 + .../product_commissions/index.html.erb | 25 + .../product_commissions/index.json.jbuilder | 1 + .../origami/product_commissions/new.html.erb | 5 + .../origami/product_commissions/show.html.erb | 4 + .../product_commissions/show.json.jbuilder | 1 + ...170822034139_create_product_commissions.rb | 12 + .../product_commissions_controller_spec.rb | 141 +++ .../product_commissions_helper_spec.rb | 15 + spec/models/product_commission_spec.rb | 5 + .../origami_product_commissions_spec.rb | 10 + .../product_commissions_routing_spec.rb | 39 + .../product_commissions/edit.html.erb_spec.rb | 14 + .../index.html.erb_spec.rb | 14 + .../product_commissions/new.html.erb_spec.rb | 14 + .../product_commissions/show.html.erb_spec.rb | 11 + 26 files changed, 1187 insertions(+), 795 deletions(-) create mode 100644 app/controllers/origami/product_commissions_controller.rb create mode 100644 app/helpers/origami/product_commissions_helper.rb create mode 100644 app/models/product_commission.rb create mode 100644 app/views/origami/product_commissions/_form.html.erb create mode 100644 app/views/origami/product_commissions/_product_commission.json.jbuilder create mode 100644 app/views/origami/product_commissions/edit.html.erb create mode 100644 app/views/origami/product_commissions/index.html.erb create mode 100644 app/views/origami/product_commissions/index.json.jbuilder create mode 100644 app/views/origami/product_commissions/new.html.erb create mode 100644 app/views/origami/product_commissions/show.html.erb create mode 100644 app/views/origami/product_commissions/show.json.jbuilder create mode 100644 db/migrate/20170822034139_create_product_commissions.rb create mode 100644 spec/controllers/origami/product_commissions_controller_spec.rb create mode 100644 spec/helpers/origami/product_commissions_helper_spec.rb create mode 100644 spec/models/product_commission_spec.rb create mode 100644 spec/requests/origami/origami_product_commissions_spec.rb create mode 100644 spec/routing/origami/product_commissions_routing_spec.rb create mode 100644 spec/views/origami/product_commissions/edit.html.erb_spec.rb create mode 100644 spec/views/origami/product_commissions/index.html.erb_spec.rb create mode 100644 spec/views/origami/product_commissions/new.html.erb_spec.rb create mode 100644 spec/views/origami/product_commissions/show.html.erb_spec.rb diff --git a/.idea/workspace.xml b/.idea/workspace.xml index fdfb3e9b..de9b54ce 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,20 +2,11 @@ - - - - - - - - - - - - - + + + + @@ -32,101 +23,74 @@ - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -136,11 +100,12 @@ - origami table_invoice sale_id oqs void + red + origami @@ -154,7 +119,6 @@ @@ -330,59 +298,7 @@ @@ -800,6 +717,9 @@ + + + @@ -812,12 +732,12 @@ - + - @@ -828,19 +748,19 @@ + + - - @@ -854,8 +774,6 @@ - - @@ -863,9 +781,7 @@ - - @@ -887,9 +803,6 @@ - - - @@ -992,14 +905,6 @@ - - - - - - - - @@ -1059,7 +964,7 @@ - + @@ -1082,8 +987,75 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/origami/product_commissions_controller.rb b/app/controllers/origami/product_commissions_controller.rb new file mode 100644 index 00000000..f3f05ab9 --- /dev/null +++ b/app/controllers/origami/product_commissions_controller.rb @@ -0,0 +1,74 @@ +class Origami::ProductCommissionsController < ApplicationController + before_action :set_product_commission, only: [:show, :edit, :update, :destroy] + + # GET /product_commissions + # GET /product_commissions.json + def index + @product_commissions = ProductCommission.all + end + + # GET /product_commissions/1 + # GET /product_commissions/1.json + def show + end + + # GET /product_commissions/new + def new + @product_commission = ProductCommission.new + end + + # GET /product_commissions/1/edit + def edit + end + + # POST /product_commissions + # POST /product_commissions.json + def create + @product_commission = ProductCommission.new(product_commission_params) + + respond_to do |format| + if @product_commission.save + format.html { redirect_to @product_commission, notice: 'Product commission was successfully created.' } + format.json { render :show, status: :created, location: @product_commission } + else + format.html { render :new } + format.json { render json: @product_commission.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /product_commissions/1 + # PATCH/PUT /product_commissions/1.json + def update + respond_to do |format| + if @product_commission.update(product_commission_params) + format.html { redirect_to @product_commission, notice: 'Product commission was successfully updated.' } + format.json { render :show, status: :ok, location: @product_commission } + else + format.html { render :edit } + format.json { render json: @product_commission.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /product_commissions/1 + # DELETE /product_commissions/1.json + def destroy + @product_commission.destroy + respond_to do |format| + format.html { redirect_to product_commissions_url, notice: 'Product commission was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_product_commission + @product_commission = ProductCommission.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def product_commission_params + params.fetch(:product_commission, {}) + end +end diff --git a/app/helpers/origami/product_commissions_helper.rb b/app/helpers/origami/product_commissions_helper.rb new file mode 100644 index 00000000..1d191b16 --- /dev/null +++ b/app/helpers/origami/product_commissions_helper.rb @@ -0,0 +1,2 @@ +module Origami::ProductCommissionsHelper +end diff --git a/app/models/product_commission.rb b/app/models/product_commission.rb new file mode 100644 index 00000000..70de81f8 --- /dev/null +++ b/app/models/product_commission.rb @@ -0,0 +1,2 @@ +class ProductCommission < ApplicationRecord +end diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index 511cd500..025cfae9 100644 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -30,7 +30,7 @@
- Origami + Cashier
@@ -66,8 +66,7 @@

- Administrator - + Administrator

@@ -105,7 +104,7 @@
  • OQS

  • -
  • Origami

  • +
  • Cashier

  • CRM
@@ -115,8 +114,7 @@

- Manager - + Manager

@@ -152,7 +150,7 @@
  • OQS

  • -
  • Origami

  • +
  • Cashier

  • CRM
@@ -162,8 +160,7 @@

- Supervisor - + Supervisor

@@ -185,14 +182,13 @@

- Cashier - + Cashier

    -
  • Orgami Panel except Edit and Void
  • +
  • Cashier Panel except Edit and Void
  • Sale and Order
  • and Queue in CRM
@@ -203,8 +199,7 @@

- Accountant - + Accountant

@@ -223,11 +218,11 @@
-