Commit 97833af7 authored by Nithya's avatar Nithya

TMSS-268

Changes updated based on review comments.
parent 08a8d27f
import React, { Component } from 'react'
import 'primeflex/primeflex.css';
import moment from 'moment';
import AppLoader from "./../../layout/components/AppLoader";
import ViewTable from './../../components/ViewTable';
......@@ -25,7 +25,7 @@ class SchedulingUnitList extends Component{
"requirements_template_id": "Template",
"start_time":"Start Time",
"stop_time":"End time",
"duration":"Duration"
"duration":"Duration (HH:mm:ss)"
}],
optionalcolumns: [{
"actionpath":"actionpath",
......@@ -40,33 +40,36 @@ class SchedulingUnitList extends Component{
async getSchedulingUnitList () {
const bluePrint = await ScheduleService.getSchedulingUnitBlueprint();
ScheduleService.getSchedulingUnitDraft().then(scheduleunit =>{
const output = [];
var scheduleunits = scheduleunit.data.results;
for( const scheduleunit of scheduleunits){
const blueprintdata = bluePrint.data.results.find(i => i.draft_id === scheduleunit.id);
const blueprintdata = bluePrint.data.results.filter(i => i.draft_id === scheduleunit.id);
blueprintdata.map(blueP => { blueP.duration = moment(blueP.duration).format('H:mm:ss'); return blueP; });
output.push(...blueprintdata);
scheduleunit['actionpath']='/schedulingunit/view';
scheduleunit['start_time'] = blueprintdata.start_time;
scheduleunit['stop_time'] = blueprintdata.stop_time;
// scheduleunit['start_time'] = blueprintdata.start_time;
// scheduleunit['stop_time'] = blueprintdata.stop_time;
scheduleunit['duration'] = moment(scheduleunit.duration).format('H:mm:ss');
output.push(scheduleunit);
}
this.setState({
scheduleunit : scheduleunit.data ,isLoading:false
scheduleunit: output, isLoading:false
});
})
}
componentDidMount(){
this.getSchedulingUnitList();
}
render(){
if (this.state.isLoading) {
return <AppLoader/>
}
return(
<>
{
{
/*
* Call View table to show table data, the parameters are,
......@@ -78,9 +81,9 @@ class SchedulingUnitList extends Component{
paths - specify the path for navigation - Table will set "id" value for each row in action button
*/}
{this.state.scheduleunit.results &&
{this.state.scheduleunit &&
<ViewTable
data={this.state.scheduleunit.results}
data={this.state.scheduleunit}
defaultcolumns={this.state.defaultcolumns}
optionalcolumns={this.state.optionalcolumns}
columnclassname={this.state.columnclassname}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment