Merge branch 'r-1902001-01' into foodcourt
This commit is contained in:
56
app/views/shared/_license_expire_warning.html.erb
Normal file
56
app/views/shared/_license_expire_warning.html.erb
Normal file
@@ -0,0 +1,56 @@
|
||||
<% license_status = current_license.detail_with_local_file %>
|
||||
<% renewable_date = current_license.read_license("renewable_date") %>
|
||||
<% date_count = (renewable_date.to_date - Date.today).to_i %>
|
||||
<% day = pluralize( date_count, 'day' )%>
|
||||
|
||||
<% if license_status == 0
|
||||
text = 'Your license has expired.'
|
||||
elsif license_status == 2
|
||||
if date_count == 0
|
||||
text = "Your license will expire in tomorrow."
|
||||
else
|
||||
text = "Your license will expire in #{day}."
|
||||
end
|
||||
end
|
||||
%>
|
||||
<% if license_status == 0 || license_status == 2 %>
|
||||
<div id="license-alert" class="alert alert-danger fade show text-center" role="alert">
|
||||
<strong style="margin-left: 40px !important"><%= text %></strong>
|
||||
<%= link_to 'Review License', review_license_url, class: 'btn btn-sm btn-primary', style: "margin-left: 20px !important"%>
|
||||
<button type="button" class="close btn-close" data-dismiss="alert" aria-label="Close" style="padding-top: 5px;">
|
||||
<span aria-hidden="true" class="text-white">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
divLicnese = $('#license-alert');
|
||||
navbar = $('.navbar');
|
||||
leftsidebar = $('#leftsidebar');
|
||||
if (<%= license_status %> == 1) {
|
||||
navbar.css("top", "");
|
||||
leftsidebar.css("top", "");
|
||||
$('section.content').css('margin-top', '0 !important');
|
||||
}
|
||||
else {
|
||||
navbar.css("top", divLicnese.outerHeight() + 'px');
|
||||
leftsidebar.css("top", navbar.outerHeight() + divLicnese.outerHeight() + 'px');
|
||||
$('.block-header, .addorder-pages').css('margin-top', '115px');
|
||||
$('.page-header, .m-top-100').css('margin-top', '100px');
|
||||
$('.alert-danger').css({
|
||||
'top': 0,
|
||||
'position': 'fixed',
|
||||
'z-index': 999,
|
||||
'width': '100%'
|
||||
})
|
||||
}
|
||||
$('.btn-close').on ('click', function() {
|
||||
navbar.css("top", '0')
|
||||
$('.block-header, .addorder-pages').css('margin-top', '')
|
||||
$('.page-header, .m-top-100').css('margin-top', '')
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user