Skip to content

Commit fd2138b

Browse files
committed
Streamlining some more of tables.
1 parent 3600484 commit fd2138b

File tree

9 files changed

+81
-46
lines changed

9 files changed

+81
-46
lines changed

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Models/Documents/BackendConfigurationDocumentProperty.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ public class BackendConfigurationDocumentProperty
55
public int Id { get; set; }
66
public int PropertyId { get; set; }
77
public int DocumentId { get; set; }
8+
public string PropertyName { get; set; }
89
}

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationDocumentService/BackendConfigurationDocumentService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public async Task<OperationDataResult<Paged<BackendConfigurationDocumentModel>>>
149149
{
150150
Id = y.Id,
151151
DocumentId = y.DocumentId,
152-
PropertyId = y.PropertyId
152+
PropertyId = y.PropertyId,
153153
}).ToList()
154154
})
155155
.ToListAsync().ConfigureAwait(false);
@@ -172,6 +172,7 @@ public async Task<OperationDataResult<Paged<BackendConfigurationDocumentModel>>>
172172
}
173173
var property = await _backendConfigurationPnDbContext.Properties.FirstAsync(x =>
174174
x.Id == backendConfigurationDocumentProperty.PropertyId);
175+
backendConfigurationDocumentProperty.PropertyName = property.Name;
175176
propertyNames += property.Name;
176177
}
177178
backendConfigurationDocumentModel.PropertyNames = propertyNames;

eform-client/src/app/plugins/modules/backend-configuration-pn/models/documents/document-property.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export class DocumentPropertyModel {
22
id?: number;
33
documentId: number;
44
propertyId: number;
5+
propertyName: string;
56
}

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-create/documents-document-create.component.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ export class DocumentsDocumentCreateComponent implements OnInit {
167167

168168
this.newDocumentModel.documentProperties = selectedProps.map((id: number) => ({
169169
propertyId: id,
170-
documentId: this.newDocumentModel.id
170+
documentId: this.newDocumentModel.id,
171+
propertyName: '',
171172
}));
172173

173174
const formTranslations = Array.isArray(formValue.translations) ? formValue.translations : [];
@@ -222,26 +223,27 @@ export class DocumentsDocumentCreateComponent implements OnInit {
222223
if (assignmentObject) {
223224
return assignmentObject;
224225
}
225-
return {propertyId: propertyId, documentId: this.newDocumentModel.id}
226+
return {propertyId: propertyId, documentId: this.newDocumentModel.id, propertyName: ''};
226227
});
227228
this.documentProperties = this.newDocumentModel.documentProperties.map(x => x.propertyId);
228229
}
229230

230-
getAssignmentIsCheckedByPropertyId(propertyId: number): boolean {
231-
const assignment = this.newDocumentModel.documentProperties.find(
232-
(x) => x.propertyId === propertyId
233-
);
234-
return assignment !== undefined;
235-
}
236-
237-
getAssignmentByPropertyId(propertyId: number): DocumentPropertyModel {
238-
return (
239-
this.newDocumentModel.documentProperties.find((x) => x.propertyId === propertyId) ?? {
240-
propertyId: propertyId,
241-
documentId: this.newDocumentModel.id,
242-
}
243-
);
244-
}
231+
// getAssignmentIsCheckedByPropertyId(propertyId: number): boolean {
232+
// const assignment = this.newDocumentModel.documentProperties.find(
233+
// (x) => x.propertyId === propertyId
234+
// );
235+
// return assignment !== undefined;
236+
// }
237+
//
238+
// getAssignmentByPropertyId(propertyId: number): DocumentPropertyModel {
239+
// return (
240+
// this.newDocumentModel.documentProperties.find((x) => x.propertyId === propertyId) ?? {
241+
// propertyId: propertyId,
242+
// documentId: this.newDocumentModel.id,
243+
// propertyName: '',
244+
// }
245+
// );
246+
// }
245247

246248
removeFile(selectedLanguage: number, extension: string) {
247249
const filesIndexByLanguage = this.newDocumentModel.documentUploadedDatas.findIndex(

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-edit/documents-document-edit.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class DocumentsDocumentEditComponent implements OnInit {
232232
if (assignmentObject) {
233233
return assignmentObject;
234234
}
235-
return {propertyId: propertyId, documentId: this.documentModel.id};
235+
return {propertyId: propertyId, documentId: this.documentModel.id, propertyName: ''};
236236
});
237237
this.documentProperties = this.documentModel.documentProperties.map(x => x.propertyId);
238238
}

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-container/documents-container.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export class DocumentsContainerComponent implements OnInit, OnDestroy {
170170
this.folders = folders.model;
171171
}
172172
if (documents && documents.success && documents.model) {
173+
// debugger;
173174
this.documents = documents.model;
174175
}
175176
});

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-table/documents-table.component.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<mtx-grid
22
[data]="documents"
33
[columns]="tableHeaders"
4+
[cellTemplate]="{
5+
status: statusTpl,
6+
documentProperties: documentPropertiesTpl
7+
}"
48
[showPaginator]="false"
59
[pageOnFront]="false"
610
[rowStriped]="true"
@@ -30,3 +34,26 @@
3034
</div>
3135
</div>
3236
</ng-template>-->
37+
38+
39+
40+
<ng-template #statusTpl let-row>
41+
<mat-chip
42+
[ngClass]="{
43+
'status-active': row.status === true,
44+
'status-inactive': row.status === false
45+
}"
46+
>
47+
<span title="{{(row.status ? 'ON' : 'OFF') | translate}}">{{(row.status ? 'Active' : 'NotActive') | translate | translate}}</span>
48+
</mat-chip>
49+
</ng-template>
50+
51+
52+
53+
<ng-template #documentPropertiesTpl let-row>
54+
<div class="d-flex flex-wrap">
55+
<mat-chip color="primary" *ngFor="let documentProperty of row.documentProperties">
56+
<span>{{documentProperty.propertyName}}</span>
57+
</mat-chip>
58+
</div>
59+
</ng-template>

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-table/documents-table.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ export class DocumentsTableComponent implements OnInit, OnDestroy {
3333
tableHeaders: MtxGridColumn[] = [
3434
{field: 'id', header: this.translateService.stream('Id'), sortable: true, sortProp: {id: 'Id'}},
3535
{
36-
field: 'propertyNames',
36+
field: 'documentProperties',
3737
header: this.translateService.stream('Properties'),
38-
formatter: (document: DocumentModel) => document.propertyNames
38+
// formatter: (document: DocumentModel) => document.propertyNames
3939
},
4040
{
4141
field: 'propertyFolder',
@@ -67,7 +67,7 @@ export class DocumentsTableComponent implements OnInit, OnDestroy {
6767
{
6868
field: 'status',
6969
header: this.translateService.stream('Status'),
70-
formatter: (document: DocumentModel) => this.translateService.instant(document.status ? 'ON' : 'OFF'),
70+
// formatter: (document: DocumentModel) => this.translateService.instant(document.status ? 'ON' : 'OFF'),
7171
sortable: true, sortProp: {id: 'Status'}
7272
},
7373
{

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/documents.module.ts

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {MatCheckboxModule} from '@angular/material/checkbox';
3232
import {MtxCheckboxGroupModule} from '@ng-matero/extensions/checkbox-group';
3333
import {MatDatepickerModule} from '@angular/material/datepicker';
3434
import {StatisticsModule} from '../statistics/statistics.module';
35+
import {MatChip} from "@angular/material/chips";
3536

3637
@NgModule({
3738
declarations: [
@@ -46,30 +47,31 @@ import {StatisticsModule} from '../statistics/statistics.module';
4647
DocumentsDocumentEditComponent,
4748
DocumentsDocumentDeleteComponent
4849
],
49-
imports: [
50-
CommonModule,
51-
TranslateModule,
52-
RouterModule,
53-
DocumentsRouting,
54-
EformSharedModule,
55-
ReactiveFormsModule,
56-
EformImportedModule,
57-
FormsModule,
58-
MatButtonModule,
59-
MatTooltipModule,
60-
MatIconModule,
61-
MatFormFieldModule,
62-
MtxSelectModule,
63-
MatInputModule,
64-
MtxGridModule,
65-
MatDialogModule,
66-
MatCardModule,
67-
MatSlideToggleModule,
68-
MatCheckboxModule,
69-
MtxCheckboxGroupModule,
70-
MatDatepickerModule,
71-
StatisticsModule,
72-
],
50+
imports: [
51+
CommonModule,
52+
TranslateModule,
53+
RouterModule,
54+
DocumentsRouting,
55+
EformSharedModule,
56+
ReactiveFormsModule,
57+
EformImportedModule,
58+
FormsModule,
59+
MatButtonModule,
60+
MatTooltipModule,
61+
MatIconModule,
62+
MatFormFieldModule,
63+
MtxSelectModule,
64+
MatInputModule,
65+
MtxGridModule,
66+
MatDialogModule,
67+
MatCardModule,
68+
MatSlideToggleModule,
69+
MatCheckboxModule,
70+
MtxCheckboxGroupModule,
71+
MatDatepickerModule,
72+
StatisticsModule,
73+
MatChip,
74+
],
7375
providers: [],
7476
})
7577

0 commit comments

Comments
 (0)