From 80f1170d8ab4ea528bbcf875eae49b6d077054ef Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 20 Oct 2017 18:50:30 +0630 Subject: [PATCH] update admin bsb crm layou --- app/assets/javascripts/CRM.js | 17 +- app/assets/javascripts/application.js | 94 +-------- app/assets/javascripts/custom.js | 50 +++++ app/assets/stylesheets/CRM.scss | 42 ++-- app/assets/stylesheets/application.scss | 5 +- app/assets/stylesheets/reset.css | 182 ++++++++++++++++++ app/controllers/application_controller.rb | 1 + app/controllers/base_crm_controller.rb | 10 + app/controllers/crm/bookings_controller.rb | 2 +- app/controllers/crm/customers_controller.rb | 2 +- .../crm/dining_queues_controller.rb | 2 +- app/controllers/crm/home_controller.rb | 2 +- app/views/crm/customers/index.html.erb | 21 +- app/views/crm/dining_queues/assign.html.erb | 67 +++---- app/views/layouts/CRM.html.erb | 79 +++++--- 15 files changed, 379 insertions(+), 197 deletions(-) create mode 100644 app/assets/javascripts/custom.js create mode 100644 app/assets/stylesheets/reset.css diff --git a/app/assets/javascripts/CRM.js b/app/assets/javascripts/CRM.js index 4b5baba8..2564e8e5 100644 --- a/app/assets/javascripts/CRM.js +++ b/app/assets/javascripts/CRM.js @@ -10,13 +10,18 @@ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // + + + //= require jquery //= require tether -//= require bootstrap +//= require bootstrap/js/popper.min +//= require bootstrap/js/bootstrap-material-design.min //= require jquery_ujs //= require turbolinks -//= require cable -//= require jquery-ui -//= require bootstrap-datepicker -//= require bootstrap/modal - +//= require jquery-slimscroll/jquery.slimscroll.js +//= require node-waves/waves.js +//= require sweetalert/sweetalert.min.js +//= require BSBMaterial/admin.js +//= require BSBMaterial/demo.js +//= require custom.js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ae6d1c12..030056a2 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -34,54 +34,10 @@ //= require BSBMaterial/admin.js //= require BSBMaterial/pages/index.js //= require BSBMaterial/demo.js - - -$(document).on('turbolinks:load', function() { - - $('.datetimepicker').bootstrapMaterialDatePicker({ - format: 'DD-MM YYYY - HH:mm', - clearButton: true, - weekStart: 1 - }); - - $('.datepicker').bootstrapMaterialDatePicker({ - format: 'DD-MM-YYYY', - clearButton: true, - weekStart: 1, - time: false - }); - - $('.timepicker').bootstrapMaterialDatePicker({ - format: 'HH:mm', - clearButton: true, - date: false - }); - -}); +//= require custom.js $(function(){ - $('body').bootstrapMaterialDesign(); - var height = ($(window).height() - ($('.legal').outerHeight() + $('.user-info').outerHeight() + $('.navbar').innerHeight())); - - $('#custom-slimscroll').slimScroll({ - height: height, - size: '5px', - color: 'rgba(0,0,0,0.5)', - alwaysVisible: false, - borderRadius: '0', - railBorderRadius: '0' - }); - - $('#order-detail-slimscroll').slimScroll({ - height: height-180, - size: '5px', - color: 'rgba(0,0,0,0.5)', - alwaysVisible: false, - borderRadius: '0', - railBorderRadius: '0' - }); - // Image Upload $("#simple_menu_item_image_path").fileinput({ previewFileType: "image", @@ -123,54 +79,6 @@ $(function(){ } }); - $('.delete').click(function(){ - var method = $(this).attr('data-method'); - var url = $(this).attr('data-ref'); - var html_text = $( this ).siblings( "#delete_text" ).html(); - swal({ - title: "Confirmation", - text: html_text, - type: "warning", - showCancelButton: true, - confirmButtonColor: "#DD6B55", - html: true - }, function (isConfirm) { - if (isConfirm) { - $.ajax({ - type: method, - url: url , - success: function(data) { - } - }); - } else { - swal("Cancelled", "Your imaginary file is safe :)", "error"); - } - }); - }); - - $('.dddddddd').click(function(){ - var currentForm = $(this).closest("form"); - bootbox.confirm({ - title: 'Confirmation', - message: $('#delete_text').html(), - buttons: { - 'cancel': { - label: 'No', - className: 'btn green col-md-4 pull-left' - }, - 'confirm': { - label: 'Yes', - className: 'btn red col-md-4 pull-right' - } - }, - callback: function(result) { - if (result) { - currentForm.submit(); - } - } - }); - }); - }); $(document).on("focus", "[data-behaviour~='datepicker']", function(e){ diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js new file mode 100644 index 00000000..e5b09e92 --- /dev/null +++ b/app/assets/javascripts/custom.js @@ -0,0 +1,50 @@ + +$(function(){ + + $('body').bootstrapMaterialDesign(); + var height = ($(window).height() - ($('.legal').outerHeight() + $('.user-info').outerHeight() + $('.navbar').innerHeight())); + + $('#custom-slimscroll').slimScroll({ + height: height, + size: '5px', + color: 'rgba(0,0,0,0.5)', + alwaysVisible: false, + borderRadius: '0', + railBorderRadius: '0' + }); + + $('#order-detail-slimscroll').slimScroll({ + height: height-180, + size: '5px', + color: 'rgba(0,0,0,0.5)', + alwaysVisible: false, + borderRadius: '0', + railBorderRadius: '0' + }); + + $('.delete').click(function(){ + var method = $(this).attr('data-method'); + var url = $(this).attr('data-ref'); + var html_text = $( this ).siblings( "#delete_text" ).html(); + swal({ + title: "Confirmation", + text: html_text, + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + html: true + }, function (isConfirm) { + if (isConfirm) { + $.ajax({ + type: method, + url: url , + success: function(data) { + } + }); + } else { + swal("Cancelled", "Your imaginary file is safe :)", "error"); + } + }); + }); + +}); diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss index df008329..a1892bc5 100644 --- a/app/assets/stylesheets/CRM.scss +++ b/app/assets/stylesheets/CRM.scss @@ -1,15 +1,21 @@ -@import "bootstrap"; -@import "font-awesome"; -@import "theme"; -@import "jquery-ui"; -@import "bootstrap-datepicker3"; -@import "bootstrap/modal"; - -/* Show it is fixed to the top */ -// body { -// min-height: 75rem; -// padding-top: 4.5rem; -// } +//@import "bootstrap"; +//@import "font-awesome"; +//@import "theme"; +//@import "jquery-ui"; +//@import "bootstrap-datepicker3"; +//@import "bootstrap/modal"; +@import "tether"; +@import "bootstrap/css/bootstrap-material-design.min"; +@import "node-waves/waves"; +@import "animate-css/animate"; +@import "sweetalert/sweetalert.css"; +@import "multi-select/css/multi-select.css"; +@import "bootstrap-material-datetimepicker/css/bootstrap-material-datetimepicker"; +@import "morrisjs/morris"; +@import "fileinput.min"; +@import "BSBMaterial/style"; +@import "BSBMaterial/themes/all-themes"; +@import "reset"; .selected-item { color: #fff !important; @@ -45,14 +51,7 @@ .jconfirm-box-container{ margin-left:-40px !important } -.card-columns { - @include media-breakpoint-only(lg) { - column-count: 5; - } - @include media-breakpoint-only(xl) { - column-count: 5; - } -} + #sxModal { display: none; @@ -93,4 +92,5 @@ width: 480px; height: 375px; -} \ No newline at end of file +} + diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index b4fbcabb..7f618024 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -185,13 +185,14 @@ section.content { opacity:0 !important; margin-right:15px; } -/* End Reset Theme */ -/* *************************************************** */ .hidden{ display: none !important; } +/* End Reset Theme */ +/* *************************************************** */ + /***************** Start Origami CSS *************************/ /* Reset */ .table { diff --git a/app/assets/stylesheets/reset.css b/app/assets/stylesheets/reset.css new file mode 100644 index 00000000..0f39daba --- /dev/null +++ b/app/assets/stylesheets/reset.css @@ -0,0 +1,182 @@ +/* Start Reset Theme */ +.col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, .col-auto, .col-lg, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-auto, .col-md, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-md-auto, .col-sm, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-auto { + padding-left: 10px; + padding-right: 10px; +} +.col-lg-1, .col-md-1, .col-sm-1,col-xl-1{ + padding-left: 5px ; + padding-right: 5px ; +} + +.navbar { + padding: 0.1rem 1rem; +} + +.navbar-header { + padding: 0px; +} + +.navbar-brand { + padding-top: 0rem; + padding-bottom: 0rem; +} + +.navbar-brand-txt { + position: relative; + top: 5px; +} + +.navbar-right a { + color: #fff; +} + +.navbar-right a.dropdown-toggle { + position: relative; + top: -5px; +} + +.dropdown-menu { + margin-top: 0px !important; +} + +.switch label { + color: #070707 !important; +} + +.ls-closed .bars:after, .ls-closed .bars:before { + position: absolute; + top: 8px; +} + +section.content { + margin: 40px 15px 0 225px; +} + +.sidebar { + width: 210px; + height: calc(100vh - 50px); + position: fixed; + top: 50px; + right: 250px; +} + +.right-sidebar { + width: 240px; + height: calc(100vh - 50px); + position: fixed; + right: -260px; + top: 50px; +} + +.info-box { + margin-bottom: 20px; +} + +.card { + margin-bottom: 20px; +} + +.card .card-header { + padding: 0.5rem; +} + +.card .card-title{ + margin-bottom:0.5rem; +} + +.card .card-block { + padding: 0.5rem; +} + +.btn { + padding: .46875rem 0.25rem; + color : #fff !important; +} +.btn-default, .bg-default{ + color : #111 !important; +} +.checkbox label, label.checkbox-inline { + padding-left: 0; +} + +.checkbox label input[type=checkbox], label.checkbox-inline input[type=checkbox] { + position: relative; + left: 0; + z-index: -1; + width: 13px; + height: 13px; + margin: 5px 5px 0 0; + overflow: hidden; + pointer-events: none; + opacity: 1; +} + + +.sidebar .menu .list .header { + background: #eee; + font-size: 12px; + font-weight: bold; + padding: 8px 16px; +} + +.breadcrumb { + font-size:0.87rem; +} + +.list-group-item{ + padding:0.75rem 1rem; +} +.btn:not(.btn-link):not(.btn-circle) span { + position: relative; + top: 0px; + margin-left: 0px; +} +.nav { + padding-left: 0; + margin-bottom: 0; + list-style: none; +} + +.nav > li > a { + position: relative; + display: block; + padding: 10px 15px; +} + +.nav-tabs > li { + float: left; + margin-bottom: -1px; +} + +.nav-tabs li a.active { + color: #000 !important; + border-bottom: 2px solid #2196F3 !important; +} + +.nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus { + color: #555; + cursor: default; + background-color: #fff; + border: 1px solid #ddd; + border-bottom-color: transparent; +} +.nav-tabs > li > a { + margin-right: 2px; + line-height: 1.42857143; + text-decoration:none; +} +.nav-tabs .nav-link { + padding: 0.7286em .8575em; +} + +.checkbox label input[type=checkbox], label.checkbox-inline input[type=checkbox] { + opacity:0 !important; + margin-right:15px; +} + +.hidden{ + display: none !important; +} + +/* End Reset Theme */ +/* *************************************************** */ \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 33ee425c..949276cd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base #all token authentication must be done here #response format must be set to JSON + #change locallization def set_locale I18n.locale = params[:locale] || I18n.default_locale end diff --git a/app/controllers/base_crm_controller.rb b/app/controllers/base_crm_controller.rb index 38f0df3d..e66c67b9 100644 --- a/app/controllers/base_crm_controller.rb +++ b/app/controllers/base_crm_controller.rb @@ -10,6 +10,16 @@ class BaseCrmController < ActionController::Base redirect_to root_path end + #change locallization + def set_locale + I18n.locale = params[:locale] || I18n.default_locale + end + + # RESTful url for localize + def default_url_options + { locale: I18n.locale } + end + def current_user @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] end diff --git a/app/controllers/crm/bookings_controller.rb b/app/controllers/crm/bookings_controller.rb index d712f66f..efaa5419 100644 --- a/app/controllers/crm/bookings_controller.rb +++ b/app/controllers/crm/bookings_controller.rb @@ -1,4 +1,4 @@ -class Crm::BookingsController < ApplicationController +class Crm::BookingsController < BaseCrmController load_and_authorize_resource def update_booking booking = Booking.find(params[:booking_id]) diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 02ce9148..2a0626dd 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -1,4 +1,4 @@ -class Crm::CustomersController < ApplicationController #BaseCrmController +class Crm::CustomersController < BaseCrmController load_and_authorize_resource except: [:create] before_action :set_crm_customer, only: [:show, :edit, :update, :destroy] diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 91e833bd..a48e03a7 100644 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -1,4 +1,4 @@ -class Crm::DiningQueuesController < ApplicationController #BaseCrmController +class Crm::DiningQueuesController < BaseCrmController load_and_authorize_resource before_action :set_dining_queue, only: [:show, :edit, :update, :destroy] diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index 92b31261..012f2bc6 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -1,4 +1,4 @@ -class Crm::HomeController < ApplicationController +class Crm::HomeController < BaseCrmController def index @booking = Booking.all diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index a1b797a5..b74f33a9 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -1,15 +1,15 @@
- -
@@ -103,7 +103,6 @@
-->
-