From 2833b7598ea868ae23acb02f96466906a2628be2 Mon Sep 17 00:00:00 2001 From: jekkos Date: Mon, 29 Feb 2016 22:20:38 +0100 Subject: [PATCH] Bootstrapify date_input for reports (#116). Form alignment to be improved, basic version working Move common jquery validation settings to base object --- application/helpers/dateformat_helper.php | 48 +++++++ application/views/customers/form.php | 4 +- application/views/employees/form.php | 4 +- application/views/giftcards/form.php | 2 - application/views/item_kits/form.php | 2 - application/views/items/form.php | 3 - application/views/items/form_bulk.php | 5 +- application/views/partial/header.php | 2 +- application/views/receivings/form.php | 4 +- application/views/reports/date_input.php | 143 ++++++++++---------- application/views/sales/form.php | 4 +- application/views/suppliers/form.php | 5 +- dist/opensourcepos.js | 3 + dist/opensourcepos.min.js | 2 +- js/manage_tables.js | 3 + templates/spacelab/views/partial/header.php | 2 +- 16 files changed, 137 insertions(+), 99 deletions(-) diff --git a/application/helpers/dateformat_helper.php b/application/helpers/dateformat_helper.php index 5e802dc63..6d31437d3 100644 --- a/application/helpers/dateformat_helper.php +++ b/application/helpers/dateformat_helper.php @@ -1,5 +1,9 @@ 'DD', + 'D' => 'ddd', + 'j' => 'D', + 'l' => 'dddd', + 'N' => 'E', + 'S' => 'o', + 'w' => 'e', + 'z' => 'DDD', + 'W' => 'W', + 'F' => 'MMMM', + 'm' => 'MM', + 'M' => 'MMM', + 'n' => 'M', + 't' => '', // no equivalent + 'L' => '', // no equivalent + 'o' => 'YYYY', + 'Y' => 'YYYY', + 'y' => 'YY', + 'a' => 'a', + 'A' => 'A', + 'B' => '', // no equivalent + 'g' => 'h', + 'G' => 'H', + 'h' => 'hh', + 'H' => 'HH', + 'i' => 'mm', + 's' => 'ss', + 'u' => 'SSS', + 'e' => 'zz', // deprecated since version $1.6.0 of moment.js + 'I' => '', // no equivalent + 'O' => '', // no equivalent + 'P' => '', // no equivalent + 'T' => '', // no equivalent + 'Z' => '', // no equivalent + 'c' => '', // no equivalent + 'r' => '', // no equivalent + 'U' => 'X' + ); + return strtr($php_format, $SYMBOLS_MATCHING); +} + function dateformat_bootstrap($php_format) { $SYMBOLS_MATCHING = array( diff --git a/application/views/customers/form.php b/application/views/customers/form.php index 1912b5740..bbf02cd48 100644 --- a/application/views/customers/form.php +++ b/application/views/customers/form.php @@ -74,9 +74,7 @@ $(document).ready(function() }); }, - errorLabelContainer: "#error_message_box", - wrapper: "li", - rules: + rules: { first_name: "required", last_name: "required", diff --git a/application/views/employees/form.php b/application/views/employees/form.php index 4253b1279..4867376a5 100644 --- a/application/views/employees/form.php +++ b/application/views/employees/form.php @@ -168,9 +168,7 @@ $(document).ready(function() }); }, - errorLabelContainer: "#error_message_box", - wrapper: "li", - rules: + rules: { first_name: "required", last_name: "required", diff --git a/application/views/giftcards/form.php b/application/views/giftcards/form.php index 480f59b8b..d71f33fa2 100644 --- a/application/views/giftcards/form.php +++ b/application/views/giftcards/form.php @@ -87,8 +87,6 @@ $(document).ready(function() selected_person_id && autocompleter.val(selected_person_id); submit_form.call(form, selected_person); }, - errorLabelContainer: "#error_message_box", - wrapper: "li", rules: { giftcard_number: diff --git a/application/views/item_kits/form.php b/application/views/item_kits/form.php index 3c7c18512..7b3ddf4aa 100644 --- a/application/views/item_kits/form.php +++ b/application/views/item_kits/form.php @@ -109,8 +109,6 @@ $(document).ready(function() }); }, - errorLabelContainer: "#error_message_box", - wrapper: "li", rules: { name:"required", diff --git a/application/views/items/form.php b/application/views/items/form.php index 81dcb01f2..b37d56596 100644 --- a/application/views/items/form.php +++ b/application/views/items/form.php @@ -333,9 +333,6 @@ }); event.preventDefault(); }, - errorLabelContainer: "#error_message_box", - errorClass: "has-error", - wrapper: "li", rules: { name:"required", diff --git a/application/views/items/form_bulk.php b/application/views/items/form_bulk.php index 61b1ef2c6..14d45e707 100644 --- a/application/views/items/form_bulk.php +++ b/application/views/items/form_bulk.php @@ -182,10 +182,7 @@ $(document).ready(function() } }, - errorLabelContainer: "#error_message_box", - errorClass: "has-error", - wrapper: "li", - rules: + rules: { unit_price: { diff --git a/application/views/partial/header.php b/application/views/partial/header.php index a62092dc1..28b2b99ad 100644 --- a/application/views/partial/header.php +++ b/application/views/partial/header.php @@ -68,7 +68,7 @@ - + diff --git a/application/views/receivings/form.php b/application/views/receivings/form.php index 76c9f7841..852063bb2 100755 --- a/application/views/receivings/form.php +++ b/application/views/receivings/form.php @@ -156,9 +156,7 @@ $(document).ready(function() selected_supplier_id && autocompleter.val(selected_supplier_id); submit_form.call(form, selected_supplier); }, - errorLabelContainer: "#error_message_box", - wrapper: "li", - rules: + rules: { invoice_number: { invoice_number: true diff --git a/application/views/reports/date_input.php b/application/views/reports/date_input.php index dfa49af13..040ac87ae 100644 --- a/application/views/reports/date_input.php +++ b/application/views/reports/date_input.php @@ -6,74 +6,67 @@ if(isset($error)) echo "
".$error."
"; } ?> - lang->line('reports_date_range'), 'report_date_range_label', array('class'=>'required')); ?> -
- - -
- -
- - - - - - - - - - - - -
- - lang->line('reports_discount_prefix') .' ' .form_input(array( - 'name'=>'selected_discount', - 'id'=>'selected_discount', - 'value'=>'0')). ' '. $this->lang->line('reports_discount_suffix') - ?> - -
- -
- - - lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required')); ?> -
- $this->lang->line('reports_all'), - 'sales' => $this->lang->line('reports_sales'), - 'returns' => $this->lang->line('reports_returns')), 'all', 'id="input_type"'); ?> -
- - lang->line('reports_receiving_type'), 'reports_receiving_type_label', array('class'=>'required')); ?> -
- $this->lang->line('reports_all'), - 'receiving' => $this->lang->line('reports_receivings'), - 'returns' => $this->lang->line('reports_returns'), - 'requisitions' => $this->lang->line('reports_requisitions')), 'all', 'id="input_type"'); ?> -
- 1) - { - ?> - lang->line('reports_stock_location'), 'reports_stock_location_label', array('class'=>'required')); ?> -
- +'item_form', 'enctype'=>'multipart/form-data', 'class' => 'form-horizontal')); ?> + +
+ lang->line('reports_date_range'), 'report_date_range_label', array('class'=>'control-label col-xs-1 required')); ?> + +
+
+
- +
+ +
+
+
+ + +
+ lang->line('reports_sale_type'), 'reports_sale_type_label', array('class'=>'required control-label col-xs-1')); ?> +
+ $this->lang->line('reports_all'), + 'sales' => $this->lang->line('reports_sales'), + 'returns' => $this->lang->line('reports_returns')), 'all', 'id="input_type" class="form-control"'); ?> +
+
+ +
+ lang->line('reports_receiving_type'), 'reports_receiving_type_label', array('class'=>'required control-label col-xs-2')); ?> +
+ $this->lang->line('reports_all'), + 'receiving' => $this->lang->line('reports_receivings'), + 'returns' => $this->lang->line('reports_returns'), + 'requisitions' => $this->lang->line('reports_requisitions')), 'all', 'id="input_type" class="form-control"'); ?> +
+
+ 1) +{ +?> +
+ lang->line('reports_stock_location'), 'reports_stock_location_label', array('class'=>'required control-label col-xs-2')); ?> +
+ +
+
+ + 'generate_report', @@ -83,11 +76,25 @@ echo form_button(array( ); ?> + + load->view("partial/footer"); ?> +