Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Ecodev/my-ichtus
Browse files Browse the repository at this point in the history
  • Loading branch information
sambaptista committed Oct 2, 2024
2 parents a55433f + aa63a59 commit 1040573
Show file tree
Hide file tree
Showing 76 changed files with 1,435 additions and 1,810 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
fetch-depth: 2

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'

Expand All @@ -35,13 +35,13 @@ jobs:
tools: cs2pr
extensions: imagick

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cache/composer
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
Expand Down
8 changes: 1 addition & 7 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "client/environments/environment.ts",
"with": "client/environments/environment.prod.ts"
}
],
"outputHashing": "all",
"budgets": [
{
Expand Down Expand Up @@ -163,7 +157,7 @@
"type": "initial",
// DO NOT MODIFY THIS, instead, if you see this error, triple-check why we included
// more code into Vanilla and if https://navigations.ichtus.club will still work with this new build
"maximumError": "374kb"
"maximumError": "385.11 kB"
},
{
"type": "anyComponentStyle",
Expand Down
5 changes: 3 additions & 2 deletions client/app/admin/accounts/account/account.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import {MatTabsModule} from '@angular/material/tabs';
import {MoneyComponent} from '../../../shared/components/money/money.component';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import Big from 'big.js';
import {startWith, switchMap, takeUntil} from 'rxjs';
import {startWith, switchMap} from 'rxjs';
import {AccountType} from '../../../shared/generated-types';
import {MatTooltip, MatTooltipModule} from '@angular/material/tooltip';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';

@Component({
selector: 'app-account',
Expand Down Expand Up @@ -94,7 +95,7 @@ export class AccountComponent extends NaturalAbstractDetail<AccountService, Natu
parent.valueChanges
.pipe(
startWith(parent.value),
takeUntil(this.ngUnsubscribe),
takeUntilDestroyed(this.destroyRef),
switchMap(value => {
this.nextCodeAvailable = null; // Hide invalid code as soon as we can

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 mat-dialog-title>Exporter bilan + PP</h2>
<h2 mat-dialog-title>Exporter bilan + résultat</h2>
<mat-dialog-content [formGroup]="form">
<div class="nat-vertical">
<mat-form-field>
Expand All @@ -14,6 +14,22 @@ <h2 mat-dialog-title>Exporter bilan + PP</h2>
}
</mat-form-field>
<mat-checkbox formControlName="showBudget">Afficher le budget</mat-checkbox>
<mat-checkbox formControlName="compareWithPrevious" (change)="compareCheck($event)"
>Comparer avec l'exercice précédent</mat-checkbox
>
@if (form.get('compareWithPrevious')?.value) {
<mat-form-field>
<mat-label>Date précédente</mat-label>
<input
matInput
formControlName="datePrevious"
[matDatepicker]="pickerPrevious"
[max]="form.get('date')?.value"
/>
<mat-datepicker-toggle matIconSuffix [for]="pickerPrevious" />
<mat-datepicker #pickerPrevious />
</mat-form-field>
}
</div>
</mat-dialog-content>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {MatDatepickerModule} from '@angular/material/datepicker';
import {MatInputModule} from '@angular/material/input';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatDialogModule} from '@angular/material/dialog';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatCheckboxChange, MatCheckboxModule} from '@angular/material/checkbox';

@Component({
selector: 'app-accounting-report',
Expand All @@ -27,6 +27,14 @@ export class AccountingReportComponent {
public readonly form = new FormGroup({
date: new FormControl(new Date(), [Validators.required]),
showBudget: new FormControl(false),
compareWithPrevious: new FormControl(false),
datePrevious: new FormControl(null),
});
public readonly today = new Date();

public compareCheck(e: MatCheckboxChange): void {
if (!e.checked) {
this.form.get('datePrevious')?.setValue(null);
}
}
}
2 changes: 1 addition & 1 deletion client/app/admin/accounts/accounts/accounts.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
}
</div>
</div>
@if (permissionsService.crud?.account.create) {
@if ((permissionsService.crud | async)?.account.create) {
<natural-fixed-button icon="add" [routerLink]="addLink()" />
}
</div>
Expand Down
3 changes: 2 additions & 1 deletion client/app/admin/accounts/accounts/accounts.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type AccountingDialogData = never;
type AccountingClosingDialogResult = Date;
type AccountingExportDialogResult = {
date: Date;
datePrevious: null | Date;
showBudget: boolean;
};

Expand Down Expand Up @@ -142,7 +143,7 @@ export class AccountsComponent extends NaturalAbstractNavigableList<AccountServi
if (result) {
button.disabled = true;
this.accountService
.getReportExportLink(result.date, result.showBudget)
.getReportExportLink(result.date, result.datePrevious, result.showBudget)
.pipe(finalize(() => (button.disabled = false)))
.subscribe(url => {
window.location.href = url;
Expand Down
4 changes: 2 additions & 2 deletions client/app/admin/accounts/services/account.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export const deleteAccounts = gql`
`;

export const exportAccountingReport = gql`
mutation ExportAccountingReport($date: Date, $showBudget: Boolean!) {
exportAccountingReport(date: $date, showBudget: $showBudget)
mutation ExportAccountingReport($date: Date!, $datePrevious: Date, $showBudget: Boolean!) {
exportAccountingReport(date: $date, datePrevious: $datePrevious, showBudget: $showBudget)
}
`;

Expand Down
2 changes: 2 additions & 0 deletions client/app/admin/accounts/services/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ export class AccountService extends NaturalAbstractModelService<

public getReportExportLink(
date: Date,
datePrevious: Date | null = null,
showBudget: boolean,
): Observable<ExportAccountingReport['exportAccountingReport']> {
const variables: ExportAccountingReportVariables = {
date: formatIsoDateTime(date),
datePrevious: datePrevious ? formatIsoDateTime(datePrevious) : null,
showBudget: showBudget,
};

Expand Down
6 changes: 3 additions & 3 deletions client/app/admin/admin/admin.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@
>
<a mat-list-item routerLinkActive="active" routerLink="license">Certifications</a>
<a mat-list-item routerLinkActive="active" routerLink="bookable-tag">Tags de réservables</a>
@if (permissionsService.crud?.configuration?.create) {
@if ((permissionsService.crud | async)?.configuration?.create) {
<a mat-list-item routerLinkActive="active" routerLink="support">Guide / Support</a>
}
@if (permissionsService.crud?.configuration?.create) {
@if ((permissionsService.crud | async)?.configuration?.create) {
<a mat-list-item routerLinkActive="active" routerLink="announcement">Annonce</a>
}
<a mat-list-item routerLinkActive="active" routerLink="log">Activité</a>
Expand All @@ -161,7 +161,7 @@
>Frais, remboursements et factures</a
>
}
@if (permissionsService.crud?.transaction?.create) {
@if ((permissionsService.crud | async)?.transaction?.create) {
<a mat-list-item routerLinkActive="active" routerLink="import">Import BVR</a>
}
<a mat-list-item routerLinkActive="active" routerLink="transaction-tag">Tags</a>
Expand Down
2 changes: 2 additions & 0 deletions client/app/admin/admin/admin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
NaturalSidenavComponent,
NaturalSidenavContentComponent,
} from '@ecodev/natural';
import {AsyncPipe} from '@angular/common';

@Component({
selector: 'app-admin',
Expand All @@ -25,6 +26,7 @@ import {
RouterLink,
NaturalSidenavContentComponent,
RouterOutlet,
AsyncPipe,
],
})
export class AdminComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@
</div>
}

@if (permissionsService.crud?.bookableTag.create) {
@if ((permissionsService.crud | async)?.bookableTag.create) {
<natural-fixed-button icon="add" [routerLink]="['/admin/bookable-tag/new']" />
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {AsyncPipe} from '@angular/common';

@Component({
selector: 'app-bookable-tags',
Expand All @@ -34,6 +35,7 @@ import {MatTableModule} from '@angular/material/table';
MatPaginatorModule,
NaturalFixedButtonComponent,
RouterLink,
AsyncPipe,
],
})
export class BookableTagsComponent extends NaturalAbstractList<BookableTagService> implements OnInit {
Expand Down
5 changes: 3 additions & 2 deletions client/app/admin/bookables/bookable/bookable.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {PermissionsService} from '../../../shared/services/permissions.service';
import {BookableTagService} from '../../bookableTags/services/bookableTag.service';
import {ImageService} from '../services/image.service';
import {accountHierarchicConfiguration} from '../../../shared/hierarchic-selector/AccountHierarchicConfiguration';
import {Observable, of, takeUntil} from 'rxjs';
import {Observable, of} from 'rxjs';
import {map, switchMap} from 'rxjs/operators';
import {
availableColumnsForBookingsWithOwnerOnlyTrainers,
Expand All @@ -50,6 +50,7 @@ import {MatTabsModule} from '@angular/material/tabs';
import {MatButtonModule} from '@angular/material/button';
import {CommonModule} from '@angular/common';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';

@Component({
selector: 'app-bookable',
Expand Down Expand Up @@ -108,7 +109,7 @@ export class BookableComponent extends NaturalAbstractDetail<BookableService, Na
const bookingType = this.form.controls.bookingType;
const simultaneousBookingMaximum = this.form.controls.simultaneousBookingMaximum;
bookingType.valueChanges
.pipe(takeUntil(this.ngUnsubscribe))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(value => simultaneousBookingMaximum.setValue(value === BookingType.SelfApproved ? 1 : -1));
}

Expand Down
8 changes: 4 additions & 4 deletions client/app/admin/bookables/bookables/bookables.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<span>{{ element.purchasePrice | currency: 'CHF' : 'symbol' : '1.0-0' }}</span>
}
</td>
<td *matFooterCellDef mat-footer-cellnatural-align-right>
<td *matFooterCellDef mat-footer-cell natural-align-right>
@if (dataSource.data?.totalPurchasePrice > 0) {
<span>
{{ dataSource.data?.totalPurchasePrice | currency: 'CHF' : 'symbol' : '1.0-0' }}
Expand All @@ -125,7 +125,7 @@
<span>{{ element.initialPrice | currency: 'CHF' : 'symbol' : '1.0-0' }}</span>
}
</td>
<td *matFooterCellDef mat-footer-cellnatural-align-right>
<td *matFooterCellDef mat-footer-cell natural-align-right>
@if (dataSource.data?.totalInitialPrice > 0) {
<span>
{{ dataSource.data?.totalInitialPrice | currency: 'CHF' : 'symbol' : '1.0-0' }}
Expand All @@ -149,7 +149,7 @@
<span>{{ element.periodicPrice | currency: 'CHF' : 'symbol' : '1.0-0' }}</span>
}
</td>
<td *matFooterCellDef mat-footer-cellnatural-align-right>
<td *matFooterCellDef mat-footer-cell natural-align-right>
@if (dataSource.data?.totalPeriodicPrice > 0) {
<span>
{{ dataSource.data?.totalPeriodicPrice | currency: 'CHF' : 'symbol' : '1.0-0' }}
Expand Down Expand Up @@ -301,6 +301,6 @@
The hideCreateFab flag is there to hide the create button for admins (is hidden for other users too.
If we want to display the FAB, we need to add padding in bottom of page to prevent overlay over paginator
-->
@if (!route.snapshot.data.hideCreateFab && permissionsService.crud?.bookable.create) {
@if (!route.snapshot.data.hideCreateFab && (permissionsService.crud | async)?.bookable.create) {
<natural-fixed-button icon="add" [routerLink]="['/admin/bookable/new']" />
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import {CommonModule, DatePipe} from '@angular/common';
import {UsageBookables} from '../../../shared/generated-types';
import {BookingService} from '../../bookings/services/booking.service';
import {switchMap, takeUntil} from 'rxjs/operators';
import {switchMap} from 'rxjs/operators';
import {UserService} from '../../users/services/user.service';
import {ParentComponent} from './parent.component';
import {of} from 'rxjs';
Expand All @@ -28,6 +28,7 @@ import {MatSortModule} from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table';
import {MatDialog} from '@angular/material/dialog';
import {MatSnackBar} from '@angular/material/snack-bar';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';

@Component({
selector: 'app-usage-bookables',
Expand Down Expand Up @@ -94,7 +95,7 @@ export class UsageBookablesComponent extends ParentComponent<UsageBookableServic

this.futureOwner$
.pipe(
takeUntil(this.ngUnsubscribe),
takeUntilDestroyed(this.destroyRef),
switchMap(futureOwner =>
futureOwner ? this.userService.getPendingApplications(futureOwner) : of({items: []}),
),
Expand Down
2 changes: 1 addition & 1 deletion client/app/admin/bookings/bookings/bookings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,6 @@
</div>
}

@if (permissionsService.crud?.booking.create && !!showFabButton) {
@if ((permissionsService.crud | async)?.booking.create && !!showFabButton) {
<natural-fixed-button icon="add" [routerLink]="['/admin/booking/new']" />
}
Loading

0 comments on commit 1040573

Please sign in to comment.