-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use common toggle switcher
- Loading branch information
1 parent
7d78377
commit fc98cdf
Showing
12 changed files
with
87 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './job-preset.service'; | ||
export * from './job-search-category.service'; | ||
export * from './job-search-occupation.service'; | ||
export * from './job.service'; | ||
export * from './job.service'; | ||
export * from './job-search.store.service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
packages/ui-core/core/src/lib/services/job/job-search.store.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { IEmployee, IOrganization } from '@gauzy/contracts'; | ||
import { JobService } from './job.service'; | ||
import { ToastrService } from '../notification/toastr.service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class JobSearchStoreService { | ||
constructor(private readonly _jobService: JobService, private readonly _toastrService: ToastrService) {} | ||
|
||
/** | ||
* Updates the job search availability status of an employee within the organization. | ||
* | ||
* @param organization - The current organization context. | ||
* @param employee - The employee object to update. | ||
* @param isJobSearchActive - A boolean flag indicating whether the job search is active. | ||
* @returns {Promise<void>} - A Promise resolving to void. | ||
*/ | ||
async updateJobSearchAvailability( | ||
organization: IOrganization | undefined, | ||
employee: IEmployee, | ||
isJobSearchActive: boolean | ||
): Promise<void> { | ||
try { | ||
// Ensure the organization context is available before proceeding. | ||
if (!organization) { | ||
console.warn('No organization provided to update job search availability.'); | ||
return; | ||
} | ||
|
||
// Destructure organization properties for clarity. | ||
const { id: organizationId, tenantId } = organization; | ||
|
||
// Update the job search status using the employeesService. | ||
await this._jobService.updateJobSearchStatus(employee.id, { | ||
isJobSearchActive, | ||
organizationId, | ||
tenantId | ||
}); | ||
|
||
// Display a success toastr notification based on the job search status. | ||
const toastrMessageKey = isJobSearchActive | ||
? 'TOASTR.MESSAGE.EMPLOYEE_JOB_STATUS_ACTIVE' | ||
: 'TOASTR.MESSAGE.EMPLOYEE_JOB_STATUS_INACTIVE'; | ||
|
||
const fullName = employee.fullName.trim() || 'Unknown Employee'; | ||
this._toastrService.success(toastrMessageKey, { name: fullName }); | ||
} catch (error) { | ||
// Display an error toastr notification in case of any exceptions. | ||
const errorMessage = error?.message || 'An error occurred while updating the job search availability.'; | ||
console.error('Error while updating job search availability:', error?.message); | ||
this._toastrService.danger(errorMessage); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
...ore/shared/src/lib/smart-data-layout/smart-table-toggle/smart-table-toggle.component.html
This file was deleted.
Oops, something went wrong.
Empty file.
25 changes: 0 additions & 25 deletions
25
.../shared/src/lib/smart-data-layout/smart-table-toggle/smart-table-toggle.component.spec.ts
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
...-core/shared/src/lib/smart-data-layout/smart-table-toggle/smart-table-toggle.component.ts
This file was deleted.
Oops, something went wrong.
7 changes: 6 additions & 1 deletion
7
...es/ui-core/shared/src/lib/table-components/toggle-switcher/toggle-switcher.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters