changed style and used flatpickr calendar

This commit is contained in:
X4Lo committed 2024-04-28 00:22:16 +01:00
1 parent 1425f0e425
commit e03e887f76
3 files changed
+38 -62

No files matched your search

@@ -1,32 +0,0 @@
.mod-container {
padding: 20px;
background-color: var(--bs-body-bg) !important;
border-right: 1px solid var(--bs-border-color);
}
.mod-container .form-group,
.mod-container .form-group input{
margin-top: 5px;
}
.mod-container {
display: flex;
flex-direction: column;
height: 100%; /* Adjust this to match the modal container's height */
}
.modal-body {
flex: 1 0 auto; /* This will make the body expand to fill the available space */
}
.modal-footer {
margin-top: 10px;
flex-shrink: 0; /* This ensures the footer does not shrink */
}
.modal-footer button{
margin-left: 5px;
color: var(--bs-border-color);
}
@@ -1,26 +1,27 @@
<!-- <div class="modal fade" id="watchModal" tabindex="-1" role="dialog" aria-labelledby="watchModalLabel" <div class="card border-top border-3 border-primary rounded-0" style="margin-bottom: 0 !important;">
aria-hidden="true"> --> <div class="modal-header card-header py-3 px-4" >
<div class="mod-container"> <h5 class="mb-0 text-primary">Watch Details</h5>
<div class="modal-header"> <button type="button" class="btn-close" (click)="onClose()" aria-label="Close"></button>
<h5 class="modal-title" id="watchModalLabel">Watch Details</h5>
<button type="button" class="btn-close" (click)="onClose()" aria-label="Close">
</button>
</div> </div>
<div class="modal-body"> <div class="card-body p-4">
<form> <form class="row g-3">
<div class="form-group"> <div class="col-md-12">
<label for="watch-date">Watch Date</label> <label class="form-label">Seen With</label>
<input tabindex0 type="date" class="form-control" name="watch-date" [(ngModel)]="watchDate"> <textarea class="form-control rounded-0" [(ngModel)]="watchedWith" [ngModelOptions]="{ standalone: true }" placeholder="Enter names" rows="3"></textarea>
</div> </div>
<div class="form-group">
<label for="watched-with">Watched With</label> <div class="col-md-12">
<input type="text" class="form-control" name="watched-with" [(ngModel)]="watchedWith" placeholder="Enter names"> <label class="form-label">Date Watched</label>
<input type="text" class="form-control rounded-0" name="watch-date" [(ngModel)]="watchDate" id="myDatepicker">
</div>
<div class="col-md-12">
<div class="d-md-flex d-grid align-items-center gap-3">
<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>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="onClose()">Cancel</button>
<button type="button" class="btn btn-primary" (click)="onConfirm()">OK</button>
</div>
</div> </div>
<!-- </div> -->
@@ -1,10 +1,5 @@
import { Component, Inject, Input, OnInit, ViewChild } from '@angular/core'; import { Component, Inject, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { UserCollectionService } from '../../../../core/services/userCollection.service';
import { NotificationPopupComponent } from '../../notification-popup/notification-popup.component';
import { NotificationService } from '../../../services/notification.service';
import { UserCollection } from '../../../models/userCollection.model';
import { import {
trigger, trigger,
@@ -14,6 +9,7 @@ import {
animate, animate,
} from '@angular/animations'; } from '@angular/animations';
import { formatDate } from '@angular/common'; import { formatDate } from '@angular/common';
import flatpickr from 'flatpickr';
@Component({ @Component({
selector: 'app-seen-modal', selector: 'app-seen-modal',
@@ -48,11 +44,22 @@ export class SeenModalComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
if (this.data == null) { if (this.data == null) {
this.watchDate = formatDate(new Date(), 'yyyy-MM-dd', 'en-US'); // ? no initial data was passed: populate date field with current date
return; // ? no initial data was passed this.watchDate = formatDate(new Date(), 'MMM dd, yyyy', 'en-US');
} else {
// ? if data is passed, populate fields
this.watchDate = this.data.watchDate.dateFormat('yyyy-MM-dd');
this.watchedWith = this.data.watchedWith.split(', ').join('\n');
} }
this.watchDate = this.data.watchDate.toString().substring(0, 10);
this.watchedWith = this.data.watchedWith.split(', ').join('\n'); flatpickr('#myDatepicker', {
inline: true,
defaultDate: this.watchDate,
altInput: true,
allowInput: false,
altFormat: 'F j, Y',
dateFormat: 'Y-m-d',
});
} }
onConfirm(): void { onConfirm(): void {