Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit f223c28

Browse files
committed
Add creation modal command & fix sort user exp
1 parent 99b6ae2 commit f223c28

File tree

8 files changed

+125
-3
lines changed

8 files changed

+125
-3
lines changed

src/app/features/dashboard/funixprod/funixbot/funixbot-commands/funixbot-command-create-modal/funixbot-command-create-modal.component.css

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<div class="card">
2+
<div class="card-header">
3+
<h3 mat-dialog-title class="text-primary">Création de commande.</h3>
4+
</div>
5+
6+
<div mat-dialog-content class="card-body">
7+
<form class="user">
8+
9+
<div class="form-group">
10+
<input type="text" [(ngModel)]="command.command"
11+
name="command"
12+
class="form-control form-control-user"
13+
placeholder="Commande">
14+
</div>
15+
16+
<div class="form-group">
17+
<input type="text" [(ngModel)]="command.message"
18+
name="message"
19+
class="form-control form-control-user"
20+
placeholder="Message de la commande">
21+
</div>
22+
</form>
23+
24+
</div>
25+
<div class="modal-footer">
26+
<button class="btn btn-secondary btn-icon-split" (click)="onNoClick()">
27+
<span class="icon text-white-50">
28+
<i class="fas fa-arrow-right"></i>
29+
</span>
30+
<span class="text">
31+
Annuler
32+
</span>
33+
</button>
34+
35+
<button class="btn btn-success btn-icon-split" (click)="onYesClick()">
36+
<span class="icon text-white-50">
37+
<i class="fas fa-paper-plane"></i>
38+
</span>
39+
<span class="text">
40+
Créer
41+
</span>
42+
</button>
43+
</div>
44+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { FunixbotCommandCreateModalComponent } from './funixbot-command-create-modal.component';
4+
5+
describe('FunixCommandCreateModalComponent', () => {
6+
let component: FunixbotCommandCreateModalComponent;
7+
let fixture: ComponentFixture<FunixbotCommandCreateModalComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ FunixbotCommandCreateModalComponent ]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(FunixbotCommandCreateModalComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import {Component, Inject} from '@angular/core';
2+
import {FunixbotCommandDto} from "../../../../../../dto/funix-api/funixbot/funixbot-command-dto";
3+
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
4+
import {
5+
FunixbotCommandsCrudService
6+
} from "../../../../../../services/funix-api/funixbot/funixbot-commands-crud-service";
7+
8+
@Component({
9+
selector: 'app-funixbot-command-create-modal',
10+
templateUrl: './funixbot-command-create-modal.component.html',
11+
styleUrls: ['./funixbot-command-create-modal.component.css']
12+
})
13+
export class FunixbotCommandCreateModalComponent {
14+
15+
command: FunixbotCommandDto = new FunixbotCommandDto();
16+
17+
constructor(public dialogRef: MatDialogRef<FunixbotCommandCreateModalComponent>,
18+
private funixBotCommandsService: FunixbotCommandsCrudService) {
19+
}
20+
21+
onNoClick(): void {
22+
this.dialogRef.close();
23+
}
24+
25+
onYesClick(): void {
26+
this.funixBotCommandsService.create(this.command).subscribe({
27+
next: () => {
28+
this.dialogRef.close();
29+
}
30+
})
31+
}
32+
33+
}

src/app/features/dashboard/funixprod/funixbot/funixbot-commands/funixbot-commands.component.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@ <h1 class="h3 mb-2 text-gray-800">FunixBot Commandes</h1>
55
</p>
66

77
<div class="card shadow mb-4">
8-
<div class="card-header py-3">
8+
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
99
<h4 class="m-0 font-weight-bold text-primary">FunixBot Commandes</h4>
10+
11+
<button class="btn btn-success btn-icon-split" (click)="openCreationModal()">
12+
<span class="icon text-white-50">
13+
<i class="fas fa-paper-plane"></i>
14+
</span>
15+
<span class="text">
16+
Créer
17+
</span>
18+
</button>
1019
</div>
1120

1221
<div class="card-body">

src/app/features/dashboard/funixprod/funixbot/funixbot-commands/funixbot-commands.component.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import {FunixbotCommandsEditComponent} from "./funixbot-commands-edit/funixbot-c
99
import {
1010
FunixbotCommandsRemoveModalComponent
1111
} from "./funixbot-commands-remove-modal/funixbot-commands-remove-modal.component";
12+
import {
13+
FunixbotCommandCreateModalComponent
14+
} from "./funixbot-command-create-modal/funixbot-command-create-modal.component";
1215

1316
@Component({
1417
selector: 'app-funixbot-commands',
@@ -48,6 +51,14 @@ export class FunixbotCommandsComponent implements OnInit {
4851
});
4952
}
5053

54+
openCreationModal(): void {
55+
const dialogRef = this.dialog.open(FunixbotCommandCreateModalComponent);
56+
57+
dialogRef.afterClosed().subscribe(res => {
58+
this.updateList();
59+
});
60+
}
61+
5162
openRemoveDialog(command: FunixbotCommandDto): void {
5263
const dialogRef = this.dialog.open(FunixbotCommandsRemoveModalComponent, {
5364
data: {

src/app/features/dashboard/funixprod/funixbot/funixbot-user-exp/funixbot-user-exp.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class FunixbotUserExpComponent implements OnInit {
1616
columnsToDisplay = ['twitch-user-id', 'level', 'xp', 'xp-next-level', 'actions'];
1717

1818
users: Paginated<FunixbotUserExpDto> = new Paginated<FunixbotUserExpDto>();
19-
sort: string = 'level:asc,xp:asc';
19+
sort: string = 'level:desc,xp:desc';
2020
page: number = 0;
2121
elemsPerPage: number = 30;
2222

src/app/features/dashboard/funixprod/funixprod.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { FunixbotCommandsEditComponent } from './funixbot/funixbot-commands/funi
1616
import { FunixbotUserExpEditComponent } from './funixbot/funixbot-user-exp/funixbot-user-exp-edit/funixbot-user-exp-edit.component';
1717
import { FunixbotCommandsRemoveModalComponent } from './funixbot/funixbot-commands/funixbot-commands-remove-modal/funixbot-commands-remove-modal.component';
1818
import { FunixbotUserExpRemoveModalComponent } from './funixbot/funixbot-user-exp/funixbot-user-exp-remove-modal/funixbot-user-exp-remove-modal.component';
19+
import { FunixbotCommandCreateModalComponent } from './funixbot/funixbot-commands/funixbot-command-create-modal/funixbot-command-create-modal.component';
1920

2021

2122
@NgModule({
@@ -29,7 +30,8 @@ import { FunixbotUserExpRemoveModalComponent } from './funixbot/funixbot-user-ex
2930
FunixbotCommandsEditComponent,
3031
FunixbotUserExpEditComponent,
3132
FunixbotCommandsRemoveModalComponent,
32-
FunixbotUserExpRemoveModalComponent
33+
FunixbotUserExpRemoveModalComponent,
34+
FunixbotCommandCreateModalComponent
3335
],
3436
imports: [
3537
CommonModule,

0 commit comments

Comments
 (0)