Skip to content

Commit

Permalink
Merge pull request #111 from sinfo/staging
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
PMax5 authored Feb 26, 2024
2 parents a19c7d6 + b60aef5 commit 90bbb12
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ <h5 *ngIf="credentials.lunchTalk">Lunch Talks</h5>
</div> -->


<h6 [innerHTML]="'reservations.info' | translate"></h6>
<h6 *ngIf="credentials.activities.length" [innerHTML]="'reservations.info' | translate"></h6>

</div>

Expand Down Expand Up @@ -144,10 +144,7 @@ <h5 style="margin-left: 5%;" [innerHTML]="'reservations.warning' | translate"></
<div class="btn-group-vertical" role="group">
<button class="btn btn-primary" type="button" (click)="makeReservation(confirmReservationPopup)"
[innerHTML]="'reservations.submit' | translate"
*ngIf="latestReservation
&& latestReservation.issued === undefined
&& (latestReservation.stands.length === credentials.participationDays || availability.venue.stands.length === 0 || latestReservation.stands === undefined)">Submit
reservation</button>
*ngIf="isReadyToSubmit()">Submit reservation</button>

<button *ngIf="showAllReservations" class="btn btn-primary" type="button"
(click)="alternateShowAllReservations()" [innerHTML]=" 'reservations.current' | translate">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ export class CompanyReservationsComponent implements OnInit, OnDestroy {

private clickableActivity(id, kind) {
return this.latestReservation && this.latestReservation.issued === undefined
&& !this.isOccupiedActivity(id, kind) && this.credentials.activities.find(a => a === kind) !== undefined
&& this.latestReservation.activities.find(act => act.kind === kind) === undefined;
&& !this.isOccupiedActivity(id, kind) && this.credentials.activities.find(a => a === kind) !== undefined;
}

private clickStand(standId: number, free: boolean) {
Expand All @@ -171,6 +170,9 @@ export class CompanyReservationsComponent implements OnInit, OnDestroy {
if (this.latestReservation.activities === undefined) {
this.latestReservation.activities = [];
}

// FIXME: This is a workaround, imo we should be using dictionaries to store activities
this.latestReservation.activities = this.latestReservation.activities.filter(act => act.kind !== kind);
this.latestReservation.activities.push(new Activity(id, kind));

this.reservationService.setReservation(this.latestReservation);
Expand Down Expand Up @@ -252,6 +254,13 @@ export class CompanyReservationsComponent implements OnInit, OnDestroy {
act.isInArray(this.latestReservation.activities) && this.latestReservation.isConfirmed();
}

private isReadyToSubmit() {
return this.latestReservation
&& this.latestReservation.issued === undefined
&& this.credentials.activities.every(act => this.latestReservation.activities.find(e => act === e.kind) !== undefined)
&& (this.latestReservation.stands.length === this.credentials.participationDays || this.availability.venue.stands.length === 0 || this.latestReservation.stands === undefined);
}

private makeReservation(content) {
const contiguous: boolean = this.latestReservation.daysAreContiguous();
const same_stand: boolean = this.latestReservation.standIsSame();
Expand Down
5 changes: 2 additions & 3 deletions src/app/company/welcome/date-en.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ export class DateEnPipe implements PipeTransform {
return `${startMonth} ${startDay}${startTerm} `;
}

const endDate = new Date(start.getTime() + end.getTime());

const endDay = endDate.getDate();
const endMonth = this.translator[endDate.getMonth()];
const endDay = end.getDate();
const endMonth = this.translator[end.getMonth()];

var endTerm
if(endDay === 1 || endDay === 21 || endDay === 31){
Expand Down
6 changes: 2 additions & 4 deletions src/app/company/welcome/date-pt.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ export class DatePtPipe implements PipeTransform {
return `${startDay} de ${startMonth}`;
}

const endDate = new Date(start.getTime() + end.getTime());

const endDay = endDate.getDate();
const endMonth = this.translator[endDate.getMonth()];
const endDay = end.getDate();
const endMonth = this.translator[end.getMonth()];

return start.getMonth() === end.getMonth()
? `${startDay} a ${endDay} de ${startMonth}`
Expand Down
2 changes: 1 addition & 1 deletion src/app/deck/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export class Event {
getDuration(): number {
const beginDate = new Date(this.begin).getTime()
const endDate = new Date(this.end).getTime()
return new Date(endDate - beginDate).getUTCDate() - 1
return new Date(endDate - beginDate).getUTCDate()
}
}

0 comments on commit 90bbb12

Please sign in to comment.