Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
MalithyaFernando committed Sep 22, 2021
1 parent c2da197 commit d3915e0
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exports.create = (req, res) => {
date: req.body.date,
time: req.body.time,
location: req.body.location,
description: req.body.description,
status: req.body.status,
isDeleted: req.body.isDeleted ? req.body.isDeleted : false,
projectId: req.body.projectId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default class AddActionPlan extends Component {
this.onChangePlanManager = this.onChangePlanManager.bind(this);
this.onChangeLocation = this.onChangeLocation.bind(this);
this.saveActionPlan = this.saveActionPlan.bind(this);
this.viewActionPlan = this.viewActionPlan.bind(this);

this.state = {
id: null,
Expand All @@ -25,7 +24,7 @@ export default class AddActionPlan extends Component {
actiontype: "",
location: "",
description: "",
approved: false,
isApproved: false,
projectId: this.props.match.params.id,

actionplantypes: [],
Expand Down Expand Up @@ -106,49 +105,51 @@ export default class AddActionPlan extends Component {
}

saveActionPlan() {
if (this.state.title != "" &&
this.state.planmanager != "" &&
this.state.actiontype != "" &&
this.state.location != "" &&
this.state.description != ""){
var data = {
name: this.state.name,
title: this.state.title,
planmanager:this.state.planmanager,
actiontype: this.state.actiontype,
location: this.state.location,
description: this.state.description,
approved: this.state.approved,
isApproved: this.state.isApproved,
projectId: this.state.projectId
};

ActionPlanDataService.create(data)
.then(response => {
this.setState({
id: response.data.id,
name: response.data.name,
title: response.data.title,
description: response.data.description,
actiontype: response.data.actiontype,
location: response.data.location,
description: response.data.description,
approved: response.data.approved,
isApproved: response.data.isApproved,
projectId: response.data.projectId,

submitted: true
});
console.log(response.data);
cogoToast.success("Meeting Saved Successfully!");
this.props.history.push("/actionplan/"+ this.props.match.params.id);
})
.catch(e => {
console.log(e);
});
}

viewActionPlan(id){
this.props.history.push("/actionplan/"+ id);
cogoToast.success("Action Plan Saved Successfully!");
}else{
cogoToast.error("Field/s cannot be empty");
}
}

render() {
const {projectId, currentIndex, actionplantypes, isTitleValid, viewActionPlan, users} = this.state;
const {projectId, currentIndex, actionplantypes, isTitleValid, users} = this.state;
return (
<div className="container">
{this.state.submitted ? (
viewActionPlan(projectId)
) : (
<div class="container">
<h2>Add New Action Plan</h2>
<Breadcrumbs aria-label="breadcrumb">
Expand All @@ -158,14 +159,14 @@ export default class AddActionPlan extends Component {
<Link color="inherit" aria-current="page" className="disabledLink">Add New Action Plan</Link>
</Breadcrumbs><hr/>
<div className="">
<div className="form-row">
{/* <div className="form-row">
<div className="form-group col-md-12">
{this.state.title == "" ? "" : isTitleValid > 0 ?
<Alert variant="danger">Name is already taken</Alert> :
<Alert variant="success">Name is avaliable to use</Alert>
}
</div>
</div>
</div> */}
<div className="form-row">
<div className="form-group col-md-9">
<label htmlFor="title">Name</label>
Expand All @@ -181,11 +182,11 @@ export default class AddActionPlan extends Component {
/>
</div>
<div className="form-group col-md-3">
<label htmlFor="approved">Status</label>
<label htmlFor="isApproved">Status</label>
<input
type="text"
className="form-control"
value="Not Approved 🔴"
value="Not Approved"
readOnly
/>
</div>
Expand Down Expand Up @@ -224,6 +225,7 @@ export default class AddActionPlan extends Component {
value={this.state.actiontype}
onChange={this.onChangeActionType}
>
<option value="">Select an Type</option>
{actionplantypes && actionplantypes.map((actionplantype, index) => (
<option
value={actionplantype.title}
Expand Down Expand Up @@ -274,7 +276,6 @@ export default class AddActionPlan extends Component {
<button onClick={this.saveActionPlan} className="btn btn-success mr-2">Create Action Plan</button>
<a href="/actionplan">Cancel</a>
</div>
)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ export default class AddAPSection extends Component {
constructor(props) {
super(props);
this.onChangeTitle = this.onChangeTitle.bind(this);
this.onChangeReftype = this.onChangeReftype.bind(this);
this.onChangeRefid = this.onChangeRefid.bind(this);
// this.onChangeReftype = this.onChangeReftype.bind(this);
// this.onChangeRefid = this.onChangeRefid.bind(this);
this.onChangeAcceptance = this.onChangeAcceptance.bind(this);
this.onChangeDuedate = this.onChangeDuedate.bind(this);
this.retrieveAPSection = this.retrieveAPSection.bind(this);
this.viewAPSection = this.viewAPSection.bind(this);
this.saveAPsection = this.saveAPsection.bind(this);

this.state = {
id: null,
title: "",
reftype: "",
refid: "",
// reftype: "",
// refid: "",
acceptance: "",
duedate: "",
actionplanId: this.props.match.params.apid,
Expand Down Expand Up @@ -70,22 +69,24 @@ export default class AddAPSection extends Component {
});
}

onChangeRefid(e) {
this.setState({
refid: e.target.value
});
}
// onChangeRefid(e) {
// this.setState({
// refid: e.target.value
// });
// }

onChangeReftype(e) {
this.setState({
reftype: e.target.value
});
}
// onChangeReftype(e) {
// this.setState({
// reftype: e.target.value
// });
// }

saveAPsection() {
if (this.state.acceptance != "" &&
this.state.duedate != "") {
var data = {
reftype: this.state.reftype,
refid: this.state.refid,
// reftype: this.state.reftype,
// refid: this.state.refid,
acceptance: this.state.acceptance,
duedate: this.state.duedate,
actionplanId: this.state.actionplanId,
Expand All @@ -95,16 +96,21 @@ export default class AddAPSection extends Component {
.then(response => {
this.setState({
id: response.data.id,
reftype: response.data.reftype,
refid: response.data.refid,
// reftype: response.data.reftype,
// refid: response.data.refid,
acceptance: response.data.acceptance,
duedate: response.data.duedate,
actionplanId: this.props.match.params.apid,

submitted: true
});
console.log(response.data);
cogoToast.success("Meeting Saved Successfully!");
this.props.history.push("/actionplansingle/" + this.props.match.params.id + "/" + this.props.match.params.apid);
})
} else {
cogoToast.error("Field/s cannot be empty");
}
}

deleteWeatherLog(e){
Expand All @@ -120,18 +126,10 @@ export default class AddAPSection extends Component {
cogoToast.success("Action Plan Section Deleted Successfully!");
}

viewAPSection(){
window.location.reload();
cogoToast.success("Action Plan Section Saved Successfully!");
}

render() {
const {actionplanId, currentIndex, projectId, viewAPSection, actionplansections} = this.state;
return (
<div className="container">
{this.state.submitted ? (
viewAPSection()
):(
<div class="container">
<h2>Add New Action Plan Section</h2>
<Breadcrumbs aria-label="breadcrumb">
Expand Down Expand Up @@ -178,7 +176,7 @@ export default class AddAPSection extends Component {
value={this.state.duedate}
onChange={this.onChangeDuedate}
type="date"
min=""
min="2021-09-23"
required
/>
</div>
Expand Down Expand Up @@ -214,7 +212,6 @@ export default class AddAPSection extends Component {
</tbody>
</Table>
</div>
)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import MeetingDataService from "../../../services/project_management/meeting.ser
import MeetingCategoryDataService from "../../../services/project_management/meetingcategory.service.js";
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import cogoToast from 'cogo-toast';
import { TextareaAutosize } from "@material-ui/core";

class CreateFollowupMeetings extends Component {
constructor(props) {
Expand Down Expand Up @@ -102,8 +103,6 @@ class CreateFollowupMeetings extends Component {

saveMeeting() {
if (this.state.name != "" &&
this.state.category != "" &&
this.state.status != "" &&
this.state.date != "" &&
this.state.time != "" &&
this.state.location != "" ) {
Expand Down Expand Up @@ -222,6 +221,7 @@ class CreateFollowupMeetings extends Component {
value={meeting.location}
onChange={this.onChangeLocation}
type="text"
list="suggest"
required
/>
<datalist id="suggest">
Expand All @@ -234,7 +234,7 @@ class CreateFollowupMeetings extends Component {
<div className="form-row">
<div className="form-group col-md-12">
<label htmlFor="">Description</label>
<textarea
<TextareaAutosize
rows="2"
className="form-control"
name="description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class MeetingsHome extends Component {
<td>
{mt.status == "Scheduled"
? "🟢 - Scheduled"
: "🔴 - Ended"}
: "🔴 - End"}
</td>
<td>
{mt.status == "Scheduled" ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ViewMeeting extends Component {
this.onChangeTime = this.onChangeTime.bind(this);
this.onChangeLocation = this.onChangeLocation.bind(this);
this.onChangeDescription = this.onChangeDescription.bind(this);
this.onChangeStatus = this.onChangeStatus.bind(this);
this.retrieveMeeting = this.retrieveMeeting.bind(this);
this.updateMeeting = this.updateMeeting.bind(this);
this.deleteMeeting = this.deleteMeeting.bind(this);
Expand Down Expand Up @@ -74,8 +75,7 @@ class ViewMeeting extends Component {
...prevState.meeting,
description: description
}
}

}
});
}

Expand Down Expand Up @@ -130,9 +130,20 @@ class ViewMeeting extends Component {
});
}

onChangeStatus(e) {
const status= e.target.value
this.setState(function(prevState){
return {
meeting: {
...prevState.meeting,
status: status
}
}
});
}

updateMeeting() {
if (this.state.meeting.name != "" &&
this.state.meeting.category != "" &&
this.state.meeting.status != "" &&
this.state.meeting.date != "" &&
this.state.meeting.time != "" &&
Expand All @@ -154,8 +165,8 @@ class ViewMeeting extends Component {
...prevState.meeting,
}
}));
this.props.history.push("/meetings/"+ this.props.match.params.id);
cogoToast.success("Meeting Updated Successfully!");
// this.props.history.push("/meetings/"+ this.props.match.params.id);
// cogoToast.success("Meeting Updated Successfully!");
console.log(response.data);
})
.catch(e => {
Expand Down Expand Up @@ -183,7 +194,7 @@ class ViewMeeting extends Component {
return (
<div className="">
<div className="">
<h2>Add New Meeting</h2>
<h2>View Meeting</h2>
<Breadcrumbs aria-label="breadcrumb">
<Link color="inherit" to="/home">Home</Link>
<Link color="inherit" to={"/projectmanagementhome/"+meeting.projectId}>App Dashboard</Link>
Expand Down Expand Up @@ -213,16 +224,16 @@ class ViewMeeting extends Component {
className="form-control"
required
>
<option value="Scheduled" onChange={this.onChangeApproved}>Scheduled</option>
<option value="Ended" onChange={this.onChangeApproved}>Ended</option>
<option value="Scheduled" onChange={this.onChangeStatus}>Scheduled</option>
<option value="End" onChange={this.onChangeStatus}>End</option>
</select>
</div>
:
<div>
<input
type="text"
className="form-control"
value="Ended"
value="End"
readOnly
/>
</div>
Expand Down
Loading

0 comments on commit d3915e0

Please sign in to comment.