Skip to content

Commit

Permalink
feat: add more address fields and arrange address view
Browse files Browse the repository at this point in the history
  • Loading branch information
belsman committed Sep 4, 2024
1 parent 8c257b7 commit 3789f4d
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 84 deletions.
110 changes: 110 additions & 0 deletions packages/modules/order/src/lib/jss-forms/order-address-jss-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,116 @@ export const buildOrderAddressSchema = (
},
],
},
{
name: 'packStation',
type: 'object',
fields: [
{
name: 'provider',
label: 'Provider',
type: 'input',
defaultValue: '',
params: {},
hints: [
{
type: 'error',
error: 'required',
message: 'This field is required.',
},
],
},
{
name: 'stationNumber',
label: 'Station number',
type: 'input',
defaultValue: '',
params: {},
hints: [
{
type: 'error',
error: 'required',
message: 'This field is required.',
},
],
},
{
name: 'postNumber',
label: 'Post number',
type: 'input',
defaultValue: '',
params: {},
hints: [
{
type: 'error',
error: 'required',
message: 'This field is required.',
},
],
},
],
},
],
},
{
name: 'contact',
type: 'object',
fields: [
{
name: 'name',
label: 'Name',
type: 'input',
defaultValue: '',
params: {},
hints: [
{
type: 'error',
error: 'required',
message: 'This field is required.',
},
],
},
{
name: 'email',
label: 'Email',
type: 'input',
defaultValue: '',
params: {},
hints: [
{
type: 'error',
error: 'required',
message: 'This field is required.',
},
],
},
{
name: 'phone',
label: 'Phone number',
type: 'input',
defaultValue: '',
params: {},
hints: [
{
type: 'error',
error: 'required',
message: 'This field is required.',
},
],
},
],
},
{
name: 'comment',
label: 'Comment',
type: 'textarea',
defaultValue: '',
params: {},
hints: [
{
type: 'error',
error: 'required',
message: 'This field is required.',
},
],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,181 +28,181 @@
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Full name:</div>
<!-- <li class="row data-list-item justify-between">
<div class="flex text">Field 1:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="rcOrderAddress?.address?.residentialAddress; else naTemplate"
>{{
rcOrderAddress?.address?.residentialAddress?.title +
' ' +
rcOrderAddress?.address?.residentialAddress?.givenName +
' ' +
rcOrderAddress?.address?.residentialAddress?.midName +
' ' +
rcOrderAddress?.address?.residentialAddress?.familyName
}}</ng-container
*ngIf="
rcOrderAddress?.address?.addressAddition?.field1;
else naTemplate
"
>{{ rcOrderAddress?.address?.addressAddition?.field1 }}</ng-container
>
</div>
</li>
</li> -->

<li class="row data-list-item justify-between">
<div class="flex text">Comments:</div>
<!-- <li class="row data-list-item justify-between">
<div class="flex text">Field 2:</div>
<div class="flex text align-right rc-lv-label">
<ng-container *ngIf="rcOrderAddress?.comments; else naTemplate">{{
rcOrderAddress?.comments
}}</ng-container>
<ng-container
*ngIf="
rcOrderAddress?.address?.addressAddition?.field2;
else naTemplate
"
>{{ rcOrderAddress?.address?.addressAddition?.field2 }}</ng-container
>
</div>
</li>
</li> -->

<li class="row data-list-item justify-between">
<div class="flex text">Email:</div>
<div class="flex text">Street:</div>
<div class="flex text align-right rc-lv-label">
<ng-container *ngIf="rcOrderAddress?.contact?.email; else naTemplate">
<a href="mailto:{{ rcOrderAddress?.contact?.email }}">{{
rcOrderAddress?.contact?.email
}}</a>
</ng-container>
<ng-container
*ngIf="rcOrderAddress?.address?.street; else naTemplate"
>{{ rcOrderAddress?.address?.street }}</ng-container
>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Phone:</div>
<div class="flex text">Building number:</div>
<div class="flex text align-right rc-lv-label">
<ng-container *ngIf="rcOrderAddress?.contact?.phone; else naTemplate">
<a href="tel:{{ rcOrderAddress?.contact?.phone }}">{{
rcOrderAddress?.contact?.phone
}}</a>
<ng-container
*ngIf="rcOrderAddress?.address?.buildingNumber; else naTemplate"
>
{{ rcOrderAddress?.address?.buildingNumber }}
</ng-container>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Pack station provider:</div>
<div class="flex text">Postcode:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="
rcOrderAddress?.address?.packStation?.provider;
else naTemplate
"
*ngIf="rcOrderAddress?.address?.postcode; else naTemplate"
>{{ rcOrderAddress?.address?.postcode }}</ng-container
>
{{ rcOrderAddress?.address?.packStation?.provider }}
</ng-container>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Pack station number:</div>
<div class="flex text">Region:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="
rcOrderAddress?.address?.packStation?.stationNumber;
else naTemplate
"
*ngIf="rcOrderAddress?.address?.region; else naTemplate"
>{{ rcOrderAddress?.address?.region }}</ng-container
>
{{ rcOrderAddress?.address?.packStation?.stationNumber }}
</ng-container>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Pack station post number:</div>
<div class="flex text">Locality:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="
rcOrderAddress?.address?.packStation?.postNumber;
else naTemplate
"
*ngIf="rcOrderAddress?.address?.locality; else naTemplate"
>{{ rcOrderAddress?.address?.locality }}</ng-container
>
{{ rcOrderAddress?.address?.packStation?.postNumber }}
</ng-container>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Field 1:</div>
<div class="flex text">Country:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="
rcOrderAddress?.address?.addressAddition?.field1;
else naTemplate
"
>{{ rcOrderAddress?.address?.addressAddition?.field1 }}</ng-container
*ngIf="rcOrderAddress?.address?.country; else naTemplate"
>{{ rcOrderAddress?.address?.country }}</ng-container
>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Field 2:</div>
<div class="flex text">Pack station provider:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="
rcOrderAddress?.address?.addressAddition?.field2;
rcOrderAddress?.address?.packStation?.provider;
else naTemplate
"
>{{ rcOrderAddress?.address?.addressAddition?.field2 }}</ng-container
>
{{ rcOrderAddress?.address?.packStation?.provider }}
</ng-container>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Street:</div>
<div class="flex text">Pack station number:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="rcOrderAddress?.address?.street; else naTemplate"
>{{ rcOrderAddress?.address?.street }}</ng-container
*ngIf="
rcOrderAddress?.address?.packStation?.stationNumber;
else naTemplate
"
>
{{ rcOrderAddress?.address?.packStation?.stationNumber }}
</ng-container>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Building number:</div>
<div class="flex text">Pack station post number:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="rcOrderAddress?.address?.buildingNumber; else naTemplate"
*ngIf="
rcOrderAddress?.address?.packStation?.postNumber;
else naTemplate
"
>
{{ rcOrderAddress?.address?.buildingNumber }}
{{ rcOrderAddress?.address?.packStation?.postNumber }}
</ng-container>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Postcode:</div>
<div class="flex text">Full name:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="rcOrderAddress?.address?.postcode; else naTemplate"
>{{ rcOrderAddress?.address?.postcode }}</ng-container
*ngIf="rcOrderAddress?.address?.residentialAddress; else naTemplate"
>{{
rcOrderAddress?.address?.residentialAddress?.title +
' ' +
rcOrderAddress?.address?.residentialAddress?.givenName +
' ' +
rcOrderAddress?.address?.residentialAddress?.midName +
' ' +
rcOrderAddress?.address?.residentialAddress?.familyName
}}</ng-container
>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Region:</div>
<div class="flex text">Email:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="rcOrderAddress?.address?.region; else naTemplate"
>{{ rcOrderAddress?.address?.region }}</ng-container
>
<ng-container *ngIf="rcOrderAddress?.contact?.email; else naTemplate">
<a href="mailto:{{ rcOrderAddress?.contact?.email }}">{{
rcOrderAddress?.contact?.email
}}</a>
</ng-container>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Locality:</div>
<div class="flex text">Phone:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="rcOrderAddress?.address?.locality; else naTemplate"
>{{ rcOrderAddress?.address?.locality }}</ng-container
>
<ng-container *ngIf="rcOrderAddress?.contact?.phone; else naTemplate">
<a href="tel:{{ rcOrderAddress?.contact?.phone }}">{{
rcOrderAddress?.contact?.phone
}}</a>
</ng-container>
</div>
</li>

<li class="row data-list-item justify-between">
<div class="flex text">Country:</div>
<div class="flex text">Comments:</div>
<div class="flex text align-right rc-lv-label">
<ng-container
*ngIf="rcOrderAddress?.address?.country; else naTemplate"
>{{ rcOrderAddress?.address?.country }}</ng-container
>
<ng-container *ngIf="rcOrderAddress?.comments; else naTemplate">{{
rcOrderAddress?.comments
}}</ng-container>
</div>
</li>
</ul>
Expand Down

0 comments on commit 3789f4d

Please sign in to comment.