Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

57 kk phone internet #109

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions imports/api/reports/methods.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import '../requests/requests.js';
import './reports.js';

/* global Reports:true*/
Expand Down
5 changes: 4 additions & 1 deletion imports/ui/components/reportDetailContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ const ReportDetailContainer = createContainer(({ params }) => {

const requests = [];
for (let x = 0; reportReady && x < report.approvedRequests.length; x += 1) {
const request = requestReady && Requests.findOne(report.approvedRequests[x]);
let request = requestReady && Requests.findOne(report.approvedRequests[x]);
if (request == undefined) {
request = {};
}
request.receipt = request.receipt && receiptReady && request.receipt.getFileRecord();
requests.push(request);
}
Expand Down
44 changes: 44 additions & 0 deletions imports/ui/components/userDashboardContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,50 @@ const UserDashboardContainer = createContainer(() => {
}
const myRequests = (requestReady && user &&
Requests.find({ userId: user._id, submitted: false }).fetch()) || [];

/* ISSUE 57 -- PHONE AND INTERNET NEED TO BE ADDED FOR FULL TIME EMPLOYEES.
Our entire group worked together to try to figure this out, and for some reason
this code won't work. Projects().find().fetch() always returns [], even though
it works above. We are genuinely stumped and out of time. */

// let indirect = []
// if (projectReady) {
// // this should be findOne( {name: "Indirect"} );
// indirect = Projects.find().fetch();
// }
// console.log(indirect);
// const indirectRequests = Requests.find({ projectId: indirect._id,
// userId: user._id, submitted: false }).fetch();
// let internetCreated = false;
// let phoneCreated = false;

// for (var req in indirectRequests) {
// if (req.description == "Internet") {
// internetCreated = true;
// }
// else if (req.description == "Phone") {
// phoneCreated = true;
// }
// }

// if (!internetCreated) {
// Meteor.call('requests.create', indirect._id.toString(), "Monthly Internet Bill",
// 50, "Internet", "1", 1, 50, Date.now(), "Internet", (error, result) => {
// if (!error) {
// myRequests.push(result);
// }
// });
// }

// if (!phoneCreated) {
// Meteor.call('requests.create', indirect._id.toString(), "Monthly Phone Bill",
// 50, "Phone", "1", 1, 50, Date.now(), "Phone", (error, result) => {
// if (!error) {
// myRequests.push(result);
// }
// });
// }

const managerIds = [];
if (managerProjects) {
for (let i = 0; i < managerProjects.length; i += 1) {
Expand Down
3 changes: 2 additions & 1 deletion imports/ui/pages/reportDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const ReportDetail = React.createClass({
},

createRequestRow(request) {
const receiptURL = request.receipt ? request.receipt.url() : '';
return (
<TableRow selectable={false}>
<TableRowColumn style={{ width: '15%' }}>{request.vendor}</TableRowColumn>
Expand All @@ -81,7 +82,7 @@ const ReportDetail = React.createClass({
<TableRowColumn style={{ width: '5%' }}>{request.dateRequired}</TableRowColumn>
<TableRowColumn style={{ width: '10%' }}>{request.intendedUsage}</TableRowColumn>
<TableRowColumn style={{ width: '10%' }}>
<a href={request.receipt.url()} rel="noopener noreferrer" target="_blank">Receipt</a>
<a href={receiptURL} rel="noopener noreferrer" target="_blank">Receipt</a>
</TableRowColumn>
</TableRow>
);
Expand Down
12 changes: 11 additions & 1 deletion imports/ui/pages/userDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,19 @@ const UserDashboard = React.createClass({
disabled={!this.state.merDates}
label="Submit MER"
primary
style={{ float: 'right', marginTop: '10px' }}
style={{ float: 'right', marginTop: '10px', marginLeft: '10px' }}
onTouchTap={this.submitReport}
/>
<!-- <RaisedButton
label="Include Internet Receipt"
primary
style={{ float: 'right', marginTop: '10px', marginLeft: '10px' }}
/>
<RaisedButton
label="Include Phone Receipt"
primary
style={{ float: 'right', marginTop: '10px' }}
/> -->
</div>
</Tab>
{this.state.isManager &&
Expand Down