diff --git a/brewman/__init__.py b/brewman/__init__.py index 41581b8e..eb2d53d4 100644 --- a/brewman/__init__.py +++ b/brewman/__init__.py @@ -85,6 +85,7 @@ def main(global_config, **settings): config.add_route('api_issues_grid', '/api/Issues/Services/{date}') config.add_route('salary_deduction_id', '/SalaryDeduction/{id}') config.add_route('salary_deduction', '/SalaryDeduction') + config.add_route('db_image', '/api/DbImage/{id}/{type}') config.add_route('api_voucher_id', '/api/Voucher/{id}') config.add_route('api_voucher', '/api/Voucher') diff --git a/brewman/models/master.py b/brewman/models/master.py index aad4f794..467f4d32 100644 --- a/brewman/models/master.py +++ b/brewman/models/master.py @@ -482,12 +482,12 @@ class LedgerType: list.append(LedgerType(5, 'Capital', True, False, False, 70, True)) list.append(LedgerType(6, 'Debtors', True, True, True, 30, True)) list.append(LedgerType(7, 'Expenses', False, True, True, 40, True)) - # list.append(LedgerType(8, 'Discount', False, False, True, 30, True)) + # list.append(LedgerType(8, 'Discount', False, False, True, 30, True)) list.append(LedgerType(9, 'Creditors', True, False, True, 60, True)) list.append(LedgerType(10, 'Salary', True, True, True, 40, False)) list.append(LedgerType(11, 'Liabilities', True, False, True, 50, True)) list.append(LedgerType(12, 'Revenue', False, False, True, 30, True)) - # list.append(LedgerType(13, 'Tax', True, False, True, 80, True)) + # list.append(LedgerType(13, 'Tax', True, False, True, 80, True)) # list.append(LedgerType(14, 'Total', False, False, False, 900, False)) # list.append(LedgerType(15, 'Net', False, False, False, 1000, False)) return list diff --git a/brewman/models/voucher.py b/brewman/models/voucher.py index 7ec52b07..07f6252b 100644 --- a/brewman/models/voucher.py +++ b/brewman/models/voucher.py @@ -1,6 +1,7 @@ from datetime import datetime import uuid +from sqlalchemy.dialects.postgresql import BYTEA from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy import Column, Integer, Boolean, Unicode, DateTime, Numeric, ForeignKey, UniqueConstraint from sqlalchemy.orm import relationship, synonym, backref @@ -334,3 +335,30 @@ class Fingerprint(Base): else: return old + +class DbImage(Base): + __tablename__ = 'images' + + id = Column('id', GUID(), primary_key=True, default=uuid.uuid4) + resource_id = Column('resource_id', GUID(), nullable=False) + resource_type = Column('resource_type', Unicode(255), nullable=False) + image = Column('image', BYTEA, nullable=False) + thumbnail = Column('thumbnail', BYTEA, nullable=False) + creation_date = Column('creation_date', DateTime(timezone=True), nullable=False) + + def __init__(self, resource_id=None, resource_type=None, image=None, thumbnail=None, creation_date=None, id=None): + self.resource_id = resource_id + self.resource_type = resource_type + self.image = image + self.thumbnail = thumbnail + self.creation_date = datetime.utcnow() if creation_date is None else creation_date + + @classmethod + def by_id(cls, id): + if not isinstance(id, uuid.UUID): + id = uuid.UUID(id) + return DBSession.query(cls).filter(cls.id == id).first() + + @classmethod + def by_resource_id(cls, id, type): + return DBSession.query(cls).filter(cls.resource_id == id, cls.resource_type == type).all() diff --git a/brewman/static/css/style.css b/brewman/static/css/style.css index 0e3adb4c..dfb25f2e 100644 --- a/brewman/static/css/style.css +++ b/brewman/static/css/style.css @@ -4,7 +4,6 @@ * */ - .thumbnails.small { margin-left: -50px; } @@ -60,7 +59,6 @@ color: #333333; } - .widget-box { background: none repeat scroll 0 0 #F9F9F9; border-top: 1px solid #CDCDCD; @@ -71,6 +69,7 @@ margin-bottom: 16px; position: relative; } + /* widgets from unicorn theme from http://wbpreview.com/previews/WB0F35928/widgets.html */ .widget-title, .modal-header, .table th, div.dataTables_wrapper .ui-widget-header, .ui-dialog .ui-dialog-titlebar { background-color: #efefef; @@ -79,9 +78,11 @@ border-bottom: 1px solid #CDCDCD; height: 36px; } + .widget-title .nav-tabs { border-bottom: 0 none; } + .widget-title .nav-tabs li a { border-bottom: medium none !important; border-left: 1px solid #DDDDDD; @@ -95,25 +96,30 @@ font-weight: bold; text-shadow: 0 1px 0 #FFFFFF; } -.widget-title .nav-tabs li:first-child a{ + +.widget-title .nav-tabs li:first-child a { border-left: medium none !important; } + .widget-title .nav-tabs li a:hover { background-color: transparent !important; border-color: #D6D6D6; border-width: 0 1px; color: #666666; } + .widget-title .nav-tabs li.active a { background-color: #F9F9F9 !important; color: #444444; } + .widget-title span.icon { border-right: 1px solid #cdcdcd; padding: 9px 10px 7px 11px; float: left; opacity: .7; } + .widget-title h5 { color: #666666; text-shadow: 0 1px 0 #ffffff; @@ -124,23 +130,28 @@ line-height: 12px; margin: 0; } + .widget-title .buttons { float: right; margin: 8px 10px 0 0; } + .widget-title .label { padding: 3px 5px 2px; float: right; margin: 9px 15px 0 0; - box-shadow: 0 1px 2px rgba(0,0,0,0.3) inset, 0 1px 0 #ffffff; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset, 0 1px 0 #ffffff; } + .widget-content { padding: 12px 15px; border-bottom: 1px solid #cdcdcd; } + .widget-box.widget-plain .widget-content { padding: 12px 0 0; } + .widget-box.collapsible .collapse.in .widget-content { border-bottom: 1px solid #CDCDCD; } @@ -148,9 +159,11 @@ .nopadding { padding: 0 !important; } + .nopadding .table { margin-bottom: 0; } + .nopadding .table-bordered { border: 0; } @@ -159,4 +172,3 @@ color: #666666; font-size: 11px; } - diff --git a/brewman/static/css/table.css b/brewman/static/css/table.css index 111665c7..6a6d1e97 100644 --- a/brewman/static/css/table.css +++ b/brewman/static/css/table.css @@ -2,46 +2,80 @@ .no-wrap { white-space: nowrap } -.hide -{ + +.hide { display: none; } + .table tbody tr.Present td:not(.no-bg) { background-color: #228B22; } + .table tbody tr.Off td:not(.no-bg) { background-color: #87CEFA; } + .table tbody tr.Leave td:not(.no-bg) { background-color: #CD5C5C; } + .table tbody tr.Absent td:not(.no-bg) { background-color: #CD0000; } + .table tbody tr.HalfDay td:not(.no-bg) { background-color: #98FB98; } + .table tbody tr.Double td:not(.no-bg) { background-color: #006400; } + .table tbody tr.PaidLeaveAvailed td:not(.no-bg) { background-color: #EEEE00; } + .table tbody tr.CasualLeaveAvailed td:not(.no-bg) { background-color: #800080; } + .table tbody tr.Overtime td:not(.no-bg) { background-color: #006400; } + .table tbody tr.OffWorked td:not(.no-bg) { background-color: #F5DEB3; } + .table tbody tr.COff td:not(.no-bg) { background-color: #F5DEB3; } + .table tbody tr.HalfPL td:not(.no-bg) { background-color: #FFF68F; } + .table tbody tr.HalfCL td:not(.no-bg) { background-color: #FF00FF; -} \ No newline at end of file +} + +.img-container { + position: relative; + display: inline-block; + cursor: crosshair; +} + +.img-container > .overlay { + position: absolute; + top: 14px; + right: 14px; + display: none; +} + +.img-container:hover .overlay { + display: block; +} + +/*.img-container:hover ~ .img-container > .overlay:hover {*/ + /*display: block;*/ +/*}*/ \ No newline at end of file diff --git a/brewman/static/partial/journal.html b/brewman/static/partial/journal.html index 0ac74b0d..e1b160ad 100644 --- a/brewman/static/partial/journal.html +++ b/brewman/static/partial/journal.html @@ -79,6 +79,18 @@ +