package view;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridLayout;
import java.util.Calendar;
import java.util.GregorianCalendar;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import controler.SimpleCal;



public class Todo {

	/*
	 *                   todo                  X
	 * _________________________________________
	 * selected date time | expire or not button
	 * recurring          | [nope][v] combobox
	 * _________________________________________
	 * |text entry                           |^|
	 * |                                     | |
	 * |                                     | |
	 * |                                     | |
	 * |                                     |_|
	 * |                                     |_|
	 * |                                     | |
	 * |                                     | |
	 * |                                     | |
	 * |_____________________________________|v|
	 * */
	public static Container makeTodo(final Calendar at, final Calendar expire){
		Container panel = new JPanel(new BorderLayout());

		Container north = new JPanel(new GridLayout(3,2));
		north.add(new JLabel(SimpleCal.getDateStr(at) + " @ " + SimpleCal.getClockStr(at)));
		if (expire==null)
			north.add(new JButton("add expiration"));
		else
			north.add(new JLabel("expire on " + SimpleCal.getDateStr(expire) + " @ " + SimpleCal.getClockStr(expire)));
		north.add(new JLabel("recuring"));
		JComboBox recuring = new JComboBox(new String[]{"once","daily","weekly","monthly","weekday","weekend"});
		recuring.setSelectedIndex(0);
		north.add(recuring);
		panel.add(north,BorderLayout.NORTH);

		JTextArea txt = new JTextArea();
		txt.setWrapStyleWord(true);
		txt.setEditable(true);
		panel.add(new JScrollPane(txt),BorderLayout.CENTER);

		Container south = new JPanel();
		south.add(new JButton("save"));
		south.add(new JButton("cancel"));
		panel.add(south,BorderLayout.SOUTH);

		return panel;
	}

	public static void main(String[] args) {
		JFrame win = SwingUI.makeWin();
		Nav nav = SwingUI.makeNav(win);
		nav.flip(makeTodo(new GregorianCalendar(),null));
		//nav.flip(makeTodo(new GregorianCalendar(),new GregorianCalendar()));

	}

}
