diff --git a/src/components/ArchestActivityStatusChangeWidgetComponent.js b/src/components/ArchestActivityStatusChangeWidgetComponent.js new file mode 100644 index 0000000..bc5cf49 --- /dev/null +++ b/src/components/ArchestActivityStatusChangeWidgetComponent.js @@ -0,0 +1,57 @@ +import React, {Component} from "react"; +import {BACKEND_ESTIMATOR_API_URL, SUB_ACTIVITY} from "../constants"; +import ArchestHttp from "../modules/archest_http"; +import {Form} from "react-bootstrap"; +import './styles/ArchestActivityStatusChangeWidgetComponent.scss'; + +const _ = require('lodash'); + +class ArchestActivityStatusChangeWidgetComponent extends Component { + + constructor(props) { + super(props); + this.state = { + activity: this.props.activity + }; + this.onChangeStatus = this.onChangeStatus.bind(this); + } + + onChangeStatus(element) { + + let urlActivityType = 'activities'; + if (this.props.type === SUB_ACTIVITY) { + urlActivityType = 'sub_activities'; + } + + ArchestHttp.PATCH(`${BACKEND_ESTIMATOR_API_URL}/${urlActivityType}/${this.props.activity.id}/`, { + status: element.target.value, + }).then((response) => { + this.setState({ + activity: response.data + }); + }).catch((error) => { + console.log(error); + }); + } + + render() { + return ( +
+ + + + + + + + +
+ ); + } + +} + +export default ArchestActivityStatusChangeWidgetComponent; \ No newline at end of file diff --git a/src/components/ArchestCalendarComponent.js b/src/components/ArchestCalendarComponent.js index 2ca560e..f32d496 100644 --- a/src/components/ArchestCalendarComponent.js +++ b/src/components/ArchestCalendarComponent.js @@ -2,7 +2,7 @@ import ReactDOM from 'react-dom'; import React, {Component} from "react"; import ArchestAuthEnabledComponent from "./ArchestAuthEnabledComponent"; import ArchestMainContainerComponent from "./ArchestMainContainerComponent"; -import './styles/ArchestTimeline.scss'; +import './styles/ArchestTimelineComponent.scss'; import FullCalendar from '@fullcalendar/react'; import dayGridPlugin from '@fullcalendar/daygrid'; import interactionPlugin from "@fullcalendar/interaction"; diff --git a/src/components/ArchestEstimateActivityComponent.js b/src/components/ArchestEstimateActivityComponent.js index cea4521..0cbc3be 100644 --- a/src/components/ArchestEstimateActivityComponent.js +++ b/src/components/ArchestEstimateActivityComponent.js @@ -16,6 +16,7 @@ class ArchestEstimateActivityComponent extends Component { featureId: this.props.activity.feature.id, activityStatus: this.props.activity.status, activityName: this.props.activity.name, + ownerId: this.props.activity.owner ? this.props.activity.owner.id : '', activityEstimatedTime: this.props.activity.estimated_time, subActivityTotalHours: 0, savingData: false, @@ -37,6 +38,7 @@ class ArchestEstimateActivityComponent extends Component { ArchestHttp.PATCH(BACKEND_ESTIMATOR_API_URL + "/activities/" + this.state.activityId + "/", { name: this.state.activityName, feature_id: this.state.featureId, + owner_id: this.state.ownerId, estimated_time: this.state.activityEstimatedTime, status: this.state.activityStatus, }).then(function (response) { @@ -107,7 +109,8 @@ class ArchestEstimateActivityComponent extends Component { render() { const activityId = this.props.activity.id; - let featureOptions; + let featureOptions = []; + let resourcesOptions = []; if (this.props.features) { featureOptions = this.props.features.map( @@ -115,6 +118,22 @@ class ArchestEstimateActivityComponent extends Component { ); } + if (this.props.estimateResources) { + resourcesOptions = this.props.estimateResources.map( + (estimateResource) => + ); + } + + if (this.state.ownerId !== '') { + let estimateResources = this.props.estimateResources.map((estimateResource) => parseInt(estimateResource.resource.id, 10)); + if (estimateResources.indexOf(parseInt(this.state.ownerId, 10)) === -1) { + resourcesOptions.unshift(); + } + } + + resourcesOptions.unshift(); + return ( @@ -155,6 +174,7 @@ class ArchestEstimateActivityComponent extends Component { size="sm" as="select" value={this.state.featureId} + disabled={!this.props.activity.is_editable} name="featureId" onChange={this.handleActivityFormFieldChange} onBlur={this.saveActivityData}> @@ -167,7 +187,7 @@ class ArchestEstimateActivityComponent extends Component { - + - + Activity + + Owner + Hrs. @@ -193,19 +216,38 @@ class ArchestEstimateActivityComponent extends Component { - + + + + + + {resourcesOptions} + + + + @@ -216,6 +258,7 @@ class ArchestEstimateActivityComponent extends Component { placeholder="Hrs." size="sm" value={this.state.activityEstimatedTime} + disabled={!this.props.activity.is_editable} name="activityEstimatedTime" onChange={this.handleActivityFormFieldChange} onBlur={this.saveActivityData}/> @@ -224,6 +267,7 @@ class ArchestEstimateActivityComponent extends Component { overlay={Auto calculate from Sub Activity Hours}>