81 lines
2.3 KiB
HTML
81 lines
2.3 KiB
HTML
|
|
<div id="prices" class="page">
|
||
|
|
<div id="gridView" class="view">
|
||
|
|
<div class="measureSelectionContainer">
|
||
|
|
<h1><span class="fa fa-sitemap"></span> Prices</h1>
|
||
|
|
<label for="DFMeasure">Measure</label>
|
||
|
|
<div class="form-group">
|
||
|
|
<select id="DFMeasure" class="form-control" tabindex="0">
|
||
|
|
</select>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div id="dataTable">
|
||
|
|
</div>
|
||
|
|
<div class="priceEditorContainer">
|
||
|
|
<div class="col-md-6">
|
||
|
|
<div class="input-group">
|
||
|
|
<span class="input-group-addon">$</span><input id="DFPrice" type="number" min="0.00" step="0.50" value="11.00" data-number-to-fixed="2" class="form-control currency" tabindex="0" required>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="col-md-6"><button id="changePriceBtn" type="button" class="btn btn-default btn-primary btn-md" tabindex="0">Apply</button></div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script language="JavaScript" type="text/javascript">//# sourceURL=prices.html
|
||
|
|
$(function() {
|
||
|
|
var numPattern = /^\d+/;
|
||
|
|
var $page = $('#prices');
|
||
|
|
var $measure = $page.find("#DFMeasure");
|
||
|
|
var $changePriceBtn = $page.find("#changePriceBtn");
|
||
|
|
|
||
|
|
//Update the dialog drop downs when the queries finish.
|
||
|
|
$.when.apply($, [$.get("data/Measure/readAll", {request: JSON.stringify({order: ['id', ['id']]})})]).then(function(query1) {
|
||
|
|
//Initialize the drop down menu.
|
||
|
|
//$page.find("#DFMeasure").buildCombo(query1, {textAttr: 'name', listClass: 'comboList'});
|
||
|
|
// query1.sort(function(a, b) {
|
||
|
|
// a.id > b.id ? 1 : -1;
|
||
|
|
// });
|
||
|
|
|
||
|
|
for(var i = 0; i < query1.length; i++) {
|
||
|
|
var next = query1[i];
|
||
|
|
var $opt = $('<option/>', {id: next.id, text: next.name});
|
||
|
|
|
||
|
|
$opt.appendTo($measure);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
$changePriceBtn.disable(true);
|
||
|
|
$measure.change(function() {
|
||
|
|
var id = $measure.val();
|
||
|
|
|
||
|
|
//TODO: Update the data table with items that use the given measure.
|
||
|
|
$table.jsGrid('loadData', id);
|
||
|
|
});
|
||
|
|
|
||
|
|
var $table = $page.find('#dataTable');
|
||
|
|
$table.jsGrid({
|
||
|
|
width: '100%',
|
||
|
|
height: '100%',
|
||
|
|
heading: true,
|
||
|
|
selecting: true,
|
||
|
|
inserting: false,
|
||
|
|
editing: false,
|
||
|
|
sorting: true,
|
||
|
|
paging: false,
|
||
|
|
fields: [
|
||
|
|
{name: "Item", type: "text", width: '50%'},
|
||
|
|
{name: 'Price', type: 'number'}
|
||
|
|
],
|
||
|
|
controller: {
|
||
|
|
loadData: function(filter) {
|
||
|
|
return $.ajax({
|
||
|
|
type: 'POST',
|
||
|
|
url: "data/Item/readAll",
|
||
|
|
data: {request: JSON.stringify({showDeleted: true, filter: filter})},
|
||
|
|
dataType: 'json'
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
</script>
|