cover image

This commit is contained in:
Myat Zin Wai Maw
2020-03-06 11:20:16 +06:30
parent 7394ca7e8d
commit 54175ddcdf
6 changed files with 35 additions and 17 deletions

View File

@@ -0,0 +1,10 @@
class Api::DisplayImagesController < Api::ApiController
skip_before_action :authenticate
def display_image
display_image = DisplayImage.where("shop_code",params[:shop_code]).last
unless display_image.nil?
image = Base64.decode64(display_image.image.gsub(/\Adata:image\/jpeg;base64\,/, ''))
send_data image,:filename=>"shop.jpeg",:type=> "image/jpeg", :disposition => 'inline'
end
end
end

View File

@@ -3,9 +3,8 @@ class Api::ShopsController < Api::ApiController
skip_before_action :set_current_tenant_by_subdomain_or_name, only: [:index, :show]
def index
@shops = Shop.select('shops.id, logo, shops.name, shops.shop_code,image as cover')
.left_joins(:display_images)
.where.not(cloud_url: nil).order('shop_code,display_images.created_at desc').uniq
@shops = Shop.select('shops.id, logo, shops.name, shops.shop_code')
# @shops = Shop.select('id, logo, name, shop_code').where.not(cloud_url: nil).all
end
def show

View File

@@ -1,6 +1,12 @@
if @shops
json.status true
json.data @shops
json.data @shops do |shop|
json.id shop.id
json.name shop.name
json.logo shop.logo
json.shop_code shop.shop_code
json.cover shop.display_images.empty? ? nil : "#{api_display_image_url(shop.shop_code)}.jpeg"
end
else
json.status false
json.message "Record Not Found"

View File

@@ -23,7 +23,7 @@
<%= f.input :quick_sale_summary %>
<%= f.input :calc_tax_order %>
<%= f.input :show_account_info %>
</div>
@@ -34,13 +34,13 @@
<% if f.object.logo? %>
<p><%= f.object.name %></p>
<%= image_tag f.object.logo.url, :class => "img-thumbnail" %>
<% else %>
<% else %>
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
<% end %>
<% end %>
</div>
<%= f.file_field :logo, :class => "img-thumbnail" %>
</div>
</div>
</div>
<div class="card">
<div class="card-block">
@@ -52,14 +52,14 @@
<% if p.object.name.nil? %>
<%= image_tag "#{p.object.image}", :class => "img-thumbnail second-display", :size => "150x185"%>
<%= link_to '<i class="material-icons">delete</i>'.html_safe, settings_shop_display_image_path(p.object), method: :delete %>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
</div>
</div>
</div>
</div>
<%= f.file_field :image, :multiple => true, name: "display_images[image][]" %>
</div>
</div>
<div class="card">
<div class="card-block">
@@ -71,13 +71,13 @@
<% if !p.object.name.nil? %>
<%= "#{p.object.image}"%>
<% end %>
<% end %>
<% end %>
</div>
</div>
</div>
</div>
</div>
<%= f.file_field :image, :multiple => false, name: "display_images[image][]", accept: 'audio/mp3', :class => "order" %>
</div>
</div>
<%= f.input :note, as: :text, :input_html => { :rows => 5} %>
@@ -110,7 +110,7 @@
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>
@@ -122,6 +122,6 @@
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>
</div>

0
blah Normal file
View File

View File

@@ -138,6 +138,9 @@ scope "(:locale)", locale: /en|mm/ do
#for foodcourt app
get "search_paypar_account_no" => "payments#search_paypar_account_no"
# get "check_security_code" => "payments#check_security_code"
#for display image
get "display_image/:shop_code" => "display_images#display_image", as:'display_image'
end
#--------- Cashier ------------#