Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution/add custom column to table on op #88

Draft
wants to merge 1 commit into
base: solution/add-validation-for-field-agency-on-op
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<core:FragmentDefinition xmlns:core="sap.ui.core" xmlns="sap.m">
<SegmentedButton core:require="{handler: 'sap/fe/cap/travel/ext/fragment/ServingTimeOfMeals'}" id="SB1"
selectionChange="handler.onSelectionChange"
enabled="{ui>/isEditable}"
selectedKey="{= ${DeliveryPreference_code}}">
<items>
<SegmentedButtonItem id="_IDGenSegmentedButtonItem1" text="{i18n>early}" key="S" />
<SegmentedButtonItem id="_IDGenSegmentedButtonItem2" text="{i18n>mid}" key="M" />
<SegmentedButtonItem id="_IDGenSegmentedButtonItem3" text="{i18n>late}" key="L" />
</items>
</SegmentedButton>
</core:FragmentDefinition>
13 changes: 13 additions & 0 deletions app/travel_processor/webapp/ext/fragment/ServingTimeOfMeals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sap.ui.define([
"sap/m/MessageToast"
], function(MessageToast) {
'use strict';

return {
onSelectionChange: function(oEvent) {
var sNewDeliveryPreferenceCode = oEvent.getParameter("item").getKey();
var oSegmBtn = oEvent.getSource();
oSegmBtn.getBindingContext().setProperty("DeliveryPreference_code", sNewDeliveryPreferenceCode);
}
};
});
15 changes: 15 additions & 0 deletions app/travel_processor/webapp/i18n/i18n.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,18 @@ title=Manage Travels

#YDES: Application description
description=Manage Travels

#XCOL: Custom column header text
servingTimeOfMeals=Serving Time of Meals

#XTIT: Delivery preference of the Meal during the flight
deliveryPreference=Delivery Preference

#XTIT: Early time of meal delivery during the flight
early=early

#XTIT: Mid time of meal delivery during the flight
mid=mid

#XTIT: Later time of meal delivery during the flight
late=late
16 changes: 15 additions & 1 deletion app/travel_processor/webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,21 @@
"options": {
"settings": {
"entitySet": "Booking",
"editableHeaderContent": false
"editableHeaderContent": false,
"controlConfiguration": {
"to_BookSupplement/@com.sap.vocabularies.UI.v1.LineItem": {
"columns": {
"ServingTimeOfMeals": {
"header": "{i18n>servingTimeOfMeals}",
"position": {
"anchor": "DataField::Price",
"placement": "After"
},
"template": "sap.fe.cap.travel.ext.fragment.ServingTimeOfMeals"
}
}
}
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions db/data/sap.fe.cap.travel-MealOptionDeliveryPreference.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
code;name;descr
S;SoonAfterTakeoff;Delivery as early as possible after the take-off
M;Midflight;Not too early not too late
L;Late;Late in the flight while still allowing you to finish the meal or drink before the landing
11 changes: 10 additions & 1 deletion db/schema.cds
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ entity BookingSupplement : managed {
key BookSupplUUID : UUID;
BookingSupplementID : Integer @Core.Computed;
Price : Decimal(16, 3);
DeliveryPreference : Association to MealOptionDeliveryPreference;
CurrencyCode : Currency;
to_Booking : Association to Booking;
to_Travel : Association to Travel;
Expand Down Expand Up @@ -107,4 +108,12 @@ entity SupplementScope {
TargetValue : Integer @Common.Label: 'Target Value';
DeviationRangeLowValue : Integer @Common.Label: 'Deviation Range Threshold';
ToleranceRangeLowValue : Integer @Common.Label: 'Tolerance Range Threshold';
}
};

entity MealOptionDeliveryPreference: CodeList {
key code : String enum {
SoonAfterTakeoff = 'S';
Midflight = 'M';
Late = 'L';
} default 'M'
};