-
-
-
-
-
- @if(record.documentType){
-
- {{ 'document_type_' + record.documentType | translate }}
-
- }
+
+
+
+
+
-
-
- @if(record.masked && record.masked !== 'not_masked') {
-
- }
-
- @if(record.title[0].subtitle) {
- : {{
- record.title[0].subtitle | languageValue | async
- }}
- }
-
-
-
- @if(record.organisation) {
-
- {{ organisation.name }}
-
- }
- @if(record.subdivisions) {
-
- {{ subdivision.name | languageValue | async }}
-
- }
-
-
-
-
-
- @if(record.provisionActivity && record.provisionActivity.length > 0) {
-
- @for(statement of record.provisionActivity; track statement) {
- @if(statement.text && statement.text.default) {
- @for(item of statement.text | keyvalue; track item) {
- -
- {{ item.value }}
-
- }
- } @else {
- - {{ statement.text }}
- }
- }
-
+
+ @if(record.documentType){
+
+ {{ 'document_type_' + record.documentType | translate }}
+
+ }
+
+
+
+ @if(record.masked && record.masked !== 'not_masked') {
+
+ }
+
+ @if(record.title[0].subtitle) { : {{
+ record.title[0].subtitle | languageValue | async
+ }}
}
+
-
- @if(record.extent || record.formats) {
-
- @if(record.extent) {
- {{ record.extent }}
- }
- @if(record.extent && record.formats) { ; }
- @if(record.formats) {
- {{
- record.formats | join : ', '
- }}
- }
-
+
+ @if(record.organisation) {
+
+ {{ organisation.name }}
+
+ } @if(record.subdivisions) {
+
+ {{ subdivision.name | languageValue | async }}
+
}
+
+
+
+
+
+
+ @if(record.provisionActivity && record.provisionActivity.length > 0) {
+
+ @for(statement of record.provisionActivity; track statement) {
+ @if(statement.text && statement.text.default) { @for(item of
+ statement.text | keyvalue; track item) {
+ -
+ {{ item.value }}
+
+ } } @else {
+ - {{ statement.text }}
+ } }
+
+ }
-
- @if(record.editionStatement) {
-
- {{ record.editionStatement.editionDesignation.value }}
- @if(record.editionStatement.responsibility) {
- / {{ record.editionStatement.responsibility.value }}
- }
-
+
+ @if(record.extent || record.formats) {
+
+ @if(record.extent) {
+ {{ record.extent }}
+ } @if(record.extent && record.formats) { ; } @if(record.formats) {
+ {{ record.formats | join : ', ' }}
}
+
+ }
-
- @if(record.dissertation) {
-
- {{ record.dissertation.text }}
-
+
+ @if(record.editionStatement) {
+
+ {{ record.editionStatement.editionDesignation.value }}
+ @if(record.editionStatement.responsibility) { /
+ {{ record.editionStatement.responsibility.value }}
}
+
+ }
+
+ @if(record.dissertation) {
+
+ {{ record.dissertation.text }}
+
+ }
-
- @if (record.partOf && record.partOf.length > 0) {
-
-
-
-
-
-
- @if (filteredFiles.length > 1) {
-
- Other files
-
- @if (tabOther.active) {
-
-
-
+
+
+
+ @for (i of [1, 2, 3]; track i) {
+
}
-
- }
-
- Statistics
-
- @if (tabStats.active) {
+
+
+
+ {{ language.value | translateLanguage }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{
+ 'classification_' + classification.classificationPortion
+ | translate
+ }}
+
+
+
+
+
+
+
+
+ {{ otherEdition.publicNote }}
+
+
+
+
+
+
+
+
+
+ {{ relatedTo.publicNote }}
+
+
+
+
+
+
+
+
+ {{ serie.name }}
+ @if (serie.number) { ; {{ serie.number }}
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ usageAndAccessPolicy.license | translate }}
+ @if(usageAndAccessPolicy.label) {
+
{{ usageAndAccessPolicy.label }}
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ permalink }}
+
+
+
+
+
+
+
+
+
+
+ 1? false: true"
+ id="documents-other-files-tab"
+ [header]="'Other files' | translate"
+ cache="false"
+ >
+
+
+
+
+
+
+
+
+
- }
-
-
- Edit Files
-
- @if (tabEditFiles.active) {
+
+
+
+
+
- }
-
-
+
+
+
}
diff --git a/projects/sonar/src/app/record/document/detail/field-description/field-description.component.html b/projects/sonar/src/app/record/document/detail/field-description/field-description.component.html
new file mode 100644
index 00000000..44b92e78
--- /dev/null
+++ b/projects/sonar/src/app/record/document/detail/field-description/field-description.component.html
@@ -0,0 +1,30 @@
+
+@if (field()) {
+
+
{{ label() }}
+
+ @if(type() === 'array') {
+
+ @for (value of field(); track value; let last=$last; let index=$index) {
+ -
+ @if (template) {
+
+ } @else {
+ {{ value }}
+ }
+
+ }
+
+ }
+ @else {
+ @if (template) {
+
+ } @else {
+ {{ field() }}
+ }
+ }
+
+
+}
diff --git a/projects/sonar/src/app/record/document/document.component.html b/projects/sonar/src/app/record/document/document.component.html
index eb06a5c7..b4c9f2a6 100644
--- a/projects/sonar/src/app/record/document/document.component.html
+++ b/projects/sonar/src/app/record/document/document.component.html
@@ -14,6 +14,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see
.
-->
+
+ @if(files?.length > 0) {
Upload Files
>
+ }
} @else {
diff --git a/projects/sonar/src/app/record/files/upload-files/upload-files.component.ts b/projects/sonar/src/app/record/files/upload-files/upload-files.component.ts
index 730c4237..1e7b689e 100644
--- a/projects/sonar/src/app/record/files/upload-files/upload-files.component.ts
+++ b/projects/sonar/src/app/record/files/upload-files/upload-files.component.ts
@@ -189,14 +189,17 @@ export class UploadFilesComponent {
.pipe(
catchError((e: any) => {
let msg = this.translateService.instant('Server error');
- if (e.error.message) {
+ if (e?.error?.message) {
msg = `${msg}: ${e.error.message}`;
}
this.toastrService.error(msg);
return of([]);
}),
+ switchMap(() => this.getRecord()),
+ switchMap(() => {
+ return this._reorder();
+ }),
tap(() => {
- this.getRecord();
this.resetFilter();
this.fileUpload.clear();
this.toastrService.success(
@@ -232,10 +235,10 @@ export class UploadFilesComponent {
this.toastrService.error(msg);
return of(null);
}),
- map((file: any) => {
+ switchMap((file: any) =>
// update the record and the files
- this.getRecord();
- }),
+ this.getRecord()
+ ),
tap(() => {
this.filesChanged.emit(this.files);
this.resetFilter();
@@ -251,15 +254,14 @@ export class UploadFilesComponent {
* Get the record and the files from the backend.
*/
getRecord() {
- this.fileService
+ return this.fileService
.get(`/api/${this.recordType()}/${this.pid()}`)
.pipe(
map((rec: any) => (rec = rec.metadata)),
tap((record) => (this.record = record)),
switchMap((record) => this.getFiles(record)),
tap((files) => (this.files = files))
- )
- .subscribe();
+ );
}
/**
@@ -279,7 +281,7 @@ export class UploadFilesComponent {
map((file: any) => {
this.nUploadedFiles += 1;
this.files = this.processFiles([
- { label: file.key, ...file },
+ { label: file.key, metadata:{order: this.files.length + 1}, ...file },
...this.files,
]);
}),
@@ -352,14 +354,19 @@ export class UploadFilesComponent {
`/api/${this.recordType()}/${this.pid()}/files/${file.key}`
)
.pipe(
- map((res) => {
+ tap(() => {
this.files = this.files.filter((f) => f.key !== file.key);
+ this.record._files = this.record._files.filter(
+ (item: any) => file.key !== item.key
+ );
+ }),
+ switchMap(() => this._reorder()),
+ tap(() => {
this.resetFilter();
this.toastrService.success(
this.translateService.instant('File removed successfully.')
);
this.filesChanged.emit(this.files);
- return true;
})
);
}
@@ -452,19 +459,28 @@ export class UploadFilesComponent {
* Reorder the files.
*/
reorder() {
+
+ this._reorder().subscribe((record: any) => {
+ this.filesChanged.emit(this.files);
+ });
+ }
+
+ _reorder() {
this.files.map((file, index) => {
let recordFile = this._getFileInRecord(file.key);
recordFile.order = index + 1;
});
- this.fileService
+ return this.fileService
.put(`/api/${this.recordType()}/${this.pid()}`, this.record)
- .subscribe((record: any) => {
+ .pipe(
+ tap((record: any) => {
this.record = record.metadata;
this.files.map((file) => {
file.metadata = this._getFileInRecord(file.key);
});
- this.filesChanged.emit(this.files);
- });
+
+ })
+ );
}
/**
diff --git a/projects/sonar/src/app/record/organisation/detail/detail.component.ts b/projects/sonar/src/app/record/organisation/detail/detail.component.ts
index 8a89f78c..ae40acbc 100644
--- a/projects/sonar/src/app/record/organisation/detail/detail.component.ts
+++ b/projects/sonar/src/app/record/organisation/detail/detail.component.ts
@@ -71,10 +71,4 @@ export class DetailComponent implements OnInit {
this.collections = result[1].hits.hits;
});
}
-
- updateFiles(files) {
- this.recordService.getRecord('organisations', this.record.id, 1).pipe(
- map(doc => this.record._files = doc.metadata._files)
- ).subscribe();
- }
}
diff --git a/projects/sonar/src/styles.scss b/projects/sonar/src/styles.scss
index f7b53583..bf1cf9c2 100644
--- a/projects/sonar/src/styles.scss
+++ b/projects/sonar/src/styles.scss
@@ -25,6 +25,7 @@ $secondary: rgb(246, 130, 17) !default;
@import url('https://fonts.googleapis.com/css?family=Roboto:300,700|Roboto+Condensed:300,700');
@import 'font-awesome/scss/font-awesome';
+
@layer bootstrap {
@import 'bootstrap/scss/bootstrap';
@import 'ngx-toastr/toastr-bs4-alert';
@@ -32,6 +33,9 @@ $secondary: rgb(246, 130, 17) !default;
// TODO: remove `node_modules` when this will be fixed in ngx-bootstrap
@import 'easymde/dist/easymde.min';
body,
+ .invalid-feedback {
+ display: block !important;
+ }
html {
line-height: normal;
font-size: 0.9rem;
@@ -105,7 +109,7 @@ $secondary: rgb(246, 130, 17) !default;
}
}
-@import 'primeng/resources/themes/bootstrap4-light-blue/theme';
+@import 'primeng/resources/themes/lara-light-blue/theme';
@import 'primeng/resources/primeng';
@layer primengother {
@import 'primeicons/primeicons';
@@ -117,3 +121,7 @@ $secondary: rgb(246, 130, 17) !default;
font-size: 0.9rem;
}
}
+@layer ng-core {
+ @import 'node_modules/@rero/ng-core/assets/scss/ng-core';
+}
+
diff --git a/tsconfig.json b/tsconfig.json
index 91de5f9c..3de016a6 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -7,7 +7,7 @@
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
- "module": "es2020",
+ "module": "es2022",
"moduleResolution": "node",
"importHelpers": true,
"target": "ES2022",