package seedu.address.ui;

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

public class PersonCard extends UiPart{

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

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label phone;
    @FXML
    private Label address;
    @FXML
    private Label email;
    @FXML
    private Label tags;
    @FXML
    private Label completion;
    
    private ReadOnlyTask person;
    private int displayedIndex;

    public PersonCard(){

    }

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

    @FXML
    public void initialize() {
        name.setText(person.getName().fullName);
        id.setText(displayedIndex + ". ");
        phone.setText(person.getDueDate().forDisplay());
        address.setText(person.getReminder().forDisplay());
        email.setText(person.getPriority().forDisplay());
        tags.setText(person.tagsString());
        completion.setText(person.toStringCompletionStatus());
        if(person.getCompletionStatus() == true) {
        	cardPane.setStyle("-fx-background-color: springgreen;");
        }
    }

    public HBox getLayout() {
        return cardPane;
    }

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

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

@@ -658,28 +658,32 @@
 ate ReadOnly
-Task
+Activity
  person;%0A   
@@ -791,19 +791,24 @@
 Only
-Task
+Activity
  person
+2
 , in
@@ -870,16 +870,16 @@
 Card();%0A
-
         
@@ -894,24 +894,25 @@
 son = person
+2
 ;%0A        ca

Edit personcard