diff --git a/Views/Shared/_Layout.cshtml b/Views/Shared/_Layout.cshtml
index 6ddbc2b..1898502 100644
--- a/Views/Shared/_Layout.cshtml
+++ b/Views/Shared/_Layout.cshtml
@@ -173,6 +173,9 @@
+
+
+
@@ -209,6 +212,53 @@
$( document ).on( 'focus', ':input', function(){
$( this ).attr( 'autocomplete', 'off' );
});
+
+ $(document).on('change', 'input.money', function() {
+ var value = parseFloat(parseFloat($(this).val()).toFixed(2));
+ $(this).maskMoney();
+ $(this).unbind("focus.maskMoney");
+ $(this).unbind("blur.maskMoney");
+ $(this).maskMoney('mask', value);
+ });
+
+ $(document).on('focus', 'input.money:not([readonly], :disabled)', function() {
+ $(this).maskMoney('destroy');
+ var val = $(this).maskMoney('unmasked')[0];
+ val = val === 0 ? '' : val;
+ $(this).val(val);
+ });
+
+ $(document).on('blur', 'input.money', function() {
+ preventDefault(event);
+ var value = $(this).val();
+ if (typeof value === 'string' && !value.includes(',')) {
+ $(this).val($(this).val());
+ $(this).change();
+ }
+ });
+
+ $('input.money').keypress(function(e){
+ e = e || window.event;
+ var key = e.which || e.charCode || e.keyCode,
+ keyPressedChar = "",
+ selection,
+ startPos,
+ endPos,
+ value;
+
+ if ((key >= 48 && key <= 57) || e.key == '.') {
+ } else {
+ preventDefault(e);
+ }
+ });
+
+ function preventDefault(e) {
+ if (e.preventDefault) { //standard browsers
+ e.preventDefault();
+ } else { // old internet explorer
+ e.returnValue = false;
+ }
+ }
});