From b37f984eb6a63b6cbbdc843812b86f87374f9144 Mon Sep 17 00:00:00 2001 From: jekkos Date: Mon, 2 May 2016 19:47:02 +0200 Subject: [PATCH] Fixes for item kits (new, update) (#507) Fixes for takings overview (pagination, sorting) (#293) Fixes for item tax bulk update (#507) Table rows are highlighted again before delete (#507) --- application/controllers/Customers.php | 2 +- application/controllers/Employees.php | 2 +- application/controllers/Giftcards.php | 2 +- application/controllers/Item_kits.php | 26 +++---- application/controllers/Items.php | 7 +- application/controllers/Sales.php | 2 +- application/controllers/Suppliers.php | 2 +- application/helpers/table_helper.php | 5 +- application/models/Item.php | 2 +- application/models/Item_taxes.php | 2 +- application/models/Sale.php | 2 +- application/views/items/form_bulk.php | 11 +-- application/views/partial/header.php | 2 +- dist/opensourcepos.js | 74 +++++++++++--------- dist/opensourcepos.min.js | 4 +- js/manage_tables.js | 75 ++++++++++++--------- templates/spacelab/views/partial/header.php | 2 +- 17 files changed, 119 insertions(+), 103 deletions(-) diff --git a/application/controllers/Customers.php b/application/controllers/Customers.php index 3df05c9f8..b3e14d57a 100644 --- a/application/controllers/Customers.php +++ b/application/controllers/Customers.php @@ -24,7 +24,7 @@ class Customers extends Person_controller $limit = $this->input->get('limit'); $offset = $this->input->get('offset'); - $customers = $this->Customer->search($search, $limit, $offset); + $customers = $this->Customer->search($search, $offset, $limit); $total_rows = $this->Customer->get_found_rows($search); $data_rows = array(); diff --git a/application/controllers/Employees.php b/application/controllers/Employees.php index 532eeb0e3..6ab77a985 100644 --- a/application/controllers/Employees.php +++ b/application/controllers/Employees.php @@ -24,7 +24,7 @@ class Employees extends Person_controller $limit = $this->input->get('limit'); $offset = $this->input->get('offset'); - $employees = $this->Employee->search($search, $offset, $limit); + $employees = $this->Employee->search($search, $limit, $offset); $total_rows = $this->Employee->get_found_rows($search); $data_rows = array(); foreach($employees->result() as $person) diff --git a/application/controllers/Giftcards.php b/application/controllers/Giftcards.php index 42edd2a92..b1539cbe0 100644 --- a/application/controllers/Giftcards.php +++ b/application/controllers/Giftcards.php @@ -27,7 +27,7 @@ class Giftcards extends Secure_area implements iData_controller $limit = $this->input->get('limit'); $offset = $this->input->get('offset'); - $giftcards = $this->Giftcard->search($search, $offset, $limit); + $giftcards = $this->Giftcard->search($search, $limit, $offset); $total_rows = $this->Giftcard->get_found_rows($search); $data_rows = array(); diff --git a/application/controllers/Item_kits.php b/application/controllers/Item_kits.php index 334d310e8..115c06362 100644 --- a/application/controllers/Item_kits.php +++ b/application/controllers/Item_kits.php @@ -44,7 +44,7 @@ class Item_kits extends Secure_area implements iData_controller $offset = $this->input->get('offset'); $lines_per_page = $this->Appconfig->get('lines_per_page'); - $item_kits = $this->Item_kit->search($search, $offset, $limit); + $item_kits = $this->Item_kit->search($search, $limit, $offset); $total_rows = $this->Item_kit->get_found_rows($search); //$links = $this->_initialize_pagination($this->Item_kit, $lines_per_page, $limit, $total_rows, 'search'); $data_rows = array(); @@ -67,7 +67,7 @@ class Item_kits extends Secure_area implements iData_controller function get_row($row_id) { // calculate the total cost and retail price of the Kit so it can be added to the table refresh - $item_kit = $this->add_totals_to_item_kit($this->Item_kit->get_info($item_kit_id)); + $item_kit = $this->add_totals_to_item_kit($this->Item_kit->get_info($row_id)); echo json_encode(get_item_kit_data_row($item_kit, $this)); } @@ -88,21 +88,10 @@ class Item_kits extends Secure_area implements iData_controller if ($this->Item_kit->save($item_kit_data, $item_kit_id)) { //New item kit - if ($item_kit_id==-1) - { + if ($item_kit_id==-1) { $item_kit_id = $item_kit_data['item_kit_id']; - - echo json_encode(array('success'=>true, - 'message'=>$this->lang->line('item_kits_successful_adding').' '.$item_kit_data['name'], - 'id'=>$item_kit_id)); } - else //previous item - { - echo json_encode(array('success'=>true, - 'message'=>$this->lang->line('item_kits_successful_updating').' '.$item_kit_data['name'], - 'id'=>$item_kit_id)); - } - + if ( $this->input->post('item_kit_item') != null ) { $item_kit_items = array(); @@ -113,9 +102,12 @@ class Item_kits extends Secure_area implements iData_controller 'quantity' => $quantity ); } - - $this->Item_kit_items->save($item_kit_items, $item_kit_id); + + $success = $this->Item_kit_items->save($item_kit_items, $item_kit_id); } + echo json_encode(array('success'=>$success, + 'message'=>$this->lang->line('item_kits_successful_adding').' '.$item_kit_data['name'], + 'id'=>$item_kit_id)); } else//failure { diff --git a/application/controllers/Items.php b/application/controllers/Items.php index e24e59293..99ec61d4c 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -57,7 +57,7 @@ class Items extends Secure_area implements iData_controller $filledup = array_fill_keys($this->input->get('filters'), true); $filters = array_merge($filters, $filledup); - $items = $this->Item->search($search, $filters, $offset, $limit); + $items = $this->Item->search($search, $filters, $limit, $offset); $total_rows = $this->Item->get_found_rows($search, $filters); $data_rows = array(); @@ -492,8 +492,7 @@ class Items extends Secure_area implements iData_controller } //Item data could be empty if tax information is being updated - $item_ids = explode(",", $items_to_update); - if(empty($item_data) || $this->Item->update_multiple($item_data, $item_ids)) + if(empty($item_data) || $this->Item->update_multiple($item_data, $items_to_update)) { $items_taxes_data = array(); $tax_names = $this->input->post('tax_names'); @@ -515,7 +514,7 @@ class Items extends Secure_area implements iData_controller $this->Item_taxes->save_multiple($items_taxes_data, $items_to_update); } - echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_bulk_edit'), 'id'=>$item_ids)); + echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_bulk_edit'), 'id'=>$items_to_update)); } else { diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index ee6185ab8..d158722ec 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -75,7 +75,7 @@ class Sales extends Secure_area $filledup = array_fill_keys($this->input->get('filters'), TRUE); $filters = array_merge($filters, $filledup); - $sales = $this->Sale->search($search, $filters, $offset, $limit); + $sales = $this->Sale->search($search, $filters, $limit, $offset); $total_rows = $this->Sale->get_found_rows($search, $filters); $payments = $this->Sale->get_payments_summary($search, $filters); $payment_summary = get_sales_manage_payments_summary($payments, $sales, $this); diff --git a/application/controllers/Suppliers.php b/application/controllers/Suppliers.php index 474503e83..c48b1dcb5 100644 --- a/application/controllers/Suppliers.php +++ b/application/controllers/Suppliers.php @@ -24,7 +24,7 @@ class Suppliers extends Person_controller $limit = $this->input->get('limit'); $offset = $this->input->get('offset'); - $suppliers = $this->Supplier->search($search, $offset, $limit); + $suppliers = $this->Supplier->search($search, $limit, $offset); $total_rows = $this->Supplier->get_found_rows($search); $data_rows = array(); foreach($suppliers->result() as $supplier) diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php index 5b4793700..256689d78 100644 --- a/application/helpers/table_helper.php +++ b/application/helpers/table_helper.php @@ -42,6 +42,7 @@ function get_sale_data_last_row($sales, $controller) } return array( + 'id' => '-', 'receipt_number' => ''.$CI->lang->line('sales_total').'', 'amount_tendered' => ''. to_currency($sum_amount_tendered).'', 'amount_due' => ''.to_currency($sum_change_due).'' @@ -97,7 +98,7 @@ function get_sales_manage_payments_summary($payments, $sales, $controller) // therefore we remove from the total cash amount any change due if( $payment['payment_type'] == $CI->lang->line('sales_cash') ) { - foreach($sales as $key=>$sale) + foreach($sales->result_array() as $key=>$sale) { $amount -= $sale['change_due']; } @@ -324,7 +325,7 @@ function get_item_kit_data_row($item_kit, $controller) { $controller_name=strtolower(get_class($CI)); return array ( - 'id' => 'KIT '.$item_kit->item_kit_id, + 'id' => $item_kit->item_kit_id, 'kit_name' => character_limiter($item_kit->name,13), 'kit_description' => character_limiter($item_kit->description,13), 'cost_price' => character_limiter($item_kit->total_cost_price,13), diff --git a/application/models/Item.php b/application/models/Item.php index 99526023c..99c9b0fdc 100644 --- a/application/models/Item.php +++ b/application/models/Item.php @@ -237,7 +237,7 @@ class Item extends CI_Model */ public function update_multiple($item_data, $item_ids) { - $this->db->where_in('item_id', explode(',', $item_ids[0])); + $this->db->where_in('item_id', explode(',', $item_ids)); return $this->db->update('items', $item_data); } diff --git a/application/models/Item_taxes.php b/application/models/Item_taxes.php index badc43b7a..dc7873a3e 100644 --- a/application/models/Item_taxes.php +++ b/application/models/Item_taxes.php @@ -34,7 +34,7 @@ class Item_taxes extends CI_Model function save_multiple(&$items_taxes_data, $item_ids) { - foreach($item_ids as $item_id) + foreach(explode(",", $item_ids) as $item_id) { $this->save($items_taxes_data, $item_id); } diff --git a/application/models/Sale.php b/application/models/Sale.php index f0d8b1d11..44e4aff9b 100644 --- a/application/models/Sale.php +++ b/application/models/Sale.php @@ -83,7 +83,7 @@ class Sale extends CI_Model } $this->db->group_by('sale_id'); - $this->db->order_by('sale_date', 'asc'); + $this->db->order_by('sale_date', 'desc'); if ($rows > 0) { diff --git a/application/views/items/form_bulk.php b/application/views/items/form_bulk.php index 085dfa429..60b9fccbd 100644 --- a/application/views/items/form_bulk.php +++ b/application/views/items/form_bulk.php @@ -177,13 +177,16 @@ $(document).ready(function() { if(!confirm_message || confirm(confirm_message)) { - $('').attr({ +/* $('').attr({ type: 'hidden', - name: 'item_ids[]', - value: table_support.selected_ids().join(",") + name: 'item_ids', + value: $(table_support.selected_ids()) }).appendTo(form); - +*/ $(form).ajaxSubmit({ + beforeSubmit: function(arr, $form, options) { + arr.push({name: 'item_ids', value: table_support.selected_ids()}); + }, success:function(response) { dialog_support.hide(); diff --git a/application/views/partial/header.php b/application/views/partial/header.php index ab3c6f35c..ac9f8c531 100644 --- a/application/views/partial/header.php +++ b/application/views/partial/header.php @@ -64,7 +64,7 @@ - + diff --git a/dist/opensourcepos.js b/dist/opensourcepos.js index d00723625..c6affc56e 100644 --- a/dist/opensourcepos.js +++ b/dist/opensourcepos.js @@ -49355,7 +49355,6 @@ $.tablesorter.addWidget({ }) }, buttons.call(this, event))); - //event.stopPropagation(); return false; }); }); @@ -49404,13 +49403,24 @@ $.tablesorter.addWidget({ return $("#table input:checkbox:checked").parents("tr"); }; - var highlight_rows = function (id, color) { - var original = $("tr.selected").css('backgroundColor'); - var selector = ((id && "tr[data-uniqueid='" + id + "']")) || "tr.selected"; - $(selector).removeClass("selected").animate({backgroundColor: color || '#e1ffdd'}, "slow", "linear") + var row_selector = function(id) { + return "tr[data-uniqueid='" + id + "']"; + }; + + var rows_selector = function(ids) { + var selectors = []; + ids = ids instanceof Array ? ids : ("" + ids).split(","); + $.each(ids, function(index, element) { + selectors.push(row_selector(element)); + }); + return selectors;; + }; + + var highlight_row = function (id, color) { + var original = $(row_selector(id,true)).css('backgroundColor'); + $(row_selector(id)).find("td").animate({backgroundColor: color || '#e1ffdd'}, "slow", "linear") .animate({backgroundColor: color || '#e1ffdd'}, 5000) .animate({backgroundColor: original}, "slow", "linear"); - $("tr input:checkbox:checked").prop("checked", false); }; var do_delete = function () { @@ -49418,24 +49428,21 @@ $.tablesorter.addWidget({ $.post(options.resource + '/delete', {'ids[]': selected_ids()}, function (response) { //delete was successful, remove checkbox rows if (response.success) { - table().remove({ - field: 'id', - values: selected_ids() + $(selected_rows()).each(function (index, element) { + $(this).find("td").animate({backgroundColor: "green"}, 1200, "linear") + .end().animate({opacity: 0}, 1200, "linear", function () { + table().remove({ + field: 'id', + values: selected_ids() + }); + //refresh(); + enable_actions(); + }); }); - - // animated delete below - /*$(selected_rows()).each(function (index, dom) { - /*$(this).find("td").animate({backgroundColor: "green"}, 1200, "linear") - .end().animate({opacity: 0}, 1200, "linear", function () { - $(this).remove(); - }); - });*/ set_feedback(response.message, 'alert alert-dismissible alert-success', false); } else { set_feedback(response.message, 'alert alert-dismissible alert-danger', true); } - refresh(); - enable_actions(); }, "json"); } else { return false; @@ -49445,7 +49452,7 @@ $.tablesorter.addWidget({ var load_success = function(callback) { return function(response) { typeof options.load_callback == 'function' && options.load_callback(); - load_callback = undefined; + options.load_callback = undefined; dialog_support.init("a.modal-dlg, button.modal-dlg"); typeof callback == 'function' && callback.call(this, response); } @@ -49472,7 +49479,8 @@ $.tablesorter.addWidget({ onUncheckAll: enable_actions, onLoadSuccess: load_success(options.onLoadSuccess), queryParamsType: 'limit', - iconSize: 'sm' + iconSize: 'sm', + silentSort: true })); enable_actions(); init_delete(); @@ -49495,30 +49503,32 @@ $.tablesorter.addWidget({ set_feedback(response.message, 'alert alert-dismissible alert-danger', true); } else { var message = response.message; - - if (selected_ids().length > 0) { - $.each(selected_ids(), function(element, id) { + var selector = rows_selector(response.id); + if ($(selector.join(",")).length > 0) { + $.each(selector, function(index, element) { + var id = $(element).data('uniqueid'); $.get({ url: resource + '/get_row/' + id, success: function (response) { - table().updateByUniqueId({id: response.id, row: response}); - dialog_support.init("tr.selected a.modal-dlg"); - highlight_rows(); - set_feedback(message, 'alert alert-dismissible alert-success', false); + table().updateByUniqueId({id: id, row: response}); + + dialog_support.init("a.modal-dlg"); + enable_actions(); + highlight_row(id); }, dataType: 'json' }); }); } else { // call hightlight function once after refresh - load_callback = function() { - highlight_rows(id); + options.load_callback = function() { + enable_actions(); + highlight_row(id); }; refresh(); - set_feedback(message, 'alert alert-dismissible alert-success', false); } + set_feedback(message, 'alert alert-dismissible alert-success', false); } - enable_actions(); }; $.extend(table_support, { diff --git a/dist/opensourcepos.min.js b/dist/opensourcepos.min.js index 667d994d5..d690fac56 100644 --- a/dist/opensourcepos.min.js +++ b/dist/opensourcepos.min.js @@ -1,4 +1,4 @@ -/*! opensourcepos 28-04-2016 */ +/*! opensourcepos 02-05-2016 */ function set_feedback(a,b,c){a?($("#feedback_bar").removeClass().addClass(b).html(a).css("opacity","1"),c||$("#feedback_bar").fadeTo(5e3,1).fadeTo("fast",0)):$("#feedback_bar").css("opacity","0")}function phpjsDate(a,b){var c,d,e=this,f=["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur","January","February","March","April","May","June","July","August","September","October","November","December"],g=/\\?(.?)/gi,h=function(a,b){return d[a]?d[a]():b},i=function(a,b){for(a=String(a);a.length=b&&1==parseInt(a%100/10,10)&&(b=0),["st","nd","rd"][b-1]||"th"},w:function(){return c.getDay()},z:function(){var a=new Date(d.Y(),d.n()-1,d.j()),b=new Date(d.Y(),0,1);return Math.round((a-b)/864e5)},W:function(){var a=new Date(d.Y(),d.n()-1,d.j()-d.N()+3),b=new Date(a.getFullYear(),0,4);return i(1+Math.round((a-b)/864e5/7),2)},F:function(){return f[6+d.n()]},m:function(){return i(d.n(),2)},M:function(){return d.F().slice(0,3)},n:function(){return c.getMonth()+1},t:function(){return new Date(d.Y(),d.n(),0).getDate()},L:function(){var a=d.Y();return a%4===0&a%100!==0|a%400===0},o:function(){var a=d.n(),b=d.W(),c=d.Y();return c+(12===a&&9>b?1:1===a&&b>9?-1:0)},Y:function(){return c.getFullYear()},y:function(){return d.Y().toString().slice(-2)},a:function(){return c.getHours()>11?"pm":"am"},A:function(){return d.a().toUpperCase()},B:function(){var a=3600*c.getUTCHours(),b=60*c.getUTCMinutes(),d=c.getUTCSeconds();return i(Math.floor((a+b+d+3600)/86.4)%1e3,3)},g:function(){return d.G()%12||12},G:function(){return c.getHours()},h:function(){return i(d.g(),2)},H:function(){return i(d.G(),2)},i:function(){return i(c.getMinutes(),2)},s:function(){return i(c.getSeconds(),2)},u:function(){return i(1e3*c.getMilliseconds(),6)},e:function(){throw"Not supported (see source code of date() for timezone on how to add support)"},I:function(){var a=new Date(d.Y(),0),b=Date.UTC(d.Y(),0),c=new Date(d.Y(),6),e=Date.UTC(d.Y(),6);return a-b!==c-e?1:0},O:function(){var a=c.getTimezoneOffset(),b=Math.abs(a);return(a>0?"-":"+")+i(100*Math.floor(b/60)+b%60,4)},P:function(){var a=d.O();return a.substr(0,3)+":"+a.substr(3,2)},T:function(){return"UTC"},Z:function(){return 60*-c.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(g,h)},r:function(){return"D, d M Y H:i:s O".replace(g,h)},U:function(){return c/1e3|0}},this.date=function(a,b){return e=this,c=void 0===b?new Date:new Date(b instanceof Date?b:1e3*b),a.replace(g,h)},this.date(a,b)}if(function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=!!a&&"length"in a&&a.length,c=na.type(a);return"function"===c||na.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(na.isFunction(b))return na.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return na.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(xa.test(b))return na.filter(b,a,c);b=na.filter(b,a)}return na.grep(a,function(a){return na.inArray(a,b)>-1!==c})}function e(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function f(a){var b={};return na.each(a.match(Da)||[],function(a,c){b[c]=!0}),b}function g(){da.addEventListener?(da.removeEventListener("DOMContentLoaded",h),a.removeEventListener("load",h)):(da.detachEvent("onreadystatechange",h),a.detachEvent("onload",h))}function h(){(da.addEventListener||"load"===a.event.type||"complete"===da.readyState)&&(g(),na.ready())}function i(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(Ia,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:Ha.test(c)?na.parseJSON(c):c}catch(e){}na.data(a,b,c)}else c=void 0}return c}function j(a){var b;for(b in a)if(("data"!==b||!na.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function k(a,b,c,d){if(Ga(a)){var e,f,g=na.expando,h=a.nodeType,i=h?na.cache:a,j=h?a[g]:a[g]&&g;if(j&&i[j]&&(d||i[j].data)||void 0!==c||"string"!=typeof b)return j||(j=h?a[g]=ca.pop()||na.guid++:g),i[j]||(i[j]=h?{}:{toJSON:na.noop}),("object"==typeof b||"function"==typeof b)&&(d?i[j]=na.extend(i[j],b):i[j].data=na.extend(i[j].data,b)),f=i[j],d||(f.data||(f.data={}),f=f.data),void 0!==c&&(f[na.camelCase(b)]=c),"string"==typeof b?(e=f[b],null==e&&(e=f[na.camelCase(b)])):e=f,e}}function l(a,b,c){if(Ga(a)){var d,e,f=a.nodeType,g=f?na.cache:a,h=f?a[na.expando]:na.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){na.isArray(b)?b=b.concat(na.map(b,na.camelCase)):b in d?b=[b]:(b=na.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;for(;e--;)delete d[b[e]];if(c?!j(d):!na.isEmptyObject(d))return}(c||(delete g[h].data,j(g[h])))&&(f?na.cleanData([a],!0):la.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}function m(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return na.css(a,b,"")},i=h(),j=c&&c[3]||(na.cssNumber[b]?"":"px"),k=(na.cssNumber[b]||"px"!==j&&+i)&&Ka.exec(na.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,na.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}function n(a){var b=Sa.split("|"),c=a.createDocumentFragment();if(c.createElement)for(;b.length;)c.createElement(b.pop());return c}function o(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||na.nodeName(d,b)?f.push(d):na.merge(f,o(d,b));return void 0===b||b&&na.nodeName(a,b)?na.merge([a],f):f}function p(a,b){for(var c,d=0;null!=(c=a[d]);d++)na._data(c,"globalEval",!b||na._data(b[d],"globalEval"))}function q(a){Oa.test(a.type)&&(a.defaultChecked=a.checked)}function r(a,b,c,d,e){for(var f,g,h,i,j,k,l,m=a.length,r=n(b),s=[],t=0;m>t;t++)if(g=a[t],g||0===g)if("object"===na.type(g))na.merge(s,g.nodeType?[g]:g);else if(Ua.test(g)){for(i=i||r.appendChild(b.createElement("div")),j=(Pa.exec(g)||["",""])[1].toLowerCase(),l=Ta[j]||Ta._default,i.innerHTML=l[1]+na.htmlPrefilter(g)+l[2],f=l[0];f--;)i=i.lastChild;if(!la.leadingWhitespace&&Ra.test(g)&&s.push(b.createTextNode(Ra.exec(g)[0])),!la.tbody)for(g="table"!==j||Va.test(g)?""!==l[1]||Va.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;f--;)na.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k);for(na.merge(s,i.childNodes),i.textContent="";i.firstChild;)i.removeChild(i.firstChild);i=r.lastChild}else s.push(b.createTextNode(g));for(i&&r.removeChild(i),la.appendChecked||na.grep(o(s,"input"),q),t=0;g=s[t++];)if(d&&na.inArray(g,d)>-1)e&&e.push(g);else if(h=na.contains(g.ownerDocument,g),i=o(r.appendChild(g),"script"),h&&p(i),c)for(f=0;g=i[f++];)Qa.test(g.type||"")&&c.push(g);return i=null,r}function s(){return!0}function t(){return!1}function u(){try{return da.activeElement}catch(a){}}function v(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)v(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=t;else if(!e)return a;return 1===f&&(g=e,e=function(a){return na().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=na.guid++)),a.each(function(){na.event.add(this,b,e,d,c)})}function w(a,b){return na.nodeName(a,"table")&&na.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function x(a){return a.type=(null!==na.find.attr(a,"type"))+"/"+a.type,a}function y(a){var b=eb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function z(a,b){if(1===b.nodeType&&na.hasData(a)){var c,d,e,f=na._data(a),g=na._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)na.event.add(b,c,h[c][d])}g.data&&(g.data=na.extend({},g.data))}}function A(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!la.noCloneEvent&&b[na.expando]){e=na._data(b);for(d in e.events)na.removeEvent(b,d,e.handle);b.removeAttribute(na.expando)}"script"===c&&b.text!==a.text?(x(b).text=a.text,y(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),la.html5Clone&&a.innerHTML&&!na.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Oa.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}function B(a,b,c,d){b=fa.apply([],b);var e,f,g,h,i,j,k=0,l=a.length,m=l-1,n=b[0],p=na.isFunction(n);if(p||l>1&&"string"==typeof n&&!la.checkClone&&db.test(n))return a.each(function(e){var f=a.eq(e);p&&(b[0]=n.call(this,e,f.html())),B(f,b,c,d)});if(l&&(j=r(b,a[0].ownerDocument,!1,a,d),e=j.firstChild,1===j.childNodes.length&&(j=e),e||d)){for(h=na.map(o(j,"script"),x),g=h.length;l>k;k++)f=j,k!==m&&(f=na.clone(f,!0,!0),g&&na.merge(h,o(f,"script"))),c.call(a[k],f,k);if(g)for(i=h[h.length-1].ownerDocument,na.map(h,y),k=0;g>k;k++)f=h[k],Qa.test(f.type||"")&&!na._data(f,"globalEval")&&na.contains(i,f)&&(f.src?na._evalUrl&&na._evalUrl(f.src):na.globalEval((f.text||f.textContent||f.innerHTML||"").replace(fb,"")));j=e=null}return a}function C(a,b,c){for(var d,e=b?na.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||na.cleanData(o(d)),d.parentNode&&(c&&na.contains(d.ownerDocument,d)&&p(o(d,"script")),d.parentNode.removeChild(d));return a}function D(a,b){var c=na(b.createElement(a)).appendTo(b.body),d=na.css(c[0],"display");return c.detach(),d}function E(a){var b=da,c=jb[a];return c||(c=D(a,b),"none"!==c&&c||(ib=(ib||na("