Numbered list for arrays
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import List
|
||||
from typing import List, Dict
|
||||
|
||||
from pydantic import BaseModel, Field, validator
|
||||
|
||||
@@ -44,11 +44,18 @@ class ProvisionTemplateReference(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class DictionaryEntry(BaseModel):
|
||||
key: str
|
||||
value: str = ""
|
||||
|
||||
|
||||
class ContractTemplate(CrudDocument):
|
||||
name: str
|
||||
parties: List[PartyTemplate] = []
|
||||
provisions: List[ProvisionTemplateReference] = Field(
|
||||
default=[],
|
||||
props={"items-per-row": "1"}
|
||||
props={"items-per-row": "1", "numbered": True}
|
||||
)
|
||||
variables: List[DictionaryEntry] = Field(default=[], format="dictionary")
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ import { FieldArrayType } from '@ngx-formly/core';
|
||||
<div class="row">
|
||||
<div *ngFor="let entry of field.fieldGroup; let i = index" class="card {{this.colSm}}">
|
||||
<div class="card-header">
|
||||
<div *ngIf="props['numbered']" class="float-start">
|
||||
<strong>{{ i + 1 }}</strong>
|
||||
</div>
|
||||
<div class="float-end">
|
||||
<button class="btn btn-primary btn-sm" [attr.disabled]="i == 0 ? 'disabled' : null" type="button" (click)="move(i, i-1)">UP</button>
|
||||
<button class="btn btn-primary btn-sm" [attr.disabled]="i == this.field.fieldGroup!.length-1 ? 'disabled' : null" type="button" (click)="move(i, i+1)">DOWN</button>
|
||||
|
||||
Reference in New Issue
Block a user