Members
(constant) FILTER_STATUS_OPTIONS :Array
Available filter options for status
Type:
- Array
- Source:
(constant) SORT_OPTIONS :Object
Available sorting options with their display labels
Type:
- Object
- Source:
Methods
applyFilterAndSort(filterStatus, sortOption)
Applies both filtering and sorting to applications and re-renders the page
Parameters:
Name | Type | Description |
---|---|---|
filterStatus |
string | The status to filter by ('All' for no filter) |
sortOption |
string | The sorting option key |
- Source:
applySorting(sortOption)
Applies sorting to applications and re-renders the page
Parameters:
Name | Type | Description |
---|---|---|
sortOption |
string | The sorting option key |
- Source:
clearAllData()
Clears all application data from localStorage.
- Source:
createApplication(formData) → {Object}
Creates a new job application card and stores it in localStorage.
Parameters:
Name | Type | Description |
---|---|---|
formData |
Object | The input data from the form. |
- Source:
Returns:
The newly created card object.
- Type
- Object
createSortingAndFilterUI()
Creates the sorting dropdown and filter buttons UI
- Source:
deleteApplication(applicationId)
Deletes a job application from localStorage and removes its card from the DOM.
Parameters:
Name | Type | Description |
---|---|---|
applicationId |
string | The unique ID of the job application. |
- Source:
(async) fetchApplications() → {Promise.<Array.<Object>>}
Fetches initial job applications from a JSON data file.
- Source:
Returns:
Array of job application objects (empty array on error).
- Type
- Promise.<Array.<Object>>
(async) fetchApplications() → {Promise.<Array.<Object>>}
Fetches initial job applications from a JSON data file.
- Source:
Returns:
Array of job application objects (empty array on error).
- Type
- Promise.<Array.<Object>>
filterApplications(applications, filterStatus) → {Array}
Filters applications by status
Parameters:
Name | Type | Description |
---|---|---|
applications |
Array | Array of application objects |
filterStatus |
string | Status to filter by ('All' for no filter) |
- Source:
Returns:
Filtered array of applications
- Type
- Array
generateUUID() → {string}
Generates a UUID, using crypto module in Node.js or browser crypto API
I have to use this function because the crypto module is not available in the browser, now it should pass the tests
- Source:
Returns:
A UUID string.
- Type
- string
getSavedFilterPreference() → {string|null}
Retrieves the saved filter preference from localStorage
- Source:
Returns:
The saved filter status or null if not found
- Type
- string | null
getSavedSortPreference() → {string|null}
Retrieves the saved sorting preference from localStorage
- Source:
Returns:
The saved sorting option or null if not found
- Type
- string | null
initSortingControls()
Initializes sorting controls when the page loads
- Source:
loadMockData()
Loads mock application data into localStorage for testing purposes.
This function will add mock applications to existing data instead of replacing it.
- Source:
openModal(data)
Populate and display the details modal for a job application.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The job application data to show. |
- Source:
populateFormForEdit(job)
Populate form fields with data for editing an existing application.
Parameters:
Name | Type | Description |
---|---|---|
job |
Object | The job data to load into the form. |
- Source:
renderCards(jobsopt)
Render job application cards based on provided jobs and current filter.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
jobs |
Array.<Object> |
<optional> |
Array of job objects to render; defaults to localStorage data. |
- Source:
saveFilterPreference(filterStatus)
Saves the filter preference to localStorage
Parameters:
Name | Type | Description |
---|---|---|
filterStatus |
string | The filter status |
- Source:
saveSortPreference(sortOption)
Saves the sorting preference to localStorage
Parameters:
Name | Type | Description |
---|---|---|
sortOption |
string | The sorting option key |
- Source:
setupModal()
Configure modal open/close behaviors (click outside, close button, Escape key).
- Source:
showErrorMessage(message)
Show an error message to the user
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The error message to display |
- Source:
showSuccessMessage(message)
Show a success message to the user
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The success message to display |
- Source:
sortApplications(applications, sortOption) → {Array}
Sorts applications based on the selected option
Parameters:
Name | Type | Description |
---|---|---|
applications |
Array | Array of application objects |
sortOption |
string | The sorting option key |
- Source:
Returns:
Sorted array of applications
- Type
- Array
updateApplication(applicationId, updatedData) → {Object|null}
Updates an existing job application in localStorage
Parameters:
Name | Type | Description |
---|---|---|
applicationId |
string | The ID of the application to update |
updatedData |
Object | New data to merge |
- Source:
Returns:
Updated application object or null if not found
- Type
- Object | null
updateCardInDOM(applicationId)
Update a specific job-app-card element in the DOM after an application update.
Parameters:
Name | Type | Description |
---|---|---|
applicationId |
string | The ID of the updated application. |
- Source: