Merge commit 'ea07766fd8'
# Conflicts: # cms/src/routes/competitive/+page.server.ts
This commit is contained in:
commit
29b760f8b6
13 changed files with 59 additions and 128 deletions
|
|
@ -8,7 +8,7 @@ export interface Exam {
|
|||
exam_date?:string;
|
||||
announcement_date?:string;
|
||||
category_id?:string
|
||||
category?:string
|
||||
category:string
|
||||
image?:string;
|
||||
images?:{title:string,url:string}[];
|
||||
files?:{title:string,url:string}[];
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
# กองสรรหาบุคคล
|
||||
## (Recruitment Division)
|
||||
มีหน้าที่รับผิดชอบเกี่ยวกับการสรรหาและเลือกสรร บุคคลเข้ารับราชการเป็นข้าราชการกรุงเทพมหานครสามัญ และข้าราชการครูกรุงเทพมหานครเฉพาะสังกัดสำนักพัฒนาชุมชน การดำเนินการเกี่ยวกับทุน จากแหล่งทุนภายนอกการดำเนินการเกี่ยวกับมาตรฐานคุณสมบัติบุคคและปฎิบัติหน้าที่อื่นที่เกี่ยวข้อง โดยแบ่งงานภายในส่วนราชการดังนี้
|
||||
|
||||
## กลุ่มงานวิชาการการสอบ
|
||||
ศึกษาวิจัย ข้อสอบเทคนิกการวัดผมและประมวลผล สร้างและพัฒนาระบบคังข้อสอบรวมถึงจัดทำฐานข้อมูลด้วยระบบอีเล็กทรอนิก
|
||||
|
||||
## กลุ่มงานดำเนินการสรรหา 1
|
||||
ดำเนินการสอบและสรรหาบุคคลเข้ารับราชการครูและบุคคลากรทางการศึกษา ออกหนังสือรับรองผล จัดทำและปรับปรุงหลักเกณท์วิธีการสอบและการคัดเลือก
|
||||
|
||||
|
||||
## กลุ่มงานดำเนินการสรรหา 2
|
||||
ดำเนินการสอบและสรรหาบุคคลเข้ารับราชการเป็นข้าราชการกรุงเทพมหานครสามัญ รวมถึงดำเนินการสอบวัดควสามรู้ความสามารถเฉพาะตำแหน่ง
|
||||
จัดทำ และปรับปรุงหลักเกณท์วิธีการสอบและการคัดเลือก พิจจารณาการให้ทุนจากภัยนอกแก่ข้าราชการกรุงเทพมหานคร
|
||||
|
||||
ฝ่ายบริหารงานทั่วไป
|
||||
งานด้านสารบรรณ ธุรการทั่วไป การจัดประชุม ควบคุมดูแลสถานที่และยานพาหนะ การเงิน บัญชี งบประมาณบัญชี งบประมาณบัญชีและพัสดุ
|
||||
จัดทำรายงาน และประเมินผลแผนปฎิบัติราชการประจำปี
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
import users from "./users.json"
|
||||
let userid =100
|
||||
|
||||
export interface User {
|
||||
id: number;
|
||||
email: string;
|
||||
username: string;
|
||||
name:string;
|
||||
last_name: string;
|
||||
phone:string
|
||||
}
|
||||
export async function getUser(id:number){
|
||||
return users.find(u=>u.id===id)
|
||||
}
|
||||
export async function getUsers(){
|
||||
return users
|
||||
}
|
||||
export async function createUser(u:User){
|
||||
u.id= userid++
|
||||
return users.push(u)
|
||||
}
|
||||
export async function updateUser(u:User){
|
||||
const user = await getUser(u.id)
|
||||
if(!user)
|
||||
return user
|
||||
user.phone = u.phone
|
||||
return user
|
||||
}
|
||||
15
cms/src/lib/utils.ts
Normal file
15
cms/src/lib/utils.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* getColorDict()
|
||||
* get color base on name, add to nameColor if name not exist.
|
||||
* Use for event background color of FullCalendar
|
||||
* @param name string of color name
|
||||
* @param nameColor dictionary like object for name and color
|
||||
*/
|
||||
export function getBgColorDict(name:string,nameColor:{ [index: string]:string}){
|
||||
const eventBg = ["#beffbf","#c6ebfe","#ffbebe","rgba(64,251,75,.2)"]
|
||||
if(!nameColor[name]){
|
||||
const len = Object.keys(nameColor).length
|
||||
nameColor[name]=len>eventBg.length?eventBg[0]:eventBg[len]
|
||||
}
|
||||
return nameColor[name]
|
||||
}
|
||||
|
|
@ -13,7 +13,6 @@ export const load: PageServerLoad = async ({fetch}) => {
|
|||
if(!res.ok)
|
||||
throw error(500, 'ไม่สามารถอ่านเนื้อหาหน้าหลักได้');
|
||||
const {content,image} = await res.json()
|
||||
console.log("xxx",image)
|
||||
//Inner function reduce code and able to throw here
|
||||
async function loadExam(api_path:string,err_msg:string){
|
||||
const res = await fetch(api_path)
|
||||
|
|
@ -26,7 +25,7 @@ export const load: PageServerLoad = async ({fetch}) => {
|
|||
})
|
||||
//This page layout require 3 item, patch with empty
|
||||
for(let i=exams.length;i<3;i++){
|
||||
exams.push({id:"0",title:"",date:"",image:"/images/exam_place_holder.png"})
|
||||
exams.push({id:"0",title:"",date:"",category:" ",image:"/images/exam_place_holder.png"})
|
||||
}
|
||||
return exams
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
import type { RequestEvent, RequestHandler } from './$types'
|
||||
import {json} from '@sveltejs/kit'
|
||||
import { createUser, getUsers } from '$lib/data/users'
|
||||
|
||||
//api/users
|
||||
export const POST: RequestHandler = async ({ request }: RequestEvent) => {
|
||||
const data = await request.json()
|
||||
return json(await createUser( data))
|
||||
}
|
||||
export const GET: RequestHandler = async () => {
|
||||
return json(await getUsers())
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
import type { RequestEvent, RequestHandler } from './$types'
|
||||
import {json} from '@sveltejs/kit'
|
||||
import { getUser, updateUser } from '$lib/data/users'
|
||||
|
||||
//api/users/1
|
||||
export const PUT: RequestHandler = async ({ request }: RequestEvent) => {
|
||||
const o = await request.json()
|
||||
if(!updateUser(o))
|
||||
return json({message:"call updateUser fail "},{status:400})
|
||||
return json({message:"Update Success"})
|
||||
}
|
||||
export const GET: RequestHandler = async ({params}: RequestEvent) => {
|
||||
const id = Number(params.id)
|
||||
const u = await getUser(id)
|
||||
if(!u)
|
||||
return json({message:`User ${id} not found`},{status:404})
|
||||
return json(u)
|
||||
}
|
||||
|
||||
|
|
@ -1,32 +1,22 @@
|
|||
import {competitiveBase} from '$lib/data/CMSDataType'
|
||||
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}) => {
|
||||
let exams:Exam[] = []
|
||||
const res = await fetch(competitiveBase+"/competitive")
|
||||
if(!res.ok)
|
||||
throw error(res.status, 'ไม่สามารถอ่านข้อมูลการสอบได้');
|
||||
exams = await res.json()
|
||||
|
||||
|
||||
const exams:Exam[] = await res.json()
|
||||
const events:CalendarEvent[]=[]
|
||||
const catColor = {};
|
||||
exams.forEach((ex)=>{
|
||||
const {id,title,start,end,category_id} = ex
|
||||
let backgroundColor ="#c6ebfe"
|
||||
switch (String(category_id)) {
|
||||
case "1":
|
||||
backgroundColor="#beffbf"
|
||||
break;
|
||||
case "2":
|
||||
backgroundColor="#c6ebfe"
|
||||
break;
|
||||
case "3":
|
||||
backgroundColor="#ffbebe"
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
const {id,title,start,end,category} = ex
|
||||
if(!category)
|
||||
return
|
||||
const backgroundColor = getBgColorDict(category,catColor)
|
||||
const url = "/competitive/"+id
|
||||
if(start){
|
||||
ex.date = dayjs(start).format("DD MMM BBBB")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import {competitiveBase} from '$lib/data/CMSDataType'
|
||||
import type {Exam} from '$lib/data/CMSDataType'
|
||||
import { error } from '@sveltejs/kit'
|
||||
import dayjs from 'dayjs'
|
||||
import type { PageServerLoad } from './$types'
|
||||
|
|
@ -11,7 +12,7 @@ export const load: PageServerLoad = async ({params,fetch}) => {
|
|||
if(!res.ok){
|
||||
throw error(500,{message:`พบข้อผิดพลาดเกี่ยวกับข้อมูลสอบคัดเลือก ${id}`})
|
||||
}
|
||||
const post = await res.json()
|
||||
const post:Exam = await res.json()
|
||||
post.date= post.start? dayjs(post.start).format("DD MMM BBBB"):""
|
||||
return post
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,12 +34,17 @@
|
|||
<div class="">
|
||||
{@html data.detail}
|
||||
</div>
|
||||
{#if data.images}
|
||||
{#each data.images as i}
|
||||
<div><img src={i.url} alt={i.title}></div>
|
||||
{/each}
|
||||
{/if}
|
||||
{#if data.files}
|
||||
{#each data.files as file}
|
||||
<hr class="border-blueGray-200 mb-4 mt-4" />
|
||||
<div class="text-lg py-1">
|
||||
<i class="fa-solid fa-bookmark mr-3 text-xs text-blue-400"></i><a href={file.url} class="text-blue-400 hover:text-blue-600" target="_blank">คลิกที่นี่เพื่ออ่าน </a> <span class="font-medium">{file.title}</span>
|
||||
</div>
|
||||
<hr class="border-blueGray-200 mb-4 mt-4" />
|
||||
<div class="text-lg py-1">
|
||||
<i class="fa-solid fa-bookmark mr-3 text-xs text-blue-400"></i><a href={file.url} class="text-blue-400 hover:text-blue-600" target="_blank">คลิกที่นี่เพื่ออ่าน </a> <span class="font-medium">{file.title}</span>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
<hr class="border-blueGray-200 my-7" />
|
||||
|
|
@ -51,5 +56,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
|
@ -1,36 +1,28 @@
|
|||
import {qualifyingBase} from '$lib/data/CMSDataType'
|
||||
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}) => {
|
||||
let exams:Exam[] = []
|
||||
const res = await fetch(qualifyingBase+"/qualifying")
|
||||
if(!res.ok)
|
||||
throw error(res.status, 'ไม่สามารถอ่านข้อมูลการสอบได้');
|
||||
exams = await res.json()
|
||||
|
||||
const exams:Exam[] = await res.json()
|
||||
const catColor = {};
|
||||
const events:CalendarEvent[]=[]
|
||||
|
||||
exams.forEach((ex)=>{
|
||||
const {id,title,start,end,category_id} = ex
|
||||
let backgroundColor ="#23ccef"
|
||||
switch (String(category_id)) {
|
||||
case "1":
|
||||
backgroundColor="rgba(251,64,75,.2)"
|
||||
break;
|
||||
case "2":
|
||||
backgroundColor="#23ccef"
|
||||
break;
|
||||
case "3":
|
||||
backgroundColor="rgba(68,125,247,.2)"
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
const {id,title,start,end,category} = ex
|
||||
if(!category)
|
||||
return
|
||||
const backgroundColor = getBgColorDict(category,catColor)
|
||||
|
||||
const url = "/qualifying/"+id
|
||||
if(start){
|
||||
ex.date = dayjs(start).format("DD MMM BBBB")
|
||||
events.push({id,title,start,end,url,backgroundColor})
|
||||
console.log({id,title,start,end,url,backgroundColor})
|
||||
events.push({id,title,start,url,backgroundColor})
|
||||
}
|
||||
if(ex.exam_date){
|
||||
events.push({id,"title":"วันสอบคัดเลือก","start":ex.exam_date,url,backgroundColor})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import {qualifyingBase} from '$lib/data/CMSDataType'
|
||||
import type {Exam} from '$lib/data/CMSDataType'
|
||||
import { error } from '@sveltejs/kit'
|
||||
import dayjs from 'dayjs'
|
||||
import type { PageServerLoad } from './$types'
|
||||
|
|
@ -11,7 +12,7 @@ export const load: PageServerLoad = async ({params,fetch}) => {
|
|||
if(!res.ok){
|
||||
throw error(500,{message:`พบข้อผิดพลาดเกี่ยวกับข้อมูลสอบคัดเลือก ${id}`})
|
||||
}
|
||||
const post = await res.json()
|
||||
const post:Exam = await res.json()
|
||||
post.date= post.start? dayjs(post.start).format("DD MMM BBBB"):""
|
||||
return post
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,12 +34,18 @@
|
|||
<div class="">
|
||||
{@html data.detail}
|
||||
</div>
|
||||
{#if data.images}
|
||||
{#each data.images as i}
|
||||
<div><img src={i.url} alt={i.title}></div>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
{#if data.files}
|
||||
{#each data.files as file}
|
||||
<hr class="border-blueGray-200 mb-4 mt-4" />
|
||||
<div class="text-lg py-1">
|
||||
<i class="fa-solid fa-bookmark mr-3 text-xs text-blue-400"></i><a href={file.url} class="text-blue-400 hover:text-blue-600" target="_blank">คลิกที่นี่เพื่ออ่าน </a> <span class="font-medium">{file.title}</span>
|
||||
</div>
|
||||
<hr class="border-blueGray-200 mb-4 mt-4" />
|
||||
<div class="text-lg py-1">
|
||||
<i class="fa-solid fa-bookmark mr-3 text-xs text-blue-400"></i><a href={file.url} class="text-blue-400 hover:text-blue-600" target="_blank">คลิกที่นี่เพื่ออ่าน </a> <span class="font-medium">{file.title}</span>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
<hr class="border-blueGray-200 my-7" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue