mirror of
https://github.com/frappe/lms.git
synced 2026-05-02 13:39:31 +03:00
feat: open to hiring
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
}"
|
||||
>
|
||||
<template #body-content>
|
||||
<div>
|
||||
<div class="text-base">
|
||||
<div class="grid grid-cols-2 gap-10">
|
||||
<div>
|
||||
<div class="text-xs text-ink-gray-5 mb-1">
|
||||
@@ -54,14 +54,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Switch
|
||||
v-model="profile.looking_for_job"
|
||||
<FormControl
|
||||
v-model="profile.open_to"
|
||||
type="select"
|
||||
:options="[' ', 'Opportunities', 'Hiring']"
|
||||
:label="__('Open to')"
|
||||
:placeholder="__('Looking for new work or hiring talent?')"
|
||||
/>
|
||||
<!-- <Switch
|
||||
v-model="profile.open_to"
|
||||
:label="__('Open to Opportunities')"
|
||||
:description="
|
||||
__('Show recruiters and others that you are open to work.')
|
||||
"
|
||||
class="!px-0"
|
||||
/>
|
||||
/> -->
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-10">
|
||||
@@ -151,7 +158,7 @@ const profile = reactive({
|
||||
headline: '',
|
||||
bio: '',
|
||||
image: '',
|
||||
looking_for_job: false,
|
||||
open_to: '',
|
||||
linkedin: '',
|
||||
github: '',
|
||||
twitter: '',
|
||||
@@ -231,7 +238,7 @@ watch(
|
||||
profile.headline = newVal.headline
|
||||
profile.language = newVal.language
|
||||
profile.bio = newVal.bio
|
||||
profile.looking_for_job = newVal.looking_for_job
|
||||
profile.open_to = newVal.open_to
|
||||
profile.linkedin = newVal.linkedin
|
||||
profile.github = newVal.github
|
||||
profile.twitter = newVal.twitter
|
||||
|
||||
@@ -7,13 +7,20 @@
|
||||
:size="size"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<template v-if="user.looking_for_job" #indicator>
|
||||
<template v-if="user.open_to === 'Opportunities'" #indicator>
|
||||
<Tooltip :text="__('Open to Opportunities')" placement="right">
|
||||
<div class="rounded-full bg-surface-green-3 w-fit">
|
||||
<BadgeCheckIcon :class="'text-ink-white ' + checkSize" />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</template>
|
||||
<template v-else-if="user.open_to === 'Hiring'" #indicator>
|
||||
<Tooltip :text="__('Hiring')" placement="right">
|
||||
<div class="rounded-full bg-purple-500 w-fit">
|
||||
<BadgeCheckIcon :class="'text-ink-white ' + checkSize" />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</template>
|
||||
</Avatar>
|
||||
</template>
|
||||
<script setup>
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
</header>
|
||||
<div class="mx-auto w-full max-w-4xl pt-6 pb-10">
|
||||
<div class="flex flex-col md:flex-row justify-between mb-4 px-3">
|
||||
<div class="text-xl font-semibold text-ink-gray-7 mb-4 md:mb-0">
|
||||
<div class="text-xl font-semibold text-ink-gray-9 mb-4 md:mb-0">
|
||||
{{ memberCount }} {{ __('certified members') }}
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="flex items-center space-x-4">
|
||||
<FormControl
|
||||
v-model="nameFilter"
|
||||
:placeholder="__('Search by Name')"
|
||||
@@ -36,13 +36,25 @@
|
||||
@update:modelValue="updateParticipants()"
|
||||
/>
|
||||
</div>
|
||||
<FormControl
|
||||
v-model="openToOpportunities"
|
||||
:label="__('Open to Opportunities')"
|
||||
type="checkbox"
|
||||
@change="updateParticipants()"
|
||||
/>
|
||||
<FormControl
|
||||
v-model="hiring"
|
||||
:label="__('Hiring')"
|
||||
type="checkbox"
|
||||
@change="updateParticipants()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="participants.data?.length" class="">
|
||||
<template v-for="(participant, index) in participants.data">
|
||||
<router-link
|
||||
:to="{
|
||||
name: 'ProfileCertificates',
|
||||
name: 'ProfileAbout',
|
||||
params: {
|
||||
username: participant.username,
|
||||
},
|
||||
@@ -118,9 +130,11 @@ import { sessionStore } from '../stores/session'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import UserAvatar from '@/components/UserAvatar.vue'
|
||||
|
||||
const currentCategory = ref('')
|
||||
const filters = ref({})
|
||||
const currentCategory = ref('')
|
||||
const nameFilter = ref('')
|
||||
const openToOpportunities = ref(false)
|
||||
const hiring = ref(false)
|
||||
const { brand } = sessionStore()
|
||||
const memberCount = ref(0)
|
||||
const dayjs = inject('$dayjs')
|
||||
@@ -152,7 +166,7 @@ const categories = createListResource({
|
||||
cache: ['certification_categories'],
|
||||
auto: true,
|
||||
transform(data) {
|
||||
data.unshift({ label: __(''), value: '' })
|
||||
data.unshift({ label: __(' '), value: ' ' })
|
||||
return data
|
||||
},
|
||||
})
|
||||
@@ -169,16 +183,19 @@ const updateParticipants = () => {
|
||||
}
|
||||
|
||||
const updateFilters = () => {
|
||||
if (currentCategory.value) {
|
||||
filters.value.category = currentCategory.value
|
||||
} else {
|
||||
delete filters.value.category
|
||||
}
|
||||
|
||||
if (nameFilter.value) {
|
||||
filters.value.member_name = ['like', `%${nameFilter.value}%`]
|
||||
} else {
|
||||
delete filters.value.member_name
|
||||
filters.value = {
|
||||
...(currentCategory.value && {
|
||||
category: currentCategory.value,
|
||||
}),
|
||||
...(nameFilter.value && {
|
||||
member_name: ['like', `%${nameFilter.value}%`],
|
||||
}),
|
||||
...(openToOpportunities.value && {
|
||||
open_to_opportunities: true,
|
||||
}),
|
||||
...(hiring.value && {
|
||||
hiring: true,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +207,7 @@ const setQueryParams = () => {
|
||||
}
|
||||
|
||||
Object.keys(filterKeys).forEach((key) => {
|
||||
if (filterKeys[key]) {
|
||||
if (filterKeys[key] && filterKeys[key].trim() !== '') {
|
||||
queries.set(key, filterKeys[key])
|
||||
} else {
|
||||
queries.delete(key)
|
||||
@@ -207,6 +224,8 @@ const setFiltersFromQuery = () => {
|
||||
let queries = new URLSearchParams(location.search)
|
||||
nameFilter.value = queries.get('name') || ''
|
||||
currentCategory.value = queries.get('category') || ''
|
||||
openToOpportunities.value = queries.get('open-to-opportunities') === 'true'
|
||||
hiring.value = queries.get('hiring') === 'true'
|
||||
}
|
||||
|
||||
const breadcrumbs = computed(() => [
|
||||
|
||||
@@ -56,15 +56,32 @@
|
||||
:src="profile.data.user_image"
|
||||
class="object-cover h-[100px] w-[100px] rounded-full border-4 border-white object-cover"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
class="flex items-center justify-center h-[100px] w-[100px] rounded-full border-4 border-white bg-surface-gray-2 text-3xl font-semibold text-ink-gray-7"
|
||||
>
|
||||
{{ profile.data.full_name.charAt(0).toUpperCase() }}
|
||||
</div>
|
||||
<Tooltip
|
||||
v-if="profile.data.looking_for_job"
|
||||
:text="__('Open to Opportunities')"
|
||||
v-if="profile.data.open_to"
|
||||
:text="
|
||||
profile.data.open_to === 'Opportunities'
|
||||
? __('Open to Opportunities')
|
||||
: __('Hiring')
|
||||
"
|
||||
placement="right"
|
||||
>
|
||||
<div
|
||||
class="absolute bottom-3 right-1 p-0.5 bg-surface-white rounded-full"
|
||||
>
|
||||
<div class="rounded-full bg-surface-green-3 w-fit">
|
||||
<div
|
||||
class="rounded-full w-fit"
|
||||
:class="
|
||||
profile.data.open_to === 'Opportunities'
|
||||
? 'bg-surface-green-3'
|
||||
: 'bg-purple-500'
|
||||
"
|
||||
>
|
||||
<BadgeCheckIcon class="text-ink-white size-5" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -238,8 +238,8 @@
|
||||
"dt": "User",
|
||||
"fetch_from": null,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "looking_for_job",
|
||||
"fieldtype": "Check",
|
||||
"fieldname": "open_to",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"hide_border": 0,
|
||||
"hide_days": 0,
|
||||
@@ -253,16 +253,16 @@
|
||||
"insert_after": "verify_terms",
|
||||
"is_system_generated": 1,
|
||||
"is_virtual": 0,
|
||||
"label": "Open to Opportunities",
|
||||
"label": "Open to",
|
||||
"length": 0,
|
||||
"link_filters": null,
|
||||
"mandatory_depends_on": null,
|
||||
"modified": "2021-12-31 12:56:32.110405",
|
||||
"modified": "2025-12-24 12:56:32.110405",
|
||||
"module": null,
|
||||
"name": "User-looking_for_job",
|
||||
"name": "User-open_to",
|
||||
"no_copy": 0,
|
||||
"non_negative": 0,
|
||||
"options": null,
|
||||
"options": "\nOpportunities\nHiring",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ def delete_custom_fields():
|
||||
"medium",
|
||||
"linkedin",
|
||||
"profession",
|
||||
"looking_for_job",
|
||||
"open_to",
|
||||
"cover_image" "work_environment",
|
||||
"dream_companies",
|
||||
"career_preference_column",
|
||||
|
||||
+56
-20
@@ -281,17 +281,7 @@ def get_evaluator_details(evaluator):
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_certified_participants(filters=None, start=0, page_length=100):
|
||||
or_filters = {}
|
||||
if not filters:
|
||||
filters = {}
|
||||
|
||||
filters.update({"published": 1})
|
||||
|
||||
category = filters.get("category")
|
||||
if category:
|
||||
del filters["category"]
|
||||
or_filters["course_title"] = ["like", f"%{category}%"]
|
||||
or_filters["batch_title"] = ["like", f"%{category}%"]
|
||||
filters, or_filters, open_to_opportunities, hiring = update_certification_filters(filters)
|
||||
|
||||
participants = frappe.db.get_all(
|
||||
"LMS Certificate",
|
||||
@@ -305,16 +295,62 @@ def get_certified_participants(filters=None, start=0, page_length=100):
|
||||
)
|
||||
|
||||
for participant in participants:
|
||||
count = frappe.db.count("LMS Certificate", {"member": participant.member})
|
||||
details = frappe.db.get_value(
|
||||
"User",
|
||||
participant.member,
|
||||
["full_name", "user_image", "username", "country", "headline", "looking_for_job"],
|
||||
as_dict=1,
|
||||
)
|
||||
details["certificate_count"] = count
|
||||
details = get_certified_participant_details(participant.member)
|
||||
participant.update(details)
|
||||
|
||||
participants = filter_by_open_to_criteria(participants, open_to_opportunities, hiring)
|
||||
|
||||
return participants
|
||||
|
||||
|
||||
def update_certification_filters(filters):
|
||||
open_to_opportunities = False
|
||||
hiring = False
|
||||
or_filters = {}
|
||||
if not filters:
|
||||
filters = {}
|
||||
|
||||
filters.update({"published": 1})
|
||||
|
||||
category = filters.get("category")
|
||||
if category:
|
||||
del filters["category"]
|
||||
or_filters["course_title"] = ["like", f"%{category}%"]
|
||||
or_filters["batch_title"] = ["like", f"%{category}%"]
|
||||
|
||||
if filters.get("open_to_opportunities"):
|
||||
del filters["open_to_opportunities"]
|
||||
open_to_opportunities = True
|
||||
|
||||
if filters.get("hiring"):
|
||||
del filters["hiring"]
|
||||
hiring = True
|
||||
|
||||
return filters, or_filters, open_to_opportunities, hiring
|
||||
|
||||
|
||||
def get_certified_participant_details(member):
|
||||
count = frappe.db.count("LMS Certificate", {"member": member})
|
||||
details = frappe.db.get_value(
|
||||
"User",
|
||||
member,
|
||||
["full_name", "user_image", "username", "country", "headline", "open_to"],
|
||||
as_dict=1,
|
||||
)
|
||||
details["certificate_count"] = count
|
||||
return details
|
||||
|
||||
|
||||
def filter_by_open_to_criteria(participants, open_to_opportunities, hiring):
|
||||
if not open_to_opportunities and not hiring:
|
||||
return participants
|
||||
|
||||
if open_to_opportunities:
|
||||
participants = [participant for participant in participants if participant.open_to == "Opportunities"]
|
||||
|
||||
if hiring:
|
||||
participants = [participant for participant in participants if participant.open_to == "Hiring"]
|
||||
|
||||
return participants
|
||||
|
||||
|
||||
@@ -1635,7 +1671,7 @@ def get_profile_details(username):
|
||||
"headline",
|
||||
"language",
|
||||
"cover_image",
|
||||
"looking_for_job",
|
||||
"open_to",
|
||||
"linkedin",
|
||||
"github",
|
||||
"twitter",
|
||||
|
||||
+2
-1
@@ -113,4 +113,5 @@ lms.patches.v2_0.enable_programming_exercises_in_sidebar
|
||||
lms.patches.v2_0.count_in_program
|
||||
lms.patches.v2_0.fix_scorm_lesson_reference_idx #02-09-2025
|
||||
lms.patches.v2_0.certified_members_to_certifications #05-10-2025
|
||||
lms.patches.v2_0.fix_job_application_resume_urls
|
||||
lms.patches.v2_0.fix_job_application_resume_urls
|
||||
lms.patches.v2_0.open_to_opportunities
|
||||
@@ -0,0 +1,10 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
looking_for_job = frappe.get_all("User", {"looking_for_job": 1}, ["name"])
|
||||
|
||||
for user in looking_for_job:
|
||||
frappe.db.set_value("User", user.name, "open_to", "Opportunities")
|
||||
|
||||
frappe.db.delete("Custom Field", {"dt": "User", "fieldname": "looking_for_job"})
|
||||
Reference in New Issue
Block a user