6 Commits

7 changed files with 23 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<ngb-toast
*ngFor="let flashmessage of flashmessagesService.toasts"
[header]="flashmessage.type" [autohide]="true" [delay]="flashmessage.delay || 1500"
[header]="flashmessage.type" [autohide]="true" [delay]="flashmessage.delay || 5000"
(hiddden)="flashmessagesService.remove(flashmessage)"
>
<ng-container [ngSwitch]="flashmessage.type">

View File

@@ -6,6 +6,7 @@ import { CrudService } from "@common/crud/crud.service";
import { ActivatedRoute, ParamMap, Router } from "@angular/router";
import { formatDate } from "@angular/common";
import {FlashmessagesService} from "../../layout/flashmessages/flashmessages.service";
export class BaseDraftsComponent {
@@ -142,6 +143,7 @@ export class DraftsCardComponent extends BaseDraftsComponent implements OnInit {
private formlyJsonschema: CrudFormlyJsonschemaService,
private crudService: CrudService,
private router: Router,
private flashService: FlashmessagesService,
) {
super();
}
@@ -159,8 +161,9 @@ export class DraftsCardComponent extends BaseDraftsComponent implements OnInit {
}
publish() {
this.crudService.create('contract', this.newContractModel).subscribe((response: any) => {
this.router.navigate([`../../${response.id}`], {relativeTo: this.route});
this.crudService.create('contract', this.newContractModel).subscribe({
next: (response: any) => this.router.navigate([`../../${response.id}`], {relativeTo: this.route}),
error: (err) => this.flashService.error(err)
});
}

View File

@@ -112,10 +112,10 @@ export class CardComponent implements OnInit {
model._id = this.resource_id;
this.crudService.update(this.resource!, model).subscribe( {
next: (model: any) => {
this.model = model;
this._modelLoading$.next(false);
this.resourceUpdated.emit(model._id);
this.resourceReceived.emit(model);
this.model = model;
this._modelLoading$.next(false);
},
error: (err) => this.error.emit("Error updating the entity:" + err)
});

View File

@@ -0,0 +1,3 @@
.table-row-link {
cursor: pointer;
}

View File

@@ -19,15 +19,15 @@
<span class="col col-form-label" i18n *ngIf="loading$ | async">Loading...</span>
</div>
<div class="table-responsive-md">
<table class="table table-striped">
<table class="table table-striped table-hover">
<thead>
<tr>
<th *ngFor="let col of this.displayedColumns" scope="col" sortable="name" (sort)="onSort($event)">{{ col.title }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let row of listData$ | async" (click)="onSelect(row._id)">
<td *ngFor="let col of this.displayedColumns">
<tr *ngFor="let row of listData$ | async" (click)="onRowClick(row._id)" (auxclick)="onRowMiddleClick(row._id);" class="table-row-link">
<td class="text-truncate" *ngFor="let col of this.displayedColumns" style="max-width: 150px;">
<ngb-highlight [result]="getColumnValue(row, col.path)" [term]="searchTerm"></ngb-highlight>
</td>
</tr>

View File

@@ -100,7 +100,7 @@ export class ListComponent implements OnInit {
parent = parent[key];
}
}
return parent;
return parent.replace(/<[^>]*>/g, '');
}
private _search() {
@@ -144,10 +144,15 @@ export class ListComponent implements OnInit {
this.sortDirection = direction;
}
onSelect(id: string) {
onRowClick(id: string) {
this.router.navigate([`../${id}`], {relativeTo: this.route});
}
onRowMiddleClick(id: string) {
let newUrl = window.location.href.replace('list', id)
window.open(newUrl, '_blank');
}
onCreate() {
this.router.navigate([`../new`], {relativeTo: this.route});
}

View File

@@ -44,6 +44,7 @@ export class RichtextTypeComponent extends FormlyFieldInput implements OnInit {
autoresize_bottom_margin: 0,
body_class: "contract-body",
content_style: ".contract-body { font-family: 'Century Schoolbook', 'sans-serif' }",
entity_encoding: 'raw',
paste_preprocess: function (plugin: any, args: any) {
console.log(args.content)
let container = document.createElement('div');
@@ -80,7 +81,7 @@ export class RichtextTypeComponent extends FormlyFieldInput implements OnInit {
}
}
getInitConfig() {
getInitConfig(): any {
return {...this.init_common, ...( this.multiline ? this.init_multiline : this.init_singleline)};
}