-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added quest achievements module, added achievements link, fix mission…
… icon, tested
- Loading branch information
1 parent
85a926b
commit 2057127
Showing
12 changed files
with
246 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/app/modules/questachievement/formcomponents/questachievement.formcomponents.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export const questachievementFormComponents = { | ||
formId: 'questachievement', | ||
title: 'Questachievement', | ||
components: [ | ||
{ | ||
name: 'Text', | ||
key: 'name', | ||
focused: true, | ||
fields: [ | ||
{ | ||
name: 'Placeholder', | ||
value: 'fill questachievement title', | ||
}, | ||
{ | ||
name: 'Label', | ||
value: 'Title', | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'Text', | ||
key: 'description', | ||
fields: [ | ||
{ | ||
name: 'Placeholder', | ||
value: 'fill questachievement description', | ||
}, | ||
{ | ||
name: 'Label', | ||
value: 'Description', | ||
} | ||
] | ||
} | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
src/app/modules/questachievement/interfaces/questachievement.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { CrudDocument } from 'wacom'; | ||
|
||
export interface Questachievement extends CrudDocument { | ||
name: string; | ||
description: string; | ||
} |
6 changes: 6 additions & 0 deletions
6
src/app/modules/questachievement/pages/achievements/achievements.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<wtable | ||
title="Achievements" | ||
[columns]="columns" | ||
[config]="config" | ||
[rows]="rows" | ||
></wtable> |
Empty file.
76 changes: 76 additions & 0 deletions
76
src/app/modules/questachievement/pages/achievements/achievements.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { Component } from '@angular/core'; | ||
import { AlertService, CoreService } from 'wacom'; | ||
import { QuestachievementService } from '../../services/questachievement.service'; | ||
import { Questachievement } from '../../interfaces/questachievement.interface'; | ||
import { FormService } from 'src/app/core/modules/form/form.service'; | ||
import { TranslateService } from 'src/app/core/modules/translate/translate.service'; | ||
import { FormInterface } from 'src/app/core/modules/form/interfaces/form.interface'; | ||
import { questachievementFormComponents } from '../../formcomponents/questachievement.formcomponents'; | ||
|
||
@Component({ | ||
templateUrl: './achievements.component.html', | ||
styleUrls: ['./achievements.component.scss'] | ||
}) | ||
export class AchievementsComponent { | ||
columns = ['name', 'description']; | ||
|
||
form: FormInterface = this._form.getForm('questachievement', questachievementFormComponents); | ||
|
||
config = { | ||
create: (): void => { | ||
this._form.modal<Questachievement>(this.form, { | ||
label: 'Create', | ||
click: (created: unknown, close: () => void) => { | ||
this._questachievementService.create(created as Questachievement); | ||
|
||
close(); | ||
} | ||
}); | ||
}, | ||
update: (doc: Questachievement): void => { | ||
this._form.modal<Questachievement>(this.form, [], doc).then((updated: Questachievement) => { | ||
this._core.copy(updated, doc); | ||
|
||
this._questachievementService.update(doc); | ||
}); | ||
}, | ||
delete: (doc: Questachievement): void => { | ||
this._alert.question({ | ||
text: this._translate.translate( | ||
'Common.Are you sure you want to delete this questachievement?' | ||
), | ||
buttons: [ | ||
{ | ||
text: this._translate.translate('Common.No') | ||
}, | ||
{ | ||
text: this._translate.translate('Common.Yes'), | ||
callback: (): void => { | ||
this._questachievementService.delete(doc); | ||
} | ||
} | ||
] | ||
}); | ||
}, | ||
buttons: [ | ||
{ | ||
icon: 'cloud_download', | ||
click: (doc: Questachievement): void => { | ||
this._form.modalUnique<Questachievement>('questachievement', 'url', doc); | ||
} | ||
} | ||
] | ||
}; | ||
|
||
get rows(): Questachievement[] { | ||
return this._questachievementService.questachievements; | ||
} | ||
|
||
constructor( | ||
private _translate: TranslateService, | ||
private _questachievementService: QuestachievementService, | ||
private _alert: AlertService, | ||
private _form: FormService, | ||
private _core: CoreService | ||
) {} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/app/modules/questachievement/pages/achievements/achievements.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CoreModule } from 'src/app/core/core.module'; | ||
import { AchievementsComponent } from './achievements.component'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: AchievementsComponent | ||
} | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes), CoreModule], | ||
declarations: [AchievementsComponent], | ||
providers: [] | ||
}) | ||
export class QuestachievementModule {} |
6 changes: 6 additions & 0 deletions
6
...ules/questachievement/selectors/questachievement/questachievement-selector.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<wselect | ||
(modelChange)="onChange.emit($event)" | ||
placeholder="Select questachievement" | ||
[select]="value" | ||
[items]="items" | ||
></wselect> |
Empty file.
36 changes: 36 additions & 0 deletions
36
...odules/questachievement/selectors/questachievement/questachievement-selector.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
SimpleChanges, | ||
EventEmitter, | ||
Component, | ||
OnChanges, | ||
Output, | ||
Input | ||
} from '@angular/core'; | ||
import { SelectModule } from 'src/app/core/modules/select/select.module'; | ||
import { QuestachievementService } from '../../services/questachievement.service'; | ||
import { Questachievement } from '../../interfaces/questachievement.interface'; | ||
|
||
@Component({ | ||
selector: 'questachievement-selector', | ||
templateUrl: './questachievement-selector.component.html', | ||
styleUrls: ['./questachievement-selector.component.scss'], | ||
standalone: true, | ||
imports: [SelectModule] | ||
}) | ||
export class SelectUserComponent implements OnChanges { | ||
@Input() value: string; | ||
|
||
@Output() wChange = new EventEmitter(); | ||
|
||
get items(): Questachievement[] { | ||
return this._questachievementService.questachievements; | ||
} | ||
|
||
constructor(private _questachievementService: QuestachievementService) {} | ||
|
||
ngOnChanges(changes: SimpleChanges): void { | ||
if (changes['value'] && !changes['value'].firstChange) { | ||
this.value = changes['value'].currentValue; | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/app/modules/questachievement/services/questachievement.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Questachievement } from '../interfaces/questachievement.interface'; | ||
import { | ||
AlertService, | ||
CoreService, | ||
HttpService, | ||
StoreService, | ||
CrudService | ||
} from 'wacom'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class QuestachievementService extends CrudService<Questachievement> { | ||
questachievements: Questachievement[] = this.getDocs(); | ||
|
||
questachievementsByAuthor: Record<string, Questachievement[]> = {}; | ||
|
||
constructor( | ||
_http: HttpService, | ||
_store: StoreService, | ||
_alert: AlertService, | ||
_core: CoreService | ||
) { | ||
super( | ||
{ | ||
name: 'questachievement', | ||
}, | ||
_http, | ||
_store, | ||
_alert, | ||
_core | ||
); | ||
|
||
this.get(); | ||
|
||
this.filteredDocuments(this.questachievementsByAuthor); | ||
} | ||
} |