package seedu.task.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.task.model.task.ReadOnlyTask;

public class TaskCard extends UiPart<Region> {

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

    @FXML
    private HBox cardPane;
    @FXML
    private Label taskName;
    @FXML
    private Label id;
    @FXML
    private Label taskDate;
    @FXML
    private Label taskTime;
    @FXML
    private Label taskDescription;
    @FXML
    private FlowPane tags;

    public TaskCard(ReadOnlyTask task, int displayedIndex) {
	super(FXML);

	id.setText(displayedIndex + ". ");
	if (task.getTaskName() != null) {
	    taskName.setText(task.getTaskName().toString());
	}
	if (task.getTaskDate() != null) {
	    taskDate.setText(task.getTaskDate().toString());
	} else
	    taskDate.setText("Date:");
	if (task.getTaskStartTime() != null && task.getTaskEndTime() != null) {
	    taskTime.setText(task.getTaskStartTime().toString() + "-" + task.getTaskEndTime());
	} else if (task.getTaskStartTime() != null) {
	    taskTime.setText(task.getTaskStartTime().toString());
	} else if (task.getTaskEndTime() != null) {
	    taskTime.setText(task.getTaskEndTime().toString());
	} else
	    taskTime.setText("Time: ");
	if (task.getTaskDescription() != null) {
	    taskDescription.setText(task.getTaskDescription().toString());
	} else
	    taskDescription.setText("Description:");
	initTags(task);
    }

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

@@ -854,32 +854,41 @@
 askDate.setText(
+%22Date: %22+
 task.getTaskDate
@@ -1166,32 +1166,47 @@
 askTime.setText(
+%22Start Time: %22+
 task.getTaskStar
@@ -1285,32 +1285,45 @@
 askTime.setText(
+%22End Time: %22+
 task.getTaskEndT
@@ -1445,32 +1445,48 @@
 ription.setText(
+%22Description: %22+
 task.getTaskDesc

make the displaying of task detial tidier