Front: updated collection edit modal UI
This commit is contained in:
1 parent
625ec3367e
commit
302f2830ff
2 files changed
+66
-50
No files matched your search
+62
-42
@@ -1,55 +1,75 @@
|
||||
<div class="card border-top border-3 border-primary rounded-0" style="margin-bottom: 0 !important;">
|
||||
<div class="card border-top border-3 border-primary rounded-0 h-100" style="margin-bottom: 0 !important;">
|
||||
<div class="modal-header card-header py-3 px-4">
|
||||
<h5 class="mb-0 text-primary">Modify Collection Details</h5>
|
||||
<button type="button" class="btn-close" (click)="onClose()" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="card-body p-4 pt-1">
|
||||
<form class="row g-3" [formGroup]="form" >
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Name</label>
|
||||
<input type="text" class="form-control rounded-0" formControlName="name">
|
||||
<div *ngIf="form.get('name')?.invalid && form.get('name')?.touched" class="error-message">
|
||||
Collection name is required
|
||||
<div class="card-body p-4 pt-1 pb-3 d-flex flex-column" style="background-color: inherit;">
|
||||
<form class="row g-3 h-100" [formGroup]="form">
|
||||
<!-- Left Column -->
|
||||
<div class="col-md-6">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Name</label>
|
||||
<input type="text" class="form-control rounded-0" formControlName="name">
|
||||
<div *ngIf="form.get('name')?.invalid && form.get('name')?.touched" class="error-message">
|
||||
Collection name is required
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Description</label>
|
||||
<textarea class="form-control rounded-0" formControlName="description" placeholder="Enter a description..."
|
||||
rows="10"></textarea>
|
||||
<div *ngIf="form.get('description')?.invalid && form.get('description')?.touched" class="error-message">
|
||||
Description is required
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Rating</label>
|
||||
<div class="d-flex justify-content-center rating m-0">
|
||||
<rating formControlName="userRating" [max]="10" [readonly]="false"></rating>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Description</label>
|
||||
<textarea class="form-control rounded-0" formControlName="description" placeholder="Enter a description..."
|
||||
rows="3"></textarea>
|
||||
<div *ngIf="form.get('description')?.invalid && form.get('description')?.touched" class="error-message">
|
||||
Description is required
|
||||
<!-- Right Column -->
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Poster</label>
|
||||
<!-- <a (click)="posterInput.click()">Choose an image</a> -->
|
||||
<input #posterInput type="file" class="form-control d-none" id="poster"
|
||||
(change)="onFileChange($event, 'poster')" multiple>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<img [src]="getCollectionPoster()" (click)="posterInput.click()" *ngIf="posterPreview == ''"
|
||||
style="max-height: 250px !important;" alt="Banner" class="img-fluid img-thumbnail banner-img">
|
||||
<img [src]="posterPreview" (click)="posterInput.click()" *ngIf="posterPreview != ''"
|
||||
style="max-height: 250px !important;" alt="Banner" class="img-fluid img-thumbnail banner-img">
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Backdrop</label>
|
||||
<!-- <a (click)="backdropInput.click()">Choose an image</a> -->
|
||||
<input #backdropInput type="file" class="form-control d-none" id="backdrop"
|
||||
(change)="onFileChange($event, 'backdrop')">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<img [src]="getCollectionPoster()" (click)="backdropInput.click()" *ngIf="backdropPreview == ''"
|
||||
style="max-height: 250px !important;" alt="Banner" class="img-fluid img-thumbnail banner-img">
|
||||
<img [src]="backdropPreview" (click)="backdropInput.click()" *ngIf="backdropPreview != ''"
|
||||
style="max-height: 250px !important;" alt="Banner" class="img-fluid img-thumbnail banner-img">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Rating</label>
|
||||
<div class="d-flex justify-content-center rating m-0">
|
||||
<rating formControlName="userRating" [max]="10" [readonly]="false">
|
||||
</rating>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Poster</label>
|
||||
<input type="file" class="form-control" id="image" (change)="onFileChange($event, 'poster')" multiple>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Backdrop</label>
|
||||
<input type="file" class="form-control" id="image" (change)="onFileChange($event, 'backdrop')">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<img [src]="getCollectionPoster()" *ngIf="posterPreview == ''" style="max-height: 250px !important;"
|
||||
alt="Banner" class="img-fluid img-thumbnail banner-img" >
|
||||
<img [src]="posterPreview" *ngIf="posterPreview != ''" style="max-height: 250px !important;" alt="Banner"
|
||||
class="img-fluid img-thumbnail banner-img">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="d-md-flex d-grid align-items-center gap-3">
|
||||
<!-- Button Section at the Bottom -->
|
||||
<div class="col-md-12 mt-auto">
|
||||
<div class="d-md-flex d-grid align-items-center gap-3 justify-content-end">
|
||||
<button type="button" class="btn btn-primary px-4 rounded-0" (click)="onConfirm()">OK</button>
|
||||
<button type="button" class="btn btn-secondary px-4 rounded-0" (click)="onClose()">Cancel</button>
|
||||
</div>
|
||||
|
||||
+4
-8
@@ -1,4 +1,4 @@
|
||||
import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
@@ -56,6 +56,9 @@ export class CollectionEditModalComponent implements OnInit {
|
||||
poster: [null],
|
||||
backdrop: [null],
|
||||
});
|
||||
|
||||
this.posterPreview = this.data.poster;
|
||||
this.backdropPreview = this.data.backdrop;
|
||||
}
|
||||
|
||||
onFileChange(event: Event, type: string) {
|
||||
@@ -75,7 +78,6 @@ export class CollectionEditModalComponent implements OnInit {
|
||||
// this.form.get('backdrop')?.updateValueAndValidity();
|
||||
this.backdropPreview = reader.result;
|
||||
}
|
||||
console.log(this.form);
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
@@ -98,12 +100,6 @@ export class CollectionEditModalComponent implements OnInit {
|
||||
this.form.get('userRating')?.value?.toString() || '0'
|
||||
);
|
||||
|
||||
// Check and append file if it exists
|
||||
// const posterFile = this.form.get('poster')?.value;
|
||||
// if (posterFile) {
|
||||
// formData.append('poster', posterFile);
|
||||
// }
|
||||
|
||||
this.dialogRef.close({ formData: formData });
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user