package seedu.scheduler.ui;

import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import seedu.scheduler.model.entry.ReadOnlyEntry;

public class EntryCard extends UiPart{

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

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label startTime;
    @FXML
    private Label date;
    @FXML
    private Label endTime;
    @FXML
    private Label tags;

    private ReadOnlyEntry entry;
    private int displayedIndex;

    public EntryCard(){

    }

    public static EntryCard load(ReadOnlyEntry entry, int displayedIndex){
        EntryCard card = new EntryCard();
        card.entry = entry;
        card.displayedIndex = displayedIndex;
        return UiPartLoader.loadUiPart(card);
    }

    @FXML
    public void initialize() {
        name.setText(entry.getName().fullName);
        id.setText(displayedIndex + ". ");
        startTime.setText("Start Time: " + entry.getStartTime().value);
        date.setText("Date: " + entry.getDate().value);
        endTime.setText("End Time: " + entry.getEndTime().value);
        tags.setText(entry.tagsString());
    }

    public HBox getLayout() {
        return cardPane;
    }

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

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

@@ -22,16 +22,42 @@
 er.ui;%0A%0A
+//import java.util.Date;%0A%0A
 import j
@@ -633,17 +633,231 @@
 dIndex;%0A
+    //@@author A0139956L%0A    public static final String COMPLETED_INDICATION = %22-fx-background-color: #ccffcc;%22;%0A    public static final String OVERDUE_INDICATION = %22-fx-background-color:  #ffcce6;%22;%0A    //@@author
 %0A
-
     publ
@@ -1120,24 +1120,49 @@
 rd);%0A    %7D%0A%0A
+    //@@author A0139956L%0A
     @FXML%0A  
@@ -1234,24 +1234,110 @@
 .fullName);%0A
+        hideFieldsAccordingToType(entry);%0A        indicatingColourByCondition(entry);%0A
         id.s
@@ -1605,25 +1605,39 @@
 g());%0A    %7D%0A
+    //@@author
 %0A
-
     public H
@@ -1819,24 +1819,24 @@
 xmlPath() %7B%0A
-
         retu
@@ -1850,10 +1850,1045 @@
 ;%0A    %7D%0A
+    %0A    //@@author A0139956L%0A    public void hideFieldsAccordingToType(ReadOnlyEntry entry) %7B%0A        //task%0A        if (entry.getStartTime().toString().contains(%22empty%22) %0A        %09%09&& entry.getEndTime().toString().contains(%22empty%22)) %7B%0A            startTime.setVisible(false);%0A            endTime.setVisible(false);%0A        %7D %0A        if (entry.getStartTime().toString().contains(%22empty%22) %0A        %09%09&& entry.getEndTime().toString().contains(%22empty%22)%0A        %09%09&& entry.getDate().toString().contains(%22empty%22)) %7B%0A            startTime.setVisible(false);%0A            endTime.setVisible(false);%0A            date.setVisible(false);%0A        %7D %0A    %7D%0A    %0A    public void indicatingColourByCondition(ReadOnlyEntry entry) %7B%0A        %0A        if (entry.tagsString().contains(%22Completed%22)) %7B%0A            cardPane.setStyle(COMPLETED_INDICATION);   // if entry completed%0A        %7D %0A        //else if (entryRead.getDate().before(new Date())) %7B%0A            // if entry overdue%0A            //cardPane.setStyle(OVERDUE_INDICATION);%0A       // %7D%0A    %7D%0A
 %7D%0A

add colour indicator and hide parameters