changed style and used flatpickr calendar
This commit is contained in:
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"
|
||||
aria-hidden="true"> -->
|
||||
<div class="mod-container">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="watchModalLabel">Watch Details</h5>
|
||||
<button type="button" class="btn-close" (click)="onClose()" aria-label="Close">
|
||||
</button>
|
||||
<div class="card border-top border-3 border-primary rounded-0" style="margin-bottom: 0 !important;">
|
||||
<div class="modal-header card-header py-3 px-4" >
|
||||
<h5 class="mb-0 text-primary">Watch Details</h5>
|
||||
<button type="button" class="btn-close" (click)="onClose()" aria-label="Close"></button>
|
||||
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="watch-date">Watch Date</label>
|
||||
<input tabindex0 type="date" class="form-control" name="watch-date" [(ngModel)]="watchDate">
|
||||
<div class="card-body p-4">
|
||||
<form class="row g-3">
|
||||
<div class="col-md-12">
|
||||
<label class="form-label">Seen With</label>
|
||||
<textarea class="form-control rounded-0" [(ngModel)]="watchedWith" [ngModelOptions]="{ standalone: true }" placeholder="Enter names" rows="3"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<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 class="form-group">
|
||||
<label for="watched-with">Watched With</label>
|
||||
<input type="text" class="form-control" name="watched-with" [(ngModel)]="watchedWith" placeholder="Enter names">
|
||||
</div>
|
||||
</form>
|
||||
</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> -->
|
||||
@@ -1,10 +1,5 @@
|
||||
import { Component, Inject, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
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 {
|
||||
trigger,
|
||||
@@ -14,6 +9,7 @@ import {
|
||||
animate,
|
||||
} from '@angular/animations';
|
||||
import { formatDate } from '@angular/common';
|
||||
import flatpickr from 'flatpickr';
|
||||
|
||||
@Component({
|
||||
selector: 'app-seen-modal',
|
||||
@@ -48,13 +44,24 @@ export class SeenModalComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.data == null) {
|
||||
this.watchDate = formatDate(new Date(), 'yyyy-MM-dd', 'en-US');
|
||||
return; // ? no initial data was passed
|
||||
}
|
||||
this.watchDate = this.data.watchDate.toString().substring(0, 10);
|
||||
// ? no initial data was passed: populate date field with current date
|
||||
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');
|
||||
}
|
||||
|
||||
flatpickr('#myDatepicker', {
|
||||
inline: true,
|
||||
defaultDate: this.watchDate,
|
||||
altInput: true,
|
||||
allowInput: false,
|
||||
altFormat: 'F j, Y',
|
||||
dateFormat: 'Y-m-d',
|
||||
});
|
||||
}
|
||||
|
||||
onConfirm(): void {
|
||||
this.dialogRef.close({
|
||||
watchDate: this.watchDate,
|
||||
|
||||
Reference in new issue
Block a user