RED-7790: File attributes editing: take into account Read-Only setting
This commit is contained in:
parent
2aa59c4e3c
commit
5f827122aa
@ -1,19 +1,22 @@
|
|||||||
<ng-container *ngIf="configService.listingMode$ | async as mode">
|
<ng-container *ngIf="configService.listingMode$ | async as mode">
|
||||||
<div
|
<div
|
||||||
(mousedown)="handleClick($event)"
|
|
||||||
(click)="editFileAttribute($event)"
|
(click)="editFileAttribute($event)"
|
||||||
|
(mousedown)="handleClick($event)"
|
||||||
[ngClass]="{ 'workflow-attribute': mode === 'workflow', 'file-name-column': fileNameColumn }"
|
[ngClass]="{ 'workflow-attribute': mode === 'workflow', 'file-name-column': fileNameColumn }"
|
||||||
class="file-attribute"
|
class="file-attribute"
|
||||||
>
|
>
|
||||||
<div [ngClass]="{ 'workflow-value': mode === 'workflow' }" class="value">
|
<div [ngClass]="{ 'workflow-value': mode === 'workflow' }" class="value">
|
||||||
|
<mat-icon *ngIf="!fileAttribute.editable" svgIcon="red:read-only"></mat-icon>
|
||||||
|
<div>
|
||||||
<b *ngIf="mode === 'workflow' && !isInEditMode"> {{ fileAttribute.label }}: </b>
|
<b *ngIf="mode === 'workflow' && !isInEditMode"> {{ fileAttribute.label }}: </b>
|
||||||
<span
|
<span
|
||||||
*ngIf="!isDate; else date"
|
*ngIf="!isDate; else date"
|
||||||
[ngClass]="{ hide: isInEditMode, 'clamp-3': mode !== 'workflow' }"
|
|
||||||
[matTooltip]="fileAttributeValue"
|
[matTooltip]="fileAttributeValue"
|
||||||
|
[ngClass]="{ hide: isInEditMode, 'clamp-3': mode !== 'workflow' }"
|
||||||
>
|
>
|
||||||
{{ fileAttributeValue || '-' }}</span
|
{{ fileAttributeValue || '-' }}</span
|
||||||
>
|
>
|
||||||
|
</div>
|
||||||
<ng-template #date>
|
<ng-template #date>
|
||||||
<span [ngClass]="{ hide: isInEditMode, 'clamp-3': mode !== 'workflow' }">
|
<span [ngClass]="{ hide: isInEditMode, 'clamp-3': mode !== 'workflow' }">
|
||||||
{{ fileAttributeValue ? (fileAttributeValue | date: 'd MMM yyyy') : '-' }}</span
|
{{ fileAttributeValue ? (fileAttributeValue | date: 'd MMM yyyy') : '-' }}</span
|
||||||
@ -25,7 +28,8 @@
|
|||||||
*ngIf="
|
*ngIf="
|
||||||
(fileAttributesService.isEditingFileAttribute() === false || isInEditMode) &&
|
(fileAttributesService.isEditingFileAttribute() === false || isInEditMode) &&
|
||||||
!file.isInitialProcessing &&
|
!file.isInitialProcessing &&
|
||||||
permissionsService.canEditFileAttributes(file, dossier)
|
permissionsService.canEditFileAttributes(file, dossier) &&
|
||||||
|
fileAttribute.editable
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -25,6 +25,17 @@
|
|||||||
|
|
||||||
.value {
|
.value {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
min-width: 12px;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
line-height: 12px;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.workflow-value {
|
.workflow-value {
|
||||||
|
|||||||
@ -49,6 +49,7 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
|
|||||||
@Input() file!: File;
|
@Input() file!: File;
|
||||||
@Input() dossier!: Dossier;
|
@Input() dossier!: Dossier;
|
||||||
@Input() fileNameColumn = false;
|
@Input() fileNameColumn = false;
|
||||||
|
readonlyAttrs: string[] = [];
|
||||||
readonly #subscriptions = new Subscription();
|
readonly #subscriptions = new Subscription();
|
||||||
readonly #shouldClose = computed(
|
readonly #shouldClose = computed(
|
||||||
() =>
|
() =>
|
||||||
@ -187,6 +188,7 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
|
|||||||
|
|
||||||
#initFileAttributes() {
|
#initFileAttributes() {
|
||||||
const configs = this.fileAttributesService.getFileAttributeConfig(this.file.dossierTemplateId).fileAttributeConfigs;
|
const configs = this.fileAttributesService.getFileAttributeConfig(this.file.dossierTemplateId).fileAttributeConfigs;
|
||||||
|
this.readonlyAttrs = configs.filter(config => config.editable === false).map(config => config.id);
|
||||||
configs.forEach(config => {
|
configs.forEach(config => {
|
||||||
if (!this.file.fileAttributes.attributeIdToValue[config.id]) {
|
if (!this.file.fileAttributes.attributeIdToValue[config.id]) {
|
||||||
this.file.fileAttributes.attributeIdToValue[config.id] = null;
|
this.file.fileAttributes.attributeIdToValue[config.id] = null;
|
||||||
@ -199,7 +201,12 @@ export class FileAttributeComponent extends BaseFormComponent implements OnDestr
|
|||||||
const fileAttributes = this.file.fileAttributes.attributeIdToValue;
|
const fileAttributes = this.file.fileAttributes.attributeIdToValue;
|
||||||
Object.keys(fileAttributes).forEach(key => {
|
Object.keys(fileAttributes).forEach(key => {
|
||||||
const attrValue = fileAttributes[key];
|
const attrValue = fileAttributes[key];
|
||||||
config[key] = [dayjs(attrValue, 'YYYY-MM-DD', true).isValid() ? dayjs(attrValue).toDate() : attrValue];
|
config[key] = [
|
||||||
|
{
|
||||||
|
value: dayjs(attrValue, 'YYYY-MM-DD', true).isValid() ? dayjs(attrValue).toDate() : attrValue,
|
||||||
|
disabled: this.readonlyAttrs.includes(key),
|
||||||
|
},
|
||||||
|
];
|
||||||
});
|
});
|
||||||
return this._formBuilder.group(config, {
|
return this._formBuilder.group(config, {
|
||||||
validators: [this.#checkEmptyInput(), this.#checkDate()],
|
validators: [this.#checkEmptyInput(), this.#checkDate()],
|
||||||
|
|||||||
@ -32,14 +32,6 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value-content {
|
|
||||||
.value {
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-header {
|
.table-header {
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
border-bottom: 1px solid var(--iqser-separator);
|
border-bottom: 1px solid var(--iqser-separator);
|
||||||
|
|||||||
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
<iqser-dynamic-input
|
<iqser-dynamic-input
|
||||||
*ngFor="let attr of customAttributes"
|
*ngFor="let attr of customAttributes"
|
||||||
[canEditInput]="!disabled"
|
|
||||||
[classList]="'w-full'"
|
[classList]="'w-full'"
|
||||||
[formControlName]="attr.id"
|
[formControlName]="attr.id"
|
||||||
[id]="attr.id"
|
[id]="attr.id"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit df01d0a910fe443a11904b74055495ebc5ffc647
|
Subproject commit bfaae5adf6522a099a55c7f3546dee3b542c4c33
|
||||||
Loading…
x
Reference in New Issue
Block a user