Skip to content

Commit

Permalink
Merge pull request #28 from SaqibSyed1014/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
SaqibSyed1014 authored Aug 18, 2024
2 parents 816d857 + f6b5d32 commit 3f1459b
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 91 deletions.
74 changes: 0 additions & 74 deletions components/core/constants/jobs.constants.ts
Original file line number Diff line number Diff line change
@@ -1,78 +1,4 @@
export const jobFilters :JobFilter[] = [
{
fieldName: 'job_role',
type: 'checkbox',
title: 'Role Type',
icon: 'SvgoBarChart',
list: [
{
label: 'Bartender',
value: 'Bartender',
checked: false,
counts: 0
},
{
label: 'Barback',
value: 'Barback',
checked: false,
counts: 0
},
{
label: 'Cook',
value: 'Cook',
checked: false,
counts: 0
},
{
label: 'Chef',
value: 'Chef',
checked: false,
counts: 0
},
{
label: 'Waiter',
value: 'Waiter',
checked: false,
counts: 0
},
{
label: 'Host',
value: 'Host',
checked: false,
counts: 0
},
{
label: 'Dishwasher',
value: 'Dishwasher',
checked: false,
counts: 0
},
{
label: 'Server',
value: 'Server',
checked: false,
counts: 0
},
{
label: 'Busser',
value: 'Busser',
checked: false,
counts: 0
},
{
label: 'Food Runner',
value: 'Food Runner',
checked: false,
counts: 0
},
{
label: 'Restaurant Manager',
value: 'Restaurant Manager',
checked: false,
counts: 0
},
]
},
{
fieldName: 'experience_level',
type: 'checkbox',
Expand Down
5 changes: 1 addition & 4 deletions components/pages/job-listings/JobCTA.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ const userType = useState('userType')
<ul class="flex flex-col gap-4 mb-6 md:mb-12 md:text-lg">
<template v-for="item in checkList">
<li class="flex lg:items-center gap-3">
<svg class="shrink-0" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 28 28" fill="none">
<rect width="28" height="28" rx="14" fill="#C2D4FD"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.9476 8.62193L11.5943 16.6836L9.37763 14.3153C8.9693 13.9303 8.32763 13.9069 7.86096 14.2336C7.40596 14.5719 7.27763 15.1669 7.55763 15.6453L10.1826 19.9153C10.4393 20.3119 10.8826 20.5569 11.3843 20.5569C11.8626 20.5569 12.3176 20.3119 12.5743 19.9153C12.9943 19.3669 21.0093 9.81193 21.0093 9.81193C22.0593 8.7386 20.7876 7.7936 19.9476 8.61027V8.62193Z" fill="#3669E4"/>
</svg>
<SvgoCheckMark class="size-8 text-brand-600" />
{{ item }}
</li>
</template>
Expand Down
3 changes: 2 additions & 1 deletion components/pages/job-listings/JobPostingJSONLD.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const props = defineProps<{ jobData: Job }>();
function convertDateFormat(dateString: string): string {
const [monthName, day, year] = dateString.split(/,\s|\s/);
console.log('rr ', monthName, day, year, dateString)
const months: { [key: string]: number } = {
January: 0,
February: 1,
Expand All @@ -17,7 +18,7 @@ function convertDateFormat(dateString: string): string {
November: 10,
December: 11,
};
const monthIndex = months[monthName];
const monthIndex = months[monthName.replace(',', '')];
if (monthIndex === undefined) throw new Error(`Invalid month name: ${monthName}`);
const date = new Date(Date.UTC(Number(year), monthIndex, Number(day)));
const isoDate = date.toISOString();
Expand Down
2 changes: 1 addition & 1 deletion pages/blog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const splitBlogs = computed(() => {
watch(() => selectedCategory.value, async (val :string) => {
showBlogsLoader.value = true;
pageInfo.value.currentPage = 1;
await blogsStore.fetchBlogs(pageInfo.value, searchedBlog.value, val);
await blogsStore.fetchBlogs(pageInfo.value, searchedBlog.value, encodeURIComponent(val));
pageInfo.value.totalPages = pagination.value.pageCount;
showBlogsLoader.value = false;
})
Expand Down
1 change: 0 additions & 1 deletion pages/jobs/[id]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { initModals } from 'flowbite'
import {useJobStore} from "~/segments/jobs/store";
import QuickSignUpModal from "~/components/pages/job-listings/QuickSignUpModal.vue";
import BaseSpinner from "~/components/core/BaseSpinner.vue";
import {convertTZDateToShortDate} from "~/segments/utils";
import {defaultImageMockup} from "~/components/core/constants/common.constants";
const center = ref({ lat: 0, lng: 0 })
Expand Down
10 changes: 6 additions & 4 deletions pages/jobs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const jobStore = useJobStore();
const homeStore = useHomeStore();
const { jobListings, facetCounts, totalPages, coordinates } = storeToRefs(jobStore);
const { employmentTypesFilter, businessTypesFilter, shiftTypesFilter } = storeToRefs(homeStore);
const { employmentTypesFilter, businessTypesFilter, shiftTypesFilter, roleTypesFilter } = storeToRefs(homeStore);
const layoutOptionSelected = ref(0);
const searchedLocationText = ref('');
Expand All @@ -46,7 +46,7 @@ const initialQuery = {
page: pageInfo.value.currentPage,
per_page: pageInfo.value.itemsPerPage,
sort_by: 'date_posted:desc',
facet_by: 'employment_type_id,job_role,experience_level,business_type_id,shift_type_id',
facet_by: 'employment_type_id,job_role_id,experience_level,business_type_id,shift_type_id',
filter_by: ''
};
const query = ref<TypesenseQueryParam>(initialQuery);
Expand Down Expand Up @@ -101,15 +101,17 @@ async function fetchFilters() {
await Promise.all([
homeStore.fetchEmploymentTypes(),
homeStore.fetchBusinessTypes(),
homeStore.fetchShiftTypes()
homeStore.fetchShiftTypes(),
homeStore.fetchRoleTypes()
]);
console.log('filters ', filters.value)
if (filters.value[0].fieldName !== 'employment_type_id') // check to avoid duplicate occurrence of employment type filter
filters.value.unshift(employmentTypesFilter.value);
if (filters.value[1].fieldName !== 'business_type_id') // check to avoid duplicate occurrence of business type filter
filters.value.splice(1, 0, businessTypesFilter.value);
if (filters.value[2].fieldName !== 'shift_type_id') // check to avoid duplicate occurrence of shift type filter
filters.value.splice(2, 0, shiftTypesFilter.value);
if (filters.value[3].fieldName !== 'job_role_id') // check to avoid duplicate occurrence of shift type filter
filters.value.splice(3, 0, roleTypesFilter.value);
}
onUnmounted(() => {
Expand Down
2 changes: 1 addition & 1 deletion segments/blogs/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const useBlogStore = defineStore('blogStore', {
} as BlogState),
actions: {
async fetchBlogs(pageInfo :PaginationInfo, queryVal :string = '', category :string = '') {
return await getBlogsList(pageInfo.currentPage, pageInfo.itemsPerPage, queryVal, category==='View All'? '':category)
return await getBlogsList(pageInfo.currentPage, pageInfo.itemsPerPage, queryVal, decodeURIComponent(category) === 'View All'? '':category)
.then(({data, meta }) => {
this.$state.blogs = data;
this.$state.pagination = meta.pagination
Expand Down
16 changes: 16 additions & 0 deletions segments/home/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,22 @@ export const useHomeStore = defineStore('homeStore', {
icon: 'SvgoClock',
list: filterList
}
},
roleTypesFilter: (state) => {
const filterList = state.roleTypes
?.map((role :RoleType) => ({
label: role.job_role,
value: role.job_role_id,
checked: false,
counts: 0
})) || []
return {
fieldName: 'job_role_id',
type: 'checkbox',
title: 'Role Type',
icon: 'SvgoBarChart',
list: filterList
}
}
}
})
8 changes: 4 additions & 4 deletions segments/jobs/store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {getJobDetails, getJobsList} from "~/segments/jobs/services";
import type {Coordinates, TypesenseQueryParam} from "~/segments/common.types";
import {convertUnixTimestamp} from "~/components/core/constants/jobs.constants";
import { convertRFCDateStringToLocaleDate } from "~/segments/utils";

interface JobsState {
jobsList: Job[]
Expand Down Expand Up @@ -52,9 +52,9 @@ export const useJobStore = defineStore('jobStore', {
if (jobDetail)
return {
...jobDetail,
application_deadline: jobDetail?.application_deadline ? jobDetail.application_deadline.slice(0, jobDetail.application_deadline.indexOf('00:00:00')) : '',
date_posted: jobDetail?.date_posted.slice(0, jobDetail.date_posted.indexOf('00:00:00'))
}
application_deadline: jobDetail?.application_deadline ? convertRFCDateStringToLocaleDate(jobDetail.application_deadline) : '',
date_posted: convertRFCDateStringToLocaleDate(jobDetail?.date_posted)
}
else return null
},
jobFaqs: (state) :JobFaq[] => {
Expand Down
7 changes: 6 additions & 1 deletion segments/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Router } from "vue-router";
import type {Router} from "vue-router";

export const usePayloadUrl = () => {
const config = useRuntimeConfig()
Expand Down Expand Up @@ -29,6 +29,11 @@ export function convertTZDateToShortDate(givenDate :Date | string) {
return (date.getMonth() + 1).toString().padStart(2, '0') + '/' + date.getDate().toString().padStart(2, '0') + '/' + date.getFullYear();
}

export function convertRFCDateStringToLocaleDate(dateString :string) {
const dateParts = dateString.split(' '); // converting MM, dd yyyy 00:00:00 +0000 to just MM, dd yyyy format
return `${dateParts[0]}, ${dateParts[1]} ${dateParts[2]}`;
}

export function getDaysDifference(givenDateString :Date | string) :string {
const givenDate :any = new Date(givenDateString);
const currentDate :any = new Date();
Expand Down

0 comments on commit 3f1459b

Please sign in to comment.