Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fix date time #238

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Singer.API/ClientApp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Singer.API/ClientApp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Singer",
"version": "0.1.0-PullRequest0237.1582",
"version": "0.1.0-issue-fix-date-time.1586",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
9 changes: 5 additions & 4 deletions Singer.API/ClientApp/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import { AuthService } from './modules/core/services/auth.service';
import { AuthGuard } from './modules/core/services/auth.guard';
import { AuthInterceptor } from './modules/core/services/auth-interceptor';
import { NavMenuComponent } from './modules/core/components/nav-menu/nav-menu.component';
import { NativeDateModule, MAT_DATE_LOCALE, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
import { NativeDateModule, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
import { AdminModule } from './modules/admin/admin.module';
import { MomentDateAdapter } from '@angular/material-moment-adapter';
import { ConfigurationService } from './modules/core/services/clientconfiguration.service';
import { ApplicationInsightsService } from './modules/core/services/applicationinsights.service';
import { registerLocaleData } from '@angular/common';
import localeBe from '@angular/common/locales/be';
import { CalendarModule } from 'angular-calendar';
import { OWL_DATE_TIME_LOCALE, OwlDateTimeIntl } from '@danielmoncada/angular-datetime-picker';
import { DutchOwlDateTimeIntl } from './modules/legalguardians/dutchowldatetime';

// Import locale settings for Belgium
registerLocaleData(localeBe);
Expand Down Expand Up @@ -74,7 +74,8 @@ export const MY_FORMATS = {
BrowserAnimationsModule,
{ provide: MAT_DATE_LOCALE, useValue: 'nl-BE' },
{ provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
{ provide: DateAdapter, useClass: MomentDateAdapter },
{ provide: OWL_DATE_TIME_LOCALE, useValue: 'nl-BE' },
{ provide: OwlDateTimeIntl, useClass: DutchOwlDateTimeIntl },
// AppInsightsService,
],
bootstrap: [AppComponent],
Expand Down
102 changes: 49 additions & 53 deletions Singer.API/ClientApp/src/app/modules/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CoreModule } from '../core/core.module';
import { CareUserDetailsComponent } from './components/careusers/careuser-details/care-user-details.component';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { KeysPipe } from '../core/pipes/keys.pipe';
import { MAT_DATE_LOCALE } from '@angular/material/core';
import { MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
Expand Down Expand Up @@ -39,59 +39,55 @@ import { PendingActionsComponent } from './components/pending-actions/pending-ac
import { LocationOverviewComponent } from './components/location-overview/location-overview.component';
import { LocationDetailsComponent } from './components/location-details/location-details.component';
import { SingerLocationProxy } from '../core/services/singer-location-api/singer-location.proxy';
import { OWL_DATE_TIME_LOCALE, OwlDateTimeIntl } from '@danielmoncada/angular-datetime-picker';
import { MY_FORMATS } from 'src/app/app.module';
import { DutchOwlDateTimeIntl } from '../legalguardians/dutchowldatetime';

@NgModule({
declarations: [
CareUserOverviewComponent,
CareUserDetailsComponent,
LegalguardianOverviewComponent,
LegalguardianDetailsComponent,
SingerEventOverviewComponent,
SingerEventDetailsComponent,
AdminOverviewComponent,
AdminDetailsComponent,
SingerRegistrationsComponent,
SingerEventAdminRegisterComponent,
AddFamilyWizardComponent,
PendingRegistrationsComponent,
PendingActionsComponent,
LocationOverviewComponent,
LocationDetailsComponent,
],
imports: [
CoreModule,
CommonModule,
SharedModule,
AdminRoutingModule,
MaterialModule,
ReactiveFormsModule,
FormsModule,
MatMomentDateModule,
MatTableModule,
MatPaginatorModule,
MatSortModule,
],
providers: [
CareUserProxy,
LegalGuardianProxy,
SingerEventsProxy,
SingerLocationProxy,
CareUserService,
AdminUserProxy,
AdminUserService,
LegalguardiansService,
SingerEventsService,
SingerLocationService,
ApiService,
AgegroupPipe,
KeysPipe,
{
provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS,
useValue: {
useUtc: true,
},
},
{ provide: MAT_DATE_LOCALE, useValue: 'nl-BE' },
]
declarations: [
CareUserOverviewComponent,
CareUserDetailsComponent,
LegalguardianOverviewComponent,
LegalguardianDetailsComponent,
SingerEventOverviewComponent,
SingerEventDetailsComponent,
AdminOverviewComponent,
AdminDetailsComponent,
SingerRegistrationsComponent,
SingerEventAdminRegisterComponent,
AddFamilyWizardComponent,
PendingRegistrationsComponent,
PendingActionsComponent,
LocationOverviewComponent,
LocationDetailsComponent,
],
imports: [
CoreModule,
CommonModule,
SharedModule,
AdminRoutingModule,
MaterialModule,
ReactiveFormsModule,
FormsModule,
MatMomentDateModule,
MatTableModule,
MatPaginatorModule,
MatSortModule,
],
providers: [
CareUserProxy,
LegalGuardianProxy,
SingerEventsProxy,
SingerLocationProxy,
CareUserService,
AdminUserProxy,
AdminUserService,
LegalguardiansService,
SingerEventsService,
SingerLocationService,
ApiService,
AgegroupPipe,
KeysPipe,
],
})
export class AdminModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class SingerEventOverviewComponent implements OnInit, AfterViewInit {

ngOnInit() {
this.dataSource = new SingerEventOverviewDataSource(this._singerEventsService);
this._singerLocationService.fetchSingerLocationsData('asc', 'name', 0, 1000, '').subscribe(res => {
this._singerLocationService.fetchSingerLocationsData('asc', 'name', 0, 1000, '').subscribe((res) => {
this.availableLocations = res.items as SingerLocation[];
});
this.sort.active = 'title';
Expand Down Expand Up @@ -104,7 +104,7 @@ export class SingerEventOverviewComponent implements OnInit, AfterViewInit {
})
)
.subscribe();
this.dataSource.loading$.subscribe(res => {
this.dataSource.loading$.subscribe((res) => {
if (res) {
this._loadingService.show();
} else {
Expand All @@ -121,7 +121,7 @@ export class SingerEventOverviewComponent implements OnInit, AfterViewInit {
}

isMaxRegistrantsExceeded(row: SingerEvent): boolean {
return row.eventSlots.some(x => x.currentRegistrants > row.maxRegistrants);
return row.eventSlots.some((x) => x.currentRegistrants > row.maxRegistrants);
}

getRegistrantsNumberString(row: SingerEvent): string {
Expand Down Expand Up @@ -158,12 +158,13 @@ export class SingerEventOverviewComponent implements OnInit, AfterViewInit {
});

dialogRef.componentInstance.submitEvent.subscribe((result: SingerEvent) => {
console.log(result);
this._singerEventsService.create(result).subscribe(
() => {
this.loadSingerEvents();
this._snackBar.open(`Evenement ${result.title} werd toegevoegd.`, 'OK', { duration: 2000 });
},
err => {
(err) => {
this.handleApiError(err);
}
);
Expand All @@ -180,14 +181,15 @@ export class SingerEventOverviewComponent implements OnInit, AfterViewInit {
});

dialogRef.componentInstance.submitEvent.subscribe((result: SingerEvent) => {
console.log(result);
// Update the SingerEvent
this._singerEventsService.update(result).subscribe(
this._singerEventsService.updateSingerEvent(result).subscribe(
() => {
// Reload SingerEvents
this.loadSingerEvents();
this._snackBar.open(`Evenement ${result.title} werd aangepast.`, 'OK', { duration: 2000 });
},
err => {
(err) => {
this.handleApiError(err);
// TODO: Should be optimised, reloading results should be necessary
this.loadSingerEvents();
Expand All @@ -197,12 +199,12 @@ export class SingerEventOverviewComponent implements OnInit, AfterViewInit {

dialogRef.componentInstance.deleteEvent.subscribe((result: SingerEvent) => {
this._singerEventsService.deleteSingerEvent(result.id).subscribe(
res => {
(res) => {
// Reload SingerEvents
this.loadSingerEvents();
this._snackBar.open(`Evenement ${result.title} werd verwijderd.`, 'OK', { duration: 2000 });
},
err => {
(err) => {
this.handleApiError(err);
// TODO: Should be optimised, reloading results should be necessary
this.loadSingerEvents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { EventSlotDTO } from '../models/eventslot.dto';
import { SingerLocationDTO } from './singer-event-location.dto';
import { DaycareLocationDTO } from './daycarelocation.dto';
import { IFilterBaseDTO } from './filterbase.dto';
import format from 'date-fns/format';

export interface CreateEventSlotRegistrationDTO {
eventSlotId: string;
Expand Down Expand Up @@ -107,8 +108,8 @@ export interface UpdateSingerEventDTO {
locationId: string;
maxRegistrants: number;
cost: number;
startDateTime: Date;
endDateTime: Date;
startDateTime: string;
endDateTime: string;
startRegistrationDateTime: Date;
endRegistrationDateTime: Date;
finalCancellationDateTime: Date;
Expand All @@ -126,8 +127,8 @@ export interface CreateSingerEventDTO {
locationId: string;
maxRegistrants: number;
cost: number;
startDateTime: Date;
endDateTime: Date;
startDateTime: string;
endDateTime: string;
startRegistrationDateTime: Date;
endRegistrationDateTime: Date;
finalCancellationDateTime: Date;
Expand Down
19 changes: 7 additions & 12 deletions Singer.API/ClientApp/src/app/modules/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import { AboutComponent } from './components/about/about.component';
import { RegistrationTypePipe } from './pipes/registration-type.pipe';
import { TitlePipe } from './pipes/title.pipe';
import { MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapter';
import { MAT_DATE_LOCALE } from '@angular/material/core';
import { MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
import { OWL_DATE_TIME_LOCALE, OwlDateTimeIntl } from '@danielmoncada/angular-datetime-picker';
import { MY_FORMATS } from 'src/app/app.module';
import { DutchOwlDateTimeIntl } from '../legalguardians/dutchowldatetime';

@NgModule({
declarations: [
Expand Down Expand Up @@ -42,17 +45,9 @@ import { MAT_DATE_LOCALE } from '@angular/material/core';
SingereventCostPipe,
AboutComponent,
RegistrationTypePipe,
TitlePipe
TitlePipe,
],

providers: [
RegistrationTypePipe,
{
provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS,
useValue: {
useUtc: true,
},
},
{ provide: MAT_DATE_LOCALE, useValue: 'nl-BE' },]
providers: [RegistrationTypePipe],
})
export class CoreModule { }
export class CoreModule {}
Loading