Files
sx-fc/app/views/shared/_license_expire_warning.html.erb
2020-06-10 18:12:15 +06:30

53 lines
1.8 KiB
Plaintext

<% 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
text = "Your license will expire in #{day}."
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', expire_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">&times;</span>
</button>
</div>
<% end %>
<script>
$(document).ready(function() {
divLicnese = $('#license-alert');
navbar = $('.navbar');
leftsidebar = $('#leftsidebar');
if (<%= license_status %> == 1) {
navbar.css("top", 0);
leftsidebar.css("top", 0);
$('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>