[New] Showing orders now
This commit is contained in:
parent
6162cb148f
commit
cb62e295b0
|
@ -6,7 +6,7 @@
|
|||
* Define the main namespace
|
||||
*/
|
||||
if (typeof strolch == 'undefined') {
|
||||
strolch = {};
|
||||
strolch = {};
|
||||
}
|
||||
|
||||
strolch.const = {
|
||||
|
@ -14,7 +14,8 @@ strolch.const = {
|
|||
urls: {
|
||||
auth: 'rest/strolch/authentication',
|
||||
version: 'rest/strolch/version',
|
||||
resources: 'rest/strolch/model/resources'
|
||||
resources: 'rest/strolch/model/resources',
|
||||
orders: 'rest/strolch/model/orders'
|
||||
},
|
||||
|
||||
auth_token: 'auth_token',
|
||||
|
|
|
@ -295,10 +295,12 @@ strolch.fn.initDataTable = function (queryData, columns) {
|
|||
// init table
|
||||
table.dataTable({
|
||||
columns: columns,
|
||||
lengthMenu: [[5, 10, 20, -1], [5, 10, 20, 'All']],
|
||||
//lengthMenu: [[5, 10, 20, -1], [5, 10, 20, 'All']],
|
||||
lengthMenu: [[10, 50, 100, -1], [10, 50, 100, 'All']],
|
||||
processing: true,
|
||||
searching: false,
|
||||
deferLoading: 0,
|
||||
dom: 't<"bottom"iflp><"clear">',
|
||||
serverSide: true,
|
||||
ajax: function (data, callback, settings) {
|
||||
|
||||
|
@ -312,8 +314,6 @@ strolch.fn.initDataTable = function (queryData, columns) {
|
|||
ascending: data.order[0].dir == 'asc'
|
||||
};
|
||||
|
||||
console.log('Searching for ' + payload.query);
|
||||
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
url: queryData.url,
|
||||
|
@ -354,7 +354,6 @@ strolch.fn.searchDataTable = function (queryData) {
|
|||
if (strolch.fn.searchTimeouts[queryData.searchFieldId] != null)
|
||||
clearTimeout(strolch.fn.searchTimeouts[queryData.searchFieldId]);
|
||||
strolch.fn.searchTimeouts[queryData.searchFieldId] = setTimeout(function () {
|
||||
console.log('Searching for ' + queryData.query);
|
||||
$('#' + queryData.tableId).DataTable().draw();
|
||||
}, 300);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ strolch.parts.model = {
|
|||
strolch.parts.model.init = function (domParent) {
|
||||
|
||||
strolch.parts.model.prepareResourceTable();
|
||||
strolch.parts.model.prepareOrderTable();
|
||||
|
||||
strolch.parts.model.registerHandlers();
|
||||
};
|
||||
|
@ -47,15 +48,29 @@ strolch.parts.model.prepareResourceTable = function () {
|
|||
data.tableId = 'modelResourceTable';
|
||||
data.searchFieldId = 'modelResourceTableSearch';
|
||||
|
||||
var columns = strolch.parts.model.prepareColumns();
|
||||
strolch.fn.initDataTable(data, columns);
|
||||
};
|
||||
|
||||
strolch.parts.model.prepareColumns = function () {
|
||||
var columns = [];
|
||||
columns.push({title: 'Id', width: 50, data: 'Id'});
|
||||
columns.push({title: 'Name', data: 'Name'});
|
||||
columns.push({title: 'Type', data: 'Type'});
|
||||
|
||||
return columns;
|
||||
};
|
||||
strolch.fn.initDataTable(data, columns);
|
||||
};
|
||||
|
||||
strolch.parts.model.prepareOrderTable = function () {
|
||||
|
||||
// prepare query data
|
||||
var data = strolch.fn.dataTableDefaults();
|
||||
data.realmName = '';
|
||||
data.url = strolch.fn.url(strolch.const.urls.orders);
|
||||
data.tableId = 'modelOrderTable';
|
||||
data.searchFieldId = 'modelOrderTableSearch';
|
||||
|
||||
var columns = [];
|
||||
columns.push({title: 'Id', width: 50, data: 'Id'});
|
||||
columns.push({title: 'Name', data: 'Name'});
|
||||
columns.push({title: 'State', data: 'State'});
|
||||
columns.push({title: 'Date', data: 'Date'});
|
||||
columns.push({title: 'Type', data: 'Type'});
|
||||
|
||||
strolch.fn.initDataTable(data, columns);
|
||||
};
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table id="modelResourceTable" class="table table-striped table-bordered hover"
|
||||
cellspacing="0"
|
||||
width="100%">
|
||||
cellspacing="0" width="100%">
|
||||
|
||||
<caption>The resources for the current user's realm</caption>
|
||||
|
||||
|
@ -39,7 +38,20 @@
|
|||
</div>
|
||||
<div class="tab-pane" id="model-ordersTab" role="tabpanel">
|
||||
<div class="row">
|
||||
<table id="modelOrderTable" class="table table-striped">
|
||||
<div class="col-sm-12">
|
||||
<form>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-offset-2 col-sm-8">
|
||||
<input type="text" class="form-control" id="modelOrderTableSearch"
|
||||
placeholder="[id:<value>] [name:<value>] [type:<value>] [param:<bagId>:<paramId>] [value]">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<table id="modelOrderTable" class="table table-striped table-bordered hover" cellspacing="0"
|
||||
width="100%">
|
||||
|
||||
<caption>The orders for the current user's realm</caption>
|
||||
|
||||
|
|
Loading…
Reference in New Issue