From c4ca7ad81cc72f16d72a21fc6e36279a05320c26 Mon Sep 17 00:00:00 2001 From: schooltechx Date: Fri, 16 Jun 2023 12:26:19 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=83=E0=B8=AB?= =?UTF-8?q?=E0=B9=89=E0=B8=AA=E0=B8=B5=E0=B8=82=E0=B8=AD=E0=B8=87=20event?= =?UTF-8?q?=20calendar=20=E0=B8=88=E0=B8=B2=E0=B8=81=E0=B9=80=E0=B8=94?= =?UTF-8?q?=E0=B8=B4=E0=B8=A1=E0=B9=83=E0=B8=8A=E0=B9=89=20category=20?= =?UTF-8?q?=E0=B9=84=E0=B8=9B=E0=B9=80=E0=B8=9B=E0=B9=87=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cms/src/lib/data/qualify-exam.json | 8 ++++---- cms/src/routes/competitive/+page.server.ts | 11 ++++------- cms/src/routes/qualifying/+page.server.ts | 11 ++++------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/cms/src/lib/data/qualify-exam.json b/cms/src/lib/data/qualify-exam.json index b1ecc73..5f17601 100644 --- a/cms/src/lib/data/qualify-exam.json +++ b/cms/src/lib/data/qualify-exam.json @@ -4,12 +4,12 @@ "category":"สำนักงาน ก.ก.","category_id":"1", "detail":"


ด่วน !! สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร ประกาศกำหนดวัน เวลา สถานที่คัดเลือก และระเบียบ เกี่ยวกับการคัดเลือกบุคลากรกรุงเทพมหานครหรือผู้ปฏิบัติงานอื่นในกรุงเทพมหานครเพื่อบรรจุและแต่งตั้ง เป็นข้าราชการกรุงเทพมหานครสามัญ ครั้งที่ 1 / 2565

", "announcement_startDate": "2023-04-01", - "announcement_endDate": "2023-05-15", + "announcement_endDate": "2023-04-15", "announcementExam": true, - "register_startDate": "2023-04-01", + "register_startDate": "2023-04-03", "register_endDate": "2023-04-10", - "payment_startDate": "2023-04-5", - "payment_endDate": "2023-04-10", + "payment_startDate": "2023-04-7", + "payment_endDate": "2023-04-15", "examDate": "2023-04-28", "positions":[ {"id":"2","title":"ผู้คุมงานทำความสะอาด","path":"2/21"} diff --git a/cms/src/routes/competitive/+page.server.ts b/cms/src/routes/competitive/+page.server.ts index 514348d..0cca374 100644 --- a/cms/src/routes/competitive/+page.server.ts +++ b/cms/src/routes/competitive/+page.server.ts @@ -1,7 +1,6 @@ import { env } from '$env/dynamic/private' import { error } from '@sveltejs/kit'; import type {CalendarEvent,Exam} from '$lib/data/CMSDataType' -import {getBgColorDict} from '$lib/utils' import dayjs from 'dayjs' import type { PageServerLoad } from './$types' export const load: PageServerLoad = async ({fetch}) => { @@ -9,12 +8,10 @@ export const load: PageServerLoad = async ({fetch}) => { if(!res.ok) throw error(res.status, 'ไม่สามารถอ่านข้อมูลการสอบได้'); const exams:Exam[] = await res.json() - const catColor = {}; const events:CalendarEvent[]=[] exams.forEach((ex)=>{ - const {id,title,category,announcement_startDate} = ex - const backgroundColor = category? getBgColorDict(category,catColor):"n/a" + const {id,title,announcement_startDate} = ex const url = "/qualifying/"+id ex.date = dayjs(announcement_startDate).format("DD MMM BBBB") ex.image = ex.image?ex.image:"/images/exam_place_holder.png" @@ -24,16 +21,16 @@ export const load: PageServerLoad = async ({fetch}) => { if(ex.register_startDate){ const start = ex.register_startDate const end = ex.register_endDate - events.push({id,"title":"สมัคร:"+title,start,end,url,backgroundColor}) + events.push({id,"title":"สมัคร:"+title,start,end,url,backgroundColor:'#67a1ff4a'}) } if(ex.payment_startDate){ const start = ex.payment_startDate const end = ex.payment_endDate - events.push({id,"title":"ชำระเงิน:"+title,start,end,url,backgroundColor}) + events.push({id,"title":"ชำระเงิน:"+title,start,end,url,backgroundColor:'#D2B4DE'}) } if(ex.examDate){ const start = ex.examDate - events.push({id,"title":"วันสอบ:"+title,start,url,backgroundColor}) + events.push({id,"title":"วันสอบ:"+title,start,url,backgroundColor:'#a2d9ce8f'}) } }) return {exams,events} diff --git a/cms/src/routes/qualifying/+page.server.ts b/cms/src/routes/qualifying/+page.server.ts index d413683..be10757 100644 --- a/cms/src/routes/qualifying/+page.server.ts +++ b/cms/src/routes/qualifying/+page.server.ts @@ -1,7 +1,6 @@ import { env } from '$env/dynamic/private' import { error } from '@sveltejs/kit'; import type {CalendarEvent,Exam} from '$lib/data/CMSDataType' -import {getBgColorDict} from '$lib/utils' import dayjs from 'dayjs' import type { PageServerLoad } from './$types' export const load: PageServerLoad = async ({fetch}) => { @@ -9,12 +8,10 @@ export const load: PageServerLoad = async ({fetch}) => { if(!res.ok) throw error(res.status, 'ไม่สามารถอ่านข้อมูลการสอบได้'); const exams:Exam[] = await res.json() - const catColor = {}; const events:CalendarEvent[]=[] exams.forEach((ex)=>{ - const {id,title,category,announcement_startDate} = ex - const backgroundColor = category? getBgColorDict(category,catColor):"n/a" + const {id,title,announcement_startDate} = ex const url = "/qualifying/"+id ex.date = dayjs(announcement_startDate).format("DD MMM BBBB") ex.image = ex.image?ex.image:"/images/exam_place_holder.png" @@ -24,16 +21,16 @@ export const load: PageServerLoad = async ({fetch}) => { if(ex.register_startDate){ const start = ex.register_startDate const end = ex.register_endDate - events.push({id,"title":"สมัคร:"+title,start,end,url,backgroundColor}) + events.push({id,"title":"สมัคร:"+title,start,end,url, backgroundColor:'#67a1ff4a'}) } if(ex.payment_startDate){ const start = ex.payment_startDate const end = ex.payment_endDate - events.push({id,"title":"ชำระเงิน:"+title,start,end,url,backgroundColor}) + events.push({id,"title":"ชำระเงิน:"+title,start,end,url,backgroundColor:'#D2B4DE'}) } if(ex.examDate){ const start = ex.examDate - events.push({id,"title":"วันสอบ:"+title,start,url,backgroundColor}) + events.push({id,"title":"วันสอบ:"+title,start,url,backgroundColor:'#a2d9ce8f'}) } }) return {exams,events}