<core:FragmentDefinition
	xmlns="sap.m"
	xmlns:core="sap.ui.core"
	xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1">

	<!-- creates the inner part of a Table -->
	<!-- Note: "target>" MUST point to an annotation like com.sap.vocabularies.UI.v1.LineItem! -->
	<columns>
		<template:repeat list="{target>}" var="field">
			<template:if test="{field>Value}"><!-- duck typing for com.sap.vocabularies.UI.v1.DataField -->
				<Column>
					<Text text="{path: 'field>Label', formatter: 'AH.format'}"/>
				</Column>
			</template:if>
			<template:if test="{field>Action}"><!-- duck typing for com.sap.vocabularies.UI.v1.DataFieldForAction -->
				<Column demandPopin="true" minScreenWidth="1800px" popinDisplay="WithoutHeader">
					<Text text="{path: 'field>Label', formatter: 'AH.format'}"/>
				</Column>
			</template:if>
		</template:repeat>
	</columns>
	<ColumnListItem>
		<template:repeat list="{target>}" var="field">
			<template:if test="{field>Value}"><!-- duck typing for com.sap.vocabularies.UI.v1.DataField -->
				<template:if test="{field>Target}"><!-- duck typing for com.sap.vocabularies.UI.v1.DataFieldWithNavigationPath -->
					<template:then>
						<template:with path="field>Target" helper="AH.resolvePath" var="entityType">
							<Link text="{path: 'field>Value', formatter: 'AH.format'}" press="onDetailsPressed">
								<dependents>
									<template:with path="entityType>com.sap.vocabularies.UI.v1.HeaderInfo" var="headerInfo">
										<Popover binding="{path: 'field>Target', formatter: 'AH.getNavigationPath'}"
												title="{path: 'headerInfo>Title/Value', formatter: 'AH.format'}">
											<core:Fragment fragmentName="sap.ui.core.sample.ViewTemplate.scenario.Identification" type="XML"/>
										</Popover>
									</template:with>
								</dependents>
							</Link>
						</template:with>
					</template:then>
					<template:else>
						<Text text="{path: 'field>Value', formatter: 'AH.format'}" />
					</template:else>
				</template:if>
			</template:if>
			<template:if test="{field>Action}"><!-- duck typing for com.sap.vocabularies.UI.v1.DataFieldForAction -->
				<template:with path="field>Action" helper="AH.gotoFunctionImport" var="function">
					<template:if test="{function>com.sap.vocabularies.Common.v1.IsActionCritical}">
						<template:then>
							<!-- IsActionCritical defaults to true -->
							<Button text="{path: 'field>Label', formatter: 'AH.format'}"
								icon="{= ${function>com.sap.vocabularies.Common.v1.IsActionCritical/Bool} !== 'false' ? 'sap-icon://notification' : ''}" />
						</template:then>
						<template:else>
							<Button text="{path: 'field>Label', formatter: 'AH.format'}" />
						</template:else>
					</template:if>
				</template:with>
			</template:if>
		</template:repeat>
	</ColumnListItem>
</core:FragmentDefinition>
