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"));
});
$("#order_queue_station_processing_items").val(items);
$("#order_queue_station_processing_items").val(JSON.stringify(items));
//$(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.
def account_params
params.require(:account).permit(:title, :account_type)
params.require(:account).permit(:title, :account_type,:discount,:point,:bonus,:rebate)
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.json
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|
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.' }

View File

@@ -1,6 +1,6 @@
class Settings::RoomsController < ApplicationController
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.json
def index
@@ -28,9 +28,10 @@ class Settings::RoomsController < ApplicationController
@settings_room = Room.new(settings_room_params)
@settings_room.type = DiningFacility::ROOM_TYPE
@settings_room.zone_id = params[:zone_id]
@settings_room.created_by = current_login_employee.name
respond_to do |format|
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 }
else
puts "abc"
@@ -43,9 +44,10 @@ class Settings::RoomsController < ApplicationController
# PATCH/PUT /settings/rooms/1
# PATCH/PUT /settings/rooms/1.json
def update
@settings_room.created_by = current_login_employee.name
respond_to do |format|
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 }
else
format.html { render :edit }
@@ -59,7 +61,7 @@ class Settings::RoomsController < ApplicationController
def destroy
@settings_room.destroy
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 }
end
end

View File

@@ -28,12 +28,12 @@ class Settings::TablesController < ApplicationController
@settings_table = Table.new(settings_table_params)
@settings_table.type = DiningFacility::TABLE_TYPE
@settings_table.zone_id = params[:zone_id]
@settings_table.created_by = current_login_employee.name
respond_to do |format|
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 }
else
puts "abc"
format.html { render :new }
format.json { render json: @settings_table.errors, status: :unprocessable_entity }
end
@@ -43,9 +43,10 @@ class Settings::TablesController < ApplicationController
# PATCH/PUT /settings/tables/1
# PATCH/PUT /settings/tables/1.json
def update
@settings_table.created_by = current_login_employee.name
respond_to do |format|
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 }
else
format.html { render :edit }
@@ -59,7 +60,7 @@ class Settings::TablesController < ApplicationController
def destroy
@settings_table.destroy
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 }
end
end

View File

@@ -27,7 +27,7 @@ class Settings::ZonesController < ApplicationController
# POST /settings/zones.json
def create
@settings_zone = Zone.new(settings_zone_params)
@settings_zone.created_by = current_login_employee.name
respond_to do |format|
if @settings_zone.save
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
def update
respond_to do |format|
@settings_zone.created_by = current_login_employee.name
if @settings_zone.update(settings_zone_params)
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully updated.' }
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.json
def destroy
@settings_zone.rooms.destroy
@settings_zone.tables.destroy
@settings_zone.destroy
respond_to do |format|
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 "Tax Profile", settings_tax_profiles_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>
</li>

View File

@@ -41,7 +41,7 @@
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @food_prices %></span></p> -->
</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="col-lg-6 col-md-1 col-sm-1">
@@ -84,9 +84,15 @@
<div class="pay purple" id="redeem">Pay</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 class="row">

View File

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

View File

@@ -14,9 +14,14 @@
<table class="table table-striped">
<thead>
<tr>
<th style="width:40%">Title</th>
<th style="width:40%">Account Type</th>
<th style="width:20%">Action</th>
<th>Title</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 style="">Action</th>
</tr>
</thead>
@@ -25,10 +30,14 @@
<tr>
<td><%= account.title %></td>
<td><%= account.account_type %></td>
<td><%= account.discount %></td>
<td><%= account.point %></td>
<td><%= account.bonus %></td>
<td><%= account.rebate %></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?' } %>
</td>
</tr>
<% end %>

View File

@@ -17,6 +17,10 @@
<tr>
<th>Title</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>
</tr>
</thead>
@@ -25,10 +29,14 @@
<tr>
<td><%= @settings_account.title %></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>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View File

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

View File

@@ -1,41 +1,47 @@
<p id="notice"><%= notice %></p>
<h1>Settings Membership Actions</h1>
<table>
<thead>
<tr>
<th>Membership type</th>
<th>Is active</th>
<th>Gateway communication type</th>
<th>Gateway url</th>
<th>Auth token</th>
<th>Merchant account</th>
<th>Created by</th>
<th>Additional parameter</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @settings_membership_actions.each do |settings_membership_action| %>
<tr>
<td><%= settings_membership_action.membership_type %></td>
<td><%= settings_membership_action.is_active %></td>
<td><%= settings_membership_action.gateway_communication_type %></td>
<td><%= settings_membership_action.gateway_url %></td>
<td><%= settings_membership_action.auth_token %></td>
<td><%= settings_membership_action.merchant_account_id %></td>
<td><%= settings_membership_action.created_by %></td>
<td><%= settings_membership_action.additional_parameter %></td>
<td><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %></td>
<td><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %></td>
<td><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<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>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Membership type</th>
<th>Is active</th>
<th>Gateway communication type</th>
<th>Gateway url</th>
<th>Auth token</th>
<th>Merchant account</th>
<th>Created by</th>
<th>Additional parameter</th>
<th colspan="3"></th>
</tr>
</thead>
<%= link_to 'New Settings Membership Action', new_settings_membership_action_path %>
<tbody>
<% @settings_membership_actions.each do |settings_membership_action| %>
<tr>
<td><%= settings_membership_action.membership_type %></td>
<td><%= settings_membership_action.is_active %></td>
<td><%= settings_membership_action.gateway_communication_type %></td>
<td><%= settings_membership_action.gateway_url %></td>
<td><%= settings_membership_action.auth_token %></td>
<td><%= settings_membership_action.merchant_account_id %></td>
<td><%= settings_membership_action.created_by %></td>
<td><%= settings_membership_action.additional_parameter %></td>
<td><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %></td>
<td><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %></td>
<td><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,6 +3,10 @@ class CreateAccounts < ActiveRecord::Migration[5.1]
create_table :accounts do |t|
t.string :title
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
end