Add specific episode-seen
This commit is contained in:
1 parent
728dae4e59
commit
29d6e3f503
13 files changed
+323
-22
No files matched your search
@@ -204,7 +204,19 @@
|
||||
<h3>Collections</h3>
|
||||
</div> -->
|
||||
<div class="row" *ngIf="this.entry.is_tvseries && this.seenHistory.length != 0">
|
||||
<h3>Watch History</h3>
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h3>Watch History</h3>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-sm btn-filter dropdown-toggle dropdown-toggle-nocaret bg-transparent" type="button"
|
||||
data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="bi bi-three-dots"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu" style="cursor: pointer;">
|
||||
<li (click)="addEpisodeSeen()"><a class="dropdown-item">Add a watch date</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body p-3">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
||||
@@ -19,6 +19,7 @@ import { SeasonService } from '../../../core/services/season.service';
|
||||
import { LibraryService } from '../../../core/services/library.service';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { EntrySeen } from '../../../shared/models/entrySeen.model';
|
||||
import { EpisodeSeenModalComponent } from '../../../shared/components/modals/episode-seen-modal/episode-seen-modal.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-entry-page',
|
||||
@@ -397,6 +398,45 @@ export class EntryPageComponent implements OnInit {
|
||||
this.seenHistoryToShow = temp.slice(startIndex, endIndex);
|
||||
}
|
||||
|
||||
addEpisodeSeen() {
|
||||
if (!this.entry) return;
|
||||
|
||||
const dialogRef = this.dialog.open(EpisodeSeenModalComponent, {
|
||||
width: '360px',
|
||||
data: {
|
||||
entryId: this.entry.id,
|
||||
},
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result) => {
|
||||
// ? if an episode-seen was created then refresh the watch history table
|
||||
if (result && result.created) {
|
||||
// ? call this function to fetch the new episode-seen history
|
||||
this.getEpisodesSeenHistory();
|
||||
|
||||
// ? Updating the episodes seen progress bar in the season card
|
||||
// ? by fetching a new updated episodes list
|
||||
this.entry.seasons.forEach(async (season) => {
|
||||
if (season.season_number == result.season_number) {
|
||||
this.seasonService.getSeasonEpisodes(season.id).subscribe({
|
||||
next: (episodes) => {
|
||||
// console.log(
|
||||
// `Loaded Season ${season.season_number} Episodes (${episodes.length})`
|
||||
// );
|
||||
season.episodes = episodes;
|
||||
},
|
||||
error: (error) => {
|
||||
console.log(`Couldn't fetch season episodes data:`, error);
|
||||
// TODO show notification
|
||||
season.episodes = [];
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
editEpisodeSeen(episodeSeen: EpisodeSeenDto) {
|
||||
if (episodeSeen == null) return;
|
||||
|
||||
@@ -456,11 +496,11 @@ export class EntryPageComponent implements OnInit {
|
||||
this.episodeSeenService.removeEpisodeSeen(episodeSeen.id).subscribe({
|
||||
next: () => {
|
||||
// console.log(`Episode seen deleted.`);
|
||||
// call this function to fetch the new episode-seen history
|
||||
// ? call this function to fetch the new episode-seen history
|
||||
this.getEpisodesSeenHistory();
|
||||
|
||||
// trying to update the episodes seen progress bar in the season card
|
||||
// by fetching a new updated episodes list
|
||||
// ? Updating the episodes seen progress bar in the season card
|
||||
// ? by fetching a new updated episodes list
|
||||
this.entry.seasons.forEach(async (season) => {
|
||||
if (season.season_number == episodeSeen.season_number) {
|
||||
this.seasonService.getSeasonEpisodes(season.id).subscribe({
|
||||
|
||||
Reference in new issue
Block a user