Merge branch 'ui_ux_changes' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -183,7 +183,27 @@ $(document).ready(function() {
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".order").fileinput({
|
||||
previewFileType: "mp3",
|
||||
allowedFileExtensions: ["mp3"],
|
||||
browseClass: "btn btn-success",
|
||||
browseLabel: "Pick Audio",
|
||||
browseIcon: "<i class=\"fa fa-image\"></i> ",
|
||||
removeClass: "btn btn-danger",
|
||||
removeLabel: "Delete",
|
||||
removeIcon: "<i class=\"fa fa-trash\"></i> ",
|
||||
showUpload: false,
|
||||
// uploadClass: "btn btn-info",
|
||||
// uploadLabel: "Upload",
|
||||
// uploadIcon: "<i class=\"fa fa-upload\"></i> ",
|
||||
previewTemplates: {
|
||||
image: '<div class="file-preview-frame" id="{previewId}" data-fileindex="{fileindex}">\n' +
|
||||
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
|
||||
'</div>\n',
|
||||
}
|
||||
});
|
||||
|
||||
// first input focus for all form
|
||||
$('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus();
|
||||
|
||||
@@ -47,13 +47,26 @@ class Settings::ShopsController < ApplicationController
|
||||
# PATCH/PUT /settings/shops/1
|
||||
# PATCH/PUT /settings/shops/1.json
|
||||
def update
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_shop.update(shop_params)
|
||||
if params[:display_images].present?
|
||||
params[:display_images][:image].each do |a|
|
||||
@aa = Base64.encode64(a.read)
|
||||
@display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => "data:image/jpeg;base64,"+@aa)
|
||||
if File.extname(a.original_filename) == ".mp3"
|
||||
delete_path = Rails.root.join("public/#{@settings_shop.display_images.find_by_name("order_audio").image}")
|
||||
if File.exists?(delete_path)
|
||||
File.delete(delete_path)
|
||||
end
|
||||
save_path = Rails.root.join("public/#{Shop.find(1).shop_code}_#{a.original_filename}")
|
||||
File.open(save_path, 'wb') do |f|
|
||||
f.write a.read
|
||||
end
|
||||
audio_name = "#{Shop.find(1).shop_code}_#{a.original_filename}"
|
||||
@settings_shop.display_images.where(:name => "order_audio").destroy_all
|
||||
@display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :name => "order_audio", :image => audio_name)
|
||||
else
|
||||
@aa = Base64.encode64(a.read)
|
||||
@display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => "data:image/jpeg;base64,"+@aa)
|
||||
end
|
||||
end
|
||||
end
|
||||
format.html { redirect_to settings_shops_url, notice: 'Shop was successfully updated.' }
|
||||
@@ -85,6 +98,6 @@ class Settings::ShopsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def shop_params
|
||||
params.require(:shop).permit(:logo, :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,:show_account_info, display_images_attributes: [:id, :shop_id, :image])
|
||||
params.require(:shop).permit(:logo, :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,:show_account_info, display_images_attributes: [:id, :shop_id, :name, :image])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,20 +41,40 @@
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<label class="card-title">Shop Images</label>
|
||||
<div class="card-block">
|
||||
<label class="card-title">Shop Images</label>
|
||||
<div class="panel padding-10">
|
||||
<div class="form-group">
|
||||
<div class="menu-item-img">
|
||||
<%= f.fields_for :display_images do |p| %>
|
||||
<% 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 %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.file_field :image, :multiple => true, name: "display_images[image][]" %>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<label class="card-title">Audio File</label>
|
||||
<div class="panel padding-10">
|
||||
<div class="form-group">
|
||||
<div class="menu-item-img">
|
||||
<%= f.fields_for :display_images do |p| %>
|
||||
<% if !p.object.name.nil? %>
|
||||
<%= "#{p.object.image}"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.file_field :image, :multiple => true, name: "display_images[image][]" %>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.file_field :image, :multiple => false, name: "display_images[image][]", accept: 'audio/mp3', :class => "order" %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions p-l-15">
|
||||
|
||||
@@ -103,7 +103,19 @@
|
||||
<td style="width:20%">Shop Images</td>
|
||||
<td>
|
||||
<% @display_images.each do |p| %>
|
||||
<%= image_tag "#{p.image}", :class => "img-thumbnail second-display", :size => "155x185"%>
|
||||
<% if p.name.nil? %>
|
||||
<%= image_tag "#{p.image}", :class => "img-thumbnail second-display", :size => "155x185"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Order Audio</td>
|
||||
<td>
|
||||
<% @display_images.each do |p| %>
|
||||
<% if !p.name.nil? %>
|
||||
<%= image_tag "#{p.image}", :class => "img-thumbnail second-display", :size => "155x185"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -18,13 +18,13 @@ class ActionController::Base
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
else
|
||||
# check for license file
|
||||
if check_license
|
||||
current_license(ENV["SX_PROVISION_URL"])
|
||||
else
|
||||
redirect_to activate_path
|
||||
end
|
||||
# else
|
||||
# # check for license file
|
||||
# if check_license
|
||||
# current_license(ENV["SX_PROVISION_URL"])
|
||||
# else
|
||||
# redirect_to activate_path
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user