From 15604fea2c59f2b990002178ec3983f683b414d9 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 26 Oct 2017 13:49:15 +0630 Subject: [PATCH] update notification --- app/assets/javascripts/CRM.js | 1 + app/assets/javascripts/application.js | 14 +++---- app/assets/javascripts/custom.js | 45 ++++++++++++++++++++++ app/views/crm/customers/_new_form.html.erb | 18 ++++----- app/views/layouts/CRM.html.erb | 24 ++++++++---- app/views/layouts/application.html.erb | 15 +++++++- app/views/settings/rooms/_form.html.erb | 25 +++++------- app/views/settings/tables/_form.html.erb | 24 +++++------- 8 files changed, 110 insertions(+), 56 deletions(-) diff --git a/app/assets/javascripts/CRM.js b/app/assets/javascripts/CRM.js index a57de941..da856a16 100755 --- a/app/assets/javascripts/CRM.js +++ b/app/assets/javascripts/CRM.js @@ -19,6 +19,7 @@ //= require momentjs/moment //= require bootstrap-material-datetimepicker/js/bootstrap-material-datetimepicker //= require jquery-slimscroll/jquery.slimscroll.js +//= require bootstrap-notify/bootstrap-notify.js //= require node-waves/waves.js //= require sweetalert/sweetalert.min.js //= require BSBMaterial/admin.js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0023c41f..f9032db4 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -24,6 +24,7 @@ //= require bootstrap/js/bootstrap.js //= require multi-select/js/jquery.multi-select.js //= require jquery-slimscroll/jquery.slimscroll.js +//= require bootstrap-notify/bootstrap-notify.js //= require node-waves/waves.js //= require sweetalert/sweetalert.min.js //= require autosize/autosize.js @@ -37,7 +38,9 @@ //= require select2 //= require custom.js + $(document).on('turbolinks:load', function() { + $('.datetimepicker').bootstrapMaterialDatePicker({ format: 'DD-MM-YYYY - HH:mm', @@ -57,9 +60,6 @@ $(document).on('turbolinks:load', function() { clearButton: true, date: false }); - -}); -$(document).on('turbolinks:load', function() { // Image Upload $("#simple_menu_item_image_path").fileinput({ @@ -102,12 +102,9 @@ $(document).on('turbolinks:load', function() { } }); -}); + -// $(document).on("focus", "[data-behaviour~='datepicker']", function(e){ -// $(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true}); -// $('.dropdown-toggle').dropdown(); -// }); +}); function export_to(path) { @@ -116,3 +113,4 @@ function export_to(path) } + diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 46543c6b..0314e537 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -50,4 +50,49 @@ $(document).on('turbolinks:load', function() { }); }); + // for Notificaiotn message + var placementFrom = $("#notify_message").attr('data-placement-from'); + var placementAlign = $("#notify_message").attr('data-placement-align'); + var animateEnter = $("#notify_message").attr('data-animate-enter'); + var animateExit = $("#notify_message").attr('data-animate-exit'); + var colorName = $("#notify_message").attr('data-color-name'); + var text = $("#notify_message").attr('data-message'); + if (text != null || colorName != null){ + showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit); + } + + function showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit) { + if (colorName === null || colorName === '') { colorName = 'bg-black'; } + if (animateEnter === null || animateEnter === '') { animateEnter = 'animated fadeInDown'; } + if (animateExit === null || animateExit === '') { animateExit = 'animated fadeOutUp'; } + var allowDismiss = true; + $.notify({ + message: text + }, + { + type: colorName, + allow_dismiss: allowDismiss, + newest_on_top: true, + timer: 1000, + placement: { + from: placementFrom, + align: placementAlign + }, + animate: { + enter: animateEnter, + exit: animateExit + }, + template: '' + }); + } + //end Notificaiotn message }); diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index bba21b02..0d6fe012 100755 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -15,14 +15,14 @@ <%= f.radio_button :salutation,"Mdm", :class => "salutation mdm with-gap radio-col-indigo", :value=>"Mdm", :style=>"width: 30px"%> -
"> +
"> <%= f.input :name, :class => "form-control col-md-6 name", :required => true %> <% flash.each do |test, msg| %> <% str="[\"#{msg['name']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end -%>
@@ -45,28 +45,28 @@ <% str="[\"#{msg['company']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end -%>
-
"> +
"> <%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%> <% flash.each do |name, msg| %> <% str="[\"#{msg['contact_no']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end %>
-
"> +
"> <%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%> <% flash.each do |name, msg| %> <% str="[\"#{msg['email']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end %>
@@ -101,13 +101,13 @@ <%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
-
"> +
"> <%= f.input :card_no, :class => "form-control col-md-6 card_no"%> <% flash.each do |name, msg| %> <% str="[\"#{msg['card_no']}\"]" str.gsub!('["', '') str.gsub!('"]', '') %> - <%= str %> + <%= str %> <% end %>
diff --git a/app/views/layouts/CRM.html.erb b/app/views/layouts/CRM.html.erb index bdd0b265..c8d1fc9e 100755 --- a/app/views/layouts/CRM.html.erb +++ b/app/views/layouts/CRM.html.erb @@ -47,14 +47,22 @@
- <% flash.each do |type, message| %> -
- - - <% if !flash["errors"]%> - <%=message%> - <% end %> -
+ <% flash.each do |type, message| %> + <% if !flash["errors"]%> + <% + if type == "notice" + color = "alert-success" + elsif type == "error" + color = "alert-danger" + else + color = "bg-black" + end + %> + + + <% end %> <% end %> <%= yield %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9a16a42c..2e60145e 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -47,7 +47,20 @@ -
+
+ <% flash.each do |type, message| %> + <% if type == "notice" + color = "alert-success" + elsif type == "error" + color = "alert-danger" + else + color = "bg-black" + end %> + + + <% end %> <%= yield %>
diff --git a/app/views/settings/rooms/_form.html.erb b/app/views/settings/rooms/_form.html.erb index b2b0ce8c..bd173a45 100755 --- a/app/views/settings/rooms/_form.html.erb +++ b/app/views/settings/rooms/_form.html.erb @@ -21,31 +21,26 @@ <% @settings_room.dining_charges.each do |dc| %>
-
+
- - - - - - - - - - - - + + + + + + - - + + +
Dining Charge
Item code :<%= dc.item_code %>
Unit price : <%= dc.unit_price %>
Charge type : <%= dc.charge_type %>
Item code :<%= dc.item_code %>Unit price : <%= dc.unit_price %>Charge type : <%= dc.charge_type %> <%= link_to 'Edit Charges', edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc),:class => 'btn bg-deep-purple' %>
diff --git a/app/views/settings/tables/_form.html.erb b/app/views/settings/tables/_form.html.erb index 51c227cb..9b160fa2 100755 --- a/app/views/settings/tables/_form.html.erb +++ b/app/views/settings/tables/_form.html.erb @@ -24,22 +24,16 @@
Dining Charge
- Item code : - <%= dc.item_code %> - - - Unit price : - <%= dc.unit_price %> - - - Charge type : - <%= dc.charge_type %> - - - <%= link_to 'Edit Charges', edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc),:class => 'btn bg-deep-purple' %> + Item code : + <%= dc.item_code %> + Unit price : + <%= dc.unit_price %> + Charge type : + <%= dc.charge_type %> + <%= link_to 'Edit Charges', edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc),:class => 'btn bg-deep-purple' %> - - + +