Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Beneficiary form #34 #50
Browse files Browse the repository at this point in the history
  • Loading branch information
wanoo21 committed Apr 10, 2020
1 parent 11081a4 commit 86b3ebb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ <h3>Coordinates</h3>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex class="full-width-input">
<mat-select placeholder="Operator" formControlName="fixer" required>
<mat-select placeholder="Fixer" formControlName="fixer" required>
<mat-option *ngFor="let operator of operators$ | async" [value]="operator._id">
{{ operator.first_name }} {{ operator.last_name }}
</mat-option>
Expand All @@ -210,7 +210,7 @@ <h3>Coordinates</h3>
<mat-slide-toggle formControlName="is_active">Active?</mat-slide-toggle>
<mat-slide-toggle formControlName="have_money">Has Money?</mat-slide-toggle>
<mat-slide-toggle formControlName="has_symptoms">Has Symptoms?</mat-slide-toggle>
<mat-slide-toggle formControlName="curator">Is Curator?</mat-slide-toggle>
<mat-slide-toggle formControlName="curator">Has Curator?</mat-slide-toggle>
</div>
</mat-card-content>
</mat-card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ export class RequestDetailsComponent implements OnInit, OnDestroy {
if (request.address) {
this.fakeAddressControl.patchValue({ address: request.address });
}
// Autofill secret field
if (!request.secret) {
this.tagsFacade.getRandomWord().pipe(first()).subscribe(secret => {
this.form.get('secret').patchValue(secret);
});
}
});

this.zones$.pipe(takeUntil(this.componentDestroyed$)).subscribe((z) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h3 class="alert acepted-offer" *ngIf="volunteer.accepted_offer">
<p><strong>Distance</strong>: {{volunteer.distance | number: '1.0-0'}} Km.</p>
<p><strong>Has Telegram</strong>: {{volunteer.telegram_chat_id ? 'Yes' : 'No'}}</p>
<p><strong>Availability</strong>: {{volunteer.availability_day|| 'None'}}</p>
<p><strong>Accepted Volunteers</strong>: {{volunteer.count}}</p>
<p><strong>Accepted Requests</strong>: {{volunteer.count}}</p>
<mat-divider></mat-divider>
<h3>Activity Types</h3>
<p *ngFor="let activity of activityTypes$ | async">{{activity.ro}}</p>
Expand Down
12 changes: 9 additions & 3 deletions src/app/services/tags/tags-facade.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
selectOffersTags,
} from '@store/tags-store/selectors';
import { map } from 'rxjs/operators';
import { TagsService } from './tags.service';
// import { getActivityTypesTagsAction } from '@store/tags-store/actions';

@Injectable({
Expand All @@ -23,16 +24,21 @@ export class TagsFacadeService {
activityTypesTags$ = this.store.pipe(select(selectActivityTypesTags));
agesTags$ = this.store.pipe(select(selectAgesTags));
availabilitiesTags$ = this.store.pipe(select(selectAvailabilitiesTags));
teamsTags$ = this.store.pipe(select(selectTeamsTags));
offersTags$ = this.store.pipe(select(selectOffersTags));

availabilitiesById$ = (id: any) =>
this.store
.pipe(select(selectAvailabilitiesTags))
.pipe(map((tags) => tags.find((t) => t._id === id)));
teamsTags$ = this.store.pipe(select(selectTeamsTags));
offersTags$ = this.store.pipe(select(selectOffersTags));

constructor(private store: Store<TagsState>) {}
constructor(private store: Store<TagsState>, private tagsService: TagsService) { }

// getActivityTypesTags() {
// this.store.dispatch(getActivityTypesTagsAction());
// }

getRandomWord() {
return this.tagsService.getRandomWord().pipe(map(({ secret }) => secret));
}
}
4 changes: 4 additions & 0 deletions src/app/services/tags/tags.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ export class TagsService {
getOffers(): Observable<{ list: IOfferTag[] }> {
return this.http.get<{ list: IOfferTag[] }>(`${environment.url}/tag/offer`);
}

getRandomWord() {
return this.http.get<{ secret: string }>(`${environment.url}/secret`)
}
}

0 comments on commit 86b3ebb

Please sign in to comment.