update shop form
This commit is contained in:
76
app/controllers/settings/shops_controller.rb
Normal file
76
app/controllers/settings/shops_controller.rb
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
class Settings::ShopsController < ApplicationController
|
||||||
|
load_and_authorize_resource except: [:create]
|
||||||
|
before_action :set_shop, only: [:show, :edit, :update]
|
||||||
|
|
||||||
|
# GET /settings/shops
|
||||||
|
# GET /settings/shops.json
|
||||||
|
def index
|
||||||
|
@settings_shops = Shop.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/shops/1
|
||||||
|
# GET /settings/shops/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/shops/new
|
||||||
|
def new
|
||||||
|
@settings_shop = Shop.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /settings/shops/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /settings/shops
|
||||||
|
# POST /settings/shops.json
|
||||||
|
def create
|
||||||
|
@settings_shop = Shop.new(shop_params)
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_shop.save
|
||||||
|
format.html { redirect_to settings_shops_url, notice: 'Shop was successfully created.' }
|
||||||
|
format.json { render :index, status: :created, location: @settings_shop }
|
||||||
|
else
|
||||||
|
format.html { render :new }
|
||||||
|
format.json { render json: settings_shops_url.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /settings/shops/1
|
||||||
|
# PATCH/PUT /settings/shops/1.json
|
||||||
|
def update
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_shop.update(shop_params)
|
||||||
|
format.html { redirect_to settings_shops_url, notice: 'Shop was successfully updated.' }
|
||||||
|
format.json { render :index, status: :ok, location: @settings_shop }
|
||||||
|
else
|
||||||
|
format.html { render :edit }
|
||||||
|
format.json { render json: settings_shops_url.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /settings/shops/1
|
||||||
|
# DELETE /settings/shops/1.json
|
||||||
|
def destroy
|
||||||
|
@settings_shop.destroy
|
||||||
|
flash[:notice] = 'Shop was successfully destroyed.'
|
||||||
|
render :json => {:status=> "Success", :url => settings_shops_url }.to_json
|
||||||
|
# respond_to do |format|
|
||||||
|
# format.html { redirect_to settings_shops_url, notice: 'shop was successfully destroyed.' }
|
||||||
|
# format.json { head :no_content }
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_shop
|
||||||
|
@settings_shop = Shop.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
|
def shop_params
|
||||||
|
params.require(:shop).permit(:name,:address,:city,:township,:state,:country,:phone_no,:reservation_no,:license,:activated_at,:license_data,:base_currency,:cloud_token,:cloud_url,:owner_token,:id_prefix,:is_rounding_adj,:quick_sale_summary,:calc_tax_order)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
class Shop < ApplicationRecord
|
class Shop < ApplicationRecord
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
67
app/views/settings/shops/_form.html.erb
Executable file
67
app/views/settings/shops/_form.html.erb
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
|
||||||
|
<%= simple_form_for([:settings,@settings_shop]) do |f| %>
|
||||||
|
<%= f.error_notification %>
|
||||||
|
<div class="form-inputs p-l-10">
|
||||||
|
<%= f.input :name ,:input_html=>{:class=>"col-md-10"},:required=>true%>
|
||||||
|
|
||||||
|
<%= f.input :address %>
|
||||||
|
<%= f.input :city %>
|
||||||
|
<%= f.input :township %>
|
||||||
|
<%= f.input :state %>
|
||||||
|
<%= f.input :phone_no %>
|
||||||
|
<%= f.input :reservation_no %>
|
||||||
|
<%= f.input :license %>
|
||||||
|
<%= f.input :license_data %>
|
||||||
|
<%= f.input :base_currency %>
|
||||||
|
<%= f.input :cloud_token %>
|
||||||
|
<%= f.input :cloud_url %>
|
||||||
|
<%= f.input :owner_token %>
|
||||||
|
<%= f.input :id_prefix %>
|
||||||
|
<%= f.input :is_rounding_adj %>
|
||||||
|
<%= f.input :quick_sale_summary %>
|
||||||
|
<%= f.input :calc_tax_order %>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="body">
|
||||||
|
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
||||||
|
<p>
|
||||||
|
1) address - to write shop's address <br>
|
||||||
|
2) city - to write city <br>
|
||||||
|
3) township - to write township <br>
|
||||||
|
4) state - to write state <br>
|
||||||
|
5) phone_no - to write shop's phone_no <br>
|
||||||
|
6) reservation_no - to write shop's reservation_no <br>
|
||||||
|
7) license - to write license <br>
|
||||||
|
8) license_data - to write license data <br>
|
||||||
|
9) base_currency - to write base currency <br>
|
||||||
|
10)cloud_token - to write cloud token <br>
|
||||||
|
11)cloud_url - to write cloud url <br>
|
||||||
|
12)owner_token - to write shop's owner token <br>
|
||||||
|
13)id_prefix - to write id prefix <br>
|
||||||
|
14)is_rounding_adj - to check for calculate rounding adj of shop <br>
|
||||||
|
15)quick_sale_summary - to check for view Quick Sale Summary <br>
|
||||||
|
16)calc_tax_order - to check for tax calculation of shop <br>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.button_lists") %></i> </h5>
|
||||||
|
<p>
|
||||||
|
1) <%= t("views.right_panel.button.submit") %> - <%= t("views.right_panel.detail.submit_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %> <br>
|
||||||
|
</p>
|
||||||
|
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.link_lists") %></i> </h5>
|
||||||
|
<p>
|
||||||
|
1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %> <br>
|
||||||
|
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.shop_txt") %> <br>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
2
app/views/settings/shops/_settings_account.json.jbuilder
Executable file
2
app/views/settings/shops/_settings_account.json.jbuilder
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
json.extract! settings_account, :id, :title, :account_type, :created_at, :updated_at
|
||||||
|
json.url settings_account_url(settings_account, format: :json)
|
||||||
12
app/views/settings/shops/edit.html.erb
Executable file
12
app/views/settings/shops/edit.html.erb
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="<%= settings_shops_path %>"><%= t("views.right_panel.detail.shop") %></a></li>
|
||||||
|
<li class="breadcrumb-item active"><%= t("views.btn.edit") %></li>
|
||||||
|
<span class="float-right">
|
||||||
|
<%= link_to t('.back', :default => t("views.btn.back")), settings_shops_path %>
|
||||||
|
</span>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= render 'form', settings_shop: @settings_shop %>
|
||||||
67
app/views/settings/shops/index.html.erb
Executable file
67
app/views/settings/shops/index.html.erb
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||||
|
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.shop") %></li>
|
||||||
|
<span class="float-right">
|
||||||
|
<%= link_to t('.back', :default => t("views.btn.back")), dashboard_path %>
|
||||||
|
</span>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
|
||||||
|
<!-- <div class="m-b-10 clearfix">
|
||||||
|
<%= link_to t("views.btn.new"),new_settings_shop_path,:class => 'btn btn-primary btn-lg float-right waves-effect"' %>
|
||||||
|
</div> -->
|
||||||
|
<div class="card">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Shop Name</th>
|
||||||
|
<th>Phone No</th>
|
||||||
|
<th>Reservation No</th>
|
||||||
|
<th>Rouding Adj</th>
|
||||||
|
<th>View Sale Summary</th>
|
||||||
|
<th>Calculate Tax</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @settings_shops.each do |shop| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= shop.name %></td>
|
||||||
|
<td><%= shop.phone_no %></td>
|
||||||
|
<td><%= shop.reservation_no %></td>
|
||||||
|
<td><%= shop.is_rounding_adj %></td>
|
||||||
|
<td><%= shop.quick_sale_summary %></td>
|
||||||
|
<td><%= shop.calc_tax_order %></td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<%= link_to t("views.btn.show"), settings_shop_path(shop),:class => 'btn btn-info btn-sm waves-effect' %>
|
||||||
|
<%= link_to t("views.btn.edit"), edit_settings_shop_path(shop),:class => 'btn btn-primary btn-sm waves-effect' %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="body">
|
||||||
|
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.button_lists") %></i> </h5>
|
||||||
|
<p>
|
||||||
|
1) <%= t("views.right_panel.button.show") %> - <%= t("views.right_panel.detail.show_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %> <br>
|
||||||
|
2) <%= t("views.right_panel.button.edit") %> - <%= t("views.right_panel.detail.edit_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %> <br>
|
||||||
|
</p>
|
||||||
|
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.link_lists") %></i> </h5>
|
||||||
|
<p>
|
||||||
|
1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %> <br>
|
||||||
|
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.dashboard_txt") %> <br>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
1
app/views/settings/shops/index.json.jbuilder
Executable file
1
app/views/settings/shops/index.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
|||||||
|
json.array! @settings_accounts, partial: 'settings_accounts/settings_account', as: :settings_account
|
||||||
126
app/views/settings/shops/show.html.erb
Executable file
126
app/views/settings/shops/show.html.erb
Executable file
@@ -0,0 +1,126 @@
|
|||||||
|
<!-- -->
|
||||||
|
<div class="page-header">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="<%= settings_shops_path %>"><%= t("views.right_panel.detail.shop") %></a></li>
|
||||||
|
<li class="breadcrumb-item active"><%= t :details %></li>
|
||||||
|
<span class="float-right">
|
||||||
|
<%= link_to t('.back', :default => t("views.btn.back")), settings_shops_path %>
|
||||||
|
</span>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-block">
|
||||||
|
<table class="table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Name</td>
|
||||||
|
<td><%= @settings_shop.name %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Address</td>
|
||||||
|
<td><%= @settings_shop.address %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>City</td>
|
||||||
|
<td><%= @settings_shop.city %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Township</td>
|
||||||
|
<td><%= @settings_shop.township %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>State</td>
|
||||||
|
<td><%= @settings_shop.state %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Country</td>
|
||||||
|
<td><%= @settings_shop.country %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Phone No</td>
|
||||||
|
<td><%= @settings_shop.phone_no %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Reservation No</td>
|
||||||
|
<td><%= @settings_shop.reservation_no %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>License</td>
|
||||||
|
<td><%= @settings_shop.license %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Activated At</td>
|
||||||
|
<td><%= @settings_shop.activated_at %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>license Data</td>
|
||||||
|
<td><%= @settings_shop.license_data %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Base Currency</td>
|
||||||
|
<td><%= @settings_shop.base_currency %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Cloud Token</td>
|
||||||
|
<td><%= @settings_shop.cloud_token %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Cloud URL</td>
|
||||||
|
<td><%= @settings_shop.cloud_url %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Owner Token</td>
|
||||||
|
<td><%= @settings_shop.owner_token %></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>id prefix</td>
|
||||||
|
<td><%= @settings_shop.id_prefix %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Rounding adj</td>
|
||||||
|
<td><%= @settings_shop.is_rounding_adj %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Viwe Sale Summary</td>
|
||||||
|
<td><%= @settings_shop.quick_sale_summary %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Calculate Tax</td>
|
||||||
|
<td><%= @settings_shop.calc_tax_order %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
|
||||||
|
<td><%= link_to t("views.btn.edit"), edit_settings_shop_path(@settings_shop),:class => 'btn btn-primary btn-sm waves-effect' %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="body">
|
||||||
|
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.button_lists") %></i> </h5>
|
||||||
|
<p>
|
||||||
|
1) <%= t("views.right_panel.button.edit") %> - <%= t("views.right_panel.detail.edit_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %> <br>
|
||||||
|
</p>
|
||||||
|
<h5><i class="material-icons md-18">list <%= t("views.right_panel.header.link_lists") %></i> </h5>
|
||||||
|
<p>
|
||||||
|
1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %> <br>
|
||||||
|
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.dashboard_txt") %> <br>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
1
app/views/settings/shops/show.json.jbuilder
Executable file
1
app/views/settings/shops/show.json.jbuilder
Executable file
@@ -0,0 +1 @@
|
|||||||
|
json.partial! "settings_accounts/settings_account", settings_account: @settings_account
|
||||||
@@ -246,6 +246,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
|
|
||||||
#--------- System Settings ------------#
|
#--------- System Settings ------------#
|
||||||
namespace :settings do
|
namespace :settings do
|
||||||
|
resources :shops
|
||||||
#employees
|
#employees
|
||||||
resources :employees
|
resources :employees
|
||||||
#menu
|
#menu
|
||||||
|
|||||||
Reference in New Issue
Block a user