<!DOCTYPE html>
<html lang="en">
{{fscript
	globals setAppointmentsForDisplay:selectedObjects.	
}}
<head>
	<meta charset="utf-8">
	<link rel="stylesheet" href="{{framework}}/default.css" type="text/css" charset="utf-8">
	<link rel="stylesheet" href="{{framework}}/screen.css" type="text/css" charset="utf-8" media="screen">
	<link rel="stylesheet" href="{{framework}}/print.css" type="text/css" charset="utf-8" media="print">
	<link rel="stylesheet" href="{{resources}}/custom.css" type="text/css" charset="utf-8">
	
</head>
<body>
	<h2>{{localize 'Appointment Summary'}}</h2>
	{{foreach appointment appointmentsForDisplay do}}
	<table>
	<tr>
	<td>
		<h3>{{appointment.subject}}</h3>
		
		{{if appointment.statusString}}<span id="labelHeader">{{localize 'Status'}}:</span> {{appointment.statusString}}<br>{{endif}}
		{{if appointment.typeString}}<span id="labelHeader">{{localize 'Type'}}: </span> {{appointment.typeString}}<br>{{endif}}
		<br>
		{{if appointment.startDate}}<span id="labelHeader">{{localize 'Start Date'}}:</span> {{appointment.startDate.mcLongDateTime}}<br>{{endif}}
		{{if appointment.endDate}}<span id="labelHeader">{{localize 'End Date'}}:</span> {{appointment.endDate.mcLongDateTime}}<br>{{endif}}
		{{if appointment.timeZoneName}}<span id="labelHeader">{{localize 'Timezone'}}:</span> {{appointment.timeZoneName}}<br>{{endif}}
		
		<br>
		{{if appointment.category}}<span id="labelHeader">{{localize 'Category'}}:</span> {{appointment.category.name}}<br>{{endif}}
		{{if appointment.keywordsString}}<span id="labelHeader">{{localize 'Keywords'}}:</span> {{appointment.keywordsString}}<br>{{endif}}
		<br>
		{{if appointment.details}}<span id="labelHeader">{{localize 'Details'}}:<br></span> {{appointment.details}}<br>{{endif}}
		<br>

		{{if appointment.tasks.@count}}
		<div id="groupHeader">{{localize 'TASKS'}}</div><br>
			{{foreach task appointment.tasks do}} 
			<b>{{task.title}}</b><br>
			{{if task.dueDate}}<span id="labelHeader">{{localize 'Due'}}:</span> {{task.dueDate.mcLongDate}}<br>{{endif}}
			{{if task.startDate}}<span id="labelHeader">{{localize 'Start Date'}}:</span> {{task.startDate.mcLongDate}}<br>{{endif}}
			{{if task.completeDate}}<span id="labelHeader">{{localize 'End Date'}}:</span> {{task.completeDate.mcLongDate}}<br>{{endif}}
			{{if task.priorityString}}<span id="labelHeader">{{localize 'Priority'}}:</span> {{task.priorityString}}<br>{{endif}}
			<br>
			{{endforeach do}}
		{{endif}}
		
		{{if appointment.projects.@count}}
		<div id="groupHeader">{{localize 'PROJECTS'}}</div><br>
			{{foreach project appointment.projects do}} 
			<b>{{project.name}}</b><br>
			<span id="labelHeader">{{localize 'Status'}}:</span> {{project.statusString}}<br>
			<span id="labelHeader">{{localize 'Due Date'}}:</span> {{project.dueDate.mcLongDate}}<br>
			<span id="labelHeader">{{localize 'Start Date'}}:</span> {{project.startDate.mcLongDate}}<br>
			<span id="labelHeader">{{localize 'Complete Date'}}:</span> {{project.completeDate.mcLongDate}}<br><br>
			{{endforeach do}}
		{{endif}}
		
		{{if appointment.opportunities.@count}}
		<div id="groupHeader">{{localize 'OPPORTUNITIES'}}</div><br>
			{{foreach opportunity appointment.opportunities do}} 
			<b>{{opportunity.name}}</b><br>
			<span id="labelHeader">{{localize 'Status'}}:</span> {{opportunity.opportunityStateString}}<br>
			<span id="labelHeader">{{localize 'Due Date'}}:</span> {{opportunity.dueDate.mcLongDate}}<br>
			<span id="labelHeader">{{localize 'Start Date'}}:</span> {{opportunity.startDate.mcLongDate}}<br>
			<span id="labelHeader">{{localize 'Complete Date'}}:</span> {{opportunity.completeDate.mcLongDate}}<br><br>
			{{endforeach do}}
		{{endif}}
			
		{{if appointment.groups.@count}}
		<div id="groupHeader">{{localize 'GROUPS'}}</div><br>
			{{foreach group appointment.groups do}} 
			<b>{{group.name}}</b><br>
			{{if group.startDate}}<span id="labelHeader">{{localize 'Start Date'}}:</span> {{group.startDate.mcLongDate}}<br>{{endif}}
			{{if group.endDate}}<span id="labelHeader">{{localize 'End Date'}}:</span> {{group.endDate.mcLongDate}}<br>{{endif}}
			<br>
			{{endforeach do}}
		{{endif}}
		
		{{if appointment.customRecordSets.@count}}
			<div id="groupHeader">{{localize 'FORMS'}}</div><br>
			{{foreach recordSet appointment.customRecordSets do}}
			<b>{{recordSet.customRecordSetDefinition.name}}</b><br>
				{{foreach record recordSet.customRecords do}}
	 			<span id="labelHeader">{{record.customRecordDefinition.name}}</span></br>
				{{record.displayString}}<br>
				{{endforeach do}}<br>
 			{{endforeach do}}
			<br>
		{{endif}}

		{{if appointment.notes.@count}}
		<div id="groupHeader">{{localize 'NOTES'}}</div><br>
			{{foreach note appointment.notesSortedByCreateDateDescending do}}
			<span id="labelHeader">{{localize 'Title'}}:</span> {{note.title}}<br>
			<span id="labelHeader">{{localize 'Create Date'}}:</span> {{note.createDate.mcLongDateTime}}<br>
			<span id="labelHeader">{{localize 'Content'}}:</span> {{note.attachmentFreeTextRepresentation}}<br>
			<br><br>
			{{endforeach do}}
		{{endif}}
		
		{{if appointment.emails.@count}}
		<div id="groupHeader">{{localize 'EMAILS'}}</div><br>
			{{foreach email appointment.emails do}}
			<span id="labelHeader">{{localize 'Subject'}}:</span> {{email.subject}}<br>
			<span id="labelHeader">{{localize 'Sender'}}:</span> {{email.fromString}}<br>
			<span id="labelHeader">{{localize 'Create Date'}}:</span> {{email.createDate.mcLongDateTime}}<br>
			<span id="labelHeader">{{localize 'Content'}}:</span> {{email.largeData.plainTextRepresentation}}<br>
			<br><br>
			{{endforeach do}}
		{{endif}}
		<br>
	<td>
	<tr>
	</table>
	<br><br><br>
	{{endforeach do}}
	<br>
	<div id="reportfooter">
	{{localize 'Generated by %@ on %@', objectContext.user.contact.cachedName, date}}.		
	</div>

</body>
</html>