Purge even more jquery stuff
and related static files etc. from old themes this might be the end of it..??
This commit is contained in:
parent
2ebae17839
commit
976a5836a9
42 changed files with 366 additions and 5152 deletions
|
@ -1,99 +1,6 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/batch/create.mako" />
|
||||
|
||||
<%def name="extra_javascript()">
|
||||
${parent.extra_javascript()}
|
||||
${self.func_show_mode()}
|
||||
<script type="text/javascript">
|
||||
|
||||
var purchases_field = '${purchases_field}';
|
||||
var purchases = null; // TODO: where is this used?
|
||||
|
||||
function vendor_selected(uuid, name) {
|
||||
var mode = $('.mode select').val();
|
||||
if (mode == ${enum.PURCHASE_BATCH_MODE_RECEIVING} || mode == ${enum.PURCHASE_BATCH_MODE_COSTING}) {
|
||||
var purchases = $('.purchase_uuid select');
|
||||
purchases.empty();
|
||||
|
||||
var data = {'vendor_uuid': uuid, 'mode': mode};
|
||||
$.get('${url('purchases.batch.eligible_purchases')}', data, function(data) {
|
||||
if (data.error) {
|
||||
alert(data.error);
|
||||
} else {
|
||||
$.each(data.purchases, function(i, purchase) {
|
||||
purchases.append($('<option value="' + purchase.key + '">' + purchase.display + '</option>'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: apparently refresh doesn't work right?
|
||||
// http://stackoverflow.com/a/10280078
|
||||
// purchases.selectmenu('refresh');
|
||||
purchases.selectmenu('destroy').selectmenu();
|
||||
}
|
||||
}
|
||||
|
||||
function vendor_cleared() {
|
||||
var purchases = $('.purchase_uuid select');
|
||||
purchases.empty();
|
||||
|
||||
// TODO: apparently refresh doesn't work right?
|
||||
// http://stackoverflow.com/a/10280078
|
||||
// purchases.selectmenu('refresh');
|
||||
purchases.selectmenu('destroy').selectmenu();
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
$('.field-wrapper.mode select').selectmenu({
|
||||
change: function(event, ui) {
|
||||
show_mode(ui.item.value);
|
||||
}
|
||||
});
|
||||
|
||||
show_mode(${batch.mode or enum.PURCHASE_BATCH_MODE_ORDERING});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
<%def name="func_show_mode()">
|
||||
<script type="text/javascript">
|
||||
|
||||
function show_mode(mode) {
|
||||
if (mode == ${enum.PURCHASE_BATCH_MODE_ORDERING}) {
|
||||
$('.field-wrapper.store_uuid').show();
|
||||
$('.field-wrapper.' + purchases_field).hide();
|
||||
$('.field-wrapper.department_uuid').show();
|
||||
$('.field-wrapper.buyer_uuid').show();
|
||||
$('.field-wrapper.date_ordered').show();
|
||||
$('.field-wrapper.date_received').hide();
|
||||
$('.field-wrapper.po_number').show();
|
||||
$('.field-wrapper.invoice_date').hide();
|
||||
$('.field-wrapper.invoice_number').hide();
|
||||
} else if (mode == ${enum.PURCHASE_BATCH_MODE_RECEIVING}) {
|
||||
$('.field-wrapper.store_uuid').hide();
|
||||
$('.field-wrapper.purchase_uuid').show();
|
||||
$('.field-wrapper.department_uuid').hide();
|
||||
$('.field-wrapper.buyer_uuid').hide();
|
||||
$('.field-wrapper.date_ordered').hide();
|
||||
$('.field-wrapper.date_received').show();
|
||||
$('.field-wrapper.invoice_date').show();
|
||||
$('.field-wrapper.invoice_number').show();
|
||||
} else if (mode == ${enum.PURCHASE_BATCH_MODE_COSTING}) {
|
||||
$('.field-wrapper.store_uuid').hide();
|
||||
$('.field-wrapper.purchase_uuid').show();
|
||||
$('.field-wrapper.department_uuid').hide();
|
||||
$('.field-wrapper.buyer_uuid').hide();
|
||||
$('.field-wrapper.date_ordered').hide();
|
||||
$('.field-wrapper.date_received').hide();
|
||||
$('.field-wrapper.invoice_date').show();
|
||||
$('.field-wrapper.invoice_number').show();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
## TODO: deprecate / remove this
|
||||
|
||||
${parent.body()}
|
||||
|
|
|
@ -1,97 +1,85 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/master/index.mako" />
|
||||
|
||||
<%def name="extra_javascript()">
|
||||
${parent.extra_javascript()}
|
||||
<%def name="grid_tools()">
|
||||
${parent.grid_tools()}
|
||||
|
||||
<b-button type="is-primary"
|
||||
@click="changeStatusInit()"
|
||||
:disabled="!selected_uuids.length">
|
||||
Change Status
|
||||
</b-button>
|
||||
|
||||
<b-modal has-modal-card
|
||||
:active.sync="changeStatusShowDialog">
|
||||
<div class="modal-card">
|
||||
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Change Status</p>
|
||||
</header>
|
||||
|
||||
<section class="modal-card-body">
|
||||
|
||||
<p class="block">
|
||||
Please choose the appropriate status for the selected credits.
|
||||
</p>
|
||||
|
||||
<b-field label="Status">
|
||||
<b-select v-model="changeStatusValue">
|
||||
<option v-for="status in changeStatusOptions"
|
||||
:key="status.value"
|
||||
:value="status.value">
|
||||
{{ status.label }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
</section>
|
||||
|
||||
<footer class="modal-card-foot">
|
||||
<b-button @click="changeStatusShowDialog = false">
|
||||
Cancel
|
||||
</b-button>
|
||||
<b-button type="is-primary"
|
||||
@click="changeStatusSubmit()"
|
||||
:disabled="changeStatusSubmitting || !changeStatusValue"
|
||||
icon-pack="fas"
|
||||
icon-left="save">
|
||||
{{ changeStatusSubmitting ? "Working, please wait..." : "Save" }}
|
||||
</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</b-modal>
|
||||
|
||||
${h.form(url('purchases.credits.change_status'), ref='changeStatusForm')}
|
||||
${h.csrf_token(request)}
|
||||
${h.hidden('uuids', **{':value': 'selected_uuids'})}
|
||||
${h.hidden('status', **{':value': 'changeStatusValue'})}
|
||||
${h.end_form()}
|
||||
|
||||
</%def>
|
||||
|
||||
<%def name="modify_this_page_vars()">
|
||||
${parent.modify_this_page_vars()}
|
||||
<script type="text/javascript">
|
||||
|
||||
function update_change_status_button() {
|
||||
var count = $('.grid tr:not(.header) td.checkbox input:checked').length;
|
||||
$('button.change-status').button('option', 'disabled', count < 1);
|
||||
${grid.component_studly}Data.changeStatusShowDialog = false
|
||||
${grid.component_studly}Data.changeStatusOptions = ${json.dumps(status_options)|n}
|
||||
${grid.component_studly}Data.changeStatusValue = null
|
||||
${grid.component_studly}Data.changeStatusSubmitting = false
|
||||
|
||||
${grid.component_studly}.methods.changeStatusInit = function() {
|
||||
this.changeStatusValue = null
|
||||
this.changeStatusShowDialog = true
|
||||
}
|
||||
|
||||
$(function() {
|
||||
${grid.component_studly}.methods.changeStatusSubmit = function() {
|
||||
this.changeStatusSubmitting = true
|
||||
this.$refs.changeStatusForm.submit()
|
||||
}
|
||||
|
||||
$('.grid-wrapper').on('click', 'tr.header td.checkbox input', function() {
|
||||
update_change_status_button();
|
||||
});
|
||||
|
||||
$('.grid-wrapper').on('click', '.grid tr:not(.header) td.checkbox input', function() {
|
||||
update_change_status_button();
|
||||
});
|
||||
$('.grid-wrapper').on('click', '.grid tr:not(.header)', function() {
|
||||
update_change_status_button();
|
||||
});
|
||||
|
||||
$('button.change-status').click(function() {
|
||||
var uuids = [];
|
||||
$('.grid tr:not(.header) td.checkbox input:checked').each(function() {
|
||||
uuids.push($(this).parents('tr:first').data('uuid'));
|
||||
});
|
||||
if (! uuids.length) {
|
||||
alert("You must first select one or more credits.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var form = $('form[name="change-status"]');
|
||||
form.find('[name="uuids"]').val(uuids.toString());
|
||||
|
||||
$('#change-status-dialog').dialog({
|
||||
title: "Change Credit Status",
|
||||
width: 500,
|
||||
height: 300,
|
||||
modal: true,
|
||||
open: function() {
|
||||
// TODO: why must we do this here instead of using auto-enhance ?
|
||||
$('#change-status-dialog select[name="status"]').selectmenu();
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
text: "Submit",
|
||||
click: function(event) {
|
||||
disable_button(dialog_button(event));
|
||||
form.submit();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "Cancel",
|
||||
click: function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
<%def name="grid_tools()">
|
||||
${parent.grid_tools()}
|
||||
<button type="button" class="change-status" disabled="disabled">Change Status</button>
|
||||
</%def>
|
||||
|
||||
${parent.body()}
|
||||
|
||||
<div id="change-status-dialog" style="display: none;">
|
||||
${h.form(url('purchases.credits.change_status'), name='change-status')}
|
||||
${h.csrf_token(request)}
|
||||
${h.hidden('uuids')}
|
||||
|
||||
<br />
|
||||
<p>Please choose the appropriate status for the selected credits.</p>
|
||||
|
||||
<div class="fieldset">
|
||||
|
||||
<div class="field-wrapper status">
|
||||
<label for="status">Status</label>
|
||||
<div class="field">
|
||||
${h.select('status', None, status_options)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
${h.end_form()}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue