14
14
You should have received a copy of the GNU Affero General Public License
15
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
-->
17
- < div class ="card my-4 ">
17
+ < div class ="my-4 " [ngClass] ="{ card: title } ">
18
+ @if (title) {
18
19
< div class ="card-header ">
19
- < h5 class ="m-0 " translate > Files </ h5 >
20
+ < h5 class ="m-0 d-inline-block " translate > {{ title }} </ h5 >
20
21
</ div >
21
- @if (!hasError && files.length) {
22
- < ul class ="list-group list-group-flush ">
23
- @for (file of files; track file) {
24
- @if (showItem(file)) {
25
- < li class ="list-group-item ">
26
- < ng-core-record-file
27
- [type] =type
28
- [record] =record
29
- [file] =file
30
- [hasChildren] =hasChildren(file)
31
- [infoExcludedFields] =infoExcludedFields
32
- (deleteFile) =deleteFile(file)
33
- (editMetadataFile) =editMetadataFile(file)
34
- (manageFile) =manageFile(file)
35
- > </ ng-core-record-file >
36
- </ li >
37
- }
38
- }
39
- </ ul >
40
22
}
41
-
42
- @if (hasError || files.length === 0) {
43
- < div class ="card-body ">
44
- @if (!hasError && files.length === 0) {
45
- < div class ="alert alert-info m-0 " translate >
46
- No file found for this record.
47
- </ div >
48
- }
49
- @if (hasError) {
50
- < div class ="alert alert-danger m-0 " translate > An error occurred, files cannot be loaded.</ div >
51
- }
52
- </ div >
53
- }
54
- @if (canAdd.can) {
55
- < div class ="card-footer text-center ">
56
- < button class ="btn btn-sm btn-primary " (click) ="manageFile(null) ">
57
- < i class ="fa fa-plus mr-1 "> </ i > {{ 'Add a new file' | translate }}
58
- </ button >
23
+ < div [ngClass] ="{ 'card-body': title } ">
24
+ @if (canAdd.can) {
25
+ < div class ="row ">
26
+ < div class ="col ">
27
+ < button class ="pull-right btn btn-sm btn-primary " (click) ="manageFile(null) ">
28
+ < i class ="fa fa-plus mr-1 "> </ i > {{ 'Add a new file' | translate }}
29
+ </ button >
30
+ </ div >
59
31
</ div >
60
- }
32
+ < hr />
33
+ } @if (!hasError && files.length) {
34
+ < ul class ="list-group list-group-flush ">
35
+ @for (file of files; track file) { @if (showItem(file)) {
36
+ < li class ="list-group-item ">
37
+ < ng-core-record-file
38
+ [type] ="type "
39
+ [record] ="parentRecord "
40
+ [file] ="file "
41
+ [hasChildren] ="hasChildren(file) "
42
+ [infoExcludedFields] ="infoExcludedFields "
43
+ (deleteFile) ="deleteFile(file) "
44
+ (editMetadataFile) ="editMetadataFile(file) "
45
+ (manageFile) ="manageFile(file) "
46
+ > </ ng-core-record-file >
47
+ </ li >
48
+ } }
49
+ </ ul >
50
+ } @if (hasError) {
51
+ < div class ="alert alert-danger m-0 " translate > An error occurred, files cannot be loaded.</ div >
52
+ }
53
+ </ div >
61
54
</ div >
62
55
63
56
< ng-template #formModal >
@@ -72,43 +65,43 @@ <h4 class="modal-title pull-left">{{ currentFile ? currentFile.key : ('Add a new
72
65
< input #file type ="file " id ="file " (change) ="handleFileInput($event.target.files) " />
73
66
</ div >
74
67
@if (!currentFile && filesToUpload) {
75
- < div class ="form-group ">
76
- < label for ="file-key " translate > File name</ label >
77
- < input type ="text " id ="file-key " class ="form-control " [(ngModel)] ="fileKey " />
78
- </ div >
68
+ < div class ="form-group ">
69
+ < label for ="file-key " translate > File name</ label >
70
+ < input type ="text " id ="file-key " class ="form-control " [(ngModel)] ="fileKey " />
71
+ </ div >
79
72
}
80
73
< div >
81
74
@if (filesToUpload && filesToUpload.length > 0) {
82
- < button class ="btn btn-sm btn-outline-primary mr-1 " (click) ="upload() ">
83
- < i class ="fa fa-upload mr-1 "> </ i > {{ 'Upload' | translate }}
84
- </ button >
85
- < button class ="btn btn-sm btn-outline-danger " (click) ="resetForm(); hideForm() ">
86
- < i class ="fa fa-times mr-1 "> </ i > {{ 'Cancel' | translate }}
87
- </ button >
75
+ < button class ="btn btn-sm btn-outline-primary mr-1 " (click) ="upload() ">
76
+ < i class ="fa fa-upload mr-1 "> </ i > {{ 'Upload' | translate }}
77
+ </ button >
78
+ < button class ="btn btn-sm btn-outline-danger " (click) ="resetForm(); hideForm() ">
79
+ < i class ="fa fa-times mr-1 "> </ i > {{ 'Cancel' | translate }}
80
+ </ button >
88
81
}
89
82
</ div >
90
83
</ div >
91
84
</ ng-template >
92
85
93
86
< ng-template #metadataFormModal >
94
87
@if (metadataForm.model) {
95
- < div class ="modal-header ">
96
- < h4 class ="modal-title pull-left "> {{ metadataForm.model.key }}</ h4 >
97
- < button type ="button " class ="close pull-right " aria-label ="Close " (click) ="hideForm() ">
98
- < span aria-hidden ="true "> ×</ span >
99
- </ button >
100
- </ div >
101
- < div class ="modal-body ">
102
- < form [formGroup] ="metadataForm.form " (ngSubmit) ="saveMetadata() ">
103
- < formly-form [form] ="metadataForm.form " [model] ="metadataForm.model " [fields] ="metadataForm.fields ">
104
- </ formly-form >
105
- < div class ="text-center ">
106
- < button type ="submit " class ="btn btn-primary btn-block ">
107
- < i class ="fa fa-floppy-o mr-2 "> </ i >
108
- {{ 'Save' | translate }}
109
- </ button >
110
- </ div >
111
- </ form >
112
- </ div >
88
+ < div class ="modal-header ">
89
+ < h4 class ="modal-title pull-left "> {{ metadataForm.model.key }}</ h4 >
90
+ < button type ="button " class ="close pull-right " aria-label ="Close " (click) ="hideForm() ">
91
+ < span aria-hidden ="true "> ×</ span >
92
+ </ button >
93
+ </ div >
94
+ < div class ="modal-body ">
95
+ < form [formGroup] ="metadataForm.form " (ngSubmit) ="saveMetadata() ">
96
+ < formly-form [form] ="metadataForm.form " [model] ="metadataForm.model " [fields] ="metadataForm.fields ">
97
+ </ formly-form >
98
+ < div class ="text-center ">
99
+ < button type ="submit " class ="btn btn-primary btn-block ">
100
+ < i class ="fa fa-floppy-o mr-2 "> </ i >
101
+ {{ 'Save' | translate }}
102
+ </ button >
103
+ </ div >
104
+ </ form >
105
+ </ div >
113
106
}
114
107
</ ng-template >
0 commit comments