Full Working static multi tenant
This commit is contained in:
@@ -70,7 +70,7 @@ export class DraftsNewComponent extends BaseDraftsComponent implements OnInit {
|
||||
this.temaplateForm.valueChanges.subscribe((values) => {
|
||||
if (values.template_id !== undefined) {
|
||||
this.crudService.get("template/contract", values.template_id).subscribe((templateModel) => {
|
||||
delete templateModel._id;
|
||||
delete templateModel.id;
|
||||
delete templateModel.created_at;
|
||||
delete templateModel.updated_at;
|
||||
delete templateModel.label;
|
||||
@@ -98,7 +98,7 @@ export class DraftsNewComponent extends BaseDraftsComponent implements OnInit {
|
||||
(resourceReceived)="this.onResourceReceived($event)"
|
||||
>
|
||||
</base-card>
|
||||
<a class="btn btn-link" href="/api/v1/contract/print/preview/draft/{{this.resource_id}}" target="_blank" i18n>Preview</a>
|
||||
<a class="btn btn-link" href="/api/v1/westside/cht/contract/print/preview/draft/{{this.resource_id}}" target="_blank" i18n>Preview</a>
|
||||
<ng-container *ngIf="this.isReadyForPublication;">
|
||||
<formly-form [fields]="newContractFormfields" [form]="newContractForm" [model]="newContractModel"></formly-form>
|
||||
<button class="btn btn-success" (click)="publish()" i18n>Publish</button>
|
||||
|
||||
@@ -71,8 +71,8 @@ export class ContractsCardComponent extends BaseContractsComponent{
|
||||
|
||||
onResourceReceived(model: any): void {
|
||||
this.resourceReadyToPrint = model.status != "published";
|
||||
this.contractPrintLink = `${location.origin}/api/v1/contract/print/pdf/${this.resource_id}`
|
||||
this.contractPreviewLink = `${location.origin}/api/v1/contract/print/preview/${this.resource_id}`
|
||||
this.contractPrintLink = `${location.origin}/api/v1/westside/cht/contract/print/pdf/${this.resource_id}`
|
||||
this.contractPreviewLink = `${location.origin}/api/v1/westside/cht/contract/print/preview/${this.resource_id}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ export class ContractsSignatureComponent implements OnInit {
|
||||
}
|
||||
|
||||
getPreview() {
|
||||
return this.sanitizer.bypassSecurityTrustResourceUrl("/api/v1/contract/print/preview/signature/" + this.signature_id);
|
||||
return this.sanitizer.bypassSecurityTrustResourceUrl("/api/v1/westside/cht/contract/print/preview/signature/" + this.signature_id);
|
||||
}
|
||||
|
||||
postSignature(image: string) {
|
||||
|
||||
@@ -24,7 +24,7 @@ export class CardComponent implements OnInit {
|
||||
@Input() set model(value: any) {
|
||||
this._model = value;
|
||||
if (Object.keys(this.form.controls).length) {
|
||||
delete value._id;
|
||||
delete value.id;
|
||||
this.form.patchValue(value);
|
||||
}
|
||||
}
|
||||
@@ -109,10 +109,10 @@ export class CardComponent implements OnInit {
|
||||
error: (err) => this.error.emit("Error creating the entity:" + err)
|
||||
});
|
||||
} else {
|
||||
model._id = this.resource_id;
|
||||
model.id = this.resource_id;
|
||||
this.crudService.update(this.resource!, model).subscribe( {
|
||||
next: (model: any) => {
|
||||
this.resourceUpdated.emit(model._id);
|
||||
this.resourceUpdated.emit(model.id);
|
||||
this.resourceReceived.emit(model);
|
||||
this.model = model;
|
||||
this._modelLoading$.next(false);
|
||||
@@ -124,7 +124,7 @@ export class CardComponent implements OnInit {
|
||||
|
||||
onDelete() {
|
||||
this._modelLoading$.next(true);
|
||||
this.model._id = this.resource_id;
|
||||
this.model.id = this.resource_id;
|
||||
this.crudService.delete(this.resource!, this.model).subscribe({
|
||||
next: (model: any) => {
|
||||
this._modelLoading$.next(false);
|
||||
|
||||
@@ -10,10 +10,10 @@ import {SortDirection} from "./list/sortable.directive";
|
||||
export class ApiService {
|
||||
constructor(protected http: HttpClient) {}
|
||||
|
||||
protected api_root: string = '/api/v1'
|
||||
protected api_root: string = '/api/v1/westside/cht'
|
||||
|
||||
public getSchema() {
|
||||
return this.http.get<Schema>(`${this.api_root}/openapi.json`);
|
||||
return this.http.get<Schema>("/api/v1/openapi.json");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ export class CrudService extends ApiService {
|
||||
|
||||
public update(resource: string, model: any) {
|
||||
return this.http.put<{ menu: [{}] }>(
|
||||
`${this.api_root}/${resource.toLowerCase()}/${model._id}`,
|
||||
`${this.api_root}/${resource.toLowerCase()}/${model.id}`,
|
||||
model
|
||||
);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ export class CrudService extends ApiService {
|
||||
|
||||
public delete(resource: string, model: any) {
|
||||
return this.http.delete<{ menu: [{}] }>(
|
||||
`${this.api_root}/${resource.toLowerCase()}/${model._id}`
|
||||
`${this.api_root}/${resource.toLowerCase()}/${model.id}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<tr *ngIf="loading$ | async">
|
||||
<td class="text-center" [attr.colspan]="this.displayedColumns.length" i18n>Loading...</td>
|
||||
</tr>
|
||||
<tr *ngFor="let row of listData$ | async" (click)="onRowClick(row._id)" (auxclick)="onRowMiddleClick(row._id);" class="table-row-link">
|
||||
<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>
|
||||
|
||||
@@ -53,7 +53,7 @@ import {DictionaryService} from "./dictionary.service";
|
||||
<div class="modal-body">
|
||||
<crud-card *ngIf="this.hasValue()"
|
||||
[resource]="this.foreignResource"
|
||||
[resource_id]="this.foreignModel._id"
|
||||
[resource_id]="this.foreignModel.id"
|
||||
[schema]="this.foreignSchema"
|
||||
[is_modal]="true"
|
||||
(resourceDeleted)="onResourceDeleted($event)"
|
||||
@@ -106,7 +106,7 @@ export class ForeignkeyTypeComponent extends FieldType<FieldTypeConfig> implemen
|
||||
if (!v) {
|
||||
this.foreignModel = {};
|
||||
this.foreignLabel = "";
|
||||
} else if (v != this.foreignModel._id) {
|
||||
} else if (v != this.foreignModel.id) {
|
||||
this.loadModel(v);
|
||||
}
|
||||
})
|
||||
@@ -123,7 +123,7 @@ export class ForeignkeyTypeComponent extends FieldType<FieldTypeConfig> implemen
|
||||
loadModel(id:string) {
|
||||
this.getResource(id).pipe(
|
||||
map(v => { this.setModel(v); return v; }),
|
||||
map( v => this.formControl.patchValue(v._id))
|
||||
map( v => this.formControl.patchValue(v.id))
|
||||
).subscribe()
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ export class ForeignkeyTypeComponent extends FieldType<FieldTypeConfig> implemen
|
||||
|
||||
selectedItem(event: any) {
|
||||
this.setModel(event.item);
|
||||
this.formControl.setValue(event.item._id);
|
||||
this.formControl.setValue(event.item.id);
|
||||
}
|
||||
|
||||
setModel(model: any) {
|
||||
|
||||
Reference in New Issue
Block a user