package seedu.dailyplanner.ui;


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

public class PersonCard extends UiPart {

<<<<<<< HEAD
	private static final String FXML = "PersonListCard.fxml";
	private static final String DUE_SOON_LABEL_STYLE = "-fx-background-color: rgba(247, 170, 69, 1);";
=======
    private static final String FXML = "PersonListCard.fxml";
>>>>>>> e29def2560a85d7954139f6df7c720be67246d7b

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label startDate;
    @FXML
    private Label startTime;
    @FXML
    private Label endDate;
    @FXML
    private Label endTime;
    @FXML
    private Label tags;
    @FXML
    private Label isComplete;
    @FXML
    private Label startAtLabel;
    @FXML
    private Label endAtLabel;

    private ReadOnlyTask task;
    private int displayedIndex;

    public PersonCard() {
    }

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

    @FXML
    public void initialize() {
	name.setText(task.getName());
	id.setText(displayedIndex + ". ");
	startDate.setText(task.getStart().getDate().toString());
	startTime.setText(task.getStart().getTime().toString());
	endDate.setText(task.getEnd().getDate().toString());
	endTime.setText(task.getEnd().getTime().toString());
	tags.setText(task.tagsString());
	if (task.isComplete()) {
	    isComplete.setText(task.getCompletion());
	    isComplete.setVisible(true);
	} else {
	    isComplete.setText("");
	    isComplete.setVisible(false);
	}
<<<<<<< HEAD

	@FXML
	public void initialize() {
		name.setText(person.getName().fullName);
		id.setText(displayedIndex + ". ");
		phone.setText(person.getPhone().value);
		endDate.setText(person.getPhone().getEndDate());
		address.setText(person.getAddress().value);
		email.setText(person.getEmail().value);
		tags.setText(person.tagsString());
		if (person.getCompletion().equals("COMPLETE")) {
			isComplete.setText(person.getCompletion());
			isComplete.setVisible(true);
		} else {
			isComplete.setText("DUE SOON");
			isComplete.setStyle(DUE_SOON_LABEL_STYLE);
		}
		
		if (person.getPhone().value.equals("") && person.getEmail().value.equals("")) {
		    startAtLabel.setVisible(false);
		} else {
		    startAtLabel.setText("Starts at: ");
		}
		
		if (person.getPhone().getEndDate().equals("") && person.getAddress().value.equals("")) {
            endAtLabel.setVisible(false);
        } else {
            endAtLabel.setText("Ends at: ");
        }
		
		
		
		
		
=======
	if (task.getStart().getDate().toString().equals("")) {
	    startAtLabel.setVisible(false);
	} else {
	    startAtLabel.setText("Starts at: ");
>>>>>>> e29def2560a85d7954139f6df7c720be67246d7b
	}

	if (task.getEnd().getDate().toString().equals("")) {
	    endAtLabel.setVisible(false);
	} else {
	    endAtLabel.setText("Ends at: ");
	}

    }

    public HBox getLayout() {
	return cardPane;
    }

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

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

@@ -239,29 +239,16 @@
 Part %7B%0A%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
 %09private
@@ -401,127 +401,8 @@
 );%22;
-%0A=======%0A    private static final String FXML = %22PersonListCard.fxml%22;%0A%3E%3E%3E%3E%3E%3E%3E e29def2560a85d7954139f6df7c720be67246d7b
 %0A%0A  
@@ -1636,576 +1636,28 @@
 xt(%22
-%22);%0A%09    isComplete.setVisible(false);%0A%09%7D%0A%3C%3C%3C%3C%3C%3C%3C HEAD%0A%0A%09@FXML%0A%09public void initialize() %7B%0A%09%09name.setText(person.getName().fullName);%0A%09%09id.setText(displayedIndex + %22. %22);%0A%09%09phone.setText(person.getPhone().value);%0A%09%09endDate.setText(person.getPhone().getEndDate());%0A%09%09address.setText(person.getAddress().value);%0A%09%09email.setText(person.getEmail().value);%0A%09%09tags.setText(person.tagsString());%0A%09%09if (person.getCompletion().equals(%22COMPLETE%22)) %7B%0A%09%09%09isComplete.setText(person.getCompletion());%0A%09%09%09isComplete.setVisible(true);%0A%09%09%7D else %7B%0A%09%09%09isComplete.setText(%22DUE SOON%22);%0A%09%09%09
+DUE SOON%22);%0A        
 isCo
@@ -1699,423 +1699,11 @@
 E);%0A
-%09
 %09%7D%0A
-%09%09%0A%09%09if (person.getPhone().value.equals(%22%22) && person.getEmail().value.equals(%22%22)) %7B%0A%09%09    startAtLabel.setVisible(false);%0A%09%09%7D else %7B%0A%09%09    startAtLabel.setText(%22Starts at: %22);%0A%09%09%7D%0A%09%09%0A%09%09if (person.getPhone().getEndDate().equals(%22%22) && person.getAddress().value.equals(%22%22)) %7B%0A            endAtLabel.setVisible(false);%0A        %7D else %7B%0A            endAtLabel.setText(%22Ends at: %22);%0A        %7D%0A%09%09%0A%09%09%0A%09%09%0A%09%09%0A%09%09%0A=======
 %0A%09if
@@ -1848,57 +1848,8 @@
 %22);%0A
-%3E%3E%3E%3E%3E%3E%3E e29def2560a85d7954139f6df7c720be67246d7b%0A
 %09%7D%0A%0A

fix personcard conflicts