diff --git a/app/controllers/settings/shops_controller.rb b/app/controllers/settings/shops_controller.rb new file mode 100644 index 00000000..25c8456d --- /dev/null +++ b/app/controllers/settings/shops_controller.rb @@ -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 diff --git a/app/models/shop.rb b/app/models/shop.rb index 24f4bc1e..9e8217df 100755 --- a/app/models/shop.rb +++ b/app/models/shop.rb @@ -1,4 +1,3 @@ class Shop < ApplicationRecord - end diff --git a/app/views/settings/shops/_form.html.erb b/app/views/settings/shops/_form.html.erb new file mode 100755 index 00000000..5f93ea50 --- /dev/null +++ b/app/views/settings/shops/_form.html.erb @@ -0,0 +1,67 @@ +
+ 1) address - to write shop's address
+ 2) city - to write city
+ 3) township - to write township
+ 4) state - to write state
+ 5) phone_no - to write shop's phone_no
+ 6) reservation_no - to write shop's reservation_no
+ 7) license - to write license
+ 8) license_data - to write license data
+ 9) base_currency - to write base currency
+ 10)cloud_token - to write cloud token
+ 11)cloud_url - to write cloud url
+ 12)owner_token - to write shop's owner token
+ 13)id_prefix - to write id prefix
+ 14)is_rounding_adj - to check for calculate rounding adj of shop
+ 15)quick_sale_summary - to check for view Quick Sale Summary
+ 16)calc_tax_order - to check for tax calculation of shop
+
+
+ 1) <%= t("views.right_panel.button.submit") %> - <%= t("views.right_panel.detail.submit_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %>
+
+ 1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %>
+ 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.shop_txt") %>
+
| Shop Name | +Phone No | +Reservation No | +Rouding Adj | +View Sale Summary | +Calculate Tax | +Actions | +
|---|---|---|---|---|---|---|
| <%= shop.name %> | +<%= shop.phone_no %> | +<%= shop.reservation_no %> | +<%= shop.is_rounding_adj %> | +<%= shop.quick_sale_summary %> | +<%= shop.calc_tax_order %> | + ++ <%= 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' %> + | +
+ 1) <%= t("views.right_panel.button.show") %> - <%= t("views.right_panel.detail.show_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %>
+ 2) <%= t("views.right_panel.button.edit") %> - <%= t("views.right_panel.detail.edit_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %>
+
+ 1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %>
+ 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.dashboard_txt") %>
+
| Name | +<%= @settings_shop.name %> | +
| Address | +<%= @settings_shop.address %> | +
| City | +<%= @settings_shop.city %> | +
| Township | +<%= @settings_shop.township %> | +
| State | +<%= @settings_shop.state %> | +
| Country | +<%= @settings_shop.country %> | +
| Phone No | +<%= @settings_shop.phone_no %> | +
| Reservation No | +<%= @settings_shop.reservation_no %> | +
| License | +<%= @settings_shop.license %> | +
| Activated At | +<%= @settings_shop.activated_at %> | +
| license Data | +<%= @settings_shop.license_data %> | +
| Base Currency | +<%= @settings_shop.base_currency %> | +
| Cloud Token | +<%= @settings_shop.cloud_token %> | +
| Cloud URL | +<%= @settings_shop.cloud_url %> | +
| Owner Token | +<%= @settings_shop.owner_token %> | +
| id prefix | +<%= @settings_shop.id_prefix %> | +
| Rounding adj | +<%= @settings_shop.is_rounding_adj %> | +
| Viwe Sale Summary | +<%= @settings_shop.quick_sale_summary %> | +
| Calculate Tax | +<%= @settings_shop.calc_tax_order %> | +
| <%= link_to t("views.btn.edit"), edit_settings_shop_path(@settings_shop),:class => 'btn btn-primary btn-sm waves-effect' %> + | +
+ 1) <%= t("views.right_panel.button.edit") %> - <%= t("views.right_panel.detail.edit_btn_txt") %> <%= t("views.right_panel.detail.shop_txt") %>
+
+ 1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %>
+ 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.dashboard_txt") %>
+