package seedu.flexitrack.ui;

import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import seedu.flexitrack.model.task.ReadOnlyTask;

public class TaskCard extends UiPart{

    private static final String FXML = "TaskListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label title;
    @FXML
    private Label id;
    @FXML
    private Label dateTime;
    @FXML
    private Label tags;

    private ReadOnlyTask task;
    private int displayedIndex;

    public TaskCard(){

    }

    public static TaskCard load(ReadOnlyTask task, int displayedIndex){
        TaskCard card = new TaskCard();
        card.task = task;
        card.displayedIndex = displayedIndex;
        return UiPartLoader.loadUiPart(card);
    }

    @FXML
    public void initialize() {
    	String dateInfo;
    	if(task.getIsTask()){
    	    dateInfo = " by " + task.getDueDate();
    	}else if(task.getIsEvent()){
    	    dateInfo =  " from " + task.getStartTime() +" to "+ task.getEndTime();
    	}else{
    	    dateInfo = "";
    	}
    	dateTime.setText(dateInfo);
        title.setText(task.getIsDone()?"(Done)":"" + task.getName().fullName );
        id.setText(displayedIndex + ". ");
        tags.setText(task.tagsString());
    }

    public HBox getLayout() {
        return cardPane;
    }

    @Override
    public void setNode(Node node) {
        cardPane = (HBox)node;
    }

    @Override
    public String getFxmlPath() {
        return FXML;
    }
}

@@ -838,24 +838,78 @@
 tialize() %7B%0A
+        String isDone = task.getIsDone()?%22(Done)%22:%22%22;%0A
     %09String 
@@ -1209,36 +1209,14 @@
 ext(
-task.getIsDone()?%22(Done)%22:%22%22
+isDone
  + t
@@ -1237,17 +1237,16 @@
 fullName
- 
 );%0A     

Fix mard done display