Adding Date and working on fereign keys

This commit is contained in:
2023-01-22 04:39:11 +01:00
parent 70d5a6e752
commit 7dd684e514
9 changed files with 289 additions and 21 deletions

View File

@@ -1,12 +1,11 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { FormlyFieldConfig } from '@ngx-formly/core'
import { FormlyJsonschema } from '@ngx-formly/core/json-schema';
import { ActivatedRoute, Router } from '@angular/router';
import { CrudService } from '../crud.service'
import { BehaviorSubject } from "rxjs";
import { JsonschemasService } from "../jsonschemas.service";
import {CrudFormlyJsonschemaService} from "../crud-formly-jsonschema.service";
export interface Model {
email: string;
@@ -33,27 +32,27 @@ export class CardComponent implements OnInit {
}
constructor(private crudService: CrudService,
private jsonSchemasService: JsonschemasService,
private formlyJsonschema: FormlyJsonschema,
private formlyJsonschema: CrudFormlyJsonschemaService,
private router: Router,
private route: ActivatedRoute,
) { }
ngOnInit(): void {
this._loading$.next(true);
let fields$;
if (this.isCreateForm()) {
this.jsonSchemasService.getCreateResource(this.resource!).subscribe((schemas: any) => {
this.fields = [this.formlyJsonschema.toFieldConfig(schemas)];
})
fields$ = this.formlyJsonschema.getCreateFields(this.resource!);
} else {
this.jsonSchemasService.getUpdateResource(this.resource!).subscribe((schemas: any) => {
this.fields = [this.formlyJsonschema.toFieldConfig(schemas)];
})
this.crudService.get(this.resource!, this.resource_id!).subscribe((model: any) => {
this.model = model
this._loading$.next(false);
});
fields$ = this.formlyJsonschema.getUpdateFields(this.resource!);
}
fields$.subscribe((fields: any) => {
this.fields = [fields]
});
}
onSubmit(model: any) {