mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-20 07:14:33 -04:00
render in red the fields in config that are empty at submit time (#116)
This commit is contained in:
1 parent
6cef7a124e
commit
2ab9404229
5 files changed
+193
-162
No files matched your search
@@ -22,7 +22,7 @@
|
||||
'type'=>'number',
|
||||
'name'=>'barcode_quality',
|
||||
'id'=>'barcode_quality',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('barcode_quality')));?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -37,7 +37,7 @@
|
||||
'type'=>'number',
|
||||
'name'=>'barcode_width',
|
||||
'id'=>'barcode_width',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('barcode_width')));?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@
|
||||
'max' => 120,
|
||||
'name'=>'barcode_height',
|
||||
'id'=>'barcode_height',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('barcode_height')));?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,7 +61,7 @@
|
||||
<div class='col-sm-2'>
|
||||
<?php echo form_dropdown('barcode_font',
|
||||
$this->barcode_lib->listfonts("fonts"),
|
||||
$this->config->item('barcode_font'), array('class'=>'form-control input-sm'));
|
||||
$this->config->item('barcode_font'), array('class'=>'form-control input-sm required'));
|
||||
?>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
@@ -71,7 +71,7 @@
|
||||
'max' => '30',
|
||||
'name'=>'barcode_font_size',
|
||||
'id'=>'barcode_font_size',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('barcode_font_size')));?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -158,7 +158,7 @@
|
||||
<?php echo form_input(array(
|
||||
'name'=>'barcode_num_in_row',
|
||||
'id'=>'barcode_num_in_row',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('barcode_num_in_row')));?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -170,7 +170,7 @@
|
||||
<?php echo form_input(array(
|
||||
'name'=>'barcode_page_width',
|
||||
'id'=>'barcode_page_width',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('barcode_page_width')));?>
|
||||
<span class="input-group-addon input-sm">%</span>
|
||||
</div>
|
||||
@@ -184,7 +184,7 @@
|
||||
<?php echo form_input(array(
|
||||
'name'=>'barcode_page_cellspacing',
|
||||
'id'=>'barcode_page_cellspacing',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('barcode_page_cellspacing')));?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
@@ -210,26 +210,32 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#barcode_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'
|
||||
});
|
||||
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: "#barcode_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: "#barcode_error_message_box",
|
||||
wrapper: "li",
|
||||
rules:
|
||||
{
|
||||
barcode_width:
|
||||
@@ -268,6 +274,7 @@ $(document).ready(function()
|
||||
number:true
|
||||
}
|
||||
},
|
||||
|
||||
messages:
|
||||
{
|
||||
barcode_width:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div id="config_wrapper">
|
||||
<fieldset id="config_info">
|
||||
<div id="required_fields_message"><?php echo $this->lang->line('common_fields_required_message'); ?></div>
|
||||
<ul id="error_message_box" class="error_message_box"></ul>
|
||||
<ul id="general_error_message_box" class="error_message_box"></ul>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_company'), 'company', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
@@ -12,7 +12,7 @@
|
||||
<?php echo form_input(array(
|
||||
'name'=>'company',
|
||||
'id'=>'company',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('company')));?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,12 +40,12 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_address'), 'address', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
<?php echo form_label($this->lang->line('config_address'), 'address', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
<div class='col-xs-6'>
|
||||
<?php echo form_textarea(array(
|
||||
'name'=>'address',
|
||||
'id'=>'address',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('address')));?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,12 +74,12 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_phone'), 'phone', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
<?php echo form_label($this->lang->line('config_phone'), 'phone', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
<div class='col-xs-6'>
|
||||
<?php echo form_input(array(
|
||||
'name'=>'phone',
|
||||
'id'=>'phone',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('phone')));?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -96,12 +96,12 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('common_return_policy'), 'return_policy', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
<?php echo form_label($this->lang->line('common_return_policy'), 'return_policy', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
<div class='col-xs-6'>
|
||||
<?php echo form_textarea(array(
|
||||
'name'=>'return_policy',
|
||||
'id'=>'return_policy',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('return_policy')));?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -112,14 +112,14 @@
|
||||
<?php echo form_input(array(
|
||||
'name'=>'default_tax_1_name',
|
||||
'id'=>'default_tax_1_name',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('default_tax_1_name')!==FALSE ? $this->config->item('default_tax_1_name') : $this->lang->line('items_sales_tax_1')));?>
|
||||
</div>
|
||||
<div class="col-xs-1 input-group">
|
||||
<?php echo form_input(array(
|
||||
'name'=>'default_tax_1_rate',
|
||||
'id'=>'default_tax_1_rate',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('default_tax_1_rate')));?>
|
||||
<span class="input-group-addon input-sm">%</span>
|
||||
</div>
|
||||
@@ -156,13 +156,13 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_default_sales_discount'), 'default_sales_discount', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
<?php echo form_label($this->lang->line('config_default_sales_discount'), 'default_sales_discount', array('class'=>'control-label col-xs-2 required')); ?>
|
||||
<div class='col-xs-2'>
|
||||
<div class="input-group">
|
||||
<?php echo form_input(array(
|
||||
'name'=>'default_sales_discount',
|
||||
'id'=>'default_sales_discount',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'type'=>'number',
|
||||
'min'=>0,
|
||||
'max'=>100,
|
||||
@@ -211,7 +211,7 @@
|
||||
<?php echo form_input(array(
|
||||
'name'=>'lines_per_page',
|
||||
'id'=>'lines_per_page',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'type'=>'number',
|
||||
'min'=>10,
|
||||
'max'=>1000,
|
||||
@@ -357,37 +357,43 @@ $(document).ready(function()
|
||||
});
|
||||
|
||||
$('#config_form').validate({
|
||||
submitHandler:function(form)
|
||||
{
|
||||
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'
|
||||
});
|
||||
|
||||
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'
|
||||
});
|
||||
},
|
||||
errorLabelContainer: "#error_message_box",
|
||||
wrapper: "li",
|
||||
|
||||
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:
|
||||
{
|
||||
company: "required",
|
||||
address: "required",
|
||||
phone: "required",
|
||||
phone: "required",
|
||||
default_tax_rate:
|
||||
{
|
||||
required:true,
|
||||
number:true
|
||||
required: true,
|
||||
number: true
|
||||
},
|
||||
email:"email",
|
||||
email: "email",
|
||||
return_policy: "required",
|
||||
lines_per_page:
|
||||
{
|
||||
@@ -400,28 +406,29 @@ $(document).ready(function()
|
||||
number: true
|
||||
}
|
||||
},
|
||||
|
||||
messages:
|
||||
{
|
||||
company: "<?php echo $this->lang->line('config_company_required'); ?>",
|
||||
address: "<?php echo $this->lang->line('config_address_required'); ?>",
|
||||
phone: "<?php echo $this->lang->line('config_phone_required'); ?>",
|
||||
default_tax_rate:
|
||||
{
|
||||
required:"<?php echo $this->lang->line('config_default_tax_rate_required'); ?>",
|
||||
number:"<?php echo $this->lang->line('config_default_tax_rate_number'); ?>"
|
||||
},
|
||||
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>",
|
||||
return_policy:"<?php echo $this->lang->line('config_return_policy_required'); ?>",
|
||||
default_sales_discount:
|
||||
{
|
||||
required: "<?php echo $this->lang->line('config_default_sales_discount_required'); ?>",
|
||||
number :"<?php echo $this->lang->line('config_default_sales_discount_number'); ?>"
|
||||
},
|
||||
lines_per_page:
|
||||
{
|
||||
required: "<?php echo $this->lang->line('config_lines_per_page_required'); ?>",
|
||||
number: "<?php echo $this->lang->line('config_lines_per_page_number'); ?>"
|
||||
}
|
||||
company: "<?php echo $this->lang->line('config_company_required'); ?>",
|
||||
address: "<?php echo $this->lang->line('config_address_required'); ?>",
|
||||
phone: "<?php echo $this->lang->line('config_phone_required'); ?>",
|
||||
default_tax_rate:
|
||||
{
|
||||
required: "<?php echo $this->lang->line('config_default_tax_rate_required'); ?>",
|
||||
number: "<?php echo $this->lang->line('config_default_tax_rate_number'); ?>"
|
||||
},
|
||||
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>",
|
||||
return_policy: "<?php echo $this->lang->line('config_return_policy_required'); ?>",
|
||||
default_sales_discount:
|
||||
{
|
||||
required: "<?php echo $this->lang->line('config_default_sales_discount_required'); ?>",
|
||||
number: "<?php echo $this->lang->line('config_default_sales_discount_number'); ?>"
|
||||
},
|
||||
lines_per_page:
|
||||
{
|
||||
required: "<?php echo $this->lang->line('config_lines_per_page_required'); ?>",
|
||||
number: "<?php echo $this->lang->line('config_lines_per_page_number'); ?>"
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div id="config_wrapper">
|
||||
<fieldset id="config_info">
|
||||
<div id="required_fields_message"><?php echo $this->lang->line('common_fields_required_message'); ?></div>
|
||||
<ul id="error_message_box" class="error_message_box"></ul>
|
||||
<ul id="locale_error_message_box" class="error_message_box"></ul>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_currency_symbol'), 'currency_symbol', array('class'=>'control-label col-xs-2')); ?>
|
||||
@@ -220,30 +220,37 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#locale_config_form').validate({
|
||||
submitHandler:function(form)
|
||||
{
|
||||
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'
|
||||
});
|
||||
|
||||
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'
|
||||
});
|
||||
},
|
||||
errorLabelContainer: "#error_message_box",
|
||||
wrapper: "li",
|
||||
|
||||
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:
|
||||
{
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
'max'=>'20',
|
||||
'name'=>'print_top_margin',
|
||||
'id'=>'print_top_margin',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('print_top_margin')));?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
@@ -138,7 +138,7 @@
|
||||
'max'=>'20',
|
||||
'name'=>'print_left_margin',
|
||||
'id'=>'print_left_margin',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('print_left_margin')));?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
@@ -155,7 +155,7 @@
|
||||
'max'=>'20',
|
||||
'name'=>'print_bottom_margin',
|
||||
'id'=>'print_bottom_margin',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('print_bottom_margin')));?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
@@ -172,7 +172,7 @@
|
||||
'max'=>'20',
|
||||
'name'=>'print_right_margin',
|
||||
'id'=>'print_right_margin',
|
||||
'class'=>'form-control input-sm',
|
||||
'class'=>'form-control input-sm required',
|
||||
'value'=>$this->config->item('print_right_margin')));?>
|
||||
<span class="input-group-addon input-sm">px</span>
|
||||
</div>
|
||||
@@ -233,33 +233,39 @@ $(document).ready(function()
|
||||
var dialog_confirmed = window.jsPrintSetup;
|
||||
|
||||
$('#receipt_config_form').validate({
|
||||
submitHandler:function(form)
|
||||
{
|
||||
submitHandler: function(form) {
|
||||
$(form).ajaxSubmit({
|
||||
beforeSerialize: function(arr, $form, options) {
|
||||
dialog_confirmed = dialog_confirmed || confirm('<?php echo $this->lang->line('config_jsprintsetup_required'); ?>');
|
||||
$("input:disabled, textarea:disabled").prop("disabled", false);
|
||||
return dialog_confirmed;
|
||||
},
|
||||
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);
|
||||
}
|
||||
// set back disabled state
|
||||
enable_disable_use_invoice_template();
|
||||
},
|
||||
dataType:'json'
|
||||
});
|
||||
|
||||
beforeSerialize: function(arr, $form, options) {
|
||||
dialog_confirmed = dialog_confirmed || confirm('<?php echo $this->lang->line('config_jsprintsetup_required'); ?>');
|
||||
$("input:disabled, textarea:disabled").prop("disabled", false);
|
||||
return dialog_confirmed;
|
||||
},
|
||||
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);
|
||||
}
|
||||
// set back disabled state
|
||||
enable_disable_use_invoice_template();
|
||||
},
|
||||
dataType:'json'
|
||||
});
|
||||
},
|
||||
|
||||
errorClass: "has-error",
|
||||
errorLabelContainer: "#receipt_error_message_box",
|
||||
wrapper: "li",
|
||||
wrapper: "li",
|
||||
highlight: function (e) {
|
||||
$(e).closest('.form-group').addClass('has-error');
|
||||
},
|
||||
unhighlight: function (e) {
|
||||
$(e).closest('.form-group').removeClass('has-error');
|
||||
},
|
||||
|
||||
rules:
|
||||
{
|
||||
print_top_margin:
|
||||
@@ -283,6 +289,7 @@ $(document).ready(function()
|
||||
number:true
|
||||
}
|
||||
},
|
||||
|
||||
messages:
|
||||
{
|
||||
print_top_margin:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div id="config_wrapper">
|
||||
<fieldset id="config_info">
|
||||
<div id="required_fields_message"><?php echo $this->lang->line('common_fields_required_message'); ?></div>
|
||||
<ul id="location_error_message_box" class="error_message_box"></ul>
|
||||
<ul id="stock_error_message_box" class="error_message_box"></ul>
|
||||
|
||||
<div id="stock_locations">
|
||||
<?php $this->load->view('partial/stock_locations', array('stock_locations' => $stock_locations)); ?>
|
||||
@@ -30,8 +30,7 @@ $(document).ready(function()
|
||||
{
|
||||
var location_count = <?php echo sizeof($stock_locations); ?>;
|
||||
|
||||
var hide_show_remove = function()
|
||||
{
|
||||
var hide_show_remove = function() {
|
||||
if ($("input[name*='stock_location']:enabled").length > 1)
|
||||
{
|
||||
$(".remove_stock_location").show();
|
||||
@@ -42,8 +41,7 @@ $(document).ready(function()
|
||||
}
|
||||
};
|
||||
|
||||
var add_stock_location = function()
|
||||
{
|
||||
var add_stock_location = function() {
|
||||
var id = $(this).parent().find('input').attr('id');
|
||||
id = id.replace(/.*?_(\d+)$/g, "$1");
|
||||
var block = $(this).parent().clone(true);
|
||||
@@ -54,14 +52,12 @@ $(document).ready(function()
|
||||
hide_show_remove();
|
||||
};
|
||||
|
||||
var remove_stock_location = function()
|
||||
{
|
||||
var remove_stock_location = function() {
|
||||
$(this).parent().remove();
|
||||
hide_show_remove();
|
||||
};
|
||||
|
||||
var init_add_remove_locations = function()
|
||||
{
|
||||
var init_add_remove_locations = function() {
|
||||
$('.add_stock_location').click(add_stock_location);
|
||||
$('.remove_stock_location').click(remove_stock_location);
|
||||
hide_show_remove();
|
||||
@@ -70,8 +66,7 @@ $(document).ready(function()
|
||||
|
||||
var duplicate_found = false;
|
||||
// run validator once for all fields
|
||||
$.validator.addMethod('stock_location' , function(value, element)
|
||||
{
|
||||
$.validator.addMethod('stock_location' , function(value, element) {
|
||||
var value_count = 0;
|
||||
$("input[name*='stock_location']").each(function() {
|
||||
value_count = $(this).val() == value ? value_count + 1 : value_count;
|
||||
@@ -79,41 +74,49 @@ $(document).ready(function()
|
||||
return value_count < 2;
|
||||
}, "<?php echo $this->lang->line('config_stock_location_duplicate'); ?>");
|
||||
|
||||
$.validator.addMethod('valid_chars', function(value, element)
|
||||
{
|
||||
$.validator.addMethod('valid_chars', function(value, element) {
|
||||
return value.indexOf('_') === -1;
|
||||
}, "<?php echo $this->lang->line('config_stock_location_invalid_chars'); ?>");
|
||||
|
||||
$('#location_config_form').validate({
|
||||
submitHandler:function(form)
|
||||
{
|
||||
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);
|
||||
}
|
||||
$("#stock_locations").load('<?php echo site_url("config/stock_locations");?>', init_add_remove_locations);
|
||||
},
|
||||
dataType:'json'
|
||||
});
|
||||
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);
|
||||
}
|
||||
|
||||
$("#stock_locations").load('<?php echo site_url("config/stock_locations");?>', init_add_remove_locations);
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
},
|
||||
errorLabelContainer: "#location_error_message_box",
|
||||
wrapper: "li",
|
||||
|
||||
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:
|
||||
{
|
||||
stock_location: {
|
||||
required:true,
|
||||
stock_location:
|
||||
{
|
||||
required: true,
|
||||
stock_location: true,
|
||||
valid_chars: true
|
||||
}
|
||||
},
|
||||
|
||||
messages:
|
||||
{
|
||||
stock_location:"<?php echo $this->lang->line('config_stock_location_required'); ?>"
|
||||
|
||||
Reference in new issue
Block a user