tailbone/tailbone/templates/products/index.mako

108 lines
3.2 KiB
Plaintext
Raw Normal View History

<%inherit file="/grid.mako" />
2012-04-16 00:51:12 -05:00
<%def name="title()">Products</%def>
<%def name="head_tags()">
${parent.head_tags()}
<style type="text/css">
table.grid-header td.tools table {
2012-08-01 07:54:03 -05:00
margin-left: auto;
}
table.grid-header td.tools table th,
table.grid-header td.tools table td {
2012-08-01 07:54:03 -05:00
padding: 0px;
text-align: left;
}
table.grid-header td.tools table #label-quantity {
2012-08-01 07:54:03 -05:00
text-align: right;
width: 30px;
}
2012-08-06 18:56:38 -05:00
div.grid table tbody td.size,
div.grid table tbody td.regular_price_uuid,
div.grid table tbody td.current_price_uuid {
2012-08-01 07:54:03 -05:00
padding-right: 6px;
text-align: right;
}
2012-08-06 18:56:38 -05:00
div.grid table tbody td.labels {
2012-08-01 07:54:03 -05:00
text-align: center;
}
</style>
% if label_profiles and request.has_perm('products.print_labels'):
2012-08-01 07:54:03 -05:00
<script language="javascript" type="text/javascript">
$(function() {
$('div.grid a.print-label').live('click', function() {
2012-08-01 07:54:03 -05:00
var quantity = $('#label-quantity').val();
2012-08-01 08:02:15 -05:00
if (isNaN(quantity)) {
alert("You must provide a valid label quantity.");
$('#label-quantity').select();
$('#label-quantity').focus();
} else {
$.ajax({
url: '${url('products.print_labels')}',
2012-08-01 08:02:15 -05:00
data: {
'product': get_uuid(this),
2012-08-01 08:02:15 -05:00
'profile': $('#label-profile').val(),
'quantity': quantity,
},
success: function(data) {
if (data.error) {
alert("An error occurred while attempting to print:\n\n" + data.error);
} else if (quantity == '1') {
alert("1 label has been printed.");
} else {
alert(quantity + " labels have been printed.");
}
},
2012-08-01 08:02:15 -05:00
});
}
2012-08-01 07:54:03 -05:00
return false;
});
});
</script>
% endif
</%def>
<%def name="tools()">
% if label_profiles and request.has_perm('products.print_labels'):
2012-08-01 07:54:03 -05:00
<table>
<thead>
<tr>
<td>Label</td>
<td>Qty.</td>
</tr>
</thead>
<tbody>
<td>
<select name="label-profile" id="label-profile">
% for profile in label_profiles:
<option value="${profile.uuid}">${profile.description}</option>
2012-08-01 07:54:03 -05:00
% endfor
</select>
</td>
<td>
<input type="text" name="label-quantity" id="label-quantity" value="1" />
</td>
</tbody>
</table>
% endif
</%def>
<%def name="context_menu_items()">
2012-11-18 10:38:11 -06:00
% if request.has_perm('products.create'):
<li>${h.link_to("Create a new Product", url('product.create'))}</li>
% endif
% if request.has_perm('batches.create'):
<li>${h.link_to("Create Batch from Results", url('products.create_batch'))}</li>
% endif
</%def>
2012-04-10 12:39:30 -05:00
${parent.body()}