Skip to content

Commit

Permalink
TaskEasy : Fix the issue more card is not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
thakurprabhat committed May 30, 2023
1 parent 73a7119 commit ad7cbc5
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 57 deletions.
2 changes: 1 addition & 1 deletion src/app/component/dashboard/state/project.selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const getAllPendingTasks = createSelector(getProjectsState, (state) => {
}
let updatedtasks = project.tasks?.filter(
(data) =>
data.task_status == 'unsheduled' || data.task_status == 'pending'
data.task_status == 'unschedule' || data.task_status == 'pending'
);
updatedtasks = updatedtasks?.map((data) => {
return { ...data, theme_colour };
Expand Down
11 changes: 3 additions & 8 deletions src/app/component/task/home/home.component.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<!-- [dataSource]="data | async" -->
<ejs-kanban
class="ejs-element"
height="100%"
weight="95%"
#kanbanObj
keyField="task_status"
[sortSettings]="sortSettings"
[dataSource]="data"
[cardSettings]="cardSettings"
(dataStateChange)="dataStateChange($event)"
(dataSourceChanged)="dataSourceChanged($event)"
(dialogOpen)="dialogOpen($event)"
(dialogClose)="dialogClose($event)"
>
<e-columns>
<e-column
headerText="Unscheduled"
keyField="unsheduled"
keyField="unschedule"
allowToggle="true"
showAddButton="true"
allowDrag="false"
>
</e-column>
<e-column
Expand Down
34 changes: 5 additions & 29 deletions src/app/component/task/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,7 @@ export class HomeComponent implements OnInit {
'Pick up groceries',
];
done = ['Get up', 'Brush teeth'];

pending!: any;
active!: any;
today!: any;
todaycompleted!: any;
scheduled!: any;
unsheduled!: any;
displayBasic!: boolean;
displayCategory!: boolean;

knobvalue: number = 50;
value2!: string;

temp!: Observable<Task[]>;
pid!: any;
Expand All @@ -70,13 +59,13 @@ export class HomeComponent implements OnInit {
private subscription: Subscription;
private getTaskSubscription: Subscription;
private titleSubscription: Subscription;

constructor(
private store: Store<AppState>,
private service: TasksCardService,
private route: ActivatedRoute,
private titleService: Title
) {

this.data = this.service;
this.badgeData = [
{ code: 'low', badge: 'Low' },
Expand All @@ -95,7 +84,7 @@ export class HomeComponent implements OnInit {
title: '',
scheduled_date: '',
description: '',
badge:'low',
badge: 'low',
subtasklist: this.subTask,
...state.addedRecords[0],
};
Expand All @@ -117,19 +106,6 @@ export class HomeComponent implements OnInit {
};
this.subTask = [];
}
// if (this.selectedStatus != undefined) {
// state.changedRecords[0] = {
// ...state.changedRecords[0],
// task_status: this.selectedStatus,
// };
// }

// if (this.selectedCategory != undefined) {
// state.changedRecords[0] = {
// ...state.changedRecords[0],
// badge: this.selectedCategory,
// };
// }

//if all suntask completed
const subtasklistcopy = state.changedRecords[0]['subtasklist'];
Expand Down Expand Up @@ -233,17 +209,16 @@ export class HomeComponent implements OnInit {

this.pid = this.route.snapshot.paramMap.get('id');
this.service.activateRouter$.next(this.pid);

// this.store.dispatch(loadAllData({ pid: this.pid }));
// this.service.execute(state);
this.subscription = this.store
.pipe(select(isTaskLoaded))
.subscribe((isTaskLoaded) => {
// console.log(isTaskLoaded);
if (!isTaskLoaded) {
this.store.dispatch(loadAllData({ pid: this.pid }));
} else {
// it will reset task state if project is diffrent
this.store.dispatch(resetTasks({ projectId: this.pid }));

this.getTaskSubscription = this.store
.select(getTasks)
.pipe(
Expand All @@ -256,6 +231,7 @@ export class HomeComponent implements OnInit {
)
.subscribe((data) => {
this.data = data;
// this.service.execute(state);
this.titleSubscription = this.store
.select(getSelectdProjectDetails)
.pipe()
Expand Down
2 changes: 1 addition & 1 deletion src/app/component/task/state/task.selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const getPendingTasks = createSelector(getTasksState, (data) => {

// tasks.forEach((data)=> console.log(date1 > formatDate(data.scheduled_date!,'yyyy-MM-dd','en_US')));
let result = tasks.filter(
(data) => data.task_status == 'pending' || data.task_status == 'unsheduled'
(data) => data.task_status == 'pending' || data.task_status == 'unschedule'
);

result = result.map((data) => {
Expand Down
4 changes: 2 additions & 2 deletions src/app/component/task/task-card/task-card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@
</span>
<ng-template #elseBlock1>
<span
*ngIf="data.task_status == 'unsheduled'"
*ngIf="data.task_status == 'unschedule'"
style="font-size: 1rem"
>
<i
class="pi pi-tag pi-tag"
style="font-size: 1rem; color: greenyellow; font-weight: bolder"
></i>
<b> Unsheduled </b>
<b> unschedule </b>
</span>

<span *ngIf="data.task_status == 'pending'" style="font-size: 1rem">
Expand Down
22 changes: 8 additions & 14 deletions src/app/component/task/task-dialog/task-dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ export class TaskDialogComponent implements OnInit, OnChanges {
{ task_status: 'Active', code: 'active' },
{ task_status: 'Pending', code: 'pending' },
{ task_status: 'Done', code: 'done' },
{ task_status: 'Unsheduled', code: 'unsheduled' },
{ task_status: 'unschedule', code: 'unschedule' },
];
if (!this.data?.task_status) {
this.status = [
{ task_status: 'Active', code: 'active' },
{ task_status: 'Pending', code: 'pending' },
{ task_status: 'Done', code: 'done' },
{ task_status: 'Unsheduled', code: 'unsheduled' },
{ task_status: 'unschedule', code: 'unschedule' },
];
}
this.data['subtasklist'] = this.data?.subtasklist?.length
Expand Down Expand Up @@ -127,18 +127,12 @@ export class TaskDialogComponent implements OnInit, OnChanges {
// add a new Task by calling addTask action
addNewTask() {
// if badge and staus not provided set default values as (low and unseduled)
if (
this.data.badge != null ||
this.data.badge != '' ||
this.data.badge != undefined
)
this.data.badge = 'low';
if (
this.data.task_status != null ||
this.data.task_status != '' ||
this.data.task_status != undefined
)
this.data.task_status = 'unsheduled';
if (typeof this.data.badge == 'undefined' && this.data.badge) {
this.data.badge = 'low';
}
if (typeof this.data.task_status == 'undefined' && this.data.task_status) {
this.data.task_status = 'unschedule';
}

const task = this.data;
const pid = this.config?.data?.pid;
Expand Down
31 changes: 29 additions & 2 deletions src/app/service/task/taskcard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,46 @@ export class TasksCardService extends Subject<DataStateChangeEventArgs> {
protected getData(
state: DataStateChangeEventArgs
): Observable<DataStateChangeEventArgs> {
// return this.http
// .get<TaskState>(`${'https://api-taskeasy.onrender.com/v1/tasks'}/${'6474f491a8010e120223428f'}`, {
// headers: this.reqHeader,
// })
// .pipe(map((response: any) => {
// console.log("response",response.tasks);
// return (<any>{
// result: response.tasks
// })
// }
// ))
// .pipe((data: any) => data);
return this.store
.select(getTasks)
.pipe(
map(
(response: Task[]) =>
<any>{
(response: Task[]) => {
console.log("response",response)
return <any>{
result: response,
}

}
)
)
.pipe((data: any) => {
return data;
});
// return this.http
// // .get(`${'https://ej2services.syncfusion.com/production/web-services/api/Kanban'}`)
// .get<TaskState>(`${'https://api-taskeasy.onrender.com/v1/tasks'}/${this.activeRouterId}`, {
// headers: this.reqHeader,
// })
// .pipe(map((response: any) => {
// console.log("response",response);
// return (<any>{
// result: response.tasks
// })
// }))
// .pipe((data: any) => data);
}

public execute(state: any): void {
Expand Down

0 comments on commit ad7cbc5

Please sign in to comment.