add label printing to product index
This commit is contained in:
parent
b4193db0f2
commit
6212932f74
3 changed files with 104 additions and 2 deletions
|
@ -7,14 +7,80 @@
|
|||
${parent.head_tags()}
|
||||
<style type="text/css">
|
||||
|
||||
table.header td.tools table {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
table.header td.tools table th,
|
||||
table.header td.tools table td {
|
||||
padding: 0px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.header td.tools table #label-quantity {
|
||||
text-align: right;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
div.grid.Product table tbody td.size,
|
||||
div.grid.Product table tbody td.regular_price,
|
||||
div.grid.Product table tbody td.sale_price {
|
||||
padding-right: 6px;
|
||||
text-align: right;
|
||||
padding-right: 6px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.grid.Product table tbody td.labels {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
</style>
|
||||
% if edbob.config.getboolean('rattail.labels', 'enabled', default=False):
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$('div.grid.Product a.print-label').live('click', function() {
|
||||
var quantity = $('#label-quantity').val();
|
||||
// TODO: Validate quantity as integer etc.
|
||||
$.ajax({
|
||||
url: '${url('products.print_label')}',
|
||||
data: {
|
||||
'uuid': get_uuid(this),
|
||||
'profile': $('#label-profile').val(),
|
||||
'quantity': quantity,
|
||||
},
|
||||
});
|
||||
alert("Label has been printed.");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="tools()">
|
||||
% if edbob.config.getboolean('rattail.labels', 'enabled', default=False):
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Label</td>
|
||||
<td>Qty.</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<td>
|
||||
<select name="label-profile" id="label-profile">
|
||||
% for profile in rattail.labels.iter_profiles():
|
||||
<option value="${profile.name}">${profile.display_name}</option>
|
||||
% endfor
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="label-quantity" id="label-quantity" value="1" />
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
${parent.body()}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue