extends layout

block content
	.page-header
		- if (locals.ititle)
			h1= ititle
		- else
			h1 New agenda
	- if (locals.agenda)
		- action = "/agendas/" + agenda.key + "/edit"
	- else
		- action = '/agendas/new'
	form.col-10(method="POST", action="#{action}")
		input(type="hidden", name="_csrf", value="#{_csrf}")
		.form-group
			- if (locals.ititle)
				input.form-control.input-lg(type="text", placeholder="Title", name="ititle", value="#{ititle}") 
			- else
				input.form-control.input-lg(type="text", placeholder="Title", name="ititle")
			span.help-block Name of your meeting or the agenda title.
		.form-group
			textarea.form-control(rows='5', name="idesc", placeholder="Description of the meeting.")
				= idesc
			span.help-block You can use Markdown or html in the description.
		.form-group
			- if (locals.agenda)
				a.btn.btn-danger.pull-right(href="#deleteModal", data-toggle="modal") Delete
			button.btn.btn-default.color2(type="cancel") Cancel 
			&nbsp;
			button.btn.color2a(type="submit") Save

	- if (locals.agenda)
		#deleteModal.modal.fade.col-4(tabindex="-1", role="dialog", aria-labelledby="deleteModelLabel", aria-hidden="true")
			.modal-dialog
				.modal-content
					.modal-header
						button.close(data-dismiss="modal", type="button", aria-hidden="true") &times;
						h3.modal-title Delete this agenda?
					.modal-body
						p This will also delete all the agenda's topics. You cannot undo this action. 
					.modal-footer
						form(method="POST", action="/agendas/#{agenda.key}/delete")
							button.btn.color2(data-dismiss="modal", type="button") Cancel
							button.btn.btn-danger.color2a(type="submit") Delete
