diff --git a/application/views/configs/barcode_config.php b/application/views/configs/barcode_config.php index f90344433..034adb247 100644 --- a/application/views/configs/barcode_config.php +++ b/application/views/configs/barcode_config.php @@ -194,39 +194,16 @@ - +jqu diff --git a/application/views/configs/general_config.php b/application/views/configs/general_config.php index 49232c99e..22cc62821 100644 --- a/application/views/configs/general_config.php +++ b/application/views/configs/general_config.php @@ -231,32 +231,9 @@ $(document).ready(function() window.location=''; }); - $('#general_config_form').validate({ - submitHandler: function(form) { - $(form).ajaxSubmit({ - success: function(response) { - if(response.success) - { - set_feedback(response.message, 'alert alert-dismissible alert-success', false); - } - else - { - set_feedback(response.message, 'alert alert-dismissible alert-danger', true); - } - }, - dataType: 'json' - }); - }, + $('#general_config_form').validate($.extend(form_support.handler, { - errorClass: "has-error", errorLabelContainer: "#general_error_message_box", - wrapper: "li", - highlight: function (e) { - $(e).closest('.form-group').addClass('has-error'); - }, - unhighlight: function (e) { - $(e).closest('.form-group').removeClass('has-error'); - }, rules: { @@ -301,6 +278,6 @@ $(document).ready(function() number: "lang->line('config_lines_per_page_number'); ?>" } } - }); + })); }); diff --git a/application/views/configs/info_config.php b/application/views/configs/info_config.php index 3e94311cf..2fee142f8 100644 --- a/application/views/configs/info_config.php +++ b/application/views/configs/info_config.php @@ -140,34 +140,11 @@ $(document).ready(function() }) }); - $('#info_config_form').validate({ - submitHandler: function(form) { - $(form).ajaxSubmit({ - success: function(response) { - if(response.success) - { - set_feedback(response.message, 'alert alert-dismissible alert-success', false); - } - else - { - set_feedback(response.message, 'alert alert-dismissible alert-danger', true); - } - }, - dataType: 'json' - }); - }, + $('#info_config_form').validate($.extend(form_support.handler, { - errorClass: "has-error", errorLabelContainer: "#general_error_message_box", - wrapper: "li", - highlight: function (e) { - $(e).closest('.form-group').addClass('has-error'); - }, - unhighlight: function (e) { - $(e).closest('.form-group').removeClass('has-error'); - }, - rules: + rules: { company: "required", address: "required", @@ -184,6 +161,6 @@ $(document).ready(function() email: "lang->line('common_email_invalid_format'); ?>", return_policy: "lang->line('config_return_policy_required'); ?>" } - }); + })); }); diff --git a/application/views/configs/invoice_config.php b/application/views/configs/invoice_config.php index 4313d0433..887f10f67 100644 --- a/application/views/configs/invoice_config.php +++ b/application/views/configs/invoice_config.php @@ -97,7 +97,7 @@ $(document).ready(function() })(); $("#use_invoice_template").change(enable_disable_use_invoice_template); - $('#invoice_config_form').validate({ + $('#invoice_config_form').validate($.extend(form_support.handler, { submitHandler: function(form) { $(form).ajaxSubmit({ beforeSerialize: function(arr, $form, options) { @@ -105,14 +105,7 @@ $(document).ready(function() return true; }, success: function(response) { - if(response.success) - { - set_feedback(response.message, 'alert alert-dismissible alert-success', false); - } - else - { - set_feedback(response.message, 'alert alert-dismissible alert-danger', true); - } + $.notify(response.message, { type: response.sucecss } ); // set back disabled state enable_disable_invoice_enable(); enable_disable_use_invoice_template(); @@ -121,25 +114,8 @@ $(document).ready(function() }); }, - errorClass: "has-error", - errorLabelContainer: "#receipt_error_message_box", - wrapper: "li", - highlight: function (e) { - $(e).closest('.form-group').addClass('has-error'); - }, - unhighlight: function (e) { - $(e).closest('.form-group').removeClass('has-error'); - }, + errorLabelContainer: "#receipt_error_message_box" - rules: - { - - }, - - messages: - { - - } - }); + })); }); diff --git a/application/views/configs/locale_config.php b/application/views/configs/locale_config.php index d71aaac34..22c4841f1 100644 --- a/application/views/configs/locale_config.php +++ b/application/views/configs/locale_config.php @@ -267,43 +267,8 @@ $(document).ready(function() { $("span").tooltip(); - - $('#locale_config_form').validate({ - submitHandler: function(form) { - $(form).ajaxSubmit({ - success: function(response) { - if(response.success) - { - set_feedback(response.message, 'alert alert-dismissible alert-success', false); - } - else - { - set_feedback(response.message, 'alert alert-dismissible alert-danger', true); - } - }, - dataType: 'json' - }); - }, - - errorClass: "has-error", - errorLabelContainer: "#locale_error_message_box", - wrapper: "li", - highlight: function (e) { - $(e).closest('.form-group').addClass('has-error'); - }, - unhighlight: function (e) { - $(e).closest('.form-group').removeClass('has-error'); - }, - - rules: - { - - }, - - messages: - { - - } - }); + $('#locale_config_form').validate($.extend(form_support.handler, { + errorLabelContainer: "#locale_error_message_box" + })); }); diff --git a/application/views/configs/message_config.php b/application/views/configs/message_config.php index 0861e3d8a..f494a33a5 100755 --- a/application/views/configs/message_config.php +++ b/application/views/configs/message_config.php @@ -71,32 +71,9 @@ //validation and submit handling $(document).ready(function() { - $('#message_config_form').validate({ - submitHandler: function(form) { - $(form).ajaxSubmit({ - success: function(response) { - if(response.success) - { - set_feedback(response.message, 'alert alert-dismissible alert-success', false); - } - else - { - set_feedback(response.message, 'alert alert-dismissible alert-danger', true); - } - }, - dataType: 'json' - }); - }, + $('#message_config_form').validate($.extend(form_support.base, { - errorClass: "has-error", errorLabelContainer: "#general_error_message_box", - wrapper: "li", - highlight: function (e) { - $(e).closest('.form-group').addClass('has-error'); - }, - unhighlight: function (e) { - $(e).closest('.form-group').removeClass('has-error'); - }, rules: { @@ -111,6 +88,6 @@ $(document).ready(function() msg_pwd: "lang->line('config_msg_pwd_required'); ?>", msg_src: "lang->line('config_msg_src_required'); ?>" } - }); + })); }); diff --git a/application/views/configs/receipt_config.php b/application/views/configs/receipt_config.php index 8d8521882..820d7e65e 100644 --- a/application/views/configs/receipt_config.php +++ b/application/views/configs/receipt_config.php @@ -211,38 +211,22 @@ $(document).ready(function() var dialog_confirmed = window.jsPrintSetup; - $('#receipt_config_form').validate({ + $('#receipt_config_form').validate($.extend(form_support.handler, { submitHandler: function(form) { $(form).ajaxSubmit({ beforeSerialize: function(arr, $form, options) { return ( dialog_confirmed || confirm('lang->line('config_jsprintsetup_required'); ?>') ); }, success: function(response) { - if(response.success) - { - set_feedback(response.message, 'alert alert-dismissible alert-success', false); - } - else - { - set_feedback(response.message, 'alert alert-dismissible alert-danger', true); - } + $.notify(response.message, { type: response.success} ); }, dataType:'json' }); }, - errorClass: "has-error", errorLabelContainer: "#receipt_error_message_box", - wrapper: "li", - highlight: function (e) { - $(e).closest('.form-group').addClass('has-error'); - }, - unhighlight: function (e) { - $(e).closest('.form-group').removeClass('has-error'); - }, - - rules: + rules: { print_top_margin: { @@ -289,6 +273,6 @@ $(document).ready(function() number:"lang->line('config_print_right_margin_number'); ?>" } } - }); + })); }); diff --git a/application/views/configs/stock_config.php b/application/views/configs/stock_config.php index a588a9337..2d720e44a 100644 --- a/application/views/configs/stock_config.php +++ b/application/views/configs/stock_config.php @@ -71,36 +71,20 @@ $(document).ready(function() return value.indexOf('_') === -1; }, "lang->line('config_stock_location_invalid_chars'); ?>"); - $('#location_config_form').validate({ + $('#location_config_form').validate($.extend(form_support.handler, { submitHandler: function(form) { $(form).ajaxSubmit({ success: function(response) { - if(response.success) - { - set_feedback(response.message, 'alert alert-dismissible alert-success', false); - } - else - { - set_feedback(response.message, 'alert alert-dismissible alert-danger', true); - } - + $.notify({ message: response.message }, { type: response.success ? 'success' : 'danger'}); $("#stock_locations").load('', init_add_remove_locations); }, dataType: 'json' }); }, - errorClass: "has-error", errorLabelContainer: "#stock_error_message_box", - wrapper: "li", - highlight: function (e) { - $(e).closest('.form-group').addClass('has-error'); - }, - unhighlight: function (e) { - $(e).closest('.form-group').removeClass('has-error'); - }, - rules: + rules: { } - }); + })); }); diff --git a/application/views/items/manage.php b/application/views/items/manage.php index d8d330470..d73ab8bc1 100644 --- a/application/views/items/manage.php +++ b/application/views/items/manage.php @@ -57,7 +57,7 @@ $(document).ready(function() }); -