diff --git a/brewman/brewman/static/css/table.css b/brewman/brewman/static/css/table.css index 3fe21cb5..596cca43 100644 --- a/brewman/brewman/static/css/table.css +++ b/brewman/brewman/static/css/table.css @@ -10,3 +10,47 @@ background-color: #1F7A1F; } +.table tbody tr.success td { + background-color: #1F7A1F; +} + + +.table tbody tr.Present td { + background-color: #228B22; +} +.table tbody tr.Off td { + background-color: #87CEFA; +} +.table tbody tr.Leave td { + background-color: #CD5C5C; +} +.table tbody tr.Absent td { + background-color: #CD0000; +} +.table tbody tr.HalfDay td { + background-color: #98FB98; +} +.table tbody tr.Double td { + background-color: #006400; +} +.table tbody tr.PaidLeaveAvailed td { + background-color: #EEEE00; +} +.table tbody tr.CasualLeaveAvailed td { + background-color: #800080; +} +.table tbody tr.Overtime td { + background-color: #006400; +} +.table tbody tr.OffWorked td { + background-color: #F5DEB3; +} +.table tbody tr.COff td { + background-color: #F5DEB3; +} +.table tbody tr.HalfPL td { + background-color: #FFF68F; +} +.table tbody tr.HalfCL td { + background-color: #FF00FF; +} \ No newline at end of file diff --git a/brewman/brewman/static/partial/attendance.html b/brewman/brewman/static/partial/attendance.html index c3981772..bd51a5e8 100644 --- a/brewman/brewman/static/partial/attendance.html +++ b/brewman/brewman/static/partial/attendance.html @@ -23,9 +23,11 @@ - + {{item.Code}} - {{item.Name}} + {{item.Name}} {{item.Designation}} {{item.Department}} diff --git a/brewman/brewman/static/partial/employee-attendance.html b/brewman/brewman/static/partial/employee-attendance.html index c9b5bd10..6462348c 100644 --- a/brewman/brewman/static/partial/employee-attendance.html +++ b/brewman/brewman/static/partial/employee-attendance.html @@ -31,7 +31,7 @@ {{item.Date}} @@ -40,7 +40,7 @@ - + diff --git a/brewman/brewman/static/partial/journal.html b/brewman/brewman/static/partial/journal.html index e4f39c74..5077b7ec 100644 --- a/brewman/brewman/static/partial/journal.html +++ b/brewman/brewman/static/partial/journal.html @@ -70,8 +70,7 @@
-
diff --git a/brewman/brewman/views/auth/user.py b/brewman/brewman/views/auth/user.py index 8e8e814d..0e0754ca 100644 --- a/brewman/brewman/views/auth/user.py +++ b/brewman/brewman/views/auth/user.py @@ -1,3 +1,4 @@ +import re import uuid from pyramid.response import Response @@ -35,8 +36,12 @@ def save(request): @view_config(request_method='POST', route_name='user_id', renderer='json', xhr=True, permission='Users') def update(request): try: - id = request.matchdict.get('id', None) - user = User.by_id(uuid.UUID(id)) + id = request.matchdict['id'] + p = re.compile('^[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$') + if p.match(id): + user = User.by_id(uuid.UUID(id)) + else: + user = User.by_name(id) user.name = request.json_body['Name'] user.locked_out = request.json_body['LockedOut'] if request.json_body['Password'] != '' and request.json_body['Password'] != user.password: @@ -77,7 +82,11 @@ def delete(request): @view_config(request_method='GET', route_name='user_id', renderer='json', xhr=True, permission='Users') def show_id(request): - return user_info(uuid.UUID(request.matchdict.get('id', None))) + id = request.matchdict['id'] + p = re.compile('^[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}$') + if p.match(id): + id = uuid.UUID(id) + return user_info(id) @view_config(request_method='GET', route_name='user', renderer='json', xhr=True, permission='Users') @@ -91,7 +100,7 @@ def show_list(request): users = [] for item in list: user = {'Name': item.name, 'LockedOut': item.locked_out, - 'Groups': [], 'Url': request.route_url('user_id', id=item.id)} + 'Groups': [], 'Url': request.route_url('user_id', id=item.name)} for group in item.groups: user['Groups'].append(group.name) users.append(user) @@ -104,7 +113,10 @@ def user_info(id): for item in Group.list(): account['Groups'].append({'GroupID': item.id, 'Name': item.name, 'Enabled': False}) else: - user = User.by_id(id) + if isinstance(id, uuid.UUID): + user = User.by_id(id) + else: + user = User.by_name(id) account = {'UserID': user.id, 'Name': user.name, 'Password': '', 'LockedOut': user.locked_out, 'Groups': []} for item in Group.list(): account['Groups'].append(