Add a column for the tax rate (duh) and the taxId. The taxId will

eventually be replaced with an icon for deleting tax info.
Change the comment character in the JS.
Return the generated output inside of an admin console.
This commit is contained in:
Colin Kuskie 2008-03-23 20:58:05 +00:00
parent c3a68228dd
commit bb274380ce
2 changed files with 22 additions and 11 deletions

View file

@ -431,14 +431,14 @@ EODIV
}; };
EODSURL EODSURL
$output .= <<STOP; $output .= <<STOP;
##Tell YUI how to get back to the site //Tell YUI how to get back to the site
var buildQueryString = function (state,dt) { var buildQueryString = function (state,dt) {
return ";startIndex=" + state.pagination.recordOffset + return ";startIndex=" + state.pagination.recordOffset +
";keywords=" + Dom.get('keywordsField').value + ";keywords=" + Dom.get('keywordsField').value +
";results=" + state.pagination.rowsPerPage; ";results=" + state.pagination.rowsPerPage;
}; };
##Build and configure a paginator //Build and configure a paginator
var myPaginator = new Paginator({ var myPaginator = new Paginator({
containers : ['paging'], containers : ['paging'],
pageLinks : 5, pageLinks : 5,
@ -447,7 +447,7 @@ EODSURL
template : "<strong>{CurrentPageReport}</strong> {PreviousPageLink} {PageLinks} {NextPageLink} {RowsPerPageDropdown}" template : "<strong>{CurrentPageReport}</strong> {PreviousPageLink} {PageLinks} {NextPageLink} {RowsPerPageDropdown}"
}); });
##Configure the table to use the paginator. //Configure the table to use the paginator.
var myTableConfig = { var myTableConfig = {
initialRequest : ';startIndex=0', initialRequest : ';startIndex=0',
generateRequest : buildQueryString, generateRequest : buildQueryString,
@ -456,28 +456,33 @@ EODSURL
}; };
STOP STOP
$output .= sprintf <<'EOCHJS', $i18n->get('country'), $i18n->get('state'), $i18n->get('city'), $i18n->get('code'); $output .= sprintf <<'EOCHJS', $i18n->get('country'), $i18n->get('state'), $i18n->get('city'), $i18n->get('code'), $i18n->get('tax rate');
##Build column headers. //Build column headers.
var taxColumnDefs = [ var taxColumnDefs = [
{key:"taxId", label:"taxId"},
{key:"country", label:"%s"}, {key:"country", label:"%s"},
{key:"state", label:"%s"}, {key:"state", label:"%s"},
{key:"city", label:"%s"}, {key:"city", label:"%s"},
{key:"code", label:"%s"} {key:"code", label:"%s"},
{key:"taxRate", label:"%s"},
]; ];
EOCHJS EOCHJS
$output .= <<STOP; $output .= <<STOP;
##Now, finally, the table //Now, finally, the table
var myTable = new DataTable('dt', myColumnDefs, mySource, myTableConfig); var myTable = new DataTable('dt', taxColumnDefs, mySource, myTableConfig);
##Setup the form to submit an AJAX request back to the site. //Setup the form to submit an AJAX request back to the site.
Dom.get('keywordSearchForm').onsubmit = function () { Dom.get('keywordSearchForm').onsubmit = function () {
mySource.sendRequest(';keywords=' + Dom.get('keywordsField').value + ';startIndex=0', mySource.sendRequest(';keywords=' + Dom.get('keywordsField').value + ';startIndex=0',
myTable.onDataReturnInitializeTable, myTable); myTable.onDataReturnInitializeTable, myTable);
return false; return false;
}; };
}); });
</script>
STOP STOP
return ''; return $admin->getAdminConsole->render($output, $i18n->get('taxes', 'Shop'));
} }
1; 1;

View file

@ -27,6 +27,12 @@ our $I18N = {
context => q|A postal code, or zip code.|, context => q|A postal code, or zip code.|,
}, },
'tax rate' => {
message => q|Tax Rate|,
lastUpdated => 1206302052,
context => q|The amount that a person is charged to buy something, a percentage of the price.|,
},
}; };
1; 1;