package seedu.watodo.ui;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.watodo.model.task.ReadOnlyTask;

//@@author A0139845R-reused
public class TaskCard extends UiPart<Region> {

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

    @FXML
    private HBox cardPane;
    @FXML
    private Label description;
    @FXML
    private Label status;
    @FXML
    private Label id;
    @FXML
    private Label startDate;
    @FXML
    private Label endDate;
    @FXML
    private FlowPane tags;


    public TaskCard(ReadOnlyTask task, int displayedIndex) {
        super(FXML);
        description.setText(task.getDescription().fullDescription);
        id.setText(displayedIndex + ". ");

        if (task.getStartDate() != null) {
            startDate.setText("Start Task From " + task.getStartDate());
        } else {
            startDate.setText("");
        }

        if (task.getEndDate() != null) {
            endDate.setText("Do Task By " + task.getEndDate());
        } else {
            endDate.setText("");
        }

        status.setText(task.getStatus().toString());

        initTags(task);
    }

    private void initTags(ReadOnlyTask person) {
        person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
    }
}

@@ -1219,16 +1219,149 @@
 ring());
+%0A        if (task.getStatus().toString().equals(%22Done%22)) %7B%0A            cardPane.setStyle(%22-fx-background-color: #2bba36;%22);%0A        %7D
 %0A%0A      

Add more visual aid to marking tasks