merge with settings

This commit is contained in:
Yan
2017-06-19 19:14:58 +06:30
18 changed files with 105 additions and 63 deletions

View File

@@ -40,7 +40,7 @@ $(document).on('turbolinks:load', function() {
items.push($(value).attr("data-id")); items.push($(value).attr("data-id"));
}); });
$("#order_queue_station_processing_items").val(items); $("#order_queue_station_processing_items").val(JSON.stringify(items));
//$(this).submit(); //$(this).submit();
}) })
}) })

View File

@@ -68,6 +68,6 @@ class Settings::AccountsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
def account_params def account_params
params.require(:account).permit(:title, :account_type) params.require(:account).permit(:title, :account_type,:discount,:point,:bonus,:rebate)
end end
end end

View File

@@ -41,7 +41,7 @@ class Settings::OrderQueueStationsController < ApplicationController
# PATCH/PUT /settings/order_queue_stations/1 # PATCH/PUT /settings/order_queue_stations/1
# PATCH/PUT /settings/order_queue_stations/1.json # PATCH/PUT /settings/order_queue_stations/1.json
def update def update
params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect # params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect
respond_to do |format| respond_to do |format|
if @settings_order_queue_station.update(settings_order_queue_station_params) if @settings_order_queue_station.update(settings_order_queue_station_params)
format.html { redirect_to settings_order_queue_station_path(@settings_order_queue_station), notice: 'Order queue station was successfully updated.' } format.html { redirect_to settings_order_queue_station_path(@settings_order_queue_station), notice: 'Order queue station was successfully updated.' }

View File

@@ -1,6 +1,6 @@
class Settings::RoomsController < ApplicationController class Settings::RoomsController < ApplicationController
before_action :set_settings_room, only: [:show, :edit, :update, :destroy] before_action :set_settings_room, only: [:show, :edit, :update, :destroy]
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create] before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create,:destroy]
# GET /settings/rooms # GET /settings/rooms
# GET /settings/rooms.json # GET /settings/rooms.json
def index def index
@@ -28,9 +28,10 @@ class Settings::RoomsController < ApplicationController
@settings_room = Room.new(settings_room_params) @settings_room = Room.new(settings_room_params)
@settings_room.type = DiningFacility::ROOM_TYPE @settings_room.type = DiningFacility::ROOM_TYPE
@settings_room.zone_id = params[:zone_id] @settings_room.zone_id = params[:zone_id]
@settings_room.created_by = current_login_employee.name
respond_to do |format| respond_to do |format|
if @settings_room.save if @settings_room.save
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully created.' } format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' }
format.json { render :show, status: :created, location: @settings_room } format.json { render :show, status: :created, location: @settings_room }
else else
puts "abc" puts "abc"
@@ -43,9 +44,10 @@ class Settings::RoomsController < ApplicationController
# PATCH/PUT /settings/rooms/1 # PATCH/PUT /settings/rooms/1
# PATCH/PUT /settings/rooms/1.json # PATCH/PUT /settings/rooms/1.json
def update def update
@settings_room.created_by = current_login_employee.name
respond_to do |format| respond_to do |format|
if @settings_room.update(settings_room_params) if @settings_room.update(settings_room_params)
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully updated.' } format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_room } format.json { render :show, status: :ok, location: @settings_room }
else else
format.html { render :edit } format.html { render :edit }
@@ -59,7 +61,7 @@ class Settings::RoomsController < ApplicationController
def destroy def destroy
@settings_room.destroy @settings_room.destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to settings_zones_path, notice: 'Room was successfully destroyed.' } format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully destroyed.' }
format.json { head :no_content } format.json { head :no_content }
end end
end end

View File

@@ -28,12 +28,12 @@ class Settings::TablesController < ApplicationController
@settings_table = Table.new(settings_table_params) @settings_table = Table.new(settings_table_params)
@settings_table.type = DiningFacility::TABLE_TYPE @settings_table.type = DiningFacility::TABLE_TYPE
@settings_table.zone_id = params[:zone_id] @settings_table.zone_id = params[:zone_id]
@settings_table.created_by = current_login_employee.name
respond_to do |format| respond_to do |format|
if @settings_table.save if @settings_table.save
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully created.' } format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully created.' }
format.json { render :show, status: :created, location: @settings_table } format.json { render :show, status: :created, location: @settings_table }
else else
puts "abc"
format.html { render :new } format.html { render :new }
format.json { render json: @settings_table.errors, status: :unprocessable_entity } format.json { render json: @settings_table.errors, status: :unprocessable_entity }
end end
@@ -43,9 +43,10 @@ class Settings::TablesController < ApplicationController
# PATCH/PUT /settings/tables/1 # PATCH/PUT /settings/tables/1
# PATCH/PUT /settings/tables/1.json # PATCH/PUT /settings/tables/1.json
def update def update
@settings_table.created_by = current_login_employee.name
respond_to do |format| respond_to do |format|
if @settings_table.update(settings_table_params) if @settings_table.update(settings_table_params)
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully updated.' } format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_table } format.json { render :show, status: :ok, location: @settings_table }
else else
format.html { render :edit } format.html { render :edit }
@@ -59,7 +60,7 @@ class Settings::TablesController < ApplicationController
def destroy def destroy
@settings_table.destroy @settings_table.destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to settings_zones_path, notice: 'Table was successfully destroyed.' } format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully destroyed.' }
format.json { head :no_content } format.json { head :no_content }
end end
end end

View File

@@ -27,7 +27,7 @@ class Settings::ZonesController < ApplicationController
# POST /settings/zones.json # POST /settings/zones.json
def create def create
@settings_zone = Zone.new(settings_zone_params) @settings_zone = Zone.new(settings_zone_params)
@settings_zone.created_by = current_login_employee.name
respond_to do |format| respond_to do |format|
if @settings_zone.save if @settings_zone.save
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully created.' } format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully created.' }
@@ -43,6 +43,7 @@ class Settings::ZonesController < ApplicationController
# PATCH/PUT /settings/zones/1.json # PATCH/PUT /settings/zones/1.json
def update def update
respond_to do |format| respond_to do |format|
@settings_zone.created_by = current_login_employee.name
if @settings_zone.update(settings_zone_params) if @settings_zone.update(settings_zone_params)
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully updated.' } format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_zone } format.json { render :show, status: :ok, location: @settings_zone }
@@ -56,6 +57,8 @@ class Settings::ZonesController < ApplicationController
# DELETE /settings/zones/1 # DELETE /settings/zones/1
# DELETE /settings/zones/1.json # DELETE /settings/zones/1.json
def destroy def destroy
@settings_zone.rooms.destroy
@settings_zone.tables.destroy
@settings_zone.destroy @settings_zone.destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' } format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' }

View File

@@ -23,6 +23,8 @@
<li><%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %></li> <li><%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %></li>
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li> <li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li> <li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
<hr>
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
</ul> </ul>
</li> </li>

View File

@@ -41,7 +41,7 @@
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p> --> <p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p> -->
</div> </div>
<div class="col-lg-7 col-md-7 col-sm-7"> <div class="col-lg-6 col-md-7 col-sm-7">
<div class="row"> <div class="row">
<div class="col-lg-6 col-md-1 col-sm-1"> <div class="col-lg-6 col-md-1 col-sm-1">
@@ -84,8 +84,14 @@
<div class="pay purple" id="redeem">Pay</div> <div class="pay purple" id="redeem">Pay</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment';"> Back </button>
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@@ -4,6 +4,10 @@
<div class="form-inputs"> <div class="form-inputs">
<%= f.input :title %> <%= f.input :title %>
<%= f.input :account_type, :collection => Lookup.collection_of("account_type") %> <%= f.input :account_type, :collection => Lookup.collection_of("account_type") %>
<%= f.input :discount %>
<%= f.input :point %>
<%= f.input :bonus %>
<%= f.input :rebate %>
</div> </div>
<div class="form-actions"> <div class="form-actions">
@@ -11,4 +15,3 @@
</div> </div>
<% end %> <% end %>

View File

@@ -14,9 +14,14 @@
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th style="width:40%">Title</th> <th>Title</th>
<th style="width:40%">Account Type</th> <th>Account Type</th>
<th style="width:20%">Action</th> <th>Can get Discount</th>
<th>Can get Points</th>
<th>Can get Bonus</th>
<th>Can rebate</th>
<th style="">Action</th>
</tr> </tr>
</thead> </thead>
@@ -25,6 +30,10 @@
<tr> <tr>
<td><%= account.title %></td> <td><%= account.title %></td>
<td><%= account.account_type %></td> <td><%= account.account_type %></td>
<td><%= account.discount %></td>
<td><%= account.point %></td>
<td><%= account.bonus %></td>
<td><%= account.rebate %></td>
<td> <td>
<%= link_to 'Edit', edit_settings_account_path(account) %> | <%= link_to 'Edit', edit_settings_account_path(account) %> |
<%= link_to 'Destroy', settings_account_path(account), method: :delete, data: { confirm: 'Are you sure?' } %> <%= link_to 'Destroy', settings_account_path(account), method: :delete, data: { confirm: 'Are you sure?' } %>

View File

@@ -17,6 +17,10 @@
<tr> <tr>
<th>Title</th> <th>Title</th>
<th>Account type</th> <th>Account type</th>
<th>Can get Discount</th>
<th>Can get Points</th>
<th>Can get Bonus</th>
<th>Can rebate</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
@@ -25,6 +29,10 @@
<tr> <tr>
<td><%= @settings_account.title %></td> <td><%= @settings_account.title %></td>
<td><%= @settings_account.account_type %></td> <td><%= @settings_account.account_type %></td>
<td><%= @settings_account.discount %></td>
<td><%= @settings_account.point %></td>
<td><%= @settings_account.bonus %></td>
<td><%= @settings_account.rebate %></td>
<td><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %></td> <td><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %></td>
</tr> </tr>

View File

@@ -9,7 +9,6 @@
<%= f.input :auth_token %> <%= f.input :auth_token %>
<%= f.input :merchant_account_id %> <%= f.input :merchant_account_id %>
<%= f.input :created_by %> <%= f.input :created_by %>
<%= f.input :additional_parameter %>
</div> </div>
<div class="form-actions"> <div class="form-actions">

View File

@@ -1,8 +1,17 @@
<p id="notice"><%= notice %></p>
<h1>Settings Membership Actions</h1> <div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li>Settings Membership Actions</li>
<span style="float: right">
<%= link_to 'New Settings Membership Action', new_settings_membership_action_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<table> <br>
<div class="card">
<table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>Membership type</th> <th>Membership type</th>
@@ -35,7 +44,4 @@
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
</div>
<br>
<%= link_to 'New Settings Membership Action', new_settings_membership_action_path %>

View File

@@ -13,6 +13,7 @@ div.form-inputs span{
<%= f.input :printer_name %> <%= f.input :printer_name %>
<%= f.input :font_size %> <%= f.input :font_size %>
<%= f.input :print_copy %> <%= f.input :print_copy %>
<%= f.hidden_field :processing_items %>
<%= f.label "Select Zones", :class => 'control-label' %> <%= f.label "Select Zones", :class => 'control-label' %>
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'ta'%> <%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'ta'%>
<%= f.input :cut_per_item %> <%= f.input :cut_per_item %>

View File

@@ -7,7 +7,6 @@
<%= f.input :seater %> <%= f.input :seater %>
<%= f.input :order_by %> <%= f.input :order_by %>
<%= f.input :is_active %> <%= f.input :is_active %>
<%= f.input :created_by, :collection => Employee.collection %>
</div> </div>
<div class="form-actions"> <div class="form-actions">

View File

@@ -7,7 +7,6 @@
<%= f.input :seater %> <%= f.input :seater %>
<%= f.input :order_by %> <%= f.input :order_by %>
<%= f.input :is_active %> <%= f.input :is_active %>
<%= f.input :created_by, :collection => Employee.collection %>
</div> </div>
<div class="form-actions"> <div class="form-actions">

View File

@@ -4,7 +4,7 @@
<div class="form-inputs"> <div class="form-inputs">
<%= f.input :name %> <%= f.input :name %>
<%= f.input :is_active %> <%= f.input :is_active %>
<%= f.input :created_by, :collection => Employee.collection %> <!-- <%= f.input :created_by, :collection => Employee.collection %> -->
</div> </div>
<div class="form-actions"> <div class="form-actions">

View File

@@ -3,6 +3,10 @@ class CreateAccounts < ActiveRecord::Migration[5.1]
create_table :accounts do |t| create_table :accounts do |t|
t.string :title t.string :title
t.string :account_type t.string :account_type
t.boolean :discount, :null => false, :default => false
t.boolean :point, :null => false, :default => false
t.boolean :bonus, :null => false, :default => false
t.boolean :rebate, :null => false, :default => false
t.timestamps t.timestamps
end end