This commit is contained in:
D065023
2019-12-11 13:26:22 +01:00
parent f56d4fe093
commit 348a7b191e

View File

@@ -1,163 +1,242 @@
using AdminService from '../../srv/admin-service'; using AdminService from '../../srv/admin-service';
annotate AdminService.Books with { annotate AdminService.Books with {
price @Common.FieldControl: #ReadOnly; price @Common.FieldControl : #ReadOnly;
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// Common // Common
// //
annotate AdminService.OrderItems with { annotate AdminService.OrderItems with {
book @( book @(
Common: { Common : {
Text: book.title, Text : book.title,
FieldControl: #Mandatory FieldControl : #Mandatory
}, },
ValueList.entity:'Books', ValueList.entity : 'Books',
); );
amount @( amount @(Common.FieldControl : #Mandatory);
Common.FieldControl: #Mandatory
);
} }
annotate AdminService.Orders with { annotate AdminService.Orders with {
shippingAddress @( shippingAddress @(Common : {
Common: { FieldControl : #Mandatory,
FieldControl: #Mandatory, ValueList : {
ValueList: { CollectionPath : 'Addresses',
CollectionPath: 'Addresses', Label : 'Addresses',
Label: 'Addresses', SearchSupported : 'true',
SearchSupported: 'true', Parameters : [
Parameters: [ {
{ $Type: 'Common.ValueListParameterOut', LocalDataProperty: 'shippingAddress_AddressID', ValueListProperty: 'AddressID'}, $Type : 'Common.ValueListParameterOut',
{ $Type: 'Common.ValueListParameterOut', LocalDataProperty: 'shippingAddress_BusinessPartner', ValueListProperty: 'BusinessPartner'}, LocalDataProperty : 'shippingAddress_AddressID',
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'postalCode'}, ValueListProperty : 'AddressID'
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'cityName'}, },
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'country'}, {
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'streetName'}, $Type : 'Common.ValueListParameterOut',
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'houseNumber'}, LocalDataProperty : 'shippingAddress_BusinessPartner',
] ValueListProperty : 'BusinessPartner'
}, },
SideEffects : { {
EffectTypes : #ValueChange, $Type : 'Common.ValueListParameterDisplayOnly',
SourceProperties : [shippingAddress_AddressID], ValueListProperty : 'postalCode'
TargetProperties : [ },
shippingAddress.country, {
shippingAddress.houseNumber, $Type : 'Common.ValueListParameterDisplayOnly',
shippingAddress.streetName, ValueListProperty : 'cityName'
shippingAddress.cityName, },
shippingAddress.postalCode {
] $Type : 'Common.ValueListParameterDisplayOnly',
} ValueListProperty : 'country'
} },
); {
$Type : 'Common.ValueListParameterDisplayOnly',
ValueListProperty : 'streetName'
},
{
$Type : 'Common.ValueListParameterDisplayOnly',
ValueListProperty : 'houseNumber'
},
]
},
SideEffects : {
EffectTypes : #ValueChange,
SourceProperties : [shippingAddress_AddressID],
TargetProperties : [
shippingAddress.country,
shippingAddress.houseNumber,
shippingAddress.streetName,
shippingAddress.cityName,
shippingAddress.postalCode
]
}
});
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// UI // UI
// //
annotate AdminService.Orders with @( annotate AdminService.Orders with @(UI : {
UI: { ////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////// //
// // Lists of Orders
// Lists of Orders //
// SelectionFields : [
SelectionFields: [ createdAt, createdBy ], createdAt,
LineItem: [ createdBy
{Value: createdBy, Label:'Customer'}, ],
{Value: createdAt, Label:'Date'} LineItem : [
], {
//////////////////////////////////////////////////////////////////////////// Value : createdBy,
// Label : 'Customer'
// Order Details },
// {
HeaderInfo: { Value : createdAt,
TypeName: 'Order', TypeNamePlural: 'Orders', Label : 'Date'
Title: { }
Label: 'Order number ', //A label is possible but it is not considered on the ObjectPage yet ],
Value: OrderNo ////////////////////////////////////////////////////////////////////////////
}, //
Description: {Value: createdBy} // Order Details
}, //
Identification: [ //Is the main field group HeaderInfo : {
// labels not considered TypeName : 'Order',
{Value: createdBy, Label:'Customer'}, TypeNamePlural : 'Orders',
{Value: createdAt, Label:'Date'}, Title : {
{Value: OrderNo }, Label : 'Order number ', //A label is possible but it is not considered on the ObjectPage yet
{Value: 'shippingAddress', Label: 'Address ID'} Value : OrderNo
], },
HeaderFacets: [ Description : {Value : createdBy}
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Created}', Target: '@UI.FieldGroup#Created'}, },
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Modified}', Target: '@UI.FieldGroup#Modified'}, Identification : [ //Is the main field group
], // labels not considered
Facets: [ {
{$Type: 'UI.ReferenceFacet', Label: '{i18n>ShippingAddress}', Target: '@UI.FieldGroup#ShippingAddress'}, Value : createdBy,
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'}, Label : 'Customer'
{$Type: 'UI.ReferenceFacet', Label: '{i18n>OrderItems}', Target: 'Items/@UI.LineItem'}, },
], {
FieldGroup#Details: { Value : createdAt,
Data: [ Label : 'Date'
{Value: currency_code, Label:'Currency'} },
] {Value : OrderNo},
}, {
FieldGroup#Created: { Value : 'shippingAddress',
Data: [ Label : 'Address ID'
{Value: createdBy}, }
{Value: createdAt}, ],
] HeaderFacets : [
}, {
FieldGroup#Modified: { $Type : 'UI.ReferenceFacet',
Data: [ Label : '{i18n>Created}',
{Value: modifiedBy}, Target : '@UI.FieldGroup#Created'
{Value: modifiedAt}, },
] {
}, $Type : 'UI.ReferenceFacet',
FieldGroup#ShippingAddress: { Label : '{i18n>Modified}',
Data: [ Target : '@UI.FieldGroup#Modified'
{Value: shippingAddress_AddressID, Label:'{i18n>shippingAddress}'}, },
{Value: shippingAddress.houseNumber, Label:'{i18n>houseNumber}'}, ],
{Value: shippingAddress.streetName, Label:'{i18n>streetName}'}, Facets : [
{Value: shippingAddress.cityName, Label:'{i18n>cityName}'}, {
{Value: shippingAddress.postalCode, Label:'{i18n>postalCode}'}, $Type : 'UI.ReferenceFacet',
] Label : '{i18n>ShippingAddress}',
}, Target : '@UI.FieldGroup#ShippingAddress'
}, },
) { {
createdAt @UI.HiddenFilter:false; $Type : 'UI.ReferenceFacet',
createdBy @UI.HiddenFilter:false; Label : '{i18n>Details}',
Target : '@UI.FieldGroup#Details'
},
{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>OrderItems}',
Target : 'Items/@UI.LineItem'
},
],
FieldGroup #Details : {Data : [{
Value : currency_code,
Label : 'Currency'
}]},
FieldGroup #Created : {Data : [
{Value : createdBy},
{Value : createdAt},
]},
FieldGroup #Modified : {Data : [
{Value : modifiedBy},
{Value : modifiedAt},
]},
FieldGroup #ShippingAddress : {Data : [
{
Value : shippingAddress_AddressID,
Label : '{i18n>shippingAddress}'
},
{
Value : shippingAddress.houseNumber,
Label : '{i18n>houseNumber}'
},
{
Value : shippingAddress.streetName,
Label : '{i18n>streetName}'
},
{
Value : shippingAddress.cityName,
Label : '{i18n>cityName}'
},
{
Value : shippingAddress.postalCode,
Label : '{i18n>postalCode}'
},
]},
}, ) {
createdAt @UI.HiddenFilter : false;
createdBy @UI.HiddenFilter : false;
}; };
//The enity types name is AdminService.my_bookshop_OrderItems //The enity types name is AdminService.my_bookshop_OrderItems
//The annotations below are not generated in edmx WHY? //The annotations below are not generated in edmx WHY?
annotate AdminService.OrderItems with @( annotate AdminService.OrderItems with @(UI : {
UI: { HeaderInfo : {
HeaderInfo: { TypeName : 'Order Item',
TypeName: 'Order Item', TypeNamePlural: ' ', TypeNamePlural : ' ',
Title: { Title : {Value : book.title},
Value: book.title Description : {Value : book.descr}
}, },
Description: {Value: book.descr} // There is no filterbar for items so the selctionfileds is not needed
}, SelectionFields : [book_ID],
// There is no filterbar for items so the selctionfileds is not needed ////////////////////////////////////////////////////////////////////////////
SelectionFields: [ book_ID ], //
//////////////////////////////////////////////////////////////////////////// // Lists of OrderItems
// //
// Lists of OrderItems LineItem : [
// {
LineItem: [ Value : book_ID,
{Value: book_ID, Label:'Book'}, Label : 'Book'
//The following entry is only used to have the assoication followed in the read event },
{Value: book.price, Label:'Book Price'}, //The following entry is only used to have the assoication followed in the read event
{Value: amount, Label:'Quantity'}, {
], Value : book.price,
Identification: [ //Is the main field group Label : 'Book Price'
//{Value: ID, Label:'ID'}, //A guid shouldn't be on the UI },
{Value: book_ID, Label:'Book'}, {
{Value: amount, Label:'Amount'}, Value : amount,
], Label : 'Quantity'
Facets: [ },
{$Type: 'UI.ReferenceFacet', Label: '{i18n>OrderItems}', Target: '@UI.Identification'}, ],
], Identification : [ //Is the main field group
}, //{Value: ID, Label:'ID'}, //A guid shouldn't be on the UI
); {
Value : book_ID,
Label : 'Book'
},
{
Value : amount,
Label : 'Amount'
},
],
Facets : [{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>OrderItems}',
Target : '@UI.Identification'
}, ],
}, );