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

View File

@@ -3,6 +3,7 @@ using AdminService from '../../srv/admin-service';
annotate AdminService.Books with { annotate AdminService.Books with {
price @Common.FieldControl : #ReadOnly; price @Common.FieldControl : #ReadOnly;
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// Common // Common
@@ -15,27 +16,47 @@ annotate AdminService.OrderItems with {
}, },
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', LocalDataProperty: 'shippingAddress_BusinessPartner', ValueListProperty: 'BusinessPartner'}, $Type : 'Common.ValueListParameterOut',
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'postalCode'}, LocalDataProperty : 'shippingAddress_AddressID',
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'cityName'}, ValueListProperty : 'AddressID'
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'country'}, },
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'streetName'}, {
{ $Type: 'Common.ValueListParameterDisplayOnly', ValueListProperty: 'houseNumber'}, $Type : 'Common.ValueListParameterOut',
LocalDataProperty : 'shippingAddress_BusinessPartner',
ValueListProperty : 'BusinessPartner'
},
{
$Type : 'Common.ValueListParameterDisplayOnly',
ValueListProperty : 'postalCode'
},
{
$Type : 'Common.ValueListParameterDisplayOnly',
ValueListProperty : 'cityName'
},
{
$Type : 'Common.ValueListParameterDisplayOnly',
ValueListProperty : 'country'
},
{
$Type : 'Common.ValueListParameterDisplayOnly',
ValueListProperty : 'streetName'
},
{
$Type : 'Common.ValueListParameterDisplayOnly',
ValueListProperty : 'houseNumber'
},
] ]
}, },
SideEffects : { SideEffects : {
@@ -49,31 +70,39 @@ annotate AdminService.Orders with {
shippingAddress.postalCode shippingAddress.postalCode
] ]
} }
} });
);
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// UI // UI
// //
annotate AdminService.Orders with @( annotate AdminService.Orders with @(UI : {
UI: {
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// Lists of Orders // Lists of Orders
// //
SelectionFields: [ createdAt, createdBy ], SelectionFields : [
createdAt,
createdBy
],
LineItem : [ LineItem : [
{Value: createdBy, Label:'Customer'}, {
{Value: createdAt, Label:'Date'} Value : createdBy,
Label : 'Customer'
},
{
Value : createdAt,
Label : 'Date'
}
], ],
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// Order Details // Order Details
// //
HeaderInfo : { HeaderInfo : {
TypeName: 'Order', TypeNamePlural: 'Orders', TypeName : 'Order',
TypeNamePlural : 'Orders',
Title : { Title : {
Label : 'Order number ', //A label is possible but it is not considered on the ObjectPage yet Label : 'Order number ', //A label is possible but it is not considered on the ObjectPage yet
Value : OrderNo Value : OrderNo
@@ -82,61 +111,95 @@ annotate AdminService.Orders with @(
}, },
Identification : [ //Is the main field group Identification : [ //Is the main field group
// labels not considered // labels not considered
{Value: createdBy, Label:'Customer'}, {
{Value: createdAt, Label:'Date'}, Value : createdBy,
Label : 'Customer'
},
{
Value : createdAt,
Label : 'Date'
},
{Value : OrderNo}, {Value : OrderNo},
{Value: 'shippingAddress', Label: 'Address ID'} {
Value : 'shippingAddress',
Label : 'Address ID'
}
], ],
HeaderFacets : [ HeaderFacets : [
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Created}', Target: '@UI.FieldGroup#Created'}, {
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Modified}', Target: '@UI.FieldGroup#Modified'}, $Type : 'UI.ReferenceFacet',
Label : '{i18n>Created}',
Target : '@UI.FieldGroup#Created'
},
{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>Modified}',
Target : '@UI.FieldGroup#Modified'
},
], ],
Facets : [ Facets : [
{$Type: 'UI.ReferenceFacet', Label: '{i18n>ShippingAddress}', Target: '@UI.FieldGroup#ShippingAddress'}, {
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'}, $Type : 'UI.ReferenceFacet',
{$Type: 'UI.ReferenceFacet', Label: '{i18n>OrderItems}', Target: 'Items/@UI.LineItem'}, Label : '{i18n>ShippingAddress}',
], Target : '@UI.FieldGroup#ShippingAddress'
FieldGroup#Details: {
Data: [
{Value: currency_code, Label:'Currency'}
]
}, },
FieldGroup#Created: { {
Data: [ $Type : 'UI.ReferenceFacet',
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 : createdBy},
{Value : createdAt}, {Value : createdAt},
] ]},
}, FieldGroup #Modified : {Data : [
FieldGroup#Modified: {
Data: [
{Value : modifiedBy}, {Value : modifiedBy},
{Value : modifiedAt}, {Value : modifiedAt},
] ]},
FieldGroup #ShippingAddress : {Data : [
{
Value : shippingAddress_AddressID,
Label : '{i18n>shippingAddress}'
}, },
FieldGroup#ShippingAddress: { {
Data: [ Value : shippingAddress.houseNumber,
{Value: shippingAddress_AddressID, Label:'{i18n>shippingAddress}'}, Label : '{i18n>houseNumber}'
{Value: shippingAddress.houseNumber, Label:'{i18n>houseNumber}'},
{Value: shippingAddress.streetName, Label:'{i18n>streetName}'},
{Value: shippingAddress.cityName, Label:'{i18n>cityName}'},
{Value: shippingAddress.postalCode, Label:'{i18n>postalCode}'},
]
}, },
{
Value : shippingAddress.streetName,
Label : '{i18n>streetName}'
}, },
) { {
Value : shippingAddress.cityName,
Label : '{i18n>cityName}'
},
{
Value : shippingAddress.postalCode,
Label : '{i18n>postalCode}'
},
]},
}, ) {
createdAt @UI.HiddenFilter : false; createdAt @UI.HiddenFilter : false;
createdBy @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', TypeNamePlural: ' ', TypeName : 'Order Item',
Title: { TypeNamePlural : ' ',
Value: book.title Title : {Value : book.title},
},
Description : {Value : book.descr} Description : {Value : book.descr}
}, },
// There is no filterbar for items so the selctionfileds is not needed // There is no filterbar for items so the selctionfileds is not needed
@@ -146,18 +209,34 @@ annotate AdminService.OrderItems with @(
// Lists of OrderItems // Lists of OrderItems
// //
LineItem : [ LineItem : [
{Value: book_ID, Label:'Book'}, {
Value : book_ID,
Label : 'Book'
},
//The following entry is only used to have the assoication followed in the read event //The following entry is only used to have the assoication followed in the read event
{Value: book.price, Label:'Book Price'}, {
{Value: amount, Label:'Quantity'}, Value : book.price,
Label : 'Book Price'
},
{
Value : amount,
Label : 'Quantity'
},
], ],
Identification : [ //Is the main field group Identification : [ //Is the main field group
//{Value: ID, Label:'ID'}, //A guid shouldn't be on the UI //{Value: ID, Label:'ID'}, //A guid shouldn't be on the UI
{Value: book_ID, Label:'Book'}, {
{Value: amount, Label:'Amount'}, Value : book_ID,
], Label : 'Book'
Facets: [
{$Type: 'UI.ReferenceFacet', Label: '{i18n>OrderItems}', Target: '@UI.Identification'},
],
}, },
); {
Value : amount,
Label : 'Amount'
},
],
Facets : [{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>OrderItems}',
Target : '@UI.Identification'
}, ],
}, );