Letový itinerář

Poznámka:

Vytváříte scénáře Copilotu, Teams nebo Outlooku s využitím adaptivních karet? Navštivte Adaptive Card Documentation Hub, nové komplexní centrum pro všechny vaše potřeby týkající se adaptivních karet! Obsahuje všechny prostředky, které hledáte, včetně kompletní dokumentace pro řadu nových funkcí, jako je responzivní rozložení, ikona, odznáček, karusely, grafy a mnoho dalšího.

Tyto vzorky jsou pouze teaser typu karet, které můžete vytvořit. Pokračujte a vylepšete je, aby byl možný jakýkoli scénář!

Důležitá poznámka týkající se přístupnosti: Ve verzi 1.3 schématu jsme zavedli vlastnost popisku u vstupů za účelem zlepšení přístupnosti. Pokud hostitelská aplikace, na kterou cílíte, podporuje verzi 1.3, měli byste místo TextBlock použít label, jak je vidět v některých níže uvedených příkladech. Po aktualizaci většiny hostitelských aplikací na nejnovější verzi ukázky odpovídajícím způsobem aktualizujeme.

Ukázka letového itineráře

V následující části se zobrazí JSON ukázky adaptivní karty "Itinerář letu", dokládající použití šablony a bez použití šablony.

Kód JSON (bez šablony)

JSON

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"version": "1.5",
	"type": "AdaptiveCard",
	"speak": "<s>Your flight is confirmed for you and 3 other passengers from San Francisco to Amsterdam on Friday, October 10 8:30 AM</s>",
	"body": [
		{
			"type": "TextBlock",
			"text": "Your Flight Itinerary",
			"wrap": true,
			"style": "heading"
		},
		{
			"type": "TextBlock",
			"text": "Passengers",
			"weight": "bolder",
			"isSubtle": false,
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Sarah Hum",
			"separator": true,
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Jeremy Goldberg",
			"spacing": "none",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Evan Litvak",
			"spacing": "none",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "2 Stops",
			"weight": "bolder",
			"spacing": "medium",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Tue, May 30, 2017 12:25 PM",
			"weight": "bolder",
			"spacing": "none",
			"wrap": true
		},
		{
			"type": "ColumnSet",
			"separator": true,
			"columns": [
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"text": "Departs From",
							"wrap": true,
							"style": "default",
							"weight": "bolder",
							"color": "light"
						},
						{
							"type": "TextBlock",
							"text": "San Francisco",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"text": "SFO",
							"spacing": "none",
							"wrap": true
						}
					]
				},
				{
					"type": "Column",
					"width": "auto",
					"verticalContentAlignment": "center",
					"items": [
						{
							"type": "Image",
							"url": "https://adaptivecards.io/content/airplane.png",
							"size": "small",
							"spacing": "none",
							"altText": "Flight to"
						}
					]
				},
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"text": "Arrives At",
							"wrap": true,
							"horizontalAlignment": "right",
							"style": "default",
							"weight": "bolder",
							"color": "light"
						},
						{
							"type": "TextBlock",
							"horizontalAlignment": "right",
							"text": "Amsterdam",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"horizontalAlignment": "right",
							"size": "extraLarge",
							"color": "accent",
							"text": "AMS",
							"spacing": "none",
							"wrap": true
						}
					]
				}
			]
		},
		{
			"type": "TextBlock",
			"text": "Non-Stop",
			"weight": "bolder",
			"spacing": "medium",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Fri, Jun 2, 2017 1:55 PM",
			"weight": "bolder",
			"spacing": "none",
			"wrap": true
		},
		{
			"type": "ColumnSet",
			"separator": true,
			"columns": [
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"text": "Departs From",
							"wrap": true,
							"style": "default",
							"weight": "bolder",
							"color": "light"
						},
						{
							"type": "TextBlock",
							"text": "Amsterdam",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"text": "AMS",
							"spacing": "none",
							"wrap": true
						}
					]
				},
				{
					"type": "Column",
					"width": "auto",
					"verticalContentAlignment": "center",
					"items": [
						{
							"type": "Image",
							"url": "https://adaptivecards.io/content/airplane.png",
							"size": "small",
							"spacing": "none",
							"altText": "Flight to"
						}
					]
				},
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"text": "Arrives At",
							"wrap": true,
							"horizontalAlignment": "right",
							"style": "default",
							"weight": "bolder",
							"color": "light"
						},
						{
							"type": "TextBlock",
							"horizontalAlignment": "right",
							"text": "San Francisco",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"horizontalAlignment": "right",
							"size": "extraLarge",
							"color": "accent",
							"text": "SFO",
							"spacing": "none",
							"wrap": true
						}
					]
				}
			]
		},
		{
			"type": "ColumnSet",
			"spacing": "medium",
			"columns": [
				{
					"type": "Column",
					"width": "1",
					"items": [
						{
							"type": "TextBlock",
							"text": "Total",
							"size": "medium",
							"isSubtle": true,
							"wrap": true
						}
					]
				},
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"horizontalAlignment": "right",
							"text": "$4,032.54",
							"size": "medium",
							"weight": "bolder",
							"wrap": true
						}
					]
				}
			]
		}
	]
}

Kód JSON (s šablonováním)

Data JSON

{
	"@context": "http://schema.org",
	"@type": "FlightReservation",
	"reservationId": "RXJ34P",
	"reservationStatus": "http://schema.org/ReservationConfirmed",
	"passengerPriorityStatus": "Fast Track",
	"passengerSequenceNumber": "ABC123",
	"securityScreening": "TSA PreCheck",
	"underName": {
		"@type": "Person",
		"name": "Eva Green"
	},
	"reservationFor": {
		"@type": "Flight",
		"flightNumber": "UA110",
		"provider": {
			"@type": "Airline",
			"name": "Continental",
			"iataCode": "CO",
			"boardingPolicy": "http://schema.org/ZoneBoardingPolicy"
		},
		"seller": {
			"@type": "Airline",
			"name": "United",
			"iataCode": "UA"
		},
		"departureAirport": {
			"@type": "Airport",
			"name": "San Francisco Airport",
			"city": "San Francisco",
			"iataCode": "SFO"
		},
		"departureTime": "2017-03-04T20:15:00-08:00",
		"arrivalAirport": {
			"@type": "Airport",
			"name": "John F. Kennedy International Airport",
			"city": "New York",
			"iataCode": "JFK"
		},
		"arrivalTime": "2017-03-05T06:30:00-05:00"
	}
}

Šablona JSON

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"version": "1.5",
	"type": "AdaptiveCard",
	"speak": "<s>Your flight is confirmed for you and 3 other passengers from San Francisco to Amsterdam on Friday, October 10 8:30 AM</s>",
	"body": [
		{
			"type": "TextBlock",
			"text": "Your Flight Itinerary",
			"wrap": true,
			"style": "heading"
		},
		{
			"type": "TextBlock",
			"text": "Passengers",
			"weight": "bolder",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Sarah Hum",
			"separator": true,
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Jeremy Goldberg",
			"spacing": "none",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Evan Litvak",
			"spacing": "none",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "2 Stops",
			"weight": "bolder",
			"spacing": "medium",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "{{DATE(${string(Segments[0].DepartureDateTime)}, SHORT)}} {{TIME(${string(Segments[0].DepartureDateTime)})}}",
			"weight": "bolder",
			"spacing": "none",
			"wrap": true
		},
		{
			"type": "ColumnSet",
			"separator": true,
			"columns": [
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"text": "Departs From",
							"wrap": true,
							"style": "default",
							"weight": "bolder",
							"color": "light"
						},
						{
							"type": "TextBlock",
							"$when": "${Segments[0].OriginStation == 11235}",
							"text": "${Places[0].Name}",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"$when": "${Segments[0].OriginStation == 13554}",
							"text": "${Places[1].Name}",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"$when": "${Segments[0].OriginStation == 11235}",
							"text": "${Places[0].Code}",
							"spacing": "none",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"$when": "${Segments[0].OriginStation == 13554}",
							"text": "${Places[1].Code}",
							"spacing": "none",
							"wrap": true
						}
					]
				},
				{
					"type": "Column",
					"width": "auto",
					"verticalContentAlignment": "center",
					"items": [
						{
							"type": "Image",
							"url": "https://adaptivecards.io/content/airplane.png",
							"altText": "Flight to",
							"size": "small",
							"spacing": "none"
						}
					]
				},
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"text": "Arrives At",
							"wrap": true,
							"horizontalAlignment": "right",
							"style": "default",
							"weight": "bolder",
							"color": "light"
						},
						{
							"type": "TextBlock",
							"$when": "${Segments[0].DestinationStation == 11235}",
							"text": "${Places[0].Name}",
							"horizontalAlignment": "right",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"$when": "${Segments[0].DestinationStation == 13554}",
							"text": "${Places[1].Name}",
							"horizontalAlignment": "right",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"$when": "${Segments[0].DestinationStation == 11235}",
							"text": "${Places[0].Code}",
							"horizontalAlignment": "right",
							"spacing": "none",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"$when": "${Segments[0].DestinationStation == 13554}",
							"text": "${Places[1].Code}",
							"horizontalAlignment": "right",
							"spacing": "none",
							"wrap": true
						}
					]
				}
			]
		},
		{
			"type": "TextBlock",
			"text": "Non-Stop",
			"weight": "bolder",
			"spacing": "medium",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "{{DATE(${string(Segments[1].ArrivalDateTime)}, SHORT)}} {{TIME(${string(Segments[1].ArrivalDateTime)})}}",
			"weight": "bolder",
			"spacing": "none",
			"wrap": true
		},
		{
			"type": "ColumnSet",
			"separator": true,
			"columns": [
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"text": "Departs From",
							"wrap": true,
							"style": "default",
							"weight": "bolder",
							"color": "light"
						},
						{
							"type": "TextBlock",
							"$when": "${Segments[1].OriginStation == 11235}",
							"text": "${Places[0].Name}",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"$when": "${Segments[1].OriginStation == 13554}",
							"text": "${Places[1].Name}",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"$when": "${Segments[1].OriginStation == 11235}",
							"text": "${Places[0].Code}",
							"spacing": "none",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"$when": "${Segments[1].OriginStation == 13554}",
							"text": "${Places[1].Code}",
							"spacing": "none",
							"wrap": true
						}
					]
				},
				{
					"type": "Column",
					"width": "auto",
					"verticalContentAlignment": "center",
					"items": [
						{
							"type": "Image",
							"url": "https://adaptivecards.io/content/airplane.png",
							"altText": "Flight to",
							"size": "small",
							"spacing": "none"
						}
					]
				},
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"text": "Arrives At",
							"wrap": true,
							"horizontalAlignment": "right",
							"style": "default",
							"weight": "bolder",
							"color": "light"
						},
						{
							"type": "TextBlock",
							"$when": "${Segments[1].DestinationStation == 11235}",
							"text": "${Places[0].Name}",
							"horizontalAlignment": "right",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"$when": "${Segments[1].DestinationStation == 13554}",
							"text": "${Places[1].Name}",
							"horizontalAlignment": "right",
							"isSubtle": true,
							"wrap": true,
							"spacing": "none"
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"$when": "${Segments[1].DestinationStation == 11235}",
							"text": "${Places[0].Code}",
							"horizontalAlignment": "right",
							"spacing": "none",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"size": "extraLarge",
							"color": "accent",
							"$when": "${Segments[1].DestinationStation == 13554}",
							"text": "${Places[1].Code}",
							"horizontalAlignment": "right",
							"spacing": "none",
							"wrap": true
						}
					]
				}
			]
		},
		{
			"type": "ColumnSet",
			"spacing": "medium",
			"columns": [
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"text": "Total",
							"size": "medium",
							"isSubtle": true,
							"wrap": true
						}
					]
				},
				{
					"type": "Column",
					"width": 1,
					"items": [
						{
							"type": "TextBlock",
							"horizontalAlignment": "right",
							"text": "$${formatNumber(BookingOptions[0].BookingItems[0].Price, 2)}",
							"size": "medium",
							"weight": "bolder",
							"wrap": true
						}
					]
				}
			]
		}
	]
}