Fix template/styles for v3 grid views, add purchasing batch status

This commit is contained in:
Lance Edgar 2017-07-14 15:45:31 -05:00
parent c774d6c8e3
commit c18774e5e5
6 changed files with 62 additions and 34 deletions

View file

@ -46,16 +46,20 @@
background-color: #e0e0e0;
}
.grid3 tr.even {
background-color: White;
.newgrid.grid3 tr:not(.header).hovering {
background-color: #bbbbbb;
}
/* this is needed only as override? */
.newgrid.grid3 tbody tr:nth-child(odd) {
background-color: White;
.newgrid.grid3 tr:not(.header).warning.odd {
background-color: #fcc;
}
.newgrid.grid3 tbody tr:nth-child(odd).hovering {
background-color: #bbbbbb;
.newgrid.grid3 tr:not(.header).warning.even {
background-color: #ebb;
}
.newgrid.grid3 tr:not(.header).warning.hovering {
background-color: #daa;
}
.newgrid.grid3 tr:not(.header).notice.odd {

View file

@ -194,37 +194,37 @@
cursor: default;
}
.newgrid tbody tr:nth-child(odd) {
background-color: #e0e0e0;
}
/* .newgrid tbody tr:nth-child(odd) { */
/* background-color: #e0e0e0; */
/* } */
.newgrid tbody tr.hovering {
background-color: #bbbbbb;
}
/* .newgrid tbody tr.hovering { */
/* background-color: #bbbbbb; */
/* } */
.newgrid tbody tr.notice {
background-color: #fd6;
}
/* .newgrid tbody tr.notice { */
/* background-color: #fd6; */
/* } */
.newgrid tbody tr.notice:nth-child(odd) {
background-color: #fe8;
}
/* .newgrid tbody tr.notice:nth-child(odd) { */
/* background-color: #fe8; */
/* } */
.newgrid tbody tr.notice.hovering {
background-color: #ec7;
}
/* .newgrid tbody tr.notice.hovering { */
/* background-color: #ec7; */
/* } */
.newgrid tbody tr.warning {
background-color: #fcc;
}
/* .newgrid tbody tr.warning { */
/* background-color: #fcc; */
/* } */
.newgrid tbody tr.warning:nth-child(odd) {
background-color: #ebb;
}
/* .newgrid tbody tr.warning:nth-child(odd) { */
/* background-color: #ebb; */
/* } */
.newgrid tbody tr.warning.hovering {
background-color: #daa;
}
/* .newgrid tbody tr.warning.hovering { */
/* background-color: #daa; */
/* } */
.newgrid tbody td.checkbox {
text-align: center;

View file

@ -1,8 +1,8 @@
## -*- coding: utf-8 -*-
## -*- coding: utf-8; -*-
<%inherit file="/master/view.mako" />
<%def name="head_tags()">
${parent.head_tags()}
<%def name="extra_javascript()">
${parent.extra_javascript()}
${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js'))}
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.batch.js'))}
<script type="text/javascript">
@ -19,6 +19,10 @@
});
</script>
</%def>
<%def name="extra_styles()">
${parent.extra_styles()}
<style type="text/css">
.newgrid-wrapper {

View file

@ -52,6 +52,18 @@ class BatchMasterView2(MasterView2, BatchMasterView):
'executed_by',
]
def get_fallback_templates(self, template, mobile=False):
if mobile:
return [
'/mobile/newbatch/{}.mako'.format(template),
'/mobile/master/{}.mako'.format(template),
]
return [
'/newbatch/{}.mako'.format(template),
'/master2/{}.mako'.format(template),
'/master/{}.mako'.format(template),
]
def configure_grid(self, g):
super(BatchMasterView2, self).configure_grid(g)

View file

@ -55,6 +55,7 @@ class PurchasingBatchView(BatchMasterView):
'date_ordered',
'created',
'created_by',
'status_code',
'executed',
]
@ -107,6 +108,10 @@ class PurchasingBatchView(BatchMasterView):
g.set_label('date_ordered', "Ordered")
g.set_label('date_received', "Received")
def grid_extra_class(self, batch, i):
if batch.status_code == batch.STATUS_UNKNOWN_PRODUCT:
return 'notice'
# def make_form(self, batch, **kwargs):
# if self.creating:
# kwargs.setdefault('id', 'new-purchase-form')
@ -174,6 +179,7 @@ class PurchasingBatchView(BatchMasterView):
fs.notes,
fs.created,
fs.created_by,
fs.status_code,
fs.complete,
fs.executed,
fs.executed_by,

View file

@ -224,6 +224,7 @@ class ReceivingBatchView(PurchasingBatchView):
rows = self.Session.query(model.PurchaseBatchRow)\
.filter(model.PurchaseBatchRow.batch == batch)\
.filter(model.PurchaseBatchRow.upc.in_((provided, checked)))\
.filter(model.PurchaseBatchRow.removed == False)\
.all()
if rows:
@ -252,6 +253,7 @@ class ReceivingBatchView(PurchasingBatchView):
row.description = "(unknown product)"
batch.add_row(row)
self.handler.refresh_row(row)
self.handler.refresh_batch_status(batch)
self.Session.flush()
return self.redirect(self.mobile_row_route_url('view', uuid=row.uuid))