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; background-color: #e0e0e0;
} }
.grid3 tr.even { .newgrid.grid3 tr:not(.header).hovering {
background-color: White; background-color: #bbbbbb;
} }
/* this is needed only as override? */ .newgrid.grid3 tr:not(.header).warning.odd {
.newgrid.grid3 tbody tr:nth-child(odd) { background-color: #fcc;
background-color: White;
} }
.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 { .newgrid.grid3 tr:not(.header).notice.odd {

View file

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

View file

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

View file

@ -52,6 +52,18 @@ class BatchMasterView2(MasterView2, BatchMasterView):
'executed_by', '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): def configure_grid(self, g):
super(BatchMasterView2, self).configure_grid(g) super(BatchMasterView2, self).configure_grid(g)

View file

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

View file

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