package seedu.taskell.ui;

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

public class TaskCard extends UiPart{

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

    @FXML
    private HBox cardPane;
    @FXML
    private Label description;
    @FXML
    private Label id;
    @FXML
    private Label startDate;
    @FXML
    private Label endDate;
    @FXML
    private Label startTime;
    @FXML
    private Label endTime;
    @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() {
        id.setText(displayedIndex + ". ");
        description.setText(task.getDescription().description);
        tags.setText(task.tagsString());
        
        if (task.getTaskType().equals(Task.FLOATING_TASK)) {
            startDate.setVisible(false);
            endDate.setVisible(false);
            startTime.setVisible(false);
            endTime.setVisible(false);
        } else {
            startDate.setText(task.getStartDate().getDisplayDate());
            endDate.setText(task.getEndDate().getDisplayDate());
            startTime.setText(task.getStartTime().taskTime);
            endTime.setText(task.getEndTime().taskTime);
        }
    }

    public HBox getLayout() {
        return cardPane;
    }

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

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

@@ -1154,91 +1154,43 @@
     
-%0A        if (task.getTaskType().equals(Task.FLOATING_TASK)) %7B%0A            s
+startDate.setText(task.getS
 tartDate
 .set
@@ -1189,32 +1189,30 @@
 Date
-.setVisible(false);%0A    
+().getDisplayDate());%0A
     
@@ -1222,37 +1222,63 @@
  endDate.set
-Visible(false
+Text(task.getEndDate().getDisplayDate()
 );%0A         
@@ -1268,36 +1268,32 @@
 ate());%0A        
-    
 startTime.setVis
@@ -1293,59 +1293,93 @@
 .set
-Visible(false);%0A            endTime.setVisible(fals
+Text(task.getStartTime().taskTime);%0A        endTime.setText(task.getEndTime().taskTim
 e);%0A
@@ -1390,16 +1390,8 @@
     
-%7D else %7B
 %0A   
@@ -1399,47 +1399,82 @@
     
-    startDate.setText(task.getS
+if (task.getTaskType().equals(Task.FLOATING_TASK)) %7B%0A            s
 tartDate
 ().g
@@ -1469,35 +1469,33 @@
 tartDate
-().getDisplayDate()
+.setVisible(false
 );%0A     
@@ -1516,164 +1516,100 @@
 .set
-Text(task.getEndDate().getDisplayDate());%0A            startTime.setText(task.getStartTime().taskTime);%0A            endTime.setText(task.getEndTime().taskTim
+Visible(false);%0A            startTime.setVisible(false);%0A            endTime.setVisible(fals
 e);%0A

Fix bug when comparing labels