ง่วงนอนไม่ไหว

This commit is contained in:
kamoa457 2023-11-08 04:36:13 +07:00
parent 659d6099f0
commit 63bb45452e
19 changed files with 2070 additions and 656 deletions

27
appserver/Expenses.json Normal file
View File

@ -0,0 +1,27 @@
[
{
"id": "3f7e1c45-a2e9-4b08-a56d-e687ea79ba61",
"firstName": "สมชัย14",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"building": "แฟลตบางเขน 1",
"floor": "2",
"roomnumber": "201",
"insurancecost": 254,
"installments": 266,
"waterbill": 150,
"electricitybill": 945,
"central": 500,
"costs": 200,
"sumCost":1000,
"typeContract": "หักได้",
"contract": "..."
}
]

348
appserver/building.json Normal file
View File

@ -0,0 +1,348 @@
[
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "อาคารแฟลต 1/11",
"sumroom": "24",
"committee": " มารุช ดีงาม , บารมี ดีงาม",
"floor": "4",
"roomnumber": "",
"type": "ช.2",
"listRoom": [
{
"floor": 1,
"rooms": [
{
"index": 1,
"numberRoom": 1,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ2",
"laststName": "มีดี",
"Affiliation": "ฝอ. 2",
"typeRoom": "ช1",
"status": "unavailable"
},
{
"index": 2,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"status": "free"
},
{
"index": 3,
"numberRoom": 3,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ2",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"status": "return"
},
{
"index": 4,
"numberRoom": 4,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ3",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"status": "unavailable"
},
{
"index": 5,
"numberRoom": 5,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"status": "free"
}
],
"sumroom": 5
},
{
"floor": 2,
"rooms": [
{
"index": 1,
"numberRoom": 1,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ9",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช3",
"status": "special"
},
{
"index": 2,
"numberRoom": 2,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ6",
"laststName": "มีดี",
"Affiliation": "ฝอ. 7",
"typeRoom": "ช2",
"status": "waiting"
},
{
"index": 3,
"numberRoom": 3,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช2",
"status": "free"
}
],
"sumroom": 3
}
]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "อาคารแฟลต 1/12",
"sumroom": "20",
"committee": "",
"floor": "4",
"roomnumber": "",
"type": "ช.2",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "อาคารแฟลต 1/13",
"sumroom": "24",
"committee": "",
"floor": "4",
"roomnumber": "",
"type": "ช.2",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "อาคารแฟลต 1/14",
"committee": "",
"sumroom": "18",
"floor": "3",
"roomnumber": "",
"type": "ช.3",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "อาคารแฟลต 1/15",
"committee": "",
"sumroom": "32",
"floor": "4",
"roomnumber": "",
"type": "ช.2",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "อาคารแฟลต 1/16",
"committee": "",
"sumroom": "24",
"floor": "4",
"roomnumber": "",
"type": "ช.2",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "อาคารแฟลต 1/17",
"committee": "",
"sumroom": "32",
"floor": "4",
"roomnumber": "",
"type": "ช.2",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "อาคารแฟลต 1/18",
"sumroom": "60",
"committee": "",
"floor": "5",
"roomnumber": "",
"type": "-",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "แฟลตลือชา 1",
"committee": "",
"sumroom": "50",
"floor": "5",
"roomnumber": "",
"type": "-",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "แฟลตลือชา 2",
"committee": "",
"sumroom": "50",
"floor": "5",
"roomnumber": "",
"type": "-",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "แฟลตลือชา 3",
"sumroom": "40",
"floor": "5",
"roomnumber": "",
"type": "ช.2",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "แฟลตบางเขน 1",
"committee": "",
"sumroom": "50",
"floor": "5",
"roomnumber": "",
"type": "-",
"listRoom":[]
},
{
"buil": "อาคารบ้านพัก บช. ตชด.",
"name": "แฟลตบางเขน 2",
"committee": "",
"sumroom": "50",
"floor": "5",
"roomnumber": "",
"type": "ช.2",
"listRoom":[]
},
{
"id": "745a7d08-5333-40ef-8c2c-5bcdf1e2a392",
"buil": "บช",
"name": "ลือชา15",
"committee": " มารุช ดีงาม , บารมี ดีงาม",
"sumroom": 8,
"floor": "2",
"roomnumber": "",
"type": "",
"listRoom": [
{
"floor": 1,
"rooms": [
{
"index": 1,
"numberRoom": 1
},
{
"index": 2,
"numberRoom": 2
},
{
"index": 3,
"numberRoom": 3
},
{
"index": 4,
"numberRoom": 4
},
{
"index": 5,
"numberRoom": 5
}
],
"sumroom": 5
},
{
"floor": 2,
"rooms": [
{
"index": 1,
"numberRoom": 1
},
{
"index": 2,
"numberRoom": 2
},
{
"index": 3,
"numberRoom": 3
}
],
"sumroom": 3
}
]
},
{
"id": "4f82fe70-ac26-473d-b9ec-e8724e9fa5a9",
"buil": "test",
"name": "ลือชา 4/5",
"committee": " มารุช ดีงาม , บารมี ดีงาม",
"sumroom": 11,
"floor": "2",
"roomnumber": "",
"type": "",
"listRoom": [
{
"floor": 1,
"rooms": [
{
"index": 1,
"numberRoom": 1
},
{
"index": 2,
"numberRoom": 2
},
{
"index": 3,
"numberRoom": 3
},
{
"index": 4,
"numberRoom": 4
},
{
"index": 5,
"numberRoom": 5
},
{
"index": 6,
"numberRoom": 6
},
{
"index": 7,
"numberRoom": 7
}
],
"sumroom": 7
},
{
"floor": 2,
"rooms": [
{
"index": 1,
"numberRoom": 1
},
{
"index": 2,
"numberRoom": 2
},
{
"index": 3,
"numberRoom": 3
},
{
"index": 4,
"numberRoom": 4
}
],
"sumroom": 4
}
]
}
]

1
appserver/history.json Normal file
View File

@ -0,0 +1 @@
[{"id":"3f7e1c45-a2e9-4b08-a56d-e687ea79ba61","no":1,"firstName":"สมชัย14","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"1234","queue":"inqueue","roomnumber":"201","insurancecost":254,"installments":266,"waterbill":150,"electricitybill":945,"central":500,"costs":200,"sumCost":1000,"typeContract":"หักได้","contract":"...","Checkintime":"","Maintenance":"","insurance":""},{"id":"ebd367bf-396f-4bae-8130-1ce3fa130d38","no":2,"firstName":"สมชัย","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"","queue":"inqueue","roomnumber":"202","insurancecost":254,"installments":266,"waterbill":150,"electricitybill":945,"central":500,"costs":200,"sumCost":1000,"typeContract":"หักได้","contract":"...","Checkintime":"","Maintenance":"","insurance":""},{"id":"507e0867-4d56-4f4e-81d1-f3a1ab0d0fde","no":1,"firstName":"มานา","lastName":"มานี","affiliation":"ลูกจ้าง","rank":"นาย","idcard":"134044411441178","phone":"0325647845","status":"สมรส","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"","queue":"inroom","roomnumber":"209","insurancecost":254,"installments":266,"waterbill":150,"electricitybill":945,"central":500,"costs":200,"sumCost":1000,"typeContract":"หักได้","contract":"...","Checkintime":"","Maintenance":"","insurance":""},{"id":"2c388c78-b2a3-4ea2-bca5-48521eb7e5db","no":3,"firstName":"มานี","lastName":"มานอน","affiliation":"ลูกจ้าง","rank":"ส.ต.ต.","idcard":"134044411441178","phone":"0325647845","status":"สมรส","typeAffiliation":"ลูกจ้าง","typeRanks":"ประทวน","typeUser":"ตร.","bookNumber":"1234","queue":"inqueue","roomnumber":"204","insurancecost":254,"installments":266,"waterbill":150,"electricitybill":945,"central":500,"costs":200,"sumCost":1000,"typeContract":"หักได้","contract":"...","Checkintime":"","Maintenance":"","insurance":""},{"id":"1cb479fa-e217-422d-938e-47f6fc9b9f32","no":4,"firstName":"มานพ","lastName":"มานี","affiliation":"ฝอ.2","rank":"ร.ต.ต.","idcard":"13404441144555","phone":"0325647845","status":"สมรส","typeAffiliation":"บก.อก.","typeRanks":"สัญญาบัตร","typeUser":"บช.ตชด.","bookNumber":"1234","queue":"inqueue","roomnumber":"206","insurancecost":254,"installments":266,"waterbill":150,"electricitybill":945,"central":500,"costs":200,"sumCost":1000,"typeContract":"หักได้","contract":"...","Checkintime":"","Maintenance":"","insurance":""},{"id":"fc3710ca-c3af-4781-9c8f-4aa6657ddff4","no":5,"firstName":"สมาน788","lastName":"แสงสุข7","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"13404441144","phone":"0325647847","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"14","queue":"none","roomnumber":"205","insurancecost":254,"installments":266,"waterbill":150,"electricitybill":945,"central":500,"costs":200,"sumCost":1000,"typeContract":"หักได้","contract":"...","Checkintime":"","Maintenance":"","insurance":""},{"id":"3f7e1c45-a2e9-4b08-a56d-e687ea79ba61","no":1,"firstName":"สมชัย14","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"1234","queue":"inroom","contract":"12/4/55","checkintime":"2","maintenance":"100","insurance":"1200","installments":"5"}]

View File

@ -1 +1,83 @@
[{"id":"3f7e1c45-a2e9-4b08-a56d-e687ea79ba61","firstName":"สมชัย14","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","bookNumber":"1234"},{"id":"8e81c39a-d50c-42f5-85c0-f9f773c2a4aa","firstName":"สมชัย","lastName":"แสงสุข","affiliation":"บช.ตซด.","rank":"ส.ต.อ.","idcard":"134044411441178","phone":"0325647845","typeAffiliation":"บช.ตซด.","typeRanks":"ประทวน","bookNumber":"1234"},{"id":"ebd367bf-396f-4bae-8130-1ce3fa130d38","firstName":"สมชัย","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","bookNumber":"1234"},{"id":"46685cde-8ea0-4cd2-ba94-7d86e6e893bd","firstName":"สมชัย","lastName":"แสงสุข","affiliation":"บช.ตซด.","rank":"ส.ต.อ.","idcard":"134044411441178","phone":"0325647845","typeAffiliation":"บช.ตซด.","typeRanks":"ประทวน","bookNumber":"14578963"},{"id":"e9aa568a-bb68-4ff9-bb3a-3751f275b631","firstName":"สมชัย14","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","bookNumber":"787878"},{"id":"a8e392df-f6e0-4363-9c36-b6c28d6ab8c8","firstName":"สมชัย14","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","bookNumber":"7889999999"}]
[
{
"id": "3f7e1c45-a2e9-4b08-a56d-e687ea79ba61",
"firstName": "สมชัย14",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"bookNumber": "1234"
},
{
"id": "8e81c39a-d50c-42f5-85c0-f9f773c2a4aa",
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "บช.ตซด.",
"rank": "ส.ต.อ.",
"idcard": "134044411441178",
"status": "โสด",
"phone": "0325647845",
"typeAffiliation": "บช.ตซด.",
"typeRanks": "ประทวน",
"bookNumber": "1234"
},
{
"id": "ebd367bf-396f-4bae-8130-1ce3fa130d38",
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"bookNumber": "1234"
},
{
"id": "46685cde-8ea0-4cd2-ba94-7d86e6e893bd",
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "บช.ตซด.",
"rank": "ส.ต.อ.",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "บช.ตซด.",
"typeRanks": "ประทวน",
"bookNumber": "14578963"
},
{
"id": "f5d0184e-3b79-4005-b873-543a45942c4c",
"firstName": "มานา",
"lastName": "มานี",
"affiliation": "ลูกจ้าง",
"rank": "นาย",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"bookNumber": "กกกกกกกกกก"
},
{
"id": "5615b6ac-de82-4ec2-b370-e7ddc830924c",
"no": 5,
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "บช.ตซด.",
"rank": "ส.ต.อ.",
"idcard": "134044411441178",
"phone": "0325647845",
"typeAffiliation": "บช.ตซด.",
"typeRanks": "ประทวน",
"typeUser": "บช.ตชด.",
"bookNumber": "56544444",
"queue": "none"
}
]

1
appserver/report.json Normal file
View File

@ -0,0 +1 @@
[{"id":"3f7e1c45-a2e9-4b08-a56d-e687ea79ba61","no":1,"firstName":"สมชัย14","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"1234","queue":"inqueue","contract":"","checkintime":"","maintenance":"","insurance":"","installments":""},{"id":"ebd367bf-396f-4bae-8130-1ce3fa130d38","no":2,"firstName":"สมชัย","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"","queue":"inqueue","contract":"","checkintime":"","maintenance":"","insurance":"","installments":""},{"id":"507e0867-4d56-4f4e-81d1-f3a1ab0d0fde","no":1,"firstName":"มานา","lastName":"มานี","affiliation":"ลูกจ้าง","rank":"นาย","idcard":"134044411441178","phone":"0325647845","status":"สมรส","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"","queue":"inroom","contract":"","checkintime":"","maintenance":"","insurance":"","installments":""},{"id":"2c388c78-b2a3-4ea2-bca5-48521eb7e5db","no":3,"firstName":"มานี","lastName":"มานอน","affiliation":"ลูกจ้าง","rank":"ส.ต.ต.","idcard":"134044411441178","phone":"0325647845","status":"สมรส","typeAffiliation":"ลูกจ้าง","typeRanks":"ประทวน","typeUser":"ตร.","bookNumber":"1234","queue":"inqueue","contract":"","checkintime":"","maintenance":"","insurance":"","installments":""},{"id":"1cb479fa-e217-422d-938e-47f6fc9b9f32","no":4,"firstName":"มานพ","lastName":"มานี","affiliation":"ฝอ.2","rank":"ร.ต.ต.","idcard":"13404441144555","phone":"0325647845","status":"สมรส","typeAffiliation":"บก.อก.","typeRanks":"สัญญาบัตร","typeUser":"บช.ตชด.","bookNumber":"1234","queue":"inqueue","contract":"","checkintime":"","maintenance":"","insurance":"","installments":""},{"id":"fc3710ca-c3af-4781-9c8f-4aa6657ddff4","no":5,"firstName":"สมาน788","lastName":"แสงสุข7","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"13404441144","phone":"0325647847","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"14","queue":"none","contract":"","checkintime":"","maintenance":"","insurance":"","installments":""},{"id":"967bf9a7-047e-4951-ba2a-190f42045715","no":5,"firstName":"สมชัย","lastName":"แสงสุข","affiliation":"ฝสสน.1","rank":"ส.ต.ท.","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"บก.สนน.","typeRanks":"ประทวน","typeUser":"บช.ตชด.","bookNumber":"456","queue":"inqueue","contract":"","checkintime":"","maintenance":"","insurance":"","installments":""},{"id":"fae8c402-f815-44cc-8702-bf843dc97db4","firstName":"กนกวรรณ","lastName":"เจริญเจริญ","affiliation":"ฝอ.1","rank":"พ.ต.อ.หญิง","idcard":"134044411441178","phone":"0974543655","status":"สมรส","typeAffiliation":"บก.อก.","typeRanks":"สัญญาบัตร","typeUser":"ตร.","queue":"inqueue","contract":"","checkintime":"","maintenance":"","insurance":"","installments":""},{"id":"8e81c39a-d50c-42f5-85c0-f9f773c2a4aa","no":0,"firstName":"สมชัย","lastName":"แสงสุข","affiliation":"บช.ตซด.","rank":"ส.ต.อ.","idcard":"134044411441178","phone":"0325647845","typeAffiliation":"บช.ตซด.","typeRanks":"ประทวน","typeUser":"บช.ตชด.","bookNumber":"1234","queue":"none","status":"โสด","contract":"","checkintime":"","maintenance":"","insurance":"","installments":""},{"id":"3f7e1c45-a2e9-4b08-a56d-e687ea79ba61","no":1,"firstName":"สมชัย14","lastName":"แสงสุข","affiliation":"ลูกจ้าง","rank":"นาง","idcard":"134044411441178","phone":"0325647845","status":"โสด","typeAffiliation":"ลูกจ้าง","typeRanks":"ลูกจ้าง","typeUser":"ตร.","bookNumber":"1234","queue":"inroom","contract":"12/4/55","checkintime":"2","maintenance":"100","insurance":"1200","installments":"5"}]

132
appserver/ro.json Normal file
View File

@ -0,0 +1,132 @@
[
{
"title": "ห้อง 1",
"dataIndex": "1",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"status": "free"
},
{
"title": "ห้อง 2",
"dataIndex": "2",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ2",
"laststName": "มีดี",
"Affiliation": "ฝอ. 2",
"typeRoom": "ช1",
"status": "unavailable"
},
{
"title": "ห้อง 3",
"dataIndex": "3",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"status": "free"
},
{
"title": "ห้อง 4",
"dataIndex": "4",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ2",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"status": "return"
},
{
"title": "ห้อง 5",
"dataIndex": "5",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ3",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"status": "unavailable"
},
{
"title": "ห้อง 6",
"dataIndex": "6",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ4",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช3",
"status": "waiting"
},
{
"title": "ห้อง 7",
"dataIndex": "7",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ3",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช1",
"status": "return"
},
{
"title": "ห้อง 8",
"dataIndex": "8",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ9",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช3",
"status": "special"
},
{
"title": "ห้อง 9",
"dataIndex": "9",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ5",
"laststName": "มีดี",
"Affiliation": "ฝอ. 4",
"typeRoom": "ช2",
"status": "unavailable"
},
{
"title": "ห้อง 10",
"dataIndex": "10",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ6",
"laststName": "มีดี",
"Affiliation": "ฝอ. 7",
"typeRoom": "ช2",
"status": "waiting"
},
{
"title": "ห้อง 11",
"dataIndex": "11",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"status": "free"
},
{
"title": "ห้อง 12",
"dataIndex": "12",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช2",
"status": "free"
},
{
"title": "ห้อง 13",
"dataIndex": "13",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ7",
"laststName": "มีดี",
"Affiliation": "ฝอ. 2",
"typeRoom": "ช3",
"status": "special"
}
]

View File

@ -1,132 +1,98 @@
[
{
"title": "ห้อง 1",
"dataIndex": "1",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"status": "free"
},
{
"title": "ห้อง 2",
"dataIndex": "2",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ2",
"laststName": "มีดี",
"Affiliation": "ฝอ. 2",
"typeRoom": "ช1",
"status": "unavailable"
},
{
"title": "ห้อง 3",
"dataIndex": "3",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"status": "free"
},
{
"title": "ห้อง 4",
"dataIndex": "4",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ2",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"status": "return"
},
{
"title": "ห้อง 5",
"dataIndex": "5",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ3",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"status": "unavailable"
},
{
"title": "ห้อง 6",
"dataIndex": "6",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ4",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช3",
"status": "waiting"
},
{
"title": "ห้อง 7",
"dataIndex": "7",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ3",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช1",
"status": "return"
},
{
"title": "ห้อง 8",
"dataIndex": "8",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ9",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช3",
"status": "special"
},
{
"title": "ห้อง 9",
"dataIndex": "9",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ5",
"laststName": "มีดี",
"Affiliation": "ฝอ. 4",
"typeRoom": "ช2",
"status": "unavailable"
},
{
"title": "ห้อง 10",
"dataIndex": "10",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ6",
"laststName": "มีดี",
"Affiliation": "ฝอ. 7",
"typeRoom": "ช2",
"status": "waiting"
},
{
"title": "ห้อง 11",
"dataIndex": "11",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"status": "free"
},
{
"title": "ห้อง 12",
"dataIndex": "12",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช2",
"status": "free"
},
{
"title": "ห้อง 13",
"dataIndex": "13",
"ranks": "ส.ต.ต.",
"firstName": "ปิติ7",
"laststName": "มีดี",
"Affiliation": "ฝอ. 2",
"typeRoom": "ช3",
"status": "special"
}
{
"index": 1,
"floor": 1,
"numberRoom": 1,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ2",
"laststName": "มีดี",
"Affiliation": "ฝอ. 2",
"typeRoom": "ช1",
"Roomconditions": "ปกติ",
"status": "unavailable"
},
{
"index": 2,
"floor": 1,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"Roomconditions": "ชำรุด",
"status": "free"
},
{
"index": 3,
"floor": 1,
"numberRoom": 3,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ2",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"Roomconditions": "ปกติ",
"status": "return"
},
{
"index": 4,
"floor": 1,
"numberRoom": 4,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ3",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"Roomconditions": "ปกติ",
"status": "unavailable"
},
{
"index": 5,
"floor": 1,
"numberRoom": 5,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"Roomconditions": "ปกติ",
"status": "free"
},
{
"index": 6,
"floor": 2,
"numberRoom": 1,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ9",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช3",
"Roomconditions": "ปกติ",
"status": "special"
},
{
"index": 7,
"floor": 2,
"numberRoom": 2,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ6",
"laststName": "มีดี",
"Affiliation": "ฝอ. 7",
"typeRoom": "ช2",
"Roomconditions": "ชำรุด",
"status": "waiting"
},
{
"index": 8,
"floor": 2,
"numberRoom": 3,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช2",
"Roomconditions": "ปกติ",
"status": "free"
}
]

View File

@ -2,6 +2,10 @@
const users = require('./users.json')
const rooms = require('./rooms.json')
const queue = require('./queue.json')
const building = require('./building.json')
const Expenses = require('./Expenses.json')
const history = require('./้history.json')
const reports = require('./report.json')
const masterData = require('./masterData.json')
const express = require("express");
const app = express();
@ -21,6 +25,7 @@ app.get('/users', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(users)
})
app.get('/users/:id', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(users.find(user => user.id === (req.params.id)))
@ -70,34 +75,80 @@ app.delete('/users/:id', (req, res) => {
res.send(`Delete user '${users[deletedIndex].username}' completed.`)
})
app.get('/room', (req, res) => {
app.get('/buildings', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(users)
res.json(building)
})
app.get('/room/:id', (req, res) => {
app.get('/buildings/:name', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(users.find(user => user.id === (req.params.id)))
res.json(building.find(user => user.name === (req.params.name)))
})
app.post('/room', (req, res) => {
app.post('/buildings', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
let id = uuidv4();
let body = req.body
let data = { id: id, ...body }
users.push(data)
fs.writeFile('./users.json', JSON.stringify(users), err => {
building.push(data)
fs.writeFile('./building.json', JSON.stringify(building), err => {
if (err) {
console.log('Error writing file', err)
} else {
console.log('Successfully wrote file', users)
console.log('Successfully wrote file', building)
}
})
res.json(users)
res.json(building)
})
app.put('/room/:id', (req, res) => {
app.get('/expenses', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
const updateIndex = users.findIndex(user => user.id === (req.params.id))
let dataOld = users[updateIndex]
let filterdata = users.filter(user => user.id !== (req.params.id))
res.json(Expenses)
})
app.post('/expenses', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
let id = uuidv4();
let body = req.body
let data = { id: id, ...body }
Expenses.push(data)
fs.writeFile('./Expenses.json', JSON.stringify(Expenses), err => {
if (err) {
console.log('Error writing file', err)
} else {
console.log('Successfully wrote file', Expenses)
}
})
res.json(Expenses)
})
app.get('/rooms', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(rooms)
})
app.get('/rooms/:id', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
console.log(req.params.id);
res.json(rooms.find(room => room.index == (req.params.id)))
})
app.post('/rooms', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
let id = uuidv4();
let body = req.body
let data = { id: id, ...body }
rooms.push(data)
fs.writeFile('./rooms.json', JSON.stringify(rooms), err => {
if (err) {
console.log('Error writing file', err)
} else {
console.log('Successfully wrote file', rooms)
}
})
res.json(rooms)
})
app.put('/rooms/:id', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
const updateIndex = rooms.findIndex(user => user.id === (req.params.id))
let dataOld = rooms[updateIndex]
let filterdata = rooms.filter(user => user.id !== (req.params.id))
const parsedData = dataOld;
if (req.body.firstName) parsedData.firstName = req.body.firstName
if (req.body.lastName) parsedData.lastName = req.body.lastName
@ -109,7 +160,7 @@ app.put('/room/:id', (req, res) => {
if (req.body.typeAffiliation) parsedData.typeAffiliation = req.body.typeAffiliation
if (req.body.typeRanks) parsedData.typeRanks = req.body.typeRanks
filterdata.push(parsedData)
fs.writeFile('./users.json', JSON.stringify(filterdata, null, 2), (err) => {
fs.writeFile('./rooms.json', JSON.stringify(filterdata, null, 2), (err) => {
if (err) {
console.log("Failed to write updated data to file");
return;
@ -119,15 +170,16 @@ app.put('/room/:id', (req, res) => {
res.send(`Update user id: '${req.params.id}' completed.`)
})
app.get('/queue', (req, res) => {
app.get('/queue/:name', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(queue)
let list = users.filter(user => user.queue === req.params.name)
res.json(list)
})
app.get('/queue/:id', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(queue.find(queue => queue.id === (req.params.id)))
})
app.post('/queue', (req, res) => {
app.put('/queue', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
let id = uuidv4();
let body = req.body
@ -148,6 +200,7 @@ app.put('/queue/:id', (req, res) => {
let dataOld = users[updateIndex]
let filterdata = users.filter(user => user.id !== (req.params.id))
const parsedData = dataOld;
console.log(req.body);
if (req.body.firstName) parsedData.firstName = req.body.firstName
if (req.body.lastName) parsedData.lastName = req.body.lastName
if (req.body.affiliation) parsedData.affiliation = req.body.affiliation
@ -157,6 +210,9 @@ app.put('/queue/:id', (req, res) => {
if (req.body.status) parsedData.status = req.body.status
if (req.body.typeAffiliation) parsedData.typeAffiliation = req.body.typeAffiliation
if (req.body.typeRanks) parsedData.typeRanks = req.body.typeRanks
if (req.body.queue) parsedData.queue = req.body.queue
if (req.body.no) parsedData.no = req.body.no
if (req.body.bookNumber) parsedData.bookNumber = req.body.bookNumber
filterdata.push(parsedData)
fs.writeFile('./users.json', JSON.stringify(filterdata, null, 2), (err) => {
if (err) {
@ -167,8 +223,61 @@ app.put('/queue/:id', (req, res) => {
});
res.send(`Update user id: '${req.params.id}' completed.`)
})
app.delete('/queue/:id', (req, res) => {
const deletedIndex = users.findIndex(user => user.id === Number(req.params.id))
app.get('/history', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
let list = users.filter(history => history.queue === req.params.name)
res.json(list)
})
app.get('/history/:id', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(history.find(history => history.id === (req.params.id)))
})
app.post('/history', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
let id = uuidv4();
let body = req.body
let data = { id: id, ...body }
history.push(data)
fs.writeFile('./history.json', JSON.stringify(history), err => {
if (err) {
console.log('Error writing file', err)
} else {
console.log('Successfully wrote file', history)
}
})
res.json(history)
})
app.put('/history/:id', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
const updateIndex = history.findIndex(user => user.id === (req.params.id))
let dataOld = history[updateIndex]
let filterdata = history.filter(user => user.id !== (req.params.id))
const parsedData = dataOld;
if (req.body.firstName) parsedData.firstName = req.body.firstName
if (req.body.lastName) parsedData.lastName = req.body.lastName
if (req.body.affiliation) parsedData.affiliation = req.body.affiliation
if (req.body.rank) parsedData.rank = req.body.rank
if (req.body.idcard) parsedData.idcard = req.body.idcard
if (req.body.phone) parsedData.phone = req.body.phone
if (req.body.status) parsedData.status = req.body.status
if (req.body.typeAffiliation) parsedData.typeAffiliation = req.body.typeAffiliation
if (req.body.typeRanks) parsedData.typeRanks = req.body.typeRanks
if (req.body.queue) parsedData.queue = req.body.queue
if (req.body.no) parsedData.no = req.body.no
if (req.body.bookNumber) parsedData.bookNumber = req.body.bookNumber
filterdata.push(parsedData)
fs.writeFile('./history.json', JSON.stringify(filterdata, null, 2), (err) => {
if (err) {
console.log("Failed to write updated data to file");
return;
}
console.log("Updated file successfully");
});
res.send(`Update user id: '${req.params.id}' completed.`)
})
app.delete('/history/:id', (req, res) => {
const deletedIndex = history.findIndex(history => user.id === Number(req.params.id))
res.send(`Delete user '${users[deletedIndex].username}' completed.`)
})
@ -228,11 +337,11 @@ app.delete('/layout/:id', (req, res) => {
app.get('/report', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(users)
res.json(reports)
})
app.get('/report/:id', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(users.find(user => user.id === (req.params.id)))
res.json(reports.find(user => user.id === (req.params.id)))
})
app.post('/report', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
@ -240,20 +349,20 @@ app.post('/report', (req, res) => {
let body = req.body
let data = { id: id, ...body }
users.push(data)
fs.writeFile('./users.json', JSON.stringify(users), err => {
fs.writeFile('./report.json', JSON.stringify(users), err => {
if (err) {
console.log('Error writing file', err)
} else {
console.log('Successfully wrote file', users)
console.log('Successfully wrote file', reports)
}
})
res.json(users)
res.json(reports)
})
app.put('/report/:id', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
const updateIndex = users.findIndex(user => user.id === (req.params.id))
let dataOld = users[updateIndex]
let filterdata = users.filter(user => user.id !== (req.params.id))
const updateIndex = reports.findIndex(user => user.id === (req.params.id))
let dataOld = reports[updateIndex]
let filterdata = reports.filter(user => user.id !== (req.params.id))
const parsedData = dataOld;
if (req.body.firstName) parsedData.firstName = req.body.firstName
if (req.body.lastName) parsedData.lastName = req.body.lastName
@ -275,7 +384,7 @@ app.put('/report/:id', (req, res) => {
res.send(`Update user id: '${req.params.id}' completed.`)
})
app.delete('/report/:id', (req, res) => {
const deletedIndex = users.findIndex(user => user.id === Number(req.params.id))
const deletedIndex = reports.findIndex(user => user.id === Number(req.params.id))
res.send(`Delete user '${users[deletedIndex].username}' completed.`)
})

View File

@ -1,61 +1,189 @@
[
{
"id": "3f7e1c45-a2e9-4b08-a56d-e687ea79ba61",
"firstName": "สมชัย14",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง"
},
{
"id": "8e81c39a-d50c-42f5-85c0-f9f773c2a4aa",
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "บช.ตซด.",
"rank": "ส.ต.อ.",
"idcard": "134044411441178",
"phone": "0325647845",
"typeAffiliation": "บช.ตซด.",
"typeRanks": "ประทวน"
},
{
"id": "ebd367bf-396f-4bae-8130-1ce3fa130d38",
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง"
},
{
"id": "fc3710ca-c3af-4781-9c8f-4aa6657ddff4",
"firstName": "สมาน788",
"lastName": "แสงสุข7",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "13404441144",
"phone": "0325647847",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง"
},
{
"id": "967bf9a7-047e-4951-ba2a-190f42045715",
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ฝสสน.1",
"rank": "ส.ต.ท.",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "บก.สนน.",
"typeRanks": "ประทวน"
}
{
"id": "3f7e1c45-a2e9-4b08-a56d-e687ea79ba61",
"no": 1,
"firstName": "สมชัย14",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"bookNumber": "1234",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": ""
},
{
"id": "ebd367bf-396f-4bae-8130-1ce3fa130d38",
"no": 2,
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"bookNumber": "",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": ""
},
{
"id": "507e0867-4d56-4f4e-81d1-f3a1ab0d0fde",
"no": 1,
"firstName": "มานา",
"lastName": "มานี",
"affiliation": "ลูกจ้าง",
"rank": "นาย",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"bookNumber": "",
"queue": "inroom",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": ""
},
{
"id": "2c388c78-b2a3-4ea2-bca5-48521eb7e5db",
"no": 3,
"firstName": "มานี",
"lastName": "มานอน",
"affiliation": "ลูกจ้าง",
"rank": "ส.ต.ต.",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ประทวน",
"typeUser": "ตร.",
"bookNumber": "1234",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": ""
},
{
"id": "1cb479fa-e217-422d-938e-47f6fc9b9f32",
"no": 4,
"firstName": "มานพ",
"lastName": "มานี",
"affiliation": "ฝอ.2",
"rank": "ร.ต.ต.",
"idcard": "13404441144555",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "บก.อก.",
"typeRanks": "สัญญาบัตร",
"typeUser": "บช.ตชด.",
"bookNumber": "1234",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": ""
},
{
"id": "fc3710ca-c3af-4781-9c8f-4aa6657ddff4",
"no": 5,
"firstName": "สมาน788",
"lastName": "แสงสุข7",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "13404441144",
"phone": "0325647847",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"bookNumber": "14",
"queue": "none",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": ""
},
{
"id": "967bf9a7-047e-4951-ba2a-190f42045715",
"no": 5,
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ฝสสน.1",
"rank": "ส.ต.ท.",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "บก.สนน.",
"typeRanks": "ประทวน",
"typeUser": "บช.ตชด.",
"bookNumber": "456",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": ""
},
{
"id": "fae8c402-f815-44cc-8702-bf843dc97db4",
"firstName": "กนกวรรณ",
"lastName": "เจริญเจริญ",
"affiliation": "ฝอ.1",
"rank": "พ.ต.อ.หญิง",
"idcard": "134044411441178",
"phone": "0974543655",
"status": "สมรส",
"typeAffiliation": "บก.อก.",
"typeRanks": "สัญญาบัตร",
"typeUser": "ตร.",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": ""
},
{
"id": "8e81c39a-d50c-42f5-85c0-f9f773c2a4aa",
"no": 0,
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "บช.ตซด.",
"rank": "ส.ต.อ.",
"idcard": "134044411441178",
"phone": "0325647845",
"typeAffiliation": "บช.ตซด.",
"typeRanks": "ประทวน",
"typeUser": "บช.ตชด.",
"bookNumber": "1234",
"queue": "none",
"status": "โสด",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": ""
}
]

176
appserver/้history.json Normal file
View File

@ -0,0 +1,176 @@
[
{
"id": "3f7e1c45-a2e9-4b08-a56d-e687ea79ba61",
"no": 1,
"firstName": "สมชัย14",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"bookNumber": "1234",
"queue": "inqueue",
"roomnumber": "201",
"insurancecost": 254,
"installments": 266,
"waterbill": 150,
"electricitybill": 945,
"central": 500,
"costs": 200,
"sumCost":1000,
"typeContract": "หักได้",
"contract": "...",
"Checkintime": "",
"Maintenance": "",
"insurance": ""
},
{
"id": "ebd367bf-396f-4bae-8130-1ce3fa130d38",
"no": 2,
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"bookNumber": "",
"queue": "inqueue",
"roomnumber": "202",
"insurancecost": 254,
"installments": 266,
"waterbill": 150,
"electricitybill": 945,
"central": 500,
"costs": 200,
"sumCost":1000,
"typeContract": "หักได้",
"contract": "...",
"Checkintime": "",
"Maintenance": "",
"insurance": ""
},
{
"id": "507e0867-4d56-4f4e-81d1-f3a1ab0d0fde",
"no": 1,
"firstName": "มานา",
"lastName": "มานี",
"affiliation": "ลูกจ้าง",
"rank": "นาย",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"bookNumber": "",
"queue": "inroom",
"roomnumber": "209",
"insurancecost": 254,
"installments": 266,
"waterbill": 150,
"electricitybill": 945,
"central": 500,
"costs": 200,
"sumCost":1000,
"typeContract": "หักได้",
"contract": "...",
"Checkintime": "",
"Maintenance": "",
"insurance": ""
},
{
"id": "2c388c78-b2a3-4ea2-bca5-48521eb7e5db",
"no": 3,
"firstName": "มานี",
"lastName": "มานอน",
"affiliation": "ลูกจ้าง",
"rank": "ส.ต.ต.",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ประทวน",
"typeUser": "ตร.",
"bookNumber": "1234",
"queue": "inqueue",
"roomnumber": "204",
"insurancecost": 254,
"installments": 266,
"waterbill": 150,
"electricitybill": 945,
"central": 500,
"costs": 200,
"sumCost":1000,
"typeContract": "หักได้",
"contract": "...",
"Checkintime": "",
"Maintenance": "",
"insurance": ""
},
{
"id": "1cb479fa-e217-422d-938e-47f6fc9b9f32",
"no": 4,
"firstName": "มานพ",
"lastName": "มานี",
"affiliation": "ฝอ.2",
"rank": "ร.ต.ต.",
"idcard": "13404441144555",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "บก.อก.",
"typeRanks": "สัญญาบัตร",
"typeUser": "บช.ตชด.",
"bookNumber": "1234",
"queue": "inqueue",
"roomnumber": "206",
"insurancecost": 254,
"installments": 266,
"waterbill": 150,
"electricitybill": 945,
"central": 500,
"costs": 200,
"sumCost":1000,
"typeContract": "หักได้",
"contract": "...",
"Checkintime": "",
"Maintenance": "",
"insurance": ""
},
{
"id": "fc3710ca-c3af-4781-9c8f-4aa6657ddff4",
"no": 5,
"firstName": "สมาน788",
"lastName": "แสงสุข7",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "13404441144",
"phone": "0325647847",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"bookNumber": "14",
"queue": "none",
"roomnumber": "205",
"insurancecost": 254,
"installments": 266,
"waterbill": 150,
"electricitybill": 945,
"central": 500,
"costs": 200,
"sumCost":1000,
"typeContract": "หักได้",
"contract": "...",
"Checkintime": "",
"Maintenance": "",
"insurance": ""
}
]

View File

@ -4,26 +4,7 @@ import MaterialButton from "@/components/MaterialButton.vue";
import Breadcrumbs from "@/examples/Breadcrumbs.vue";
import vueMkHeader from "@/assets/img/bg.jpg";
import masterData from "@/assets/dataJson/masterData.json";
const listRoom = [
{ title: "ตึก 1" },
{ title: "ตึก 2" },
{ title: "ตึก 3" },
{ title: "ตึก 4" },
{ title: "ตึก 5" },
{ title: "ตึก 6" },
{ title: "ตึก 7" },
];
const NoRoom = [
{ title: "ชั้น 1" },
{ title: "ชั้น 2" },
{ title: "ชั้น 3" },
{ title: "ชั้น 4" },
{ title: "ชั้น 5" },
{ title: "ชั้น 6" },
{ title: "ชั้น 7" },
];
import axios from "axios";
const userlist = [
{
@ -60,8 +41,6 @@ export default {
},
setup() {
return {
listRoom,
NoRoom,
userlist,
vueMkHeader,
masterData,
@ -70,14 +49,6 @@ export default {
data() {
return {
value: { name: "Vue.js", language: "JavaScript" },
options: [
{ label: "Vue.js", value: "JavaScript" },
{ label: "Rails", value: "Ruby" },
{ label: "Sinatra", value: "Ruby" },
{ label: "Laravel", value: "PHP" },
{ label: "Phoenix", value: "Elixir" },
],
optionsBuilding: [
{ label: "อาคารแฟลต 1/11", value: "1" },
{ label: "อาคารแฟลต 1/12", value: "2" },
@ -107,6 +78,26 @@ export default {
{ label: "ห้อง 404", value: "4" },
{ label: "ห้อง 505", value: "5" },
],
optionYear: [
{ label: "2023", value: "2023" },
{ label: "2022", value: "2022" },
{ label: "2021", value: "2021" },
{ label: "2020", value: "2020" },
],
optionMonth: [
{ label: "มกราคม", value: "มกราคม" },
{ label: "กุมภาพันธ์", value: "กุมภาพันธ์" },
{ label: "มีนาคม", value: "มีนาคม" },
{ label: "เมษายน", value: "เมษายน" },
{ label: "พฤษภาคม", value: "พฤษภาคม" },
{ label: "มิถุนายน", value: "มิถุนายน" },
{ label: "กรกฎาคม", value: "กรกฎาคม" },
{ label: "สิงหาคม", value: "สิงหาคม" },
{ label: "กันยายน", value: "กันยายน" },
{ label: "ตุลาคม", value: "ตุลาคม" },
{ label: "พฤศจิกายน", value: "พฤศจิกายน" },
{ label: "ธันวาคม", value: "ธันวาคม" },
],
selectedBuilding: "อาคารแฟลต 1/11",
selectedFloor: "ชั้น 1",
selectedRoom: "ห้อง 101",
@ -120,10 +111,17 @@ export default {
selectedRanks: "ส.ต.ต.",
selectedAffiliation: "ฝอ.2",
birthday: "14/07/2534",
typeContract: "หักได้",
sumCost: 10000,
expensesList: [],
searchName: "",
selectedMonth: "พฤศจิกายน"
};
},
created() {
console.log(this.masterData);
// console.log(this.masterData);
this.getBuildings();
this.getExpenses();
},
watch: {
selectedColor: function (newValue) {
@ -131,25 +129,87 @@ export default {
console.log(newValue);
},
},
computed: {
expensesList() {
return this.expensesList.filter((item) =>
item.roomnumber.includes(this.searchName)
);
},
},
methods: {
changedLabel(event) {
console.log(event);
// this.selected = event;
},
typeContractchange(e) {
this.typeContract = e.target.value;
},
async getExpenses() {
try {
await axios
.get("http://localhost:3001/expenses")
.then((res) => {
this.expensesList = res.data;
// console.log(res.data);
})
.catch((err) => {
console.log(err);
});
} catch (error) {
console.error(error);
}
},
async getBuildings() {
try {
await axios
.get("http://localhost:3001/buildings")
.then((res) => {
// this.buildingList = res.data;
// console.log(res.data);
})
.catch((err) => {
console.log(err);
});
} catch (error) {
console.error(error);
}
},
async getRooms() {
try {
await axios
.get("http://localhost:3001/rooms")
.then((res) => {
// this.buildingList = res.data;
console.log(res.data);
})
.catch((err) => {
console.log(err);
});
} catch (error) {
console.error(error);
}
},
submitForm() {
let body = {
firstName: this.firstName,
lastName: this.lastName,
Affiliation: this.Affiliation,
rank: this.rank,
idcard: this.idcard,
phone: this.phone,
building: this.selectedBuilding.label,
floor: this.selectedFloor.label,
roomnumber: this.selectedRoom.label,
insurancecost: this.Insurancecost,
installments: this.installments,
waterbill: this.Waterbill,
electricitybill: this.Electricitybill,
central: this.Central,
costs: this.Costs,
typeContract: this.typeContract,
contract: this.contract,
sumCost: this.sumCost,
};
// let b = []
// b.push(body)
this.userlist.push(body);
console.log(this.userlist);
// this.userlist.push(body);
console.log(body);
},
},
};
@ -182,13 +242,27 @@ export default {
]"
/>
</div>
<!-- <div class="d-flex justify-content-end align-items-baseline">
<div class="mb-3 w-15" style="margin-right: 20px">
<label>เดอน</label>
<v-select :options="optionMonth" v-model="selectedMonth"></v-select>
</div>
</div> -->
<div class="d-flex justify-content-end align-items-baseline">
<div class="mb-3 w-15" style="margin-right: 20px;
display: flex;
align-items: baseline;">
<label style="margin-right: 5px;">เดอน</label>
<v-select :options="optionMonth" v-model="selectedMonth"></v-select>
</div>
<label style="margin-right: 10px">นหาเลขทอง </label>
<MaterialInput
class="input-group-dynamic w-30"
icon="search"
type="text"
placeholder="Search"
:value="searchName"
@input="(event) => (searchName = event.target.value)"
/>
</div>
<div class="text-center pt-4 table-responsive">
@ -216,24 +290,24 @@ export default {
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>...โชคด </td>
<td>อาคารแฟลต 1/11</td>
<td>2</td>
<td>202</td>
<td>201</td>
<td>205</td>
<td>4</td>
<td>8,000</td>
<td>20,000</td>
<td>8,000</td>
<td>20,000</td>
<td>10,000</td>
<td>5/10</td>
<td>/</td>
<tr v-for="(item, index) in expensesList" :key="index">
<th scope="row">{{ index + 1 }}</th>
<td>{{ item?.rank }} {{ item?.firstName }} {{ item?.lastName }}</td>
<td>{{ item?.building }}</td>
<td>{{ item?.floor }}</td>
<td>{{ item?.roomnumber }}</td>
<td>{{ item?.installments }}</td>
<td>{{ item?.insurancecost }}</td>
<td>{{ item?.sumCost }}</td>
<td>{{ item?.waterbill }}</td>
<td>{{ item?.electricitybill }}</td>
<td>{{ item?.central }}</td>
<td>{{ item?.costs }}</td>
<td>{{ item?.roomnumber }}</td>
<td>{{ item?.typeContract }}</td>
<td>{{ item?.typeContract }}</td>
<td></td>
<td>5555</td>
<td>{{ item?.contract }}</td>
<td>
<MaterialButton
style="margin-bottom: 0px"
@ -278,7 +352,7 @@ export default {
<div class="modal-body">
<div>
<div class="mb-1">
<label style="font-size:large">...โชคด </label>
<label style="font-size: large">...โชคด </label>
</div>
<div class="mb-3">
<label>อาคาร</label>
@ -358,11 +432,7 @@ export default {
</div>
<div
class="mb-3"
style="
display: flex;
justify-content: flex-start;
align-items: center;
"
style="display: flex; justify-content: flex-start; align-items: center"
>
<div class="form-check form-check-inline">
<input
@ -370,32 +440,33 @@ export default {
type="radio"
name="inlineRadioOptions"
id="inlineRadio1"
value="option1"
value="หักได้"
@change="typeContractchange($event)"
/>
<label class="form-check-label" for="inlineRadio1">กได</label>
</div>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="inlineRadioOptions"
id="inlineRadio2"
value="option2"
value="หักไม่ได้"
@change="typeContractchange($event)"
/>
<label class="form-check-label" for="inlineRadio2">กไมได</label>
</div>
</div>
<div style=" margin-bottom: 10px">
<MaterialInput
name="contract"
:value="contract"
@input="(event) => (contract = event.target.value)"
class="input-group-static"
type="text"
placeholder="สาเหตุ"
/>
</div>
<div style="margin-bottom: 10px">
<MaterialInput
name="contract"
:value="contract"
@input="(event) => (contract = event.target.value)"
class="input-group-static"
type="text"
placeholder="สาเหตุ"
/>
</div>
</div>
</div>
<div class="modal-footer">
@ -504,7 +575,7 @@ export default {
</template>
<style>
.bg-green {
border: 2px solid #4CBB17 !important;
border: 2px solid #4cbb17 !important;
color: #000;
}
.bg-red {

View File

@ -21,13 +21,6 @@ export default {
data() {
return {
value: { name: "Vue.js", language: "JavaScript" },
options: [
{ label: "มานพ", value: "มานพ" },
{ label: "วิชัย", value: "วิชัย" },
{ label: "ธนาพร", value: "ธนาพร" },
{ label: "มนตรี", value: "มนตรี" },
],
selectedUser: "",
firstName: "",
lastName: "",
@ -36,21 +29,31 @@ export default {
idcard: "",
phone: "",
bookNumber: "",
queueList : [],
userList : [],
userByid: {}
queueList: [],
userList: [],
userByid: {},
searchName: "",
typeUserByqueue: "โสด",
olddatatypeQueue: [],
datatypeQueue: [],
no: 0,
userId: ''
};
},
created() {
// console.log(this.masterData);
this.getAllqueue();
this.getAllusers()
// this.getAllusers();
this.getAllNoqueue();
},
watch: {
selectedUser: function (newValue) {
// this.updateColor(newValue)
console.log(newValue.value);
this.getAllusersByid(newValue.value)
this.getAllusersByid(newValue.value);
},
},
computed: {
queueList() {
return this.queueList.filter((item) => item.firstName.includes(this.searchName));
},
},
methods: {
@ -59,13 +62,28 @@ export default {
// this.selected = event;
},
queuefilter(e) {
if (e.target) this.typeUserByqueue = e.target.value;
else this.typeUserByqueue = e;
this.datatypeQueue = this.olddatatypeQueue;
if(this.typeUserByqueue !== 'ทั้งหมด'){
let dataqueue = this.datatypeQueue.filter((e) => e.status == this.typeUserByqueue);
this.queueList = dataqueue;
}else if (this.typeUserByqueue == 'ทั้งหมด'){
this.queueList = this.datatypeQueue;
}
},
getAllqueue() {
try {
axios
.get("http://localhost:3001/queue")
.get(`http://localhost:3001/queue/inqueue`)
.then((res) => {
this.queueList = res.data;
console.log(this.queueList);
this.olddatatypeQueue = this.queueList;
console.log(res.data);
this.no = this.queueList.length+1
this.queuefilter("โสด");
})
.catch((err) => {
console.log(err.response);
@ -76,13 +94,33 @@ export default {
},
getAllusersByid(id) {
this.userId = id
try {
axios
.get(`http://localhost:3001/users/${id}`)
.then((res) => {
let data =res.data
this.userByid = data
// console.log(this.userByid)
let data = res.data;
this.userByid = data;
})
.catch((err) => {
console.log(err.response);
});
} catch (error) {
console.error(error);
}
},
getAllNoqueue() {
try {
axios
.get(`http://localhost:3001/queue/none`)
.then((res) => {
this.userList = res.data.map((ele) => {
return {
label: ele.rank + " " + ele.firstName + " " + ele.lastName,
value: ele.id,
};
});
})
.catch((err) => {
console.log(err.response);
@ -97,15 +135,15 @@ export default {
axios
.get("http://localhost:3001/users")
.then((res) => {
this.userList = res.data.map(ele =>{
this.userList = res.data.map((ele) => {
return {
label : ele.rank + " "+ ele.firstName + " " + ele.lastName,
value : ele.id,
}
})
label: ele.rank + " " + ele.firstName + " " + ele.lastName,
value: ele.id,
};
});
})
.catch((err) => {
console.log(err.response);
console.log(err);
});
} catch (error) {
console.error(error);
@ -113,20 +151,15 @@ export default {
},
submitForm() {
// firstName: this.firstName,
// lastName: this.lastName,
// Affiliation: this.Affiliation,
// rank: this.rank,
// idcard: this.idcard,
// phone: this.phone,
let body = {
...this.userByid,
bookNumber: this.bookNumber
no: this.no,
bookNumber: this.bookNumber,
queue: 'inqueue'
};
delete body.id
console.log(body);
delete body.id;
axios
.post(`http://localhost:3001/queue`, body, {
.put(`http://localhost:3001/queue/${this.userId}`, body, {
headers: {
// remove headers
"Access-Control-Allow-Origin": "*",
@ -137,12 +170,8 @@ export default {
this.getAllqueue();
})
.catch((err) => {
console.log(err.response);
console.log(err);
});
// let b = []
// b.push(body)
// this.userlist.push(body);
// console.log(this.userlist);
},
},
};
@ -174,6 +203,7 @@ export default {
</div>
<div class="d-flex justify-content-between align-items-baseline">
<div class="mb-3">
<div class="form-check form-check-inline">
<label style="margin-right: 20px">สถานภาพ</label>
<input
@ -182,6 +212,7 @@ export default {
name="inlineRadioOptions"
id="inlineRadio1"
value="โสด"
@change="queuefilter($event)"
checked
/>
<label class="form-check-label" for="inlineRadio1">โสด</label>
@ -193,9 +224,21 @@ export default {
name="inlineRadioOptions"
id="inlineRadio2"
value="สมรส"
@change="queuefilter($event)"
/>
<label class="form-check-label" for="inlineRadio2">สมรส</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="inlineRadioOptions"
id="inlineRadio3"
value="ทั้งหมด"
@change="queuefilter($event)"
/>
<label class="form-check-label" for="inlineRadio3">งหมด</label>
</div>
</div>
<div class="d-flex align-items-baseline">
<label style="margin-right: 20px">นหาช </label>
@ -205,6 +248,8 @@ export default {
icon="search"
type="text"
placeholder="Search"
:value="searchName"
@input="(event) => (searchName = event.target.value)"
/>
<MaterialButton
variant="gradient"
@ -231,7 +276,7 @@ export default {
</thead>
<tbody>
<tr v-for="(item, index) in queueList" :key="index">
<th scope="row">{{ index + 1 }}</th>
<th scope="row">{{ item?.no }}</th>
<td>{{ item?.rank }} {{ item?.firstName }} {{ item?.lastName }}</td>
<td>{{ item?.affiliation }}</td>
<td>{{ item?.status }}</td>
@ -282,16 +327,19 @@ export default {
placeholder="ตัวอย่าง : 11244"
></textarea>
</div>
<div class="row g-0" v-if="selectedUser!== ''">
<div class="row g-0" v-if="selectedUser !== ''">
<div class="col-md-12">
<div class="row" >
<h5 class="card-title ">รายละเอยดผเช</h5>
<p class="card-text pt-1">-สก : {{ userByid?.rank }} {{ userByid?.firstName }} {{ userByid?.lastName }}</p>
<p class="card-text">งก : {{ userByid?.affiliation }}</p>
<p class="card-text">เลขบตรประชาชน : {{ userByid?.idcard }}</p>
<p class="card-text">สถานภาพ : {{ userByid?.status }}</p>
<p class="card-text">เบอรโทร : {{ userByid?.phone }}</p>
</div>
<div class="row">
<h5 class="card-title">รายละเอยด</h5>
<p class="card-text pt-1">
-สก : {{ userByid?.rank }} {{ userByid?.firstName }}
{{ userByid?.lastName }}
</p>
<p class="card-text">งก : {{ userByid?.affiliation }}</p>
<p class="card-text">เลขบตรประชาชน : {{ userByid?.idcard }}</p>
<p class="card-text">สถานภาพ : {{ userByid?.status }}</p>
<p class="card-text">เบอรโทร : {{ userByid?.phone }}</p>
</div>
</div>
</div>
</div>
@ -316,7 +364,7 @@ export default {
</template>
<style>
.bg-green {
border: 2px solid #4CBB17 !important;
border: 2px solid #4cbb17 !important;
color: #000;
}
.bg-red {

View File

@ -195,21 +195,6 @@ export default {
นทกคาใชายบานพ บช.ตชด.
</button>
</li>
<li class="nav-item" role="presentation">
<button
class="nav-link"
style="color: #57b05b"
id="contact-tab"
data-bs-toggle="tab"
data-bs-target="#contact"
type="button"
role="tab"
aria-controls="contact"
aria-selected="false"
>
สรปรายงานคาใชาย
</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div
@ -261,13 +246,13 @@ export default {
v-model="selectedMonth"
></v-select>
</div>
<div class="mb-3 w-10 " style="margin-right: 5px">
<!-- <div class="mb-3 w-10 " style="margin-right: 5px">
<label>..</label>
<v-select
:options="optionYear"
v-model="selectedYear"
></v-select>
</div>
</div> -->
<div class="mb-3 w-15 ">
<label>งก</label>
<v-select

View File

@ -5,6 +5,8 @@ import vueMkHeader from "@/assets/img/bg.jpg";
import MaterialInput from "@/components/MaterialInput.vue";
import MaterialButton from "@/components/MaterialButton.vue";
import Breadcrumbs from "@/examples/Breadcrumbs.vue";
import axios from "axios";
const userlist = [
{
dataIndex: "1",
@ -70,14 +72,20 @@ export default {
old: "",
birthday: "",
installments: "",
booknumber:""
booknumber: "",
typeroom: "",
data: "",
queueList: [],
queuefilter: [],
};
},
created() {
this.mode = this.$route.query.mode;
if (this.$route.params.id) {
this.id = this.$route.params.id;
this.getroomByid(this.id);
}
this.getAllqueue();
// this.$route.query
},
methods: {
@ -88,6 +96,134 @@ export default {
// this.$router.push({ path: `/addUserRoom` , query: { mode: this.mode } });
// }
},
getAllqueue() {
try {
axios
.get(`http://localhost:3001/queue/inqueue`)
.then((res) => {
this.queueList = res.data;
this.queuefilter = this.queueList.filter((e) => e.status === this.typeroom);
})
.catch((err) => {
console.log(err.response);
});
} catch (error) {
console.error(error);
}
},
async getroomByid(id) {
try {
axios.get(`http://localhost:3001/rooms/${id}`).then((res) => {
this.data = res.data;
console.log(this.data);
if (this.data.typeRoom == "ช1") this.typeroom = "โสด";
if (this.data.typeRoom == "ช2") this.typeroom = "สมรส";
if (this.data.typeRoom == "ช3") this.typeroom = "ทั่วไป";
});
} catch (e) {
console.error(e);
}
},
getAllusersByid(id) {
this.userId = id;
try {
axios
.get(`http://localhost:3001/users/${id}`)
.then((res) => {
let data = res.data;
this.userByid = data;
})
.catch((err) => {
console.log(err.response);
});
} catch (error) {
console.error(error);
}
},
async submitForm() {
let body = {
...this.userByid,
queue: "inroom",
contract: this.contract,
checkintime: this.Checkintime,
maintenance: this.Maintenance,
insurance: this.insurance,
installments: this.installments,
};
console.log(body);
await axios
.post(`http://localhost:3001/history`, body, {
headers: {
// remove headers
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
})
.then((res) => {
this.submitForm2()
this.submitForm3()
this.getAllqueue();
})
.catch((err) => {
console.log(err);
});
},
async submitForm2() {
let body = {
...this.userByid,
queue: "inroom",
contract: this.contract,
checkintime: this.Checkintime,
maintenance: this.Maintenance,
insurance: this.insurance,
installments: this.installments,
};
await axios
.post(`http://localhost:3001/report`, body, {
headers: {
// remove headers
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
})
.then((res) => {
this.getAllqueue();
})
.catch((err) => {
console.log(err);
});
},
async submitForm3() {
let body = {
...this.userByid,
queue: "inroom",
contract: this.contract,
checkintime: this.Checkintime,
maintenance: this.Maintenance,
insurance: this.insurance,
installments: this.installments,
};
await axios
.put(`http://localhost:3001/queue/${this.id}`, body, {
headers: {
// remove headers
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
})
.then((res) => {
this.getAllqueue();
})
.catch((err) => {
console.log(err);
});
},
},
};
</script>
@ -122,7 +258,7 @@ export default {
</div>
<!-- d-flex justify-content-between -->
<div class="d-flex justify-content-between align-items-baseline">
<h4>รายละเอยดหองพ 101</h4>
<h4>รายละเอยดหองพ {{ data?.numberRoom }}</h4>
<div>
<MaterialButton variant="gradient" color="success" @click="gotoAction()"
>ดการหองพ</MaterialButton
@ -142,7 +278,7 @@ export default {
<p class="card-text">งก : ฝอ. 1</p>
<p class="card-text">เลขบตรประชาชน : 123456123456</p>
<p class="card-text">นทำสญญา : 12/02/2564</p>
<p class="card-text">ระยะเวลาทเขาพ : 3 เดอน</p>
</div>
<div class="col-7">
@ -157,20 +293,11 @@ export default {
<div class="row" v-if="this.mode !== 'special'">
<div class="col-5">
<h5 class="card-title pt-2">รายละเอยดหองพ</h5>
<p class="card-text">ประเภทหองพ : ช๓</p>
<p class="card-text">ประเภทหองพ : {{ data?.typeRoom }}</p>
<!-- <p class="card-text">เตอร/ไฟ : 745/546</p> -->
<p class="card-text">สภาพหอง : ปกต</p>
</div>
<div class="col-5">
<h5 class="card-title pt-2"></h5>
<p class="card-text">เลขทเรมใช : 3012</p>
<p class="card-text">เดอนทเรมใช : มกราคม</p>
<p class="card-text">เรมใช : 2565</p>
<p class="card-text">สภาพหอง : {{ data?.Roomconditions }}</p>
</div>
</div>
<!-- <p class="card-text">
<small class="text-muted">Last updated 3 mins ago</small>
</p> -->
</div>
</div>
</div>
@ -190,8 +317,8 @@ export default {
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in userlist" :key="index">
<th scope="row">{{ index + 1 }}</th>
<tr v-for="(item, index) in queuefilter" :key="index">
<th scope="row">{{ item.no }}</th>
<td>
{{ item.rank }} {{ item.firstName }} {{ item.lastName }}
</td>
@ -205,6 +332,7 @@ export default {
color="success"
data-bs-toggle="modal"
data-bs-target="#contractBackdrop"
@click="getAllusersByid(item.id)"
>เพมผเชาหองพ</MaterialButton
>
</td>
@ -293,7 +421,6 @@ export default {
placeholder="จำนวนงวดเงินค่าประกัน"
/>
</div>
</div>
</div>
<div class="modal-footer">
@ -305,6 +432,7 @@ export default {
color="success"
@click="submitForm"
html-type="submit"
data-bs-dismiss="modal"
>นท</MaterialButton
>
</div>
@ -478,13 +606,11 @@ export default {
</div>
</div>
</div>
</section>
</template>
<style>
.bg-green {
border: 2px solid #4CBB17 !important;
border: 2px solid #4cbb17 !important;
color: #000;
}
.bg-red {

View File

@ -4,12 +4,10 @@ import MaterialButton from "@/components/MaterialButton.vue";
import MaterialCheckbox from "@/components/MaterialCheckbox.vue";
import vueMkHeader from "@/assets/img/bg.jpg";
import Breadcrumbs from "@/examples/Breadcrumbs.vue";
import roomData from "@/assets/dataJson/rooms.json";
// import roomData from "@/assets/dataJson/rooms.json";
// import posts from "../posts.json";
import axios from "axios";
const NoRoom = [{ title: "ชั้น 1" }, { title: "ชั้น 2" }, { title: "ชั้น 3" }];
export default {
components: {
MaterialInput,
@ -21,20 +19,12 @@ export default {
return {
NoRoom,
vueMkHeader,
roomData,
// roomData,
};
},
data() {
return {
value: { name: "Vue.js", language: "JavaScript" },
options: [
{ label: "Vue.js", value: "JavaScript" },
{ label: "Rails", value: "Ruby" },
{ label: "Sinatra", value: "Ruby" },
{ label: "Laravel", value: "PHP" },
{ label: "Phoenix", value: "Elixir" },
],
typeRoom: [
{ label: "ทั้งหมด", value: "ทั้งหมด" },
{ label: "ช1", value: "ช1" },
@ -42,39 +32,34 @@ export default {
{ label: "ช3", value: "ช3" },
],
listRoom: [
{ label: "อาคารแฟลต 1/11", value: "1" },
{ label: "อาคารแฟลต 1/12", value: "2" },
{ label: "อาคารแฟลต 1/13", value: "3" },
{ label: "อาคารแฟลต 1/14", value: "4" },
{ label: "อาคารแฟลต 1/15", value: "5" },
{ label: "อาคารแฟลต 1/16", value: "3" },
{ label: "อาคารแฟลต 1/17", value: "4" },
{ label: "อาคารแฟลต 1/18", value: "5" },
{ label: "แฟลตลือชา 1", value: "5" },
{ label: "แฟลตลือชา 2", value: "3" },
{ label: "แฟลตลือชา 3", value: "4" },
{ label: "แฟลตบางเขน 1", value: "5" },
{ label: "แฟลตบางเขน 2", value: "5" },
],
listRoom: [],
selectedtypeRoom: "ช1",
selectedColor: "",
statusfree: false,
statusreturn: false,
statuseunavailable: false,
statusewaiting: false,
selectedlistRoom: "อาคารแฟลต 1/11 ",
selectedlistRoom: { label: "อาคารแฟลต 1/11", value: "อาคารแฟลต 1/11" },
committee: "",
selectedStatus: "",
selectedReturn: "",
selectedUnavailable: "",
selectedWaiting: "",
selectedScaple: "",
roomData: [],
buildingList: [],
};
},
created() {
// this.$route.query
try {
axios.get(`http://localhost:3001/users/`).then((res) => console.log(res.data));
axios.get(`http://localhost:3001/users/`).then();
} catch (e) {
console.error(e);
}
this.oldData = this.roomData;
this.getRooms();
this.getBuildings();
},
watch: {
selectedtypeRoom: function (newValue) {
@ -90,20 +75,26 @@ export default {
}
}
},
selectedStatus: function (newValue) {
console.log(newValue);
this.roomData = this.oldData;
// if (newValue !== null) {
// if (newValue.value !== "") {
// const typeRoom = this.roomData.filter(
// (tagreturn) => tagreturn.typeRoom === newValue.value
// );
// this.roomData = typeRoom;
// } else {
// this.roomData = this.oldData;
// }
// }
},
// selectedtypeRoom: async function (newValue) {
// // this.dataBuilding["listRoom"] = [];
// let buildingList = [];
// buildingList = this.oldData
// let datalist = []
// if (newValue !== null) {
// if (newValue.value !== "") {
// datalist = buildingList["listRoom"].map((ele, i) => {
// ele.rooms = ele.rooms.filter((c) => c.typeRoom == newValue.value);
// return ele; // return ele;
// });
// this.dataBuilding["listRoom"] = datalist;
// console.log(this.dataBuilding);
// } else {
// // this.roomData = this.oldData;
// }
// }
// },
},
methods: {
gotodetail(id, index) {
@ -115,13 +106,93 @@ export default {
if (index == "return") action = "return";
this.$router.push({ path: `/room/detail/${id}`, query: { mode: action } });
},
onChangeEvent(e, event) {
async roomType() {
this.dataBuilding["listRoom"] = [];
let buildingList = [];
let datalist = await axios.get(`http://localhost:3001/buildings/`);
buildingList = await datalist.data.find(
(el) => el.name == this.selectedlistRoom.value
);
if (newValue !== null) {
if (newValue.value !== "ทั้งหมด") {
datalist = buildingList["listRoom"].map((ele, i) => {
ele.rooms = ele.rooms.filter((c) => c.typeRoom == newValue.value);
return ele; // return ele;
});
this.dataBuilding["listRoom"] = datalist;
console.log(this.dataBuilding);
} else {
// this.roomData = this.oldData;
}
}
},
async getRooms() {
try {
await axios
.get("http://localhost:3001/rooms")
.then((res) => {
this.roomData = res.data;
console.log(this.roomData);
this.oldData = this.roomData;
})
.catch((err) => {
console.log(err);
});
} catch (error) {
console.error(error);
}
},
async getBuildings() {
try {
axios.get(`http://localhost:3001/buildings/`).then((res) => {
this.buildingList = res.data;
// this.oldData = res.data
let roomValue = this.buildingList.find(
(el) => el.name == this.selectedlistRoom.value
);
this.committee = roomValue.committee;
this.dataBuilding = { ...roomValue };
// this.oldData = { ...roomValue };
// console.log(this.dataBuilding);
this.listRoom = this.buildingList.map((ele) => {
return {
label: ele.name,
value: ele.name,
};
});
});
} catch (e) {
console.error(e);
}
},
async EdituserForm() {
let body = {
committee: this.committee,
};
axios
.put(`http://localhost:3001/buildings`, body, {
headers: {
// remove headers
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
})
.then((res) => {
this.getBuildings();
})
.catch((err) => {
console.log(err);
});
},
onChangeEvent(e, event, selectedStatus) {
this.roomData = this.oldData;
if (e == "free") {
if (event.target.checked) {
const free = this.roomData.filter((tagfree) => tagfree.status === "free");
this.roomData = free;
console.log(this.roomData);
}
} else if (e == "unavailable") {
if (event.target.checked) {
@ -199,14 +270,11 @@ export default {
<div class="col-8">
<div class="d-flex justify-content-end align-items-baseline">
<div class="d-flex">
<!-- <MaterialCheckbox id="terms5" checked>
<a href="javascript:;" class="font-weight-bolder"> รายต</a>
</MaterialCheckbox> -->
<MaterialCheckbox id="terms6">
<!-- <MaterialCheckbox id="terms6">
<a href="javascript:;" class="font-weight-bolder"> กทงหมด</a>
</MaterialCheckbox>
</MaterialCheckbox> -->
</div>
<label style="margin-right: 10px; margin-left: 20px"
<!-- <label style="margin-right: 10px; margin-left: 20px"
>นหาชอหรอเลขหอง
</label>
<MaterialInput
@ -214,7 +282,7 @@ export default {
icon="search"
type="text"
placeholder="Search"
/>
/> -->
</div>
</div>
</div>
@ -231,11 +299,11 @@ export default {
<div class="d-flex justify-content-between align-items-baseline p-2">
<div class="text-start">
<p class="d-flex align-items-baseline p-2">
<span style="font-weight: bold; text-decoration: underline">
คณะกรรมการประจาต : มาร งาม , บารม งาม</span
>
<a data-bs-toggle="modal" data-bs-target="#Edituser"
><i
<a data-bs-toggle="modal" data-bs-target="#Edituser">
<span style="font-weight: bold; text-decoration: underline">
คณะกรรมการประจาต : {{ committee || "เพิ่มชื่อ" }}</span
>
<i
class="material-icons"
style="cursor: pointer; margin-left: 10px"
aria-hidden="true"
@ -252,7 +320,7 @@ export default {
color="green"
:checked="statusfree"
v-model="selectedStatus"
@change="onChangeEvent('free', $event)"
@click="onChangeEvent('free', $event, selectedStatus)"
>
<a href="javascript:;" class="font-weight-bolder"> าง</a>
</MaterialCheckbox>
@ -260,7 +328,8 @@ export default {
id="terms2"
color="red"
:checked="statuseunavailable"
@change="onChangeEvent('unavailable', $event)"
v-model="selectedUnavailable"
@click="onChangeEvent('unavailable', $event)"
>
<a href="javascript:;" class="font-weight-bolder"> ไมาง</a>
</MaterialCheckbox>
@ -291,7 +360,7 @@ export default {
</div>
<!-- v-for="(item, index) in NoRoom" :key="index" -->
<div v-for="(item, index) in NoRoom" :key="index">
<div v-for="(item, index) in dataBuilding?.listRoom" :key="index">
<div class="card mb-2">
<div class="card-body">
<p class="text-start">
@ -302,27 +371,27 @@ export default {
href="#collapseExample"
aria-expanded="false"
aria-controls="collapseExample"
>{{ item?.title }}</MaterialButton
> {{ item?.floor }}</MaterialButton
>
</p>
<div class="collapse show" id="collapseExample" aria-expanded="true">
<div class="flex-container">
<div v-for="(item, index) in roomData" :key="index">
<div v-for="(item2, index) in roomData" :key="index">
<div
class="card mb-2"
:class="{
'bg-red': item?.status == 'unavailable',
'bg-green': item?.status == 'free',
'bg-warning2': item?.status == 'waiting',
'bg-return': item?.status == 'return',
'bgg-red': item?.status == 'special',
'bg-red': item2?.status == 'unavailable',
'bg-green': item2?.status == 'free',
'bg-warning2': item2?.status == 'waiting',
'bg-return': item2?.status == 'return',
'bgg-red': item2?.status == 'special',
}"
:style="{ width: `220px`, height: `170px` }"
>
<div class="card-body p-1">
<a
style="cursor: pointer"
@click="gotodetail(item?.dataIndex, item?.status)"
@click="gotodetail(item2?.index, item2?.status)"
>
<p
class="card-title"
@ -333,48 +402,50 @@ export default {
background: white;
"
>
<a style="font-size: medium">{{ item?.title }}</a>
<a style="font-size: medium"
>อง {{ item2?.numberRoom }}</a
>
</p>
<p
v-if="item?.status == 'free'"
v-if="item2?.status == 'free'"
class="card-title bgg-green"
style="font-size: 16px"
>
{{ "ว่าง" }}
</p>
<p
v-if="item?.status == 'unavailable'"
v-if="item2?.status == 'unavailable'"
class="card-title bgg-red"
style="font-size: 16px"
>
{{ "ไม่ว่าง" }}
</p>
<p
v-if="item?.status == 'waiting'"
v-if="item2?.status == 'waiting'"
class="card-title bgg-warning2"
style="font-size: 16px"
>
{{ "ชำรุด" }}
</p>
<p
v-if="item?.status == 'return'"
v-if="item2?.status == 'return'"
class="card-title bgg-return"
style="font-size: 16px"
>
{{ "ผ่อนผัน" }}
</p>
<p class="card-title" style="font-size: 14px">
{{ item?.ranks }} {{ item?.firstName }}
{{ item?.laststName }}
{{ item2?.ranks }} {{ item2?.firstName }}
{{ item2?.laststName }}
</p>
<div>
<span
v-if="item?.status !== 'special'"
v-if="item2?.status !== 'special'"
style="text-align: right; font-size: small"
>{{ item?.Affiliation }}</span
>{{ item2?.Affiliation }}</span
>
<span
v-if="item?.status == 'special'"
v-if="item2?.status == 'special'"
style="text-align: right; font-size: 16px"
>{{ "กรณีพิเศษ" }}</span
>
@ -457,6 +528,8 @@ export default {
id="exampleFormControlTextarea1"
rows="3"
placeholder="กรอกชื่อ"
:value="committee"
@input="(event) => (committee = event.target.value)"
></textarea>
</div>
</div>
@ -464,7 +537,14 @@ export default {
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
ดหนาตาง
</button>
<MaterialButton variant="gradient" color="success">นท</MaterialButton>
<MaterialButton
variant="gradient"
color="success"
@click="EdituserForm"
html-type="submit"
data-bs-dismiss="modal"
>นท</MaterialButton
>
</div>
</div>
</div>

View File

@ -14,6 +14,7 @@ import setMaterialInput from "@/assets/js/material-input";
// onMounted(() => {
// setMaterialInput();
// });
import axios from "axios";
const listRoom = [
{ title: "ตึก 1" },
{ title: "ตึก 2" },
@ -164,9 +165,9 @@ export default {
{ label: "มนตรี", value: "มนตรี" },
],
optionsRoomtype: [
{ label: "ช๑", value: "ช๑" },
{ label: "ช๒", value: "ช๒" },
{ label: "ช๓", value: "ช๓" },
{ label: "ช1", value: "ช1" },
{ label: "ช2", value: "ช2" },
{ label: "ช3", value: "ช3" },
],
optionsBuilding: [
{ label: "อาคารแฟลต 1/11", value: "1" },
@ -209,18 +210,21 @@ export default {
phone: "1200",
old: "100",
birthday: "200",
Roomtype: "ช",
Roomtype: "ช1",
Roomconditions: "ปกติ",
selectedRoomtype: "ช",
selectedRoomtype: "ช1",
statusedit: false,
mode: "",
id: "",
numberRoom: "",
roomData:[]
};
},
created() {
this.mode = this.$route.query.mode;
if (this.$route.params.id) {
this.id = this.$route.params.id;
this.getRooms(this.id)
}
// this.$route.query
},
@ -235,6 +239,22 @@ export default {
console.log(event);
// this.selected = event;
},
async getRooms(id) {
try {
await axios
.get(`http://localhost:3001/rooms/${id}`)
.then((res) => {
this.roomData = res.data;
console.log(this.roomData);
// this.oldData = this.roomData;
})
.catch((err) => {
console.log(err);
});
} catch (error) {
console.error(error);
}
},
submitForm() {
let body = {
@ -332,8 +352,8 @@ export default {
<h5>แกไขรายละเอยด อง 2</h5>
<div class="mb-3">
<MaterialInput
:value="lastName"
@input="(event) => (lastName = event.target.value)"
:value="numberRoom"
@input="(event) => (numberRoom = event.target.value)"
class="input-group-static"
label="เลขห้อง"
type="text"
@ -369,7 +389,7 @@ export default {
value="option2"
/>
<label class="form-check-label" for="inlineRadio2"
>ไมชำร</label
>ปกต</label
>
</div>
</div>

View File

@ -4,94 +4,7 @@ import MaterialButton from "@/components/MaterialButton.vue";
import vueMkHeader from "@/assets/img/bg.jpg";
import Breadcrumbs from "@/examples/Breadcrumbs.vue";
import masterData from "@/assets/dataJson/masterData.json";
const listRoom = [
{ title: "ตึก 1" },
{ title: "ตึก 2" },
{ title: "ตึก 3" },
{ title: "ตึก 4" },
{ title: "ตึก 5" },
{ title: "ตึก 6" },
{ title: "ตึก 7" },
];
const NoRoom = [
{ title: "ชั้น 1" },
{ title: "ชั้น 2" },
{ title: "ชั้น 3" },
{ title: "ชั้น 4" },
{ title: "ชั้น 5" },
{ title: "ชั้น 6" },
{ title: "ชั้น 7" },
];
const landingColumns = [
{
title: "ห้อง 1",
dataIndex: "1",
status: true,
},
{
title: "ห้อง 2",
dataIndex: "2",
status: false,
},
{
title: "ห้อง 3",
dataIndex: "3",
status: true,
},
{
title: "ห้อง 4",
dataIndex: "4",
status: true,
},
{
title: "ห้อง 5",
dataIndex: "5",
status: false,
},
{
title: "ห้อง 6",
dataIndex: "6",
status: false,
},
{
title: "ห้อง 7",
dataIndex: "7",
status: true,
},
{
title: "ห้อง 8",
dataIndex: "8",
status: false,
},
{
title: "ห้อง 9",
dataIndex: "9",
status: false,
},
{
title: "ห้อง 10",
dataIndex: "10",
status: false,
},
{
title: "ห้อง 11",
dataIndex: "11",
status: true,
},
{
title: "ห้อง 12",
dataIndex: "12",
status: false,
},
{
title: "ห้อง 13",
dataIndex: "13",
status: false,
},
];
import axios from "axios";
export default {
components: {
@ -101,9 +14,6 @@ export default {
},
setup() {
return {
listRoom,
NoRoom,
landingColumns,
vueMkHeader,
masterData,
};
@ -111,36 +21,121 @@ export default {
data() {
return {
value: { name: "Vue.js", language: "JavaScript" },
options: [
{ label: "Vue.js", value: "JavaScript" },
{ label: "Rails", value: "Ruby" },
{ label: "Sinatra", value: "Ruby" },
{ label: "Laravel", value: "PHP" },
{ label: "Phoenix", value: "Elixir" },
],
optionsRoomtype: [
{ label: "ช๑", value: "ช๑" },
{ label: "ช๒", value: "ช๒" },
{ label: "ช๓", value: "ช๓" },
],
selectedColor: "",
Edifice: "",
Building: "",
Floors: "",
selectedRoomtype: "ช๑",
buildingList: [],
searchName: "",
FloorsList: [],
Area: "",
};
},
created() {
// console.log(this.masterData);
this.getBuildings();
},
watch: {
selectedColor: function (newValue) {
// this.updateColor(newValue)
console.log(newValue);
},
},
computed: {
buildingList() {
return this.buildingList.filter((item) => item.name.includes(this.searchName));
},
},
methods: {
changedLabel(event) {
console.log(event);
// this.selected = event;
changedFloors() {
let array = [];
for (let index = 0; index < this.Floors; index++) {
array.push({
name: this.Building,
floor: index + 1,
rooms: [
{
index: 1,
numberRoom: 1,
ranks: "",
firstName: "",
laststName: "",
Affiliation: "",
typeRoom: "",
status: "free",
},
],
sumroom: 1,
});
}
this.FloorsList = array;
},
addRoom(item) {
item.rooms.push({
index: item.sumroom + 1,
numberRoom: item.sumroom + 1,
ranks: "",
firstName: "",
laststName: "",
Affiliation: "",
typeRoom: "",
status: "free",
});
item.sumroom = item.sumroom + 1;
},
async submitForm() {
let sum = 0;
this.FloorsList.forEach((num) => {
sum += num.sumroom;
});
let body = {
buil: this.Area,
name: this.Building,
sumroom: sum,
floor: this.Floors,
roomnumber: "",
type: "",
listRoom: this.FloorsList,
};
await axios
.post(`http://localhost:3001/buildings`, body, {
headers: {
// remove headers
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
})
.then((res) => {
this.getBuildings();
})
.catch((err) => {
console.log(err);
});
await axios
.post(`http://localhost:3001/rooms`, body, {
headers: {
// remove headers
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
})
},
// buildings
async getBuildings() {
try {
await axios
.get("http://localhost:3001/buildings")
.then((res) => {
this.buildingList = res.data;
})
.catch((err) => {
console.log(err);
});
} catch (error) {
console.error(error);
}
},
},
};
@ -172,12 +167,14 @@ export default {
/>
</div>
<div class="d-flex justify-content-end align-items-baseline">
<label style="margin-right: 10px">นหานทหรอต </label>
<label style="margin-right: 10px">นหาออาคาร </label>
<MaterialInput
class="input-group-dynamic w-30"
icon="search"
type="text"
placeholder="Search"
:value="searchName"
@input="(event) => (searchName = event.target.value)"
/>
<MaterialButton
style="margin-left: 20px"
@ -202,12 +199,12 @@ export default {
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in masterData?.building" :key="index">
<tr v-for="(item, index) in buildingList" :key="index">
<th scope="row">{{ index + 1 }}</th>
<td>{{ item?.buil }}</td>
<td>{{ item?.name }}</td>
<td>{{ item?.floor }}</td>
<td>{{ item?.room }}</td>
<td>{{ item?.sumroom }}</td>
<!-- <td>{{ item?.roomnumber }}</td> -->
<!-- <td>{{ item?.type }}</td> -->
</tr>
@ -228,7 +225,7 @@ export default {
aria-labelledby="staticBackdropLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-dialog-centered">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="staticBackdropLabel">เพมผงหอง</h5>
@ -261,53 +258,67 @@ export default {
placeholder="ชื่ออาคาร"
/>
</div>
<md-chips v-model="fruits" md-placeholder="Add fruit..."></md-chips>
<div class="mb-3">
<MaterialInput
:value="Floors"
@input="(event) => (Floors = event.target.value)"
class="input-group-static"
label="ชั้น"
label="จำนวนชั้น"
type="number"
placeholder="ชั้น"
placeholder="จำนวนชั้น"
@change="changedFloors()"
/>
<div class="card pt-4" v-for="(item, index) in FloorsList" :key="index">
<ul
class="list-group list-group-flush"
style="border: 2px solid #2b572d"
>
<li class="list-group-item">
<span style="font-size: 16px; font-weight: bold"
>นท {{ item.floor }}</span
>
<div>
<label
style="font-size: 16px; font-weight: bold; margin-left: 20px"
>
จำนวนหอง {{ item.sumroom }}
</label>
</div>
<div class="flex-container2">
<div v-for="(item2, index) in item?.rooms" :key="index">
อง {{ item2.numberRoom }}
</div>
<div
style="
background: white;
color: #000;
border: 2px solid #4cbb17;
cursor: pointer;
text-decoration: underline;
font-size: 18px;
"
>
<a @click="addRoom(item)">เพิ่มห้อง</a>
</div>
</div>
</li>
</ul>
</div>
</div>
<div class="mb-3">
<MaterialInput
name="Edifice"
:value="Edifice"
@input="(event) => (Edifice = event.target.value)"
class="input-group-static"
label="จำนวนห้อง"
type="text"
placeholder="จำนวนห้อง"
/>
</div>
<!-- <div class="mb-3">
<label>กรอกเลขหอง</label>
<textarea
:value="roomnumber"
@input="(event) => (roomnumber = event.target.value)"
class="form-control"
id="exampleFormControlTextarea1"
rows="3"
placeholder="ตัวอย่าง : 1,2,3"
></textarea>
</div>
<div class="mb-3">
<label>ประเภทหองพ</label>
<v-select
:options="optionsRoomtype"
v-model="selectedRoomtype"
></v-select>
</div> -->
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
ดหนาตาง
</button>
<MaterialButton variant="gradient" color="success">นท</MaterialButton>
<MaterialButton
variant="gradient"
color="success"
@click="submitForm"
html-type="submit"
data-bs-dismiss="modal"
>นท</MaterialButton
>
</div>
</div>
</div>
@ -316,7 +327,7 @@ export default {
</template>
<style>
.bg-green {
border: 2px solid #4CBB17 !important;
border: 2px solid #4cbb17 !important;
color: #000;
}
.bg-red {
@ -344,4 +355,19 @@ input::-webkit-inner-spin-button {
input[type="number"] {
-moz-appearance: textfield;
}
.flex-container2 {
display: flex;
flex-wrap: wrap;
}
.flex-container2 > div {
background-color: #4cbb17;
color: white;
width: 98px;
margin: 10px;
height: 80px;
text-align: center;
font-size: 24px;
line-height: 80px;
}
</style>

View File

@ -39,45 +39,59 @@ export default {
typeAffiliation: "",
typeRanks: "",
dataUser: [],
olddata: [],
datatypeUser: [],
olddatatypeUser: [],
modalShow: false,
id: "",
searchName: "",
typeUser: "ตร.",
typeUserBytype: "",
typeUserByrankr: "",
};
},
created() {
// console.log(this.masterData);
this.getAlluser();
},
watch: {
selectedColor: function (newValue) {
// this.updateColor(newValue)
console.log(newValue);
},
typeAffiliation: function (newValue) {
// this.updateColor(newValue)
console.log(newValue);
// if(newValue != undefined){
// this.typeAffiliation = newValue.value
// }
},
typeRanks: function (newValue) {
// this.updateColor(newValue)
console.log(newValue);
// if(newValue != undefined){
// this.typeRanks = newValue.value
// }
},
},
computed: {
dataUser() {
return this.dataUser.filter((item) => item.firstName.includes(this.searchName));
},
},
methods: {
filteredData() {
this.dataUser.filter((entry) =>
this.dataUser.length
? Object.keys(this.dataUser[0]).some((key) =>
("" + entry[key]).toLowerCase().includes(this.searchName.toLowerCase())
)
: true
);
typeUserfilter(e) {
if (e.target) this.typeUserBytype = e.target.value;
else this.typeUserBytype = e;
this.dataUser = this.olddata;
if (this.typeUserBytype !== "ทั้งหมด") {
let dataFind = this.dataUser.filter((e) => e.typeUser === this.typeUserBytype);
this.datatypeUser = dataFind;
this.olddatatypeUser = dataFind;
this.dataUser = dataFind;
if (this.typeUserByrankr !== "") this.rankrfilter(this.typeUserByrankr);
} else if (this.typeUserBytype == "ทั้งหมด") {
this.dataUser = this.olddata;
}
},
rankrfilter(e) {
if (e.target) this.typeUserByrankr = e.target.value;
else this.typeUserByrankr = e;
this.datatypeUser = this.olddatatypeUser;
let dataRank = this.datatypeUser.filter((e) => e.typeRanks == this.typeUserByrankr);
this.dataUser = dataRank;
},
typeUserchange(e) {
this.typeUser = e.target.value;
},
async editUser(id) {
@ -98,7 +112,7 @@ export default {
this.modalShow = true;
})
.catch((err) => {
console.log(err.response);
console.log(err);
});
},
@ -133,7 +147,7 @@ export default {
this.getAlluser();
})
.catch((err) => {
console.log(err.response);
console.log(err);
});
},
async submitForm() {
@ -153,8 +167,8 @@ export default {
status: this.selectedDataObtion.value || "โสด",
typeAffiliation: this.typeAffiliation.value,
typeRanks: this.typeRanks.value,
typeUser: this.typeUser,
};
axios
.post(`http://localhost:3001/users`, body, {
headers: {
@ -167,19 +181,22 @@ export default {
this.getAlluser();
})
.catch((err) => {
console.log(err.response);
console.log(err);
});
},
getAlluser() {
async getAlluser() {
try {
axios
await axios
.get("http://localhost:3001/users")
.then((res) => {
this.dataUser = res.data;
this.olddata = res.data;
this.typeUserfilter("ทั้งหมด");
// this.rankrfilter("");
})
.catch((err) => {
console.log(err.response);
console.log(err);
});
} catch (error) {
console.error(error);
@ -213,6 +230,20 @@ export default {
:routes="[{ label: 'หน้าหลัก', route: '/' }, { label: 'ทะเบียน' }]"
/>
</div>
<div class="mb-1">
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="inlineRadioOptions"
id="inlineRadio33"
value="ทั้งหมด"
@change="typeUserfilter($event)"
checked
/>
<label class="form-check-label" for="inlineRadio33">งหมด</label>
</div>
</div>
<div class="d-flex justify-content-between align-items-baseline">
<div class="mb-3">
<div class="form-check form-check-inline">
@ -222,8 +253,8 @@ export default {
type="radio"
name="inlineRadioOptions"
id="inlineRadio1"
value="Radio1"
checked
value="ตร."
@change="typeUserfilter($event)"
/>
<label class="form-check-label" for="inlineRadio1">ตร.</label>
</div>
@ -233,7 +264,8 @@ export default {
type="radio"
name="inlineRadioOptions"
id="inlineRadio2"
value="Radio2"
value="บช.ตชด."
@change="typeUserfilter($event)"
/>
<label class="form-check-label" for="inlineRadio2">บช.ตชด.</label>
</div>
@ -247,7 +279,6 @@ export default {
type="text"
placeholder="Search"
:value="searchName"
@change="filteredData()"
@input="(event) => (searchName = event.target.value)"
/>
<MaterialButton
@ -268,8 +299,8 @@ export default {
type="radio"
name="inlineRadioOptions1"
id="inlineRadio3"
value="Radio3"
checked
value="ประทวน"
@change="rankrfilter($event)"
/>
<label class="form-check-label" for="inlineRadio3">ประทวน</label>
</div>
@ -279,10 +310,22 @@ export default {
type="radio"
name="inlineRadioOptions1"
id="inlineRadio4"
value="Radio4"
value="สัญญาบัตร"
@change="rankrfilter($event)"
/>
<label class="form-check-label" for="inlineRadio4">ญญาบตร</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="inlineRadioOptions1"
id="inlineRadio5"
value="ลูกจ้าง"
@change="rankrfilter($event)"
/>
<label class="form-check-label" for="inlineRadio5">กจาง</label>
</div>
</div>
<div class="text-center pt-4 table-responsive">
<table class="table border border-2 border-success">
@ -353,6 +396,32 @@ export default {
</div>
<div class="modal-body">
<div>
<div class="mb-3">
<div class="form-check form-check-inline">
<label style="margin-right: 20px">ประเภท</label>
<input
class="form-check-input"
type="radio"
name="typeUser"
id="inlinetypeUser1"
value="ตร."
@change="typeUserchange($event)"
checked
/>
<label class="form-check-label" for="inlinetypeUser1">ตร.</label>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="typeUser"
id="inlinetypeUser"
value="บช.ตชด."
@change="typeUserchange($event)"
/>
<label class="form-check-label" for="inlinetypeUser">บช.ตชด.</label>
</div>
</div>
<div class="mb-1">
<label>งก</label>
<v-select
@ -490,14 +559,24 @@ export default {
v-model="typeAffiliation"
></v-select>
</div>
<div class="mb-3" v-if="typeAffiliation.label == 'บก.อก.'">
<div
class="mb-3"
v-if="
typeAffiliation.label == 'บก.อก.' || this.typeAffiliation == 'บก.อก.'
"
>
<label>งก {{ typeAffiliation.label }}</label>
<v-select
:options="masterData?.Affiliation"
v-model="selectedAffiliation"
></v-select>
</div>
<div class="mb-3" v-if="typeAffiliation.label == 'บก.สนน.'">
<div
class="mb-3"
v-if="
typeAffiliation.label == 'บก.สนน.' || this.typeAffiliation == 'บก.สนน.'
"
>
<label>งก {{ typeAffiliation.label }}</label>
<v-select
:options="masterData?.Affiliation2"
@ -508,18 +587,27 @@ export default {
<label>ลำดบยศ</label>
<v-select :options="masterData?.typeranks" v-model="typeRanks"></v-select>
</div>
<div class="mb-3" v-if="typeRanks.label == 'ลูกจ้าง'">
<div
class="mb-3"
v-if="typeRanks.label == 'ลูกจ้าง' || this.typeRanks == 'ลูกจ้าง'"
>
<label> {{ typeRanks.label }}</label>
<v-select :options="masterData?.ranks" v-model="selectedRanks"></v-select>
</div>
<div class="mb-3" v-if="typeRanks.label == 'ประทวน'">
<div
class="mb-3"
v-if="typeRanks.label == 'ประทวน' || this.typeRanks == 'ประทวน'"
>
<label> {{ typeRanks.label }}</label>
<v-select
:options="masterData?.ranks2"
v-model="selectedRanks"
></v-select>
</div>
<div class="mb-3" v-if="typeRanks.label == 'สัญญาบัตร'">
<div
class="mb-3"
v-if="typeRanks.label == 'สัญญาบัตร' || this.typeRanks == 'สัญญาบัตร'"
>
<label> {{ typeRanks.label }}</label>
<v-select
:options="masterData?.ranks3"