Skip to content

Commit

Permalink
Fixed prettier formating
Browse files Browse the repository at this point in the history
  • Loading branch information
amahdysancsoft committed Jan 13, 2025
1 parent b1397d0 commit 2ba4ebb
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,25 @@
}
</hq-select-input>
}
@if(clientDetailService.showCurrentOnly$ | async){
<div class="inline-flex items-center">
<div class="text-[12px] mr-[10px] leading-none text-nowrap">
Show current only
</div>
<label class="relative inline-flex cursor-pointer items-center">
<input id="switch" type="checkbox" class="peer sr-only" [formControl]="clientDetailService.currentOnly" checked />
<label for="switch" class="hidden"></label>
<div
class="peer h-[14px] w-[33px] rounded-full bg-slate-200 after:absolute after:left-[4px] after:top-[3px] after:h-[8px] after:w-[8px] after:rounded-full after:bg-gray-500 peer-checked:after:bg-white after:transition-all after:content-[''] peer-checked:bg-steel-blue-600 peer-checked:after:translate-x-full peer-checked:after:right-[12px] peer-checked:after:left-auto">
@if (clientDetailService.showCurrentOnly$ | async) {
<div class="inline-flex items-center">
<div class="text-[12px] mr-[10px] leading-none text-nowrap">
Show current only
</div>
</label>
<div class="text-xs ml-[6px]">On</div>
</div>
}
<label class="relative inline-flex cursor-pointer items-center">
<input
id="switch"
type="checkbox"
class="peer sr-only"
[formControl]="clientDetailService.currentOnly"
checked
/>
<label for="switch" class="hidden"></label>
<div
class="peer h-[14px] w-[33px] rounded-full bg-slate-200 after:absolute after:left-[4px] after:top-[3px] after:h-[8px] after:w-[8px] after:rounded-full after:bg-gray-500 peer-checked:after:bg-white after:transition-all after:content-[''] peer-checked:bg-steel-blue-600 peer-checked:after:translate-x-full peer-checked:after:right-[12px] peer-checked:after:left-auto"
></div>
</label>
<div class="text-xs ml-[6px]">On</div>
</div>
}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@
<div class="flex flex-col xl:flex-row justify-between items-start gap-4">
<hq-client-details-search-filter></hq-client-details-search-filter>
<div class="flex divide-x ml-auto">
<hq-tab routerLink="projects" (click)="clientDetailsService.showCurrentOnly()">Projects</hq-tab>
<hq-tab routerLink="quotes" (click)="clientDetailsService.hideCurrentOnly()">Quotes</hq-tab>
<hq-tab
routerLink="projects"
(click)="clientDetailsService.showCurrentOnly()"
>Projects</hq-tab
>
<hq-tab
routerLink="quotes"
(click)="clientDetailsService.hideCurrentOnly()"
>Quotes</hq-tab
>
<!-- <hq-tab routerLink="services">Services</hq-tab>
<hq-tab routerLink="invoices">Invoices</hq-tab> -->
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ export class ClientDetailsService {
this.clientIdSubject.next(clientId);
}
}
showCurrentOnly(){
showCurrentOnly() {
this.showCurrentOnlySubject.next(true);
}
hideCurrentOnly(){
hideCurrentOnly() {
this.showCurrentOnlySubject.next(false);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
shareReplay,
combineLatest,
debounceTime,
switchMap,startWith
switchMap,
startWith,
} from 'rxjs';
import { formControlChanges } from '../../../core/functions/form-control-changes';
import { BaseListService } from '../../../core/services/base-list.service';
Expand Down Expand Up @@ -43,20 +44,22 @@ export class ClientProjectListService extends BaseListService<
this.clientDetailsService.projectStatus,
).pipe(
tap(() => this.goToPage(1)),
tap((status)=> {
if(status != null){
tap((status) => {
if (status != null) {
this.clientDetailsService.currentOnly.setValue(false);
}
}),
}
}),
shareReplay({ bufferSize: 1, refCount: false }),
);
const currentOnly$ = formControlChanges(this.clientDetailsService.currentOnly).pipe(
const currentOnly$ = formControlChanges(
this.clientDetailsService.currentOnly,
).pipe(
startWith(this.clientDetailsService.currentOnly.value),
tap(value => {
if (value){
tap((value) => {
if (value) {
this.clientDetailsService.projectStatus.setValue(null);
}
})
}),
);
const result$ = combineLatest({
search: search$,
Expand All @@ -66,7 +69,7 @@ export class ClientProjectListService extends BaseListService<
sortBy: this.sortOption$,
projectStatus: projectStatus$,
sortDirection: this.sortDirection$,
currentOnly: currentOnly$
currentOnly: currentOnly$,
}).pipe(
debounceTime(500),
tap(() => this.loadingSubject.next(true)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,23 @@ <h1 class="font-rajdhani font-semibold text-3xl">Projects</h1>
}
</hq-select-input>
</div>
@if(listService){}
@if (listService) {}
<div class="inline-flex items-center">
<div class="text-[12px] mr-[10px] leading-none text-nowrap">
Show current only
</div>
<label class="relative inline-flex cursor-pointer items-center">
<input id="switch" type="checkbox" class="peer sr-only" [formControl]="listService.currentOnly" checked />
<input
id="switch"
type="checkbox"
class="peer sr-only"
[formControl]="listService.currentOnly"
checked
/>
<label for="switch" class="hidden"></label>
<div
class="peer h-[14px] w-[33px] rounded-full bg-slate-200 after:absolute after:left-[4px] after:top-[3px] after:h-[8px] after:w-[8px] after:rounded-full after:bg-gray-500 peer-checked:after:bg-white after:transition-all after:content-[''] peer-checked:bg-steel-blue-600 peer-checked:after:translate-x-full peer-checked:after:right-[12px] peer-checked:after:left-auto">
</div>
class="peer h-[14px] w-[33px] rounded-full bg-slate-200 after:absolute after:left-[4px] after:top-[3px] after:h-[8px] after:w-[8px] after:rounded-full after:bg-gray-500 peer-checked:after:bg-white after:transition-all after:content-[''] peer-checked:bg-steel-blue-600 peer-checked:after:translate-x-full peer-checked:after:right-[12px] peer-checked:after:left-auto"
></div>
</label>
<div class="text-xs ml-[6px]">On</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
Observable,
shareReplay,
switchMap,
tap, startWith
tap,
startWith,
} from 'rxjs';
import { SortDirection } from '../../models/common/sort-direction';
import { HQService } from '../../services/hq.service';
Expand Down Expand Up @@ -43,9 +44,9 @@ export class ProjectListService extends BaseListService<
public projectStatus = new FormControl<ProjectStatus | null>(null);
public projectStatus$ = formControlChanges(this.projectStatus).pipe(
tap(() => this.goToPage(1)),
tap((status)=> {
if(status != null){
this.currentOnly.setValue(false);
tap((status) => {
if (status != null) {
this.currentOnly.setValue(false);
}
}),
shareReplay({ bufferSize: 1, refCount: false }),
Expand All @@ -60,13 +61,13 @@ export class ProjectListService extends BaseListService<
projectManagers$: Observable<GetStaffV1Record[]>;
currentOnly = new FormControl<boolean>(true);
public currentOnly$ = formControlChanges(this.currentOnly).pipe(
startWith(this.currentOnly.value),
tap(value => {
if (value){
this.projectStatus.setValue(null);
}
})
);
startWith(this.currentOnly.value),
tap((value) => {
if (value) {
this.projectStatus.setValue(null);
}
}),
);
protected override getResponse(): Observable<GetProjectResponseV1> {
return combineLatest({
search: this.search$,
Expand Down

0 comments on commit 2ba4ebb

Please sign in to comment.