-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User can now view summary of books borrowed by others
- Loading branch information
Showing
40 changed files
with
270 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
var express = require('express'); | ||
var router = express.Router(); | ||
var async = require('asyncawait/async'); | ||
var await = require('asyncawait/await'); | ||
var UserModel = require('../models/users'); | ||
var BorrowPartModel = require('../models/borrowParts'); | ||
var BorrowParts = require('../lib/mongo').BorrowPart; | ||
var checkIsAdmin = require('../middlewares/check').checkIsAdmin; | ||
var InventoryModel = require('../models/inventory'); | ||
|
||
router.get('/', async (function (req, res, next) { | ||
var result = []; | ||
try { | ||
var users = await (BorrowPartModel.BorrowSummary()); | ||
users.forEach(async (function(user){ | ||
var userInfo = await (UserModel.getUserByDefaultId(user.userId)); | ||
var partInfo = await (InventoryModel.getPartById(user.partId)); | ||
result.push({ | ||
userId: user.userId, | ||
name: userInfo.name, | ||
id: userInfo.id, | ||
avatar: userInfo.avatar, | ||
borrowTime: user.created_at, | ||
borrowId: user._id, | ||
partId: user.partId, | ||
returnTime: user.return_time, | ||
bool: user.bool, | ||
approval: user.approval, | ||
partname: partInfo.name, | ||
partmodel_no: partInfo.model_no, | ||
partpic: partInfo.image | ||
}) | ||
})); | ||
|
||
setTimeout(function() { | ||
res.render('borrow_summary', { | ||
borrowUser: result | ||
}); | ||
}, 1000); | ||
|
||
} catch (error) { | ||
next(); | ||
} | ||
|
||
})); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<%- include('./layout/header') %> | ||
<div class="ui items" style="padding: 0 100px;"> | ||
<% borrowUser.forEach(function(user){ %> | ||
<div class="item"> | ||
<a class="ui tiny image" href="/profile/<%= user.userId%>" style="width: 72px; height: 72px; overflow: hidden; background: #eee;"> | ||
<img src="/img/<%= user.avatar%>"> | ||
</a> | ||
<a class="ui tiny image" style="width: 72px; height: 72px; overflow: hidden; background: #eee;"> | ||
<img src="<%= user.partpic%>"> | ||
</a> | ||
<div class="content"> | ||
<a class="header" href="/profile/<%= user.userId%>"><%= user.name%></a> | ||
<div class="description"> | ||
<p><span style="color: #666;">Employee Id</span> : <%= user.id%></p> | ||
<p><span style="color: #666;">Book Name</span> : <%= user.partname%></p> | ||
<p><span style="color: #666;">Author</span> : <%= user.partmodel_no%></p> | ||
<p><span style="color: #666;">Borrow Time</span>: <%= user.borrowTime%></p> | ||
<p><span style="color: #666;">Admin Approval Created</span>: <%= user.approval == false ? "NA" : "Approval Pending By Admin"%></p> | ||
</div> | ||
</div> | ||
</div> | ||
<hr> | ||
<% }) %> | ||
</div> | ||
<%- include('./layout/footer') %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters