diff --git a/app/assets/javascripts/BSBMaterial/turbolink_admin.js b/app/assets/javascripts/BSBMaterial/turbolink_admin.js new file mode 100644 index 00000000..50a3a8a2 --- /dev/null +++ b/app/assets/javascripts/BSBMaterial/turbolink_admin.js @@ -0,0 +1,458 @@ +if (typeof jQuery === "undefined") { + throw new Error("jQuery plugins need to be before this file"); +} + +$.AdminBSB = {}; +$.AdminBSB.options = { + colors: { + red: '#F44336', + pink: '#E91E63', + purple: '#9C27B0', + deepPurple: '#673AB7', + indigo: '#3F51B5', + blue: '#2196F3', + lightBlue: '#03A9F4', + cyan: '#00BCD4', + teal: '#009688', + green: '#4CAF50', + lightGreen: '#8BC34A', + lime: '#CDDC39', + yellow: '#ffe821', + amber: '#FFC107', + orange: '#FF9800', + deepOrange: '#FF5722', + brown: '#795548', + grey: '#9E9E9E', + blueGrey: '#607D8B', + black: '#000000', + white: '#ffffff' + }, + leftSideBar: { + scrollColor: 'rgba(0,0,0,0.5)', + scrollWidth: '4px', + scrollAlwaysVisible: false, + scrollBorderRadius: '0', + scrollRailBorderRadius: '0', + scrollActiveItemWhenPageLoad: true, + breakpointWidth: 2230 //1170 + }, + dropdownMenu: { + effectIn: 'fadeIn', + effectOut: 'fadeOut' + } +} + +/* Left Sidebar - Function ================================================================================================= +* You can manage the left sidebar menu options +* +*/ +$.AdminBSB.leftSideBar = { + activate: function () { + var _this = this; + var $body = $('body'); + var $overlay = $('.overlay'); + + //Close sidebar + $(window).click(function (e) { + var $target = $(e.target); + if (e.target.nodeName.toLowerCase() === 'i') { $target = $(e.target).parent(); } + + if (!$target.hasClass('bars') && _this.isOpen() && $target.parents('#leftsidebar').length === 0) { + if (!$target.hasClass('js-right-sidebar')) $overlay.fadeOut(); + $body.removeClass('overlay-open'); + } + }); + + $.each($('.menu-toggle.toggled'), function (i, val) { + $(val).next().slideToggle(0); + }); + + //When page load + $.each($('.menu .list li.active'), function (i, val) { + var $activeAnchors = $(val).find('a:eq(0)'); + + $activeAnchors.addClass('toggled'); + $activeAnchors.next().show(); + }); + + //Collapse or Expand Menu + $('.menu-toggle').on('click', function (e) { + var $this = $(this); + var $content = $this.next(); + + if ($($this.parents('ul')[0]).hasClass('list')) { + var $not = $(e.target).hasClass('menu-toggle') ? e.target : $(e.target).parents('.menu-toggle'); + + $.each($('.menu-toggle.toggled').not($not).next(), function (i, val) { + if ($(val).is(':visible')) { + $(val).prev().toggleClass('toggled'); + $(val).slideUp(); + } + }); + } + + $this.toggleClass('toggled'); + $content.slideToggle(320); + }); + + //Set menu height + _this.setMenuHeight(); + _this.checkStatuForResize(true); + $(window).resize(function () { + _this.setMenuHeight(); + _this.checkStatuForResize(false); + }); + + //Set Waves + Waves.attach('.menu .list a', ['waves-block']); + Waves.init(); + }, + setMenuHeight: function (isFirstTime) { + if (typeof $.fn.slimScroll != 'undefined') { + var configs = $.AdminBSB.options.leftSideBar; + var height = ($(window).height() - ($('.legal').outerHeight() + $('.user-info').outerHeight() + $('.navbar').innerHeight())); + var $el = $('.list'); + + $el.slimscroll({ + height: height + "px", + color: configs.scrollColor, + size: configs.scrollWidth, + alwaysVisible: configs.scrollAlwaysVisible, + borderRadius: configs.scrollBorderRadius, + railBorderRadius: configs.scrollRailBorderRadius + }); + + //Scroll active menu item when page load, if option set = true + if ($.AdminBSB.options.leftSideBar.scrollActiveItemWhenPageLoad) { + var activeItemOffsetTop = $('.menu .list li.active')[0].offsetTop + if (activeItemOffsetTop > 150) $el.slimscroll({ scrollTo: activeItemOffsetTop + 'px' }); + } + } + }, + checkStatuForResize: function (firstTime) { + var $body = $('body'); + var $openCloseBar = $('.navbar .navbar-header .bars'); + var width = $body.width(); + + if (firstTime) { + $body.find('.content, .sidebar').addClass('no-animate').delay(1000).queue(function () { + $(this).removeClass('no-animate').dequeue(); + }); + } + + if (width < $.AdminBSB.options.leftSideBar.breakpointWidth) { + $body.addClass('ls-closed'); + $openCloseBar.fadeIn(); + } + else { + $body.removeClass('ls-closed'); + $openCloseBar.fadeOut(); + } + }, + isOpen: function () { + return $('body').hasClass('overlay-open'); + } +}; +//========================================================================================================================== + +/* Right Sidebar - Function ================================================================================================ +* You can manage the right sidebar menu options +* +*/ +$.AdminBSB.rightSideBar = { + activate: function () { + var _this = this; + var $sidebar = $('#rightsidebar'); + var $overlay = $('.overlay'); + + //Close sidebar + $(window).click(function (e) { + var $target = $(e.target); + if (e.target.nodeName.toLowerCase() === 'i') { $target = $(e.target).parent(); } + + if (!$target.hasClass('js-right-sidebar') && _this.isOpen() && $target.parents('#rightsidebar').length === 0) { + if (!$target.hasClass('bars')) $overlay.fadeOut(); + $sidebar.removeClass('open'); + } + }); + + $('.js-right-sidebar').on('click', function () { + $sidebar.toggleClass('open'); + if (_this.isOpen()) { $overlay.fadeIn(); } else { $overlay.fadeOut(); } + }); + }, + isOpen: function () { + return $('.right-sidebar').hasClass('open'); + } +} +//========================================================================================================================== + +/* Searchbar - Function ================================================================================================ +* You can manage the search bar +* +*/ +var $searchBar = $('.search-bar'); +$.AdminBSB.search = { + activate: function () { + var _this = this; + + //Search button click event + $('.js-search').on('click', function () { + _this.showSearchBar(); + }); + + //Close search click event + $searchBar.find('.close-search').on('click', function () { + _this.hideSearchBar(); + }); + + //ESC key on pressed + $searchBar.find('input[type="text"]').on('keyup', function (e) { + if (e.keyCode == 27) { + _this.hideSearchBar(); + } + }); + }, + showSearchBar: function () { + $searchBar.addClass('open'); + $searchBar.find('input[type="text"]').focus(); + }, + hideSearchBar: function () { + $searchBar.removeClass('open'); + $searchBar.find('input[type="text"]').val(''); + } +} +//========================================================================================================================== + +/* Navbar - Function ======================================================================================================= +* You can manage the navbar +* +*/ +$.AdminBSB.navbar = { + activate: function () { + var $body = $('body'); + var $overlay = $('.overlay'); + + //Open left sidebar panel + $('.bars').on('click', function () { + $body.toggleClass('overlay-open'); + if ($body.hasClass('overlay-open')) { $overlay.fadeIn(); } else { $overlay.fadeOut(); } + }); + + //Close collapse bar on click event + $('.nav [data-close="true"]').on('click', function () { + var isVisible = $('.navbar-toggle').is(':visible'); + var $navbarCollapse = $('.navbar-collapse'); + + if (isVisible) { + $navbarCollapse.slideUp(function () { + $navbarCollapse.removeClass('in').removeAttr('style'); + }); + } + }); + } +} +//========================================================================================================================== + +/* Input - Function ======================================================================================================== +* You can manage the inputs(also textareas) with name of class 'form-control' +* +*/ +$.AdminBSB.input = { + activate: function () { + //On focus event + $('.form-control').focus(function () { + $(this).parent().addClass('focused'); + }); + + //On focusout event + $('.form-control').focusout(function () { + var $this = $(this); + if ($this.parents('.form-group').hasClass('form-float')) { + if ($this.val() == '') { $this.parents('.form-line').removeClass('focused'); } + } + else { + $this.parents('.form-line').removeClass('focused'); + } + }); + + //On label click + $('body').on('click', '.form-float .form-line .form-label', function () { + $(this).parent().find('input').focus(); + }); + + //Not blank form + $('.form-control').each(function () { + if ($(this).val() !== '') { + $(this).parents('.form-line').addClass('focused'); + } + }); + } +} +//========================================================================================================================== + +/* Form - Select - Function ================================================================================================ +* You can manage the 'select' of form elements +* +*/ +$.AdminBSB.select = { + activate: function () { + if ($.fn.selectpicker) { $('select:not(.ms)').selectpicker(); } + } +} +//========================================================================================================================== + +/* DropdownMenu - Function ================================================================================================= +* You can manage the dropdown menu +* +*/ + +$.AdminBSB.dropdownMenu = { + activate: function () { + var _this = this; + + $('.dropdown, .dropup, .btn-group').on({ + "show.bs.dropdown": function () { + var dropdown = _this.dropdownEffect(this); + _this.dropdownEffectStart(dropdown, dropdown.effectIn); + }, + "shown.bs.dropdown": function () { + var dropdown = _this.dropdownEffect(this); + if (dropdown.effectIn && dropdown.effectOut) { + _this.dropdownEffectEnd(dropdown, function () { }); + } + }, + "hide.bs.dropdown": function (e) { + var dropdown = _this.dropdownEffect(this); + if (dropdown.effectOut) { + e.preventDefault(); + _this.dropdownEffectStart(dropdown, dropdown.effectOut); + _this.dropdownEffectEnd(dropdown, function () { + dropdown.dropdown.removeClass('open'); + }); + } + } + }); + + //Set Waves + Waves.attach('.dropdown-menu li a', ['waves-block']); + Waves.init(); + }, + dropdownEffect: function (target) { + var effectIn = $.AdminBSB.options.dropdownMenu.effectIn, effectOut = $.AdminBSB.options.dropdownMenu.effectOut; + var dropdown = $(target), dropdownMenu = $('.dropdown-menu', target); + + if (dropdown.length > 0) { + var udEffectIn = dropdown.data('effect-in'); + var udEffectOut = dropdown.data('effect-out'); + if (udEffectIn !== undefined) { effectIn = udEffectIn; } + if (udEffectOut !== undefined) { effectOut = udEffectOut; } + } + + return { + target: target, + dropdown: dropdown, + dropdownMenu: dropdownMenu, + effectIn: effectIn, + effectOut: effectOut + }; + }, + dropdownEffectStart: function (data, effectToStart) { + if (effectToStart) { + data.dropdown.addClass('dropdown-animating'); + data.dropdownMenu.addClass('animated dropdown-animated'); + data.dropdownMenu.addClass(effectToStart); + } + }, + dropdownEffectEnd: function (data, callback) { + var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; + data.dropdown.one(animationEnd, function () { + data.dropdown.removeClass('dropdown-animating'); + data.dropdownMenu.removeClass('animated dropdown-animated'); + data.dropdownMenu.removeClass(data.effectIn); + data.dropdownMenu.removeClass(data.effectOut); + + if (typeof callback == 'function') { + callback(); + } + }); + } +} +//========================================================================================================================== + +/* Browser - Function ====================================================================================================== +* You can manage browser +* +*/ +var edge = 'Microsoft Edge'; +var ie10 = 'Internet Explorer 10'; +var ie11 = 'Internet Explorer 11'; +var opera = 'Opera'; +var firefox = 'Mozilla Firefox'; +var chrome = 'Google Chrome'; +var safari = 'Safari'; + +$.AdminBSB.browser = { + activate: function () { + var _this = this; + var className = _this.getClassName(); + + if (className !== '') $('html').addClass(_this.getClassName()); + }, + getBrowser: function () { + var userAgent = navigator.userAgent.toLowerCase(); + + if (/edge/i.test(userAgent)) { + return edge; + } else if (/rv:11/i.test(userAgent)) { + return ie11; + } else if (/msie 10/i.test(userAgent)) { + return ie10; + } else if (/opr/i.test(userAgent)) { + return opera; + } else if (/chrome/i.test(userAgent)) { + return chrome; + } else if (/firefox/i.test(userAgent)) { + return firefox; + } else if (!!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)) { + return safari; + } + + return undefined; + }, + getClassName: function () { + var browser = this.getBrowser(); + + if (browser === edge) { + return 'edge'; + } else if (browser === ie11) { + return 'ie11'; + } else if (browser === ie10) { + return 'ie10'; + } else if (browser === opera) { + return 'opera'; + } else if (browser === chrome) { + return 'chrome'; + } else if (browser === firefox) { + return 'firefox'; + } else if (browser === safari) { + return 'safari'; + } else { + return ''; + } + } +} +//========================================================================================================================== + +$(document).on('turbolinks:load', function() { + $.AdminBSB.browser.activate(); + $.AdminBSB.leftSideBar.activate(); + $.AdminBSB.rightSideBar.activate(); + $.AdminBSB.navbar.activate(); + $.AdminBSB.dropdownMenu.activate(); + $.AdminBSB.input.activate(); + $.AdminBSB.select.activate(); + $.AdminBSB.search.activate(); + + setTimeout(function () { $('.page-loader-wrapper').fadeOut(); }, 50); +}); \ No newline at end of file diff --git a/app/assets/javascripts/CRM.js b/app/assets/javascripts/CRM.js index 646bc195..98becbc8 100755 --- a/app/assets/javascripts/CRM.js +++ b/app/assets/javascripts/CRM.js @@ -22,7 +22,7 @@ //= require bootstrap-notify/bootstrap-notify.js //= require node-waves/waves.js //= require sweetalert/sweetalert.min.js -//= require BSBMaterial/admin.js +//= require BSBMaterial/turbolink_admin.js //= require BSBMaterial/demo.js //= require custom.js diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index 4d66cfab..2f8d866d 100755 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -20,7 +20,7 @@ //= require jquery-slimscroll/jquery.slimscroll.js //= require node-waves/waves.js //= require sweetalert/sweetalert.min.js -//= require BSBMaterial/admin.js +//= require BSBMaterial/turbolink_admin.js //= require BSBMaterial/demo.js //= require custom.js diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 35dce150..818807c2 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -38,8 +38,7 @@ $(document).ready(function() { $.ajax({ type: method, url: url , - success: function(data) { - console.log(data.url); + success: function(data) { location.href = data.url; } }); diff --git a/app/assets/javascripts/inventory.js b/app/assets/javascripts/inventory.js index 3200da8a..a766ff86 100644 --- a/app/assets/javascripts/inventory.js +++ b/app/assets/javascripts/inventory.js @@ -7,6 +7,6 @@ //= require jquery-slimscroll/jquery.slimscroll.js //= require node-waves/waves.js //= require sweetalert/sweetalert.min.js -//= require BSBMaterial/admin.js +//= require BSBMaterial/turbolink_admin.js //= require BSBMaterial/demo.js //= require custom.js diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 84799a93..f23d13c6 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -11,7 +11,7 @@ //= require sweetalert/sweetalert.min.js //= require cable //= require turbolinks -//= require BSBMaterial/admin.js +//= require BSBMaterial/turbolink_admin.js //= require BSBMaterial/demo.js //= require custom.js diff --git a/app/controllers/settings/accounts_controller.rb b/app/controllers/settings/accounts_controller.rb index 549d5887..b192c24d 100755 --- a/app/controllers/settings/accounts_controller.rb +++ b/app/controllers/settings/accounts_controller.rb @@ -55,10 +55,12 @@ class Settings::AccountsController < ApplicationController # DELETE /settings/accounts/1.json def destroy @settings_account.destroy - respond_to do |format| - format.html { redirect_to settings_accounts_url, notice: 'Account was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Account was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_accounts_url }.to_json + # respond_to do |format| + # format.html { redirect_to settings_accounts_url, notice: 'Account was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/cashier_terminals_controller.rb b/app/controllers/settings/cashier_terminals_controller.rb index 3f87de5f..31e8da04 100755 --- a/app/controllers/settings/cashier_terminals_controller.rb +++ b/app/controllers/settings/cashier_terminals_controller.rb @@ -56,10 +56,12 @@ class Settings::CashierTerminalsController < ApplicationController # DELETE /settings/cashier_terminals/1.json def destroy @settings_cashier_terminal.destroy - respond_to do |format| - format.html { redirect_to settings_cashier_terminals_path, notice: 'Cashier terminal was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Cashier terminal was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_cashier_terminals_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_cashier_terminals_path, notice: 'Cashier terminal was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/commissioners_controller.rb b/app/controllers/settings/commissioners_controller.rb index b518ca8f..4f195f43 100755 --- a/app/controllers/settings/commissioners_controller.rb +++ b/app/controllers/settings/commissioners_controller.rb @@ -63,10 +63,12 @@ class Settings::CommissionersController < ApplicationController # DELETE /commissioners/1.json def destroy @commissioner.destroy - respond_to do |format| - format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully destroyed.'} - format.json {head :no_content} - end + flash[:notice] = 'Commissioner was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_commissioners_path }.to_json + # respond_to do |format| + # format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully destroyed.'} + # format.json {head :no_content} + # end end def get_transaction_by_commissioner diff --git a/app/controllers/settings/commissions_controller.rb b/app/controllers/settings/commissions_controller.rb index 333a57f8..5a41de17 100755 --- a/app/controllers/settings/commissions_controller.rb +++ b/app/controllers/settings/commissions_controller.rb @@ -60,10 +60,12 @@ class Settings::CommissionsController < ApplicationController # DELETE /commissions/1.json def destroy @commission.destroy - respond_to do |format| - format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully destroyed.'} - format.json {head :no_content} - end + flash[:notice] = 'Commission was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_commissions_path }.to_json + # respond_to do |format| + # format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully destroyed.'} + # format.json {head :no_content} + # end end private diff --git a/app/controllers/settings/dining_charges_controller.rb b/app/controllers/settings/dining_charges_controller.rb index 1d34f9c9..576703ed 100755 --- a/app/controllers/settings/dining_charges_controller.rb +++ b/app/controllers/settings/dining_charges_controller.rb @@ -72,10 +72,12 @@ class Settings::DiningChargesController < ApplicationController # DELETE /dining_charges/1.json def destroy @dining_charge.destroy - respond_to do |format| - format.html { redirect_to dining_charges_url, notice: 'Dining charge was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Dining charge was successfully destroyed.' + render :json => {:status=> "Success", :url => dining_charges_url }.to_json + # respond_to do |format| + # format.html { redirect_to dining_charges_url, notice: 'Dining charge was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/employees_controller.rb b/app/controllers/settings/employees_controller.rb index 07656470..2bc81c51 100755 --- a/app/controllers/settings/employees_controller.rb +++ b/app/controllers/settings/employees_controller.rb @@ -53,9 +53,11 @@ class Settings::EmployeesController < ApplicationController # DELETE /employees/1.json def destroy @employee.destroy - respond_to do |format| - format.html { redirect_to settings_employees_url, notice: 'Employee was successfully destroyed.' } - end + flash[:notice] = 'Employee was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_employees_url }.to_json + # respond_to do |format| + # format.html { redirect_to settings_employees_url, notice: 'Employee was successfully destroyed.' } + # end end private diff --git a/app/controllers/settings/item_sets_controller.rb b/app/controllers/settings/item_sets_controller.rb index cbd74edb..471860ca 100755 --- a/app/controllers/settings/item_sets_controller.rb +++ b/app/controllers/settings/item_sets_controller.rb @@ -55,10 +55,12 @@ class Settings::ItemSetsController < ApplicationController # DELETE /settings/item_sets/1.json def destroy @settings_item_set.destroy - respond_to do |format| - format.html { redirect_to settings_item_sets_url, notice: 'Item set was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Item set was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_item_sets_url }.to_json + # respond_to do |format| + # format.html { redirect_to settings_item_sets_url, notice: 'Item set was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/membership_actions_controller.rb b/app/controllers/settings/membership_actions_controller.rb index f386aecd..4f22a285 100755 --- a/app/controllers/settings/membership_actions_controller.rb +++ b/app/controllers/settings/membership_actions_controller.rb @@ -56,10 +56,12 @@ class Settings::MembershipActionsController < ApplicationController # DELETE /settings/membership_actions/1.json def destroy @settings_membership_action.destroy - respond_to do |format| - format.html { redirect_to settings_membership_actions_url, notice: 'Membership action was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Membership action was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_membership_actions_url }.to_json + # respond_to do |format| + # format.html { redirect_to settings_membership_actions_url, notice: 'Membership action was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/membership_settings_controller.rb b/app/controllers/settings/membership_settings_controller.rb index d4da84cd..48f601db 100755 --- a/app/controllers/settings/membership_settings_controller.rb +++ b/app/controllers/settings/membership_settings_controller.rb @@ -56,10 +56,12 @@ class Settings::MembershipSettingsController < ApplicationController # DELETE /settings/membership_settings/1.json def destroy @settings_membership_setting.destroy - respond_to do |format| - format.html { redirect_to settings_membership_settings_path, notice: 'Membership setting was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Membership setting was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_membership_settings_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_membership_settings_path, notice: 'Membership setting was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/menu_categories_controller.rb b/app/controllers/settings/menu_categories_controller.rb index a15cca20..4f1c9e85 100755 --- a/app/controllers/settings/menu_categories_controller.rb +++ b/app/controllers/settings/menu_categories_controller.rb @@ -72,10 +72,12 @@ class Settings::MenuCategoriesController < ApplicationController # @settings_menu_category.destroy abc = MenuCategory.destroyCategory(@settings_menu_category) - respond_to do |format| - format.html { redirect_to settings_menu_categories_path, notice: 'Menu category was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Menu category was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_menu_categories_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_menu_categories_path, notice: 'Menu category was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/menu_item_attributes_controller.rb b/app/controllers/settings/menu_item_attributes_controller.rb index 162325a2..8187d2a9 100755 --- a/app/controllers/settings/menu_item_attributes_controller.rb +++ b/app/controllers/settings/menu_item_attributes_controller.rb @@ -56,10 +56,12 @@ class Settings::MenuItemAttributesController < ApplicationController # DELETE /settings/menu_item_attributes/1.json def destroy @settings_menu_item_attribute.destroy - respond_to do |format| - format.html { redirect_to settings_menu_item_attributes_path, notice: 'Menu item attribute was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Menu item attribute was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_menu_item_attributes_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_menu_item_attributes_path, notice: 'Menu item attribute was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/menu_item_instances_controller.rb b/app/controllers/settings/menu_item_instances_controller.rb index e9b67de2..336bf7c8 100755 --- a/app/controllers/settings/menu_item_instances_controller.rb +++ b/app/controllers/settings/menu_item_instances_controller.rb @@ -134,8 +134,9 @@ class Settings::MenuItemInstancesController < ApplicationController item = MenuItem.find(catID.menu_item_id) category = MenuCategory.find(item.menu_category_id) end + flash[:notice] = 'Menu item instance was successfully destroyed.' render :json => {:status=> "Success", :url => settings_menu_category_simple_menu_item_path(category,catID) }.to_json - # respond_to do |format| + # respond_to do |format| # format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully destroyed.' } # format.json { head :no_content } # end diff --git a/app/controllers/settings/menu_item_options_controller.rb b/app/controllers/settings/menu_item_options_controller.rb index f74b0689..00791e5d 100755 --- a/app/controllers/settings/menu_item_options_controller.rb +++ b/app/controllers/settings/menu_item_options_controller.rb @@ -56,10 +56,12 @@ class Settings::MenuItemOptionsController < ApplicationController # DELETE /settings/menu_item_options/1.json def destroy @settings_menu_item_option.destroy - respond_to do |format| - format.html { redirect_to settings_menu_item_options_path, notice: 'Menu item option was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Menu item option was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_menu_item_options_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_menu_item_options_path, notice: 'Menu item option was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/menu_item_sets_controller.rb b/app/controllers/settings/menu_item_sets_controller.rb index eb710e8c..4337e0e3 100755 --- a/app/controllers/settings/menu_item_sets_controller.rb +++ b/app/controllers/settings/menu_item_sets_controller.rb @@ -55,10 +55,12 @@ class Settings::MenuItemSetsController < ApplicationController # DELETE /settings/menu_item_sets/1.json def destroy @settings_menu_item_set.destroy - respond_to do |format| - format.html { redirect_to settings_menu_item_sets_url, notice: 'Menu item set was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Menu item set was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_menu_item_sets_url }.to_json + # respond_to do |format| + # format.html { redirect_to settings_menu_item_sets_url, notice: 'Menu item set was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/menus_controller.rb b/app/controllers/settings/menus_controller.rb index 1a5ada31..240343b1 100755 --- a/app/controllers/settings/menus_controller.rb +++ b/app/controllers/settings/menus_controller.rb @@ -58,10 +58,13 @@ class Settings::MenusController < ApplicationController def destroy # @settings_menu.destroy abc = Menu.destroyMenu(@settings_menu) - respond_to do |format| - format.html { redirect_to settings_menus_path, notice: 'Menu was successfully destroyed.' } - format.json { head :no_content } - end + @settings_menu_item_set.destroy + flash[:notice] = 'Menu was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_menus_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_menus_path, notice: 'Menu was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/order_queue_stations_controller.rb b/app/controllers/settings/order_queue_stations_controller.rb index 73dea1f9..b6baf64d 100755 --- a/app/controllers/settings/order_queue_stations_controller.rb +++ b/app/controllers/settings/order_queue_stations_controller.rb @@ -59,10 +59,12 @@ class Settings::OrderQueueStationsController < ApplicationController # DELETE /settings/order_queue_stations/1.json def destroy @settings_order_queue_station.destroy - respond_to do |format| - format.html { redirect_to settings_order_queue_stations_url, notice: 'Order queue station was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Order queue station was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_order_queue_stations_url }.to_json + # respond_to do |format| + # format.html { redirect_to settings_order_queue_stations_url, notice: 'Order queue station was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/payment_method_settings_controller.rb b/app/controllers/settings/payment_method_settings_controller.rb index ecbbcced..2fccfd67 100755 --- a/app/controllers/settings/payment_method_settings_controller.rb +++ b/app/controllers/settings/payment_method_settings_controller.rb @@ -56,10 +56,12 @@ class Settings::PaymentMethodSettingsController < ApplicationController # DELETE /settings/payment_method_settings/1.json def destroy @settings_payment_method_setting.destroy - respond_to do |format| - format.html { redirect_to settings_payment_method_settings_path, notice: 'Payment method setting was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Payment method setting was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_payment_method_settings_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_payment_method_settings_path, notice: 'Payment method setting was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/products_controller.rb b/app/controllers/settings/products_controller.rb index 16b0da7a..c0be149e 100755 --- a/app/controllers/settings/products_controller.rb +++ b/app/controllers/settings/products_controller.rb @@ -57,10 +57,12 @@ load_and_authorize_resource except: [:create] # DELETE /settings/products/1.json def destroy @settings_product.destroy - respond_to do |format| - format.html { redirect_to settings_products_path, notice: 'Product was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Product was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_products_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_products_path, notice: 'Product was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/promotion_products_controller.rb b/app/controllers/settings/promotion_products_controller.rb index 29248e1f..d297fb71 100755 --- a/app/controllers/settings/promotion_products_controller.rb +++ b/app/controllers/settings/promotion_products_controller.rb @@ -55,10 +55,12 @@ class Settings::PromotionProductsController < ApplicationController # DELETE /promotion_products/1.json def destroy @promotion_product.destroy - respond_to do |format| - format.html { redirect_to edit_settings_promotion_path(@promotion) , notice: 'PromotionProduct was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Promotion Product was successfully destroyed.' + render :json => {:status=> "Success", :url => edit_settings_promotion_path(@promotion) }.to_json + # respond_to do |format| + # format.html { redirect_to edit_settings_promotion_path(@promotion) , notice: 'PromotionProduct was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/promotions_controller.rb b/app/controllers/settings/promotions_controller.rb index 708da778..ec09aaab 100755 --- a/app/controllers/settings/promotions_controller.rb +++ b/app/controllers/settings/promotions_controller.rb @@ -74,10 +74,12 @@ class Settings::PromotionsController < ApplicationController pp.destroy end @promotion.destroy - respond_to do |format| - format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Promotion was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_promotions_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully destroyed.' } + # format.json { head :no_content } + # end end def find_item_instance diff --git a/app/controllers/settings/rooms_controller.rb b/app/controllers/settings/rooms_controller.rb index 2d5b01e1..ef127e2b 100755 --- a/app/controllers/settings/rooms_controller.rb +++ b/app/controllers/settings/rooms_controller.rb @@ -60,10 +60,12 @@ class Settings::RoomsController < ApplicationController # DELETE /settings/rooms/1.json def destroy @settings_room.destroy - respond_to do |format| - format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Room was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_zone_path(@zone) }.to_json + # respond_to do |format| + # format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/set_menu_items_controller.rb b/app/controllers/settings/set_menu_items_controller.rb index 0c046d7c..1fbeb148 100755 --- a/app/controllers/settings/set_menu_items_controller.rb +++ b/app/controllers/settings/set_menu_items_controller.rb @@ -112,6 +112,7 @@ class Settings::SetMenuItemsController < ApplicationController File.delete(path_to_file) if File.exist?(path_to_file) abc = MenuItem.deleteRecursive(@settings_menu_item) + flash[:notice] = 'Menu item was successfully destroyed.' render :json => {:status=> "Success", :url => settings_menu_category_simple_menu_items_path }.to_json # respond_to do |format| # format.html { redirect_to settings_menu_category_set_menu_items_path(category_id,item_id), notice: 'Menu item was successfully destroyed.' } diff --git a/app/controllers/settings/tables_controller.rb b/app/controllers/settings/tables_controller.rb index 7c293455..913ef57e 100755 --- a/app/controllers/settings/tables_controller.rb +++ b/app/controllers/settings/tables_controller.rb @@ -59,10 +59,12 @@ class Settings::TablesController < ApplicationController # DELETE /settings/tables/1.json def destroy @settings_table.destroy - respond_to do |format| - format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Table was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_zone_path(@zone) }.to_json + # respond_to do |format| + # format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/tax_profiles_controller.rb b/app/controllers/settings/tax_profiles_controller.rb index 992f637a..77414c57 100755 --- a/app/controllers/settings/tax_profiles_controller.rb +++ b/app/controllers/settings/tax_profiles_controller.rb @@ -57,10 +57,12 @@ class Settings::TaxProfilesController < ApplicationController # DELETE /settings/tax_profiles/1.json def destroy @settings_tax_profile.destroy - respond_to do |format| - format.html { redirect_to settings_tax_profiles_url, notice: 'Tax profile was successfully destroyed.' } - format.json { head :no_content } - end + flash[:notice] = 'Tax profile was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_tax_profiles_url }.to_json + # respond_to do |format| + # format.html { redirect_to settings_tax_profiles_url, notice: 'Tax profile was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/controllers/settings/zones_controller.rb b/app/controllers/settings/zones_controller.rb index 49505854..63bd3439 100755 --- a/app/controllers/settings/zones_controller.rb +++ b/app/controllers/settings/zones_controller.rb @@ -61,10 +61,12 @@ class Settings::ZonesController < ApplicationController @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.' } - format.json { head :no_content } - end + flash[:notice] = 'Zone was successfully destroyed.' + render :json => {:status=> "Success", :url => settings_zones_path }.to_json + # respond_to do |format| + # format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' } + # format.json { head :no_content } + # end end private diff --git a/app/views/crm/dining_queues/index.html.erb b/app/views/crm/dining_queues/index.html.erb index d7ee6f06..a02cc36d 100755 --- a/app/views/crm/dining_queues/index.html.erb +++ b/app/views/crm/dining_queues/index.html.erb @@ -49,7 +49,7 @@