update room

This commit is contained in:
kamoa457 2023-11-09 02:09:18 +07:00
parent e2f4f8d1b4
commit 3556889a2d
14 changed files with 1198 additions and 875 deletions

View File

@ -1,347 +1,243 @@
[ [
{ {
"buil": "อาคารบ้านพัก บช. ตชด.", "buil": "test023",
"name": "อาคารแฟลต 1/11", "name": "023",
"sumroom": "24", "sumroom": 7,
"committee": " มารุช ดีงาม , บารมี ดีงาม", "floor": "2",
"floor": "4",
"roomnumber": "", "roomnumber": "",
"type": "ช.2", "type": "",
"committee":"",
"listRoom": [ "listRoom": [
{ {
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"name": "023",
"floor": 1, "floor": 1,
"rooms": [ "rooms": [
{ {
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "f5c54b45-9f9f-459d-891f-838c3a7ff41c",
"name": "023",
"floor": 1,
"index": 1, "index": 1,
"numberRoom": 1, "numberRoom": 1,
"ranks": "ส.ต.ต.", "ranks": "",
"firstName": "ปิติ2", "firstName": "",
"laststName": "มีดี", "laststName": "",
"Affiliation": "ฝอ. 2", "Affiliation": "",
"typeRoom": "ช1", "typeRoom": "",
"status": "unavailable" "roomStatus": "free"
}, },
{ {
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "a10eff34-cbe2-4a71-a44e-0d95bfe33410",
"name": "023",
"floor": 1,
"index": 2, "index": 2,
"numberRoom": 2, "numberRoom": 2,
"ranks": "", "ranks": "",
"firstName": "", "firstName": "",
"laststName": "", "laststName": "",
"Affiliation": "", "Affiliation": "",
"typeRoom": "ช1", "typeRoom": "",
"status": "free" "roomStatus": "free"
}, },
{ {
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "03dc297e-ea5e-4852-8e49-6c9f3d2d47d4",
"name": "023",
"floor": 1,
"index": 3, "index": 3,
"numberRoom": 3, "numberRoom": 3,
"ranks": "ส.ต.ต.", "ranks": "",
"firstName": "ปิติ2", "firstName": "",
"laststName": "มีดี", "laststName": "",
"Affiliation": "ฝอ. 1", "Affiliation": "",
"typeRoom": "ช2", "typeRoom": "",
"status": "return" "roomStatus": "free"
}, },
{ {
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "76f80b9e-a31e-4e7a-92d2-6d857c90fc81",
"name": "023",
"floor": 1,
"index": 4, "index": 4,
"numberRoom": 4, "numberRoom": 4,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ3",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"status": "unavailable"
},
{
"index": 5,
"numberRoom": 5,
"ranks": "", "ranks": "",
"firstName": "", "firstName": "",
"laststName": "", "laststName": "",
"Affiliation": "", "Affiliation": "",
"typeRoom": "ช1", "typeRoom": "",
"status": "free" "roomStatus": "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 "sumroom": 4
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"name": "023",
"floor": 2,
"rooms": [
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "ffe28ac7-d4e3-4ad3-bec4-7d4744660027",
"name": "023",
"floor": 2,
"index": 1,
"numberRoom": 1,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomStatus": "free"
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "ee69339f-529d-443a-b387-cf67102b4a23",
"name": "023",
"floor": 2,
"index": 2,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomStatus": "free"
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "728100ee-a335-4c77-a226-a63c4de6088a",
"name": "023",
"floor": 2,
"index": 3,
"numberRoom": 3,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomStatus": "free"
}
],
"sumroom": 3
}
]
},
{
"buil": "test02",
"name": "01",
"sumroom": 6,
"floor": "2",
"roomnumber": "",
"type": "",
"committee":"",
"listRoom": [
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"name": "01",
"floor": 1,
"rooms": [
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "bcfb5f40-8b1e-4b69-b64e-4d8ca15db8bb",
"name": "01",
"floor": 1,
"index": 1,
"numberRoom": 1,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "3e8b5594-f735-46cf-b71f-14ba3b955c27",
"name": "01",
"floor": 1,
"index": 2,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "cb5942ce-8ba9-4084-9e6a-cd202c238cbe",
"name": "01",
"floor": 1,
"index": 3,
"numberRoom": 3,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "f0ed9596-ee93-4781-a2aa-14d76472d314",
"name": "01",
"floor": 1,
"index": 4,
"numberRoom": 4,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
}
],
"sumroom": 4
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"name": "01",
"floor": 2,
"rooms": [
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "67473bca-fd63-40e5-ad21-87598a77471d",
"name": "01",
"floor": 2,
"index": 1,
"numberRoom": 1,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "932d8efa-e1f7-4529-ad3f-54c109d9f69e",
"name": "01",
"floor": 2,
"index": 2,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
}
],
"sumroom": 2
} }
] ]
} }

View File

@ -1 +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"}] [{"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":"2c388c78-b2a3-4ea2-bca5-48521eb7e5db","no":3,"firstName":"มานี","lastName":"มานอน","affiliation":"ลูกจ้าง","rank":"ส.ต.ต.","idcard":"134044411441178","phone":"0325647845","status":"สมรส","typeAffiliation":"ลูกจ้าง","typeRanks":"ประทวน","typeUser":"ตร.","bookNumber":"1234","typeRoom":"ช2","queue":"inroom","contract":"123","checkintime":"5","maintenance":"200","insurance":"2000","installments":"5","pickedBook":"2023-11-02T14:10:26.374Z"}]

File diff suppressed because one or more lines are too long

View File

@ -1,132 +0,0 @@
[
{
"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,5 +1,6 @@
[ [
{ {
"id": "2c388c78-b2a3-4ea2-bca5-48521eb7e5db",
"index": 1, "index": 1,
"floor": 1, "floor": 1,
"numberRoom": 1, "numberRoom": 1,
@ -8,22 +9,11 @@
"laststName": "มีดี", "laststName": "มีดี",
"Affiliation": "ฝอ. 2", "Affiliation": "ฝอ. 2",
"typeRoom": "ช1", "typeRoom": "ช1",
"Roomconditions": "ปกติ", "roomconditions": "ปกติ",
"status": "unavailable" "roomStatus": "unavailable"
},
{
"index": 2,
"floor": 1,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"Roomconditions": "ชำรุด",
"status": "free"
}, },
{ {
"id": "2c389c78-b2a3-4ea2-bca5-48521eb7e5db",
"index": 3, "index": 3,
"floor": 1, "floor": 1,
"numberRoom": 3, "numberRoom": 3,
@ -32,10 +22,11 @@
"laststName": "มีดี", "laststName": "มีดี",
"Affiliation": "ฝอ. 1", "Affiliation": "ฝอ. 1",
"typeRoom": "ช2", "typeRoom": "ช2",
"Roomconditions": "ปกติ", "roomconditions": "ปกติ",
"status": "return" "roomStatus": "return"
}, },
{ {
"id": "2c388c78-b2a3-4ea2-bca5-57521eb7e5db",
"index": 4, "index": 4,
"floor": 1, "floor": 1,
"numberRoom": 4, "numberRoom": 4,
@ -44,22 +35,11 @@
"laststName": "มีดี", "laststName": "มีดี",
"Affiliation": "ฝอ. 1", "Affiliation": "ฝอ. 1",
"typeRoom": "ช2", "typeRoom": "ช2",
"Roomconditions": "ปกติ", "roomconditions": "ปกติ",
"status": "unavailable" "roomStatus": "unavailable"
},
{
"index": 5,
"floor": 1,
"numberRoom": 5,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"Roomconditions": "ปกติ",
"status": "free"
}, },
{ {
"id": "2c388c78-b2v3-4ea2-bca5-48521eb7e5db",
"index": 6, "index": 6,
"floor": 2, "floor": 2,
"numberRoom": 1, "numberRoom": 1,
@ -68,10 +48,11 @@
"laststName": "มีดี", "laststName": "มีดี",
"Affiliation": "ฝอ. 1", "Affiliation": "ฝอ. 1",
"typeRoom": "ช3", "typeRoom": "ช3",
"Roomconditions": "ปกติ", "roomconditions": "ปกติ",
"status": "special" "roomStatus": "special"
}, },
{ {
"id": "2c787c78-b2a3-4ea2-bca5-48521eb7e5db",
"index": 7, "index": 7,
"floor": 2, "floor": 2,
"numberRoom": 2, "numberRoom": 2,
@ -80,10 +61,11 @@
"laststName": "มีดี", "laststName": "มีดี",
"Affiliation": "ฝอ. 7", "Affiliation": "ฝอ. 7",
"typeRoom": "ช2", "typeRoom": "ช2",
"Roomconditions": "ชำรุด", "roomconditions": "ชำรุด",
"status": "waiting" "roomStatus": "waiting"
}, },
{ {
"id": "2c388c78-q2a3-4ea2-bca5-48521eb7e5db",
"index": 8, "index": 8,
"floor": 2, "floor": 2,
"numberRoom": 3, "numberRoom": 3,
@ -92,10 +74,11 @@
"laststName": "", "laststName": "",
"Affiliation": "", "Affiliation": "",
"typeRoom": "ช2", "typeRoom": "ช2",
"Roomconditions": "ปกติ", "roomconditions": "ปกติ",
"status": "free" "roomStatus": "free"
}, },
{ {
"id": "2c388c36-b2a3-4ea2-bca5-48521eb7e5db",
"index": 5, "index": 5,
"floor": 1, "floor": 1,
"numberRoom": 5, "numberRoom": 5,
@ -104,10 +87,11 @@
"laststName": "", "laststName": "",
"Affiliation": "", "Affiliation": "",
"typeRoom": "ช1", "typeRoom": "ช1",
"Roomconditions": "ปกติ", "roomconditions": "ปกติ",
"status": "free" "roomStatus": "free"
}, },
{ {
"id": "2c388c41-b2a3-4ea2-bca5-48521eb7e5db",
"index": 6, "index": 6,
"floor": 2, "floor": 2,
"numberRoom": 1, "numberRoom": 1,
@ -116,10 +100,11 @@
"laststName": "มีดี", "laststName": "มีดี",
"Affiliation": "ฝอ. 1", "Affiliation": "ฝอ. 1",
"typeRoom": "ช3", "typeRoom": "ช3",
"Roomconditions": "ปกติ", "roomconditions": "ปกติ",
"status": "special" "roomStatus": "special"
}, },
{ {
"id": "2c388c99-b2a3-4ea2-bca5-48521eb7e5db",
"index": 7, "index": 7,
"floor": 2, "floor": 2,
"numberRoom": 2, "numberRoom": 2,
@ -128,10 +113,11 @@
"laststName": "มีดี", "laststName": "มีดี",
"Affiliation": "ฝอ. 7", "Affiliation": "ฝอ. 7",
"typeRoom": "ช2", "typeRoom": "ช2",
"Roomconditions": "ชำรุด", "roomconditions": "ชำรุด",
"status": "waiting" "roomStatus": "waiting"
}, },
{ {
"id": "2c988c78-b2a3-4ea2-bca5-48521eb7e5db",
"index": 8, "index": 8,
"floor": 2, "floor": 2,
"numberRoom": 3, "numberRoom": 3,
@ -140,7 +126,249 @@
"laststName": "", "laststName": "",
"Affiliation": "", "Affiliation": "",
"typeRoom": "ช2", "typeRoom": "ช2",
"Roomconditions": "ปกติ", "roomconditions": "ปกติ",
"status": "free" "roomStatus": "free"
},
{
"id": "2c388c78-b2a3-4ea2-bca5-47821eb7e5db",
"index": 8,
"floor": 1,
"numberRoom": 2,
"ranks": "",
"firstName": "สมชัย14",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"roomconditions": "ปกติ",
"roomStatus": "unavailable",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง"
},
{
"id": "2c388c78-b2a3-4ea2-bca5-48981eb7e5db",
"index": 5,
"floor": 1,
"numberRoom": 5,
"ranks": "",
"firstName": "สมชัย",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"roomconditions": "ปกติ",
"roomStatus": "unavailable",
"lastName": "แสงสุข",
"affiliation": "ฝสสน.1",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "บก.สนน.",
"typeRanks": "ประทวน"
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "ee69339f-529d-443a-b387-cf67102b4a23",
"name": "023",
"floor": 2,
"index": 2,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"roomconditions": "ปกติ",
"typeRoom": "ช1",
"roomStatus": "free"
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "a10eff34-cbe2-4a71-a44e-0d95bfe33410",
"name": "023",
"floor": 1,
"index": 2,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"roomconditions": "ปกติ",
"typeRoom": "ช1",
"roomStatus": "free"
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "03dc297e-ea5e-4852-8e49-6c9f3d2d47d4",
"name": "023",
"floor": 1,
"index": 3,
"numberRoom": 3,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช2",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "ffe28ac7-d4e3-4ad3-bec4-7d4744660027",
"name": "023",
"floor": 2,
"index": 1,
"numberRoom": 1,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "f5c54b45-9f9f-459d-891f-838c3a7ff41c",
"name": "023",
"floor": 1,
"index": 1,
"numberRoom": "112",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"roomconditions": "ชำรุด",
"typeRoom": "ช2",
"roomStatus": "free"
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "76f80b9e-a31e-4e7a-92d2-6d857c90fc81",
"name": "023",
"floor": 1,
"index": 4,
"numberRoom": 4,
"ranks": "",
"firstName": "มานี",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช2",
"roomconditions": "ปกติ",
"roomStatus": "unavailable",
"lastName": "มานอน",
"affiliation": "ลูกจ้าง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ประทวน"
},
{
"buildingId": "8bc8b393-8ae2-4e65-9a35-32c0e76545b3",
"id": "728100ee-a335-4c77-a226-a63c4de6088a",
"name": "023",
"floor": 2,
"index": 3,
"numberRoom": "23",
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "bcfb5f40-8b1e-4b69-b64e-4d8ca15db8bb",
"name": "01",
"floor": 1,
"index": 1,
"numberRoom": 1,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "3e8b5594-f735-46cf-b71f-14ba3b955c27",
"name": "01",
"floor": 1,
"index": 2,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "cb5942ce-8ba9-4084-9e6a-cd202c238cbe",
"name": "01",
"floor": 1,
"index": 3,
"numberRoom": 3,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "f0ed9596-ee93-4781-a2aa-14d76472d314",
"name": "01",
"floor": 1,
"index": 4,
"numberRoom": 4,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "67473bca-fd63-40e5-ad21-87598a77471d",
"name": "01",
"floor": 2,
"index": 1,
"numberRoom": 1,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
},
{
"buildingId": "3ac5e496-89f8-44da-a666-4d910f9ba61c",
"id": "932d8efa-e1f7-4529-ad3f-54c109d9f69e",
"name": "01",
"floor": 2,
"index": 2,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "",
"roomconditions": "ปกติ",
"roomStatus": "free"
} }
] ]

View File

@ -65,6 +65,7 @@ app.put('/users/:id', (req, res) => {
if (req.body.bookNumber) parsedData.bookNumber = req.body.bookNumber if (req.body.bookNumber) parsedData.bookNumber = req.body.bookNumber
if (req.body.pickedBook) parsedData.pickedBook = req.body.pickedBook if (req.body.pickedBook) parsedData.pickedBook = req.body.pickedBook
if (req.body.typeRoom) parsedData.typeRoom = req.body.typeRoom if (req.body.typeRoom) parsedData.typeRoom = req.body.typeRoom
if (req.body.roomconditions) parsedData.roomconditions = req.body.roomconditions
filterdata.push(parsedData) filterdata.push(parsedData)
fs.writeFile('./users.json', JSON.stringify(filterdata, null, 2), (err) => { fs.writeFile('./users.json', JSON.stringify(filterdata, null, 2), (err) => {
if (err) { if (err) {
@ -84,16 +85,14 @@ app.get('/buildings', (req, res) => {
res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Origin", "*");
res.json(building) res.json(building)
}) })
app.get('/buildings/:name', (req, res) => { // app.get('/buildings/:buildingId', (req, res) => {
res.header("Access-Control-Allow-Origin", "*"); // res.header("Access-Control-Allow-Origin", "*");
res.json(building.find(user => user.name === (req.params.name))) // res.json(building.find(buildings => buildings.buildingId === (req.params.buildingId)))
}) // })
app.post('/buildings', (req, res) => { app.post('/buildings', (req, res) => {
res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Origin", "*");
let id = uuidv4();
let body = req.body let body = req.body
let data = { id: id, ...body } building.push(body)
building.push(data)
fs.writeFile('./building.json', JSON.stringify(building), err => { fs.writeFile('./building.json', JSON.stringify(building), err => {
if (err) { if (err) {
console.log('Error writing file', err) console.log('Error writing file', err)
@ -131,15 +130,18 @@ app.get('/rooms', (req, res) => {
}) })
app.get('/rooms/:id', (req, res) => { app.get('/rooms/:id', (req, res) => {
res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Origin", "*");
console.log(req.params.id); res.json(rooms.find(room => room.id == (req.params.id)))
res.json(rooms.find(room => room.index == (req.params.id)))
}) })
app.get('/buildings/:buildingId', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.json(rooms.find(room => room.buildingId === (req.params.buildingId)))
})
app.post('/rooms', (req, res) => { app.post('/rooms', (req, res) => {
res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Origin", "*");
let id = uuidv4();
let body = req.body let body = req.body
let data = { id: id, ...body } rooms.push(body)
rooms.push(data)
fs.writeFile('./rooms.json', JSON.stringify(rooms), err => { fs.writeFile('./rooms.json', JSON.stringify(rooms), err => {
if (err) { if (err) {
console.log('Error writing file', err) console.log('Error writing file', err)
@ -155,15 +157,20 @@ app.put('/rooms/:id', (req, res) => {
let dataOld = rooms[updateIndex] let dataOld = rooms[updateIndex]
let filterdata = rooms.filter(user => user.id !== (req.params.id)) let filterdata = rooms.filter(user => user.id !== (req.params.id))
const parsedData = dataOld; const parsedData = dataOld;
if (req.body.floor) parsedData.floor = req.body.floor
if (req.body.firstName) parsedData.firstName = req.body.firstName if (req.body.firstName) parsedData.firstName = req.body.firstName
if (req.body.lastName) parsedData.lastName = req.body.lastName if (req.body.lastName) parsedData.lastName = req.body.lastName
if (req.body.numberRoom) parsedData.numberRoom = req.body.numberRoom
if (req.body.affiliation) parsedData.affiliation = req.body.affiliation if (req.body.affiliation) parsedData.affiliation = req.body.affiliation
if (req.body.rank) parsedData.rank = req.body.rank if (req.body.ranks) parsedData.ranks = req.body.ranks
if (req.body.idcard) parsedData.idcard = req.body.idcard if (req.body.idcard) parsedData.idcard = req.body.idcard
if (req.body.phone) parsedData.phone = req.body.phone if (req.body.phone) parsedData.phone = req.body.phone
if (req.body.status) parsedData.status = req.body.status if (req.body.status) parsedData.status = req.body.status
if (req.body.roomStatus) parsedData.roomStatus = req.body.roomStatus
if (req.body.typeAffiliation) parsedData.typeAffiliation = req.body.typeAffiliation if (req.body.typeAffiliation) parsedData.typeAffiliation = req.body.typeAffiliation
if (req.body.typeRanks) parsedData.typeRanks = req.body.typeRanks if (req.body.typeRanks) parsedData.typeRanks = req.body.typeRanks
if (req.body.typeRoom) parsedData.typeRoom = req.body.typeRoom
if (req.body.roomconditions) parsedData.roomconditions = req.body.roomconditions
filterdata.push(parsedData) filterdata.push(parsedData)
fs.writeFile('./rooms.json', JSON.stringify(filterdata, null, 2), (err) => { fs.writeFile('./rooms.json', JSON.stringify(filterdata, null, 2), (err) => {
if (err) { if (err) {

348
appserver/test.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",
"roomStatus": "unavailable"
},
{
"index": 2,
"numberRoom": 2,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"roomStatus": "free"
},
{
"index": 3,
"numberRoom": 3,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ2",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"roomStatus": "return"
},
{
"index": 4,
"numberRoom": 4,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ3",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช2",
"roomStatus": "unavailable"
},
{
"index": 5,
"numberRoom": 5,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช1",
"roomStatus": "free"
}
],
"sumroom": 5
},
{
"floor": 2,
"rooms": [
{
"index": 1,
"numberRoom": 1,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ9",
"laststName": "มีดี",
"Affiliation": "ฝอ. 1",
"typeRoom": "ช3",
"roomStatus": "special"
},
{
"index": 2,
"numberRoom": 2,
"ranks": "ส.ต.ต.",
"firstName": "ปิติ6",
"laststName": "มีดี",
"Affiliation": "ฝอ. 7",
"typeRoom": "ช2",
"roomStatus": "waiting"
},
{
"index": 3,
"numberRoom": 3,
"ranks": "",
"firstName": "",
"laststName": "",
"Affiliation": "",
"typeRoom": "ช2",
"roomStatus": "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
}
]
}
]

View File

@ -1,50 +1,4 @@
[ [
{
"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",
"typeRoom": "ช1",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": "",
"pickedBook":"2023-10-08T14:10:26.374Z"
},
{
"id": "ebd367bf-396f-4bae-8130-1ce3fa130d38",
"no": 2,
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"typeRoom": "ช1",
"bookNumber": "",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": "",
"pickedBook":"2023-11-01T14:10:26.374Z"
},
{ {
"id": "507e0867-4d56-4f4e-81d1-f3a1ab0d0fde", "id": "507e0867-4d56-4f4e-81d1-f3a1ab0d0fde",
"no": 1, "no": 1,
@ -66,30 +20,7 @@
"maintenance": "", "maintenance": "",
"insurance": "", "insurance": "",
"installments": "", "installments": "",
"pickedBook":"2023-11-03T14:10:26.374Z" "pickedBook": "2023-11-03T14:10:26.374Z"
},
{
"id": "2c388c78-b2a3-4ea2-bca5-48521eb7e5db",
"no": 3,
"firstName": "มานี",
"lastName": "มานอน",
"affiliation": "ลูกจ้าง",
"rank": "ส.ต.ต.",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ประทวน",
"typeUser": "ตร.",
"bookNumber": "1234",
"typeRoom": "ช2",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": "",
"pickedBook":"2023-11-02T14:10:26.374Z"
}, },
{ {
"id": "1cb479fa-e217-422d-938e-47f6fc9b9f32", "id": "1cb479fa-e217-422d-938e-47f6fc9b9f32",
@ -112,30 +43,7 @@
"maintenance": "", "maintenance": "",
"insurance": "", "insurance": "",
"installments": "", "installments": "",
"pickedBook":"2023-11-07T14:10:26.374Z" "pickedBook": "2023-11-07T14:10:26.374Z"
},
{
"id": "967bf9a7-047e-4951-ba2a-190f42045715",
"no": 5,
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ฝสสน.1",
"rank": "ส.ต.ท.",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeRoom": "ช1",
"typeAffiliation": "บก.สนน.",
"typeRanks": "ประทวน",
"typeUser": "บช.ตชด.",
"bookNumber": "456",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": "",
"pickedBook":"2023-11-08T14:10:26.374Z"
}, },
{ {
"id": "fae8c402-f815-44cc-8702-bf843dc97db4", "id": "fae8c402-f815-44cc-8702-bf843dc97db4",
@ -157,7 +65,7 @@
"maintenance": "", "maintenance": "",
"insurance": "", "insurance": "",
"installments": "", "installments": "",
"pickedBook":"2023-11-08T10:10:26.374Z" "pickedBook": "2023-11-08T10:10:26.374Z"
}, },
{ {
"id": "fc3710ca-c3af-4781-9c8f-4aa6657ddff4", "id": "fc3710ca-c3af-4781-9c8f-4aa6657ddff4",
@ -180,7 +88,7 @@
"maintenance": "", "maintenance": "",
"insurance": "", "insurance": "",
"installments": "", "installments": "",
"pickedBook":"2023-11-08T14:10:26.374Z" "pickedBook": "2023-11-08T14:10:26.374Z"
}, },
{ {
"id": "8e81c39a-d50c-42f5-85c0-f9f773c2a4aa", "id": "8e81c39a-d50c-42f5-85c0-f9f773c2a4aa",
@ -203,6 +111,98 @@
"maintenance": "", "maintenance": "",
"insurance": "", "insurance": "",
"installments": "", "installments": "",
"pickedBook":"2023-11-08T12:10:26.374Z" "pickedBook": "2023-11-08T12:10:26.374Z"
},
{
"id": "ebd367bf-396f-4bae-8130-1ce3fa130d38",
"no": 2,
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ลูกจ้าง",
"rank": "นาง",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ลูกจ้าง",
"typeUser": "ตร.",
"typeRoom": "ช1",
"bookNumber": "",
"queue": "inqueue",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": "",
"pickedBook": "2023-11-01T14:10:26.374Z"
},
{
"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",
"typeRoom": "ช1",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": "",
"pickedBook": "2023-10-08T14:10:26.374Z"
},
{
"id": "967bf9a7-047e-4951-ba2a-190f42045715",
"no": 5,
"firstName": "สมชัย",
"lastName": "แสงสุข",
"affiliation": "ฝสสน.1",
"rank": "ส.ต.ท.",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "โสด",
"typeRoom": "ช1",
"typeAffiliation": "บก.สนน.",
"typeRanks": "ประทวน",
"typeUser": "บช.ตชด.",
"bookNumber": "456",
"queue": "inroom",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": "",
"pickedBook": "2023-11-08T14:10:26.374Z"
},
{
"id": "2c388c78-b2a3-4ea2-bca5-48521eb7e5db",
"no": 3,
"firstName": "มานี",
"lastName": "มานอน",
"affiliation": "ลูกจ้าง",
"rank": "ส.ต.ต.",
"idcard": "134044411441178",
"phone": "0325647845",
"status": "สมรส",
"typeAffiliation": "ลูกจ้าง",
"typeRanks": "ประทวน",
"typeUser": "ตร.",
"bookNumber": "1234",
"typeRoom": "ช2",
"queue": "inroom",
"contract": "",
"checkintime": "",
"maintenance": "",
"insurance": "",
"installments": "",
"pickedBook": "2023-11-02T14:10:26.374Z"
} }
] ]

View File

@ -17,6 +17,7 @@
"pinia": "2.0.14", "pinia": "2.0.14",
"prismjs": "1.28.0", "prismjs": "1.28.0",
"typed.js": "2.0.12", "typed.js": "2.0.12",
"uuid": "^9.0.1",
"vue": "3.2.36", "vue": "3.2.36",
"vue-clipboard3": "2.0.0", "vue-clipboard3": "2.0.0",
"vue-count-to": "1.0.13", "vue-count-to": "1.0.13",

View File

@ -70,7 +70,7 @@ export default {
}, },
editTypeRoom(event) { editTypeRoom(event) {
console.log(event); // console.log(event);
this.typeroomByqueue = event; this.typeroomByqueue = event;
}, },
@ -116,7 +116,7 @@ export default {
this.userByid = data; this.userByid = data;
}) })
.catch((err) => { .catch((err) => {
console.log(err.response); console.log(err);
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);

View File

@ -7,36 +7,7 @@ import MaterialButton from "@/components/MaterialButton.vue";
import Breadcrumbs from "@/examples/Breadcrumbs.vue"; import Breadcrumbs from "@/examples/Breadcrumbs.vue";
import axios from "axios"; import axios from "axios";
const userlist = [
{
dataIndex: "1",
firstName: "สมชาย",
lastName: "แสงทอง",
Affiliation: "ฝอ.2", //
rank: "ส.ต.ต.",
idcard: "134044411441122",
phone: "0325647846",
bookNumber: "1234",
ContractDate: "12/11/2566", //
Lengthofstay: "3 เดือน", //
InsuranceMoney: "10,000",
Status: "รอคิว",
},
{
dataIndex: "2",
firstName: "สมชัย",
lastName: "แสงสุข",
Affiliation: "ฝอ.2", //
rank: "ส.ต.ต.",
idcard: "134044411441178",
phone: "0325647845",
bookNumber: "1234",
ContractDate: "12/11/2566", //
Lengthofstay: "3 เดือน", //
InsuranceMoney: "10,000",
Status: "รอคิว",
},
];
export default { export default {
components: { components: {
MaterialInput, MaterialInput,
@ -45,8 +16,7 @@ export default {
}, },
setup() { setup() {
return { return {
vueMkHeader, vueMkHeader
userlist,
}; };
}, },
@ -85,16 +55,10 @@ export default {
this.id = this.$route.params.id; this.id = this.$route.params.id;
this.getroomByid(this.id); this.getroomByid(this.id);
} }
this.getAllqueue();
// this.$route.query
}, },
methods: { methods: {
gotoAction() { gotoAction() {
// if (this.mode == "edit") {
this.$router.push({ path: `/room/update/${this.id}`, query: { mode: this.mode } }); this.$router.push({ path: `/room/update/${this.id}`, query: { mode: this.mode } });
// } else {
// this.$router.push({ path: `/addUserRoom` , query: { mode: this.mode } });
// }
}, },
getAllqueue() { getAllqueue() {
try { try {
@ -102,7 +66,8 @@ export default {
.get(`http://localhost:3001/queue/inqueue`) .get(`http://localhost:3001/queue/inqueue`)
.then((res) => { .then((res) => {
this.queueList = res.data; this.queueList = res.data;
this.queuefilter = this.queueList.filter((e) => e.status === this.typeroom); console.log(this.queueList);
this.queuefilter = this.queueList.filter((e) => e.typeRoom === this.typeroom);
}) })
.catch((err) => { .catch((err) => {
console.log(err.response); console.log(err.response);
@ -115,10 +80,12 @@ export default {
try { try {
axios.get(`http://localhost:3001/rooms/${id}`).then((res) => { axios.get(`http://localhost:3001/rooms/${id}`).then((res) => {
this.data = res.data; this.data = res.data;
console.log(this.data); // console.log(this.data);
if (this.data.typeRoom == "ช1") this.typeroom = "โสด"; // if (this.data.typeRoom == "1") this.typeroom = "";
if (this.data.typeRoom == "ช2") this.typeroom = "สมรส"; // if (this.data.typeRoom == "2") this.typeroom = "";
if (this.data.typeRoom == "ช3") this.typeroom = "ทั่วไป"; // if (this.data.typeRoom == "3") this.typeroom = "";
this.typeroom = this.data.typeRoom
this.getAllqueue()
}); });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@ -156,7 +123,6 @@ export default {
await axios await axios
.post(`http://localhost:3001/history`, body, { .post(`http://localhost:3001/history`, body, {
headers: { headers: {
// remove headers
"Access-Control-Allow-Origin": "*", "Access-Control-Allow-Origin": "*",
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@ -164,7 +130,7 @@ export default {
.then((res) => { .then((res) => {
this.submitForm2() this.submitForm2()
this.submitForm3() this.submitForm3()
this.getAllqueue(); this.submitFormRoom()
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
@ -185,17 +151,10 @@ export default {
await axios await axios
.post(`http://localhost:3001/report`, body, { .post(`http://localhost:3001/report`, body, {
headers: { headers: {
// remove headers
"Access-Control-Allow-Origin": "*", "Access-Control-Allow-Origin": "*",
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
}) })
.then((res) => {
this.getAllqueue();
})
.catch((err) => {
console.log(err);
});
}, },
async submitForm3() { async submitForm3() {
@ -210,15 +169,35 @@ export default {
}; };
await axios await axios
.put(`http://localhost:3001/queue/${this.id}`, body, { .put(`http://localhost:3001/queue/${this.userId}`, body, {
headers: {
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
})
},
async submitFormRoom() {
let body = {
...this.userByid,
queue: "inroom",
roomStatus: 'unavailable',
contract: this.contract,
checkintime: this.Checkintime,
maintenance: this.Maintenance,
insurance: this.insurance,
installments: this.installments,
};
await axios
.put(`http://localhost:3001/rooms/${this.id}`, body, {
headers: { headers: {
// remove headers
"Access-Control-Allow-Origin": "*", "Access-Control-Allow-Origin": "*",
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
}) })
.then((res) => { .then((res) => {
this.getAllqueue(); this.getAllqueue();
this.$router.push({ path: `/room` });
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);

View File

@ -32,13 +32,13 @@ export default {
], ],
listRoom: [], listRoom: [],
selectedtypeRoom: "ช1", selectedtypeRoom: "ทั้งหมด",
selectedColor: "", selectedColor: "",
statusfree: false, statusfree: false,
statusreturn: false, statusreturn: false,
statuseunavailable: false, statuseunavailable: false,
statusewaiting: false, statusewaiting: false,
selectedlistRoom: { label: "อาคารแฟลต 1/11", value: "อาคารแฟลต 1/11" }, selectedlistRoom: "",
committee: "", committee: "",
selectedStatus: "", selectedStatus: "",
selectedReturn: "", selectedReturn: "",
@ -47,6 +47,9 @@ export default {
selectedScaple: "", selectedScaple: "",
roomData: [], roomData: [],
buildingList: [], buildingList: [],
roomList: [],
roomListOld: [],
buidingId: "",
}; };
}, },
created() { created() {
@ -57,43 +60,37 @@ export default {
console.error(e); console.error(e);
} }
this.getRooms(); // this.getRooms();
this.getBuildings(); this.getBuildings();
}, },
watch: { watch: {
selectedtypeRoom: function (newValue) { selectedtypeRoom: function (newValue) {
this.roomData = this.oldData; this.roomList = this.roomListOld;
let filldata = [];
if (newValue !== null) { if (newValue !== null) {
if (newValue.value !== "ทั้งหมด") { if (newValue.value !== "ทั้งหมด") {
const typeRoom = this.roomData.filter( filldata = this.roomList.map((ele, i) => {
(tagreturn) => tagreturn.typeRoom === newValue.value return ele.data.filter((c) => c.typeRoom == newValue.value);
); });
this.roomData = typeRoom; let t = Object.keys(filldata).map((ele) => {
return {
floor: parseInt(ele) + 1,
data: filldata[ele] || [],
};
});
this.roomList = t;
} else { } else {
this.roomData = this.oldData; this.roomList = this.roomListOld;
} }
} }
}, },
// selectedtypeRoom: async function (newValue) { selectedlistRoom: async function (newValue) {
// // this.dataBuilding["listRoom"] = []; let arr = []
// let buildingList = []; arr = this.buildingList.find(e => e.buil == newValue.value )
// buildingList = this.oldData this.buidingId = arr.listRoom[0].buildingId
// let datalist = [] this.buildById(this.buidingId);
// 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: { methods: {
gotodetail(id, index) { gotodetail(id, index) {
@ -133,8 +130,8 @@ export default {
.get("http://localhost:3001/rooms") .get("http://localhost:3001/rooms")
.then((res) => { .then((res) => {
this.roomData = res.data; this.roomData = res.data;
console.log(this.roomData);
this.oldData = this.roomData; this.oldData = this.roomData;
this.buildById(this.buidingId);
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
@ -143,24 +140,44 @@ export default {
console.error(error); console.error(error);
} }
}, },
async buildById(id) {
try {
axios.get(`http://localhost:3001/rooms/`).then((res) => {
let broom = [];
let buidingRoom = res.data;
// let buidingRoomOld = buidingRoom;
broom = buidingRoom.filter((e) => e.buildingId == id);
const groupByCategory = Object.groupBy(broom, (product) => {
return product.floor;
});
this.roomList = Object.keys(groupByCategory).map((ele) => {
return {
floor: parseInt(ele),
data: groupByCategory[ele].sort((a, b) => a.index - b.index),
};
});
this.roomListOld = this.roomList;
});
} catch (e) {
console.error(e);
}
},
async getBuildings() { async getBuildings() {
try { try {
axios.get(`http://localhost:3001/buildings/`).then((res) => { axios.get(`http://localhost:3001/buildings/`).then((res) => {
this.buildingList = res.data; this.buildingList = res.data;
// this.oldData = res.data this.listRoom = this.buildingList.map(e => {
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 { return {
label: ele.name, label: e.buil,
value: ele.name, value: e.buil
}; }
}); })
let roomValue = this.buildingList[0];
this.committee = roomValue.committee;
this.selectedlistRoom = { label: roomValue.buil, value: roomValue.buil };
this.buidingId = roomValue.listRoom[0].buildingId;
this.dataBuilding = { ...roomValue };
this.getRooms();
}); });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@ -187,39 +204,72 @@ export default {
}); });
}, },
onChangeEvent(e, event, selectedStatus) { onChangeEvent(e, event, selectedStatus) {
this.roomData = this.oldData; this.roomList = this.roomListOld;
let filldata = [];
if (e == "free") { if (e == "free") {
if (event.target.checked) { if (event.target.checked) {
const free = this.roomData.filter((tagfree) => tagfree.status === "free"); filldata = this.roomList.map((ele, i) => {
this.roomData = free; return ele.data.filter((c) => c.roomStatus == "free");
});
let t = Object.keys(filldata).map((ele) => {
return {
floor: parseInt(ele) + 1,
data: filldata[ele] || [],
};
});
this.roomList = t;
} }
} else if (e == "unavailable") { } else if (e == "unavailable") {
if (event.target.checked) { if (event.target.checked) {
const statuseunavailable = this.roomData.filter( filldata = this.roomList.map((ele, i) => {
(tagun) => tagun.status === "unavailable" return ele.data.filter((c) => c.roomStatus == "unavailable");
); });
this.roomData = statuseunavailable; let t = Object.keys(filldata).map((ele) => {
return {
floor: parseInt(ele) + 1,
data: filldata[ele] || [],
};
});
this.roomList = t;
} }
} else if (e == "waiting") { } else if (e == "waiting") {
if (event.target.checked) { if (event.target.checked) {
const waiting = this.roomData.filter( filldata = this.roomList.map((ele, i) => {
(tagwaiting) => tagwaiting.status === "waiting" return ele.data.filter((c) => c.roomconditions == "ชำรุด");
); });
this.roomData = waiting; let t = Object.keys(filldata).map((ele) => {
return {
floor: parseInt(ele) + 1,
data: filldata[ele] || [],
};
});
this.roomList = t;
} }
} else if (e == "return") { } else if (e == "return") {
if (event.target.checked) { if (event.target.checked) {
const returns = this.roomData.filter( filldata = this.roomList.map((ele, i) => {
(tagreturn) => tagreturn.status === "return" return ele.data.filter((c) => c.roomStatus == "return");
); });
this.roomData = returns; let t = Object.keys(filldata).map((ele) => {
return {
floor: parseInt(ele) + 1,
data: filldata[ele] || [],
};
});
this.roomList = t;
} }
} else if (e == "special") { } else if (e == "special") {
if (event.target.checked) { if (event.target.checked) {
const specials = this.roomData.filter( filldata = this.roomList.map((ele, i) => {
(tagreturn) => tagreturn.status === "special" return ele.data.filter((c) => c.roomStatus == "special");
); });
this.roomData = specials; let t = Object.keys(filldata).map((ele) => {
return {
floor: parseInt(ele) + 1,
data: filldata[ele] || [],
};
});
this.roomList = t;
} }
} }
}, },
@ -233,7 +283,7 @@ export default {
:style="`background-image: url(${vueMkHeader})`" :style="`background-image: url(${vueMkHeader})`"
loading="lazy" loading="lazy"
> >
<div class="container-fluid"> <div class="container">
<div class="text-center" style="margin-top: -120px"> <div class="text-center" style="margin-top: -120px">
<img src="../../assets/img/logo.png" alt="title" loading="lazy" class="w-35" /> <img src="../../assets/img/logo.png" alt="title" loading="lazy" class="w-35" />
</div> </div>
@ -299,7 +349,7 @@ export default {
<div class="text-center pt-4"> <div class="text-center pt-4">
<div class="d-flex justify-content-start align-items-baseline pt-1 w-35"> <div class="d-flex justify-content-start align-items-baseline pt-1 w-35">
<label class="w-30" style="margin-right: 5px"> เลอกประเภทหอง</label> <label class="w-30" style="margin-right: 5px; margin-left: -20px"> เลอกประเภทหอง</label>
<v-select <v-select
class="w-50" class="w-50"
:options="typeRoom" :options="typeRoom"
@ -359,14 +409,6 @@ export default {
> >
<a href="javascript:;" class="font-weight-bolder"> อนผ</a> <a href="javascript:;" class="font-weight-bolder"> อนผ</a>
</MaterialCheckbox> </MaterialCheckbox>
<MaterialCheckbox
id="terms5"
color="warning3"
:checked="statusreturn"
@change="onChangeEvent('return', $event)"
>
<a href="javascript:;" class="font-weight-bolder"> รอคนเงนประก</a>
</MaterialCheckbox>
<MaterialCheckbox <MaterialCheckbox
id="terms6" id="terms6"
color="special" color="special"
@ -378,7 +420,7 @@ export default {
</div> </div>
<!-- v-for="(item, index) in NoRoom" :key="index" --> <!-- v-for="(item, index) in NoRoom" :key="index" -->
<div v-for="(item, index) in dataBuilding?.listRoom" :key="index"> <div v-for="(item, index) in roomList" :key="index">
<div class="card mb-2"> <div class="card mb-2">
<div class="card-body"> <div class="card-body">
<p class="text-start"> <p class="text-start">
@ -394,22 +436,24 @@ export default {
</p> </p>
<div class="collapse show" id="collapseExample" aria-expanded="true"> <div class="collapse show" id="collapseExample" aria-expanded="true">
<div class="flex-container-fluid"> <div class="flex-container-fluid">
<div v-for="(item2, index) in roomData" :key="index"> <div v-for="(item2, index) in item.data" :key="index">
<div <div
class="card mb-2" class="card mb-2"
:class="{ :class="{
'bg-red': item2?.status == 'unavailable', 'bg-red': item2?.roomStatus == 'unavailable',
'bg-green': item2?.status == 'free', 'bg-green':
'bg-warning2': item2?.status == 'waiting', item2?.roomStatus == 'free' &&
'bg-return': item2?.status == 'return', item2?.roomconditions !== 'ชำรุด',
'bgg-red': item2?.status == 'special', 'bg-warning2': item2?.roomconditions == 'ชำรุด',
'bg-return': item2?.roomStatus == 'return',
'bgg-red': item2?.roomStatus == 'special',
}" }"
:style="{ height: `150px` }" :style="{ height: `150px` }"
> >
<div class="card-body p-1"> <div class="card-body p-1">
<a <a
style="cursor: pointer" style="cursor: pointer"
@click="gotodetail(item2?.index, item2?.status)" @click="gotodetail(item2?.id, item2?.roomStatus)"
> >
<p <p
class="card-title" class="card-title"
@ -425,28 +469,31 @@ export default {
> >
</p> </p>
<p <p
v-if="item2?.status == 'free'" v-if="
item2?.roomStatus == 'free' &&
item2?.roomconditions !== 'ชำรุด'
"
class="card-title bgg-green" class="card-title bgg-green"
style="font-size: 16px" style="font-size: 16px"
> >
{{ "ว่าง" }} {{ "ว่าง" }}
</p> </p>
<p <p
v-if="item2?.status == 'unavailable'" v-if="item2?.roomStatus == 'unavailable'"
class="card-title bgg-red" class="card-title bgg-red"
style="font-size: 16px" style="font-size: 16px"
> >
{{ "ไม่ว่าง" }} {{ "ไม่ว่าง" }}
</p> </p>
<p <p
v-if="item2?.status == 'waiting'" v-if="item2?.roomconditions == 'ชำรุด'"
class="card-title bgg-warning2" class="card-title bgg-warning2"
style="font-size: 16px" style="font-size: 16px"
> >
{{ "ชำรุด" }} {{ "ชำรุด" }}
</p> </p>
<p <p
v-if="item2?.status == 'return'" v-if="item2?.roomStatus == 'return'"
class="card-title bgg-return" class="card-title bgg-return"
style="font-size: 16px" style="font-size: 16px"
> >
@ -458,13 +505,23 @@ export default {
</p> </p>
<p> <p>
<span <span
v-if="item2?.status !== 'special'" v-if="item2?.roomStatus !== 'special'"
style="text-align: right; font-size: small" style="text-align: right; font-size: small"
>{{ item2?.Affiliation }}</span >{{ item2?.Affiliation }}</span
> >
<span <span
v-if="item2?.status == 'special'" v-if="item2?.roomStatus == 'special'"
style="text-align: right; font-size: 16px" style="
font-size: 16px;
display: flex;
align-items: center;
margin-left: 5px;
"
><i
class="material-icons me-2"
style="cursor: pointer"
aria-hidden="true"
>star</i
>{{ "กรณีพิเศษ" }}</span >{{ "กรณีพิเศษ" }}</span
> >
</p> </p>

View File

@ -11,97 +11,9 @@ import Breadcrumbs from "@/examples/Breadcrumbs.vue";
import MaterialButton from "@/components/MaterialButton.vue"; import MaterialButton from "@/components/MaterialButton.vue";
// material-input // material-input
import setMaterialInput from "@/assets/js/material-input"; import setMaterialInput from "@/assets/js/material-input";
// onMounted(() => {
// setMaterialInput();
// });
import axios from "axios"; import axios from "axios";
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,
},
];
const userlist = [ const userlist = [
{ {
dataIndex: "1", dataIndex: "1",
@ -134,8 +46,6 @@ export default {
}, },
setup() { setup() {
return { return {
listRoom,
NoRoom,
vueMkHeader, vueMkHeader,
userlist, userlist,
}; };
@ -143,7 +53,6 @@ export default {
data() { data() {
return { return {
value: { name: "Vue.js", language: "JavaScript" },
options: [ options: [
{ label: "มกราคม", value: "01" }, { label: "มกราคม", value: "01" },
{ label: "กุมภาพันธ์", value: "02" }, { label: "กุมภาพันธ์", value: "02" },
@ -240,6 +149,10 @@ export default {
console.log(event); console.log(event);
// this.selected = event; // this.selected = event;
}, },
queuetypefilter(e) {
if (e.target) this.Roomconditions = e.target.value;
},
async getRooms(id) { async getRooms(id) {
try { try {
await axios await axios
@ -247,6 +160,9 @@ export default {
.then((res) => { .then((res) => {
this.roomData = res.data; this.roomData = res.data;
console.log(this.roomData); console.log(this.roomData);
this.numberRoom = this.roomData.numberRoom;
this.selectedRoomtype = this.roomData.typeRoom
// this.oldData = this.roomData; // this.oldData = this.roomData;
}) })
.catch((err) => { .catch((err) => {
@ -259,17 +175,24 @@ export default {
submitForm() { submitForm() {
let body = { let body = {
firstName: this.firstName, numberRoom: this.numberRoom,
lastName: this.lastName, typeRoom: this.selectedRoomtype.label,
Affiliation: this.Affiliation, roomconditions: this.Roomconditions,
rank: this.rank,
idcard: this.idcard,
phone: this.phone,
}; };
// let b = [] axios
// b.push(body) .put(`http://localhost:3001/rooms/${this.id}`, body, {
// this.userlist.push(body) headers: {
// console.log(this.userlist); // remove headers
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
})
.then((res) => {
this.getRooms(this.id);
})
.catch((err) => {
console.log(err);
});
}, },
}, },
}; };
@ -373,7 +296,7 @@ export default {
> >
<div class="p-4"> <div class="p-4">
<div> <div>
<h5>แกไขรายละเอยด อง 2</h5> <h5>แกไขรายละเอยด อง {{ numberRoom }}</h5>
<div class="mb-3"> <div class="mb-3">
<MaterialInput <MaterialInput
:value="numberRoom" :value="numberRoom"
@ -400,9 +323,11 @@ export default {
type="radio" type="radio"
name="inlineRadioOptions" name="inlineRadioOptions"
id="inlineRadio1" id="inlineRadio1"
value="option1" value="ปกติ"
@change="queuetypefilter($event)"
:checked="Roomconditions == 'ปกติ'"
/> />
<label class="form-check-label" for="inlineRadio1">ชำร</label> <label class="form-check-label" for="inlineRadio1">ปกต</label>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input <input
@ -410,15 +335,21 @@ export default {
type="radio" type="radio"
name="inlineRadioOptions" name="inlineRadioOptions"
id="inlineRadio2" id="inlineRadio2"
value="option2" value="ชำรุด"
@change="queuetypefilter($event)"
:checked="Roomconditions == 'ชำรุด'"
/> />
<label class="form-check-label" for="inlineRadio2">ปกต</label> <label class="form-check-label" for="inlineRadio2">ชำร</label>
</div> </div>
</div> </div>
</div> </div>
<div class="text-center"> <div class="text-center">
<MaterialButton variant="gradient" color="success" <MaterialButton
variant="gradient"
color="success"
@click="submitForm"
html-type="submit"
>นท</MaterialButton >นท</MaterialButton
> >
</div> </div>
@ -561,27 +492,6 @@ export default {
/> />
</div> </div>
</div> </div>
<div
class="mb-3"
style="
display: flex;
justify-content: space-between;
align-items: center;
"
>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="inlineRadioOptions"
id="inlineRadio22"
value="รอคืนเงินประกัน"
/>
<label class="form-check-label" for="inlineRadio22"
>รอคนเงนประก</label
>
</div>
</div>
<div> <div>
<label style="padding-left: 30px" <label style="padding-left: 30px"
>หลกฐานแสดงการชาระคาไฟเดอนลาส</label >หลกฐานแสดงการชาระคาไฟเดอนลาส</label

View File

@ -5,6 +5,7 @@ import vueMkHeader from "@/assets/img/bg.jpg";
import Breadcrumbs from "@/examples/Breadcrumbs.vue"; import Breadcrumbs from "@/examples/Breadcrumbs.vue";
import masterData from "@/assets/dataJson/masterData.json"; import masterData from "@/assets/dataJson/masterData.json";
import axios from "axios"; import axios from "axios";
import { v4 as uuidv4 } from "uuid";
export default { export default {
components: { components: {
@ -50,12 +51,19 @@ export default {
methods: { methods: {
changedFloors() { changedFloors() {
let array = []; let array = [];
let idbuilding = uuidv4();
for (let index = 0; index < this.Floors; index++) { for (let index = 0; index < this.Floors; index++) {
array.push({ array.push({
buildingId: idbuilding,
name: this.Building, name: this.Building,
floor: index + 1, floor: index + 1,
committee: "",
rooms: [ rooms: [
{ {
buildingId: idbuilding,
id: uuidv4(),
name: this.Building,
floor: index + 1,
index: 1, index: 1,
numberRoom: 1, numberRoom: 1,
ranks: "", ranks: "",
@ -63,7 +71,8 @@ export default {
laststName: "", laststName: "",
Affiliation: "", Affiliation: "",
typeRoom: "", typeRoom: "",
status: "free", roomconditions: "ปกติ",
roomStatus: "free",
}, },
], ],
sumroom: 1, sumroom: 1,
@ -73,6 +82,10 @@ export default {
}, },
addRoom(item) { addRoom(item) {
item.rooms.push({ item.rooms.push({
buildingId: item.buildingId,
id: uuidv4(),
name: item.name,
floor: item.floor,
index: item.sumroom + 1, index: item.sumroom + 1,
numberRoom: item.sumroom + 1, numberRoom: item.sumroom + 1,
ranks: "", ranks: "",
@ -80,7 +93,8 @@ export default {
laststName: "", laststName: "",
Affiliation: "", Affiliation: "",
typeRoom: "", typeRoom: "",
status: "free", roomconditions: "ปกติ",
roomStatus: "free",
}); });
item.sumroom = item.sumroom + 1; item.sumroom = item.sumroom + 1;
}, },
@ -108,20 +122,35 @@ export default {
}, },
}) })
.then((res) => { .then((res) => {
this.submitRoom();
this.getBuildings(); this.getBuildings();
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
}); });
await axios },
.post(`http://localhost:3001/rooms`, body, {
async submitRoom() {
let floorsList = [];
await this.FloorsList.forEach((e) => {
e.rooms.forEach((ele) => {
floorsList.push(ele);
});
});
// let body = floorsList
console.log(floorsList);
await floorsList.forEach(x => {
axios
.post(`http://localhost:3001/rooms`, x, {
headers: { headers: {
// remove headers // remove headers
"Access-Control-Allow-Origin": "*", "Access-Control-Allow-Origin": "*",
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
}) })
})
}, },
// buildings // buildings
async getBuildings() { async getBuildings() {
try { try {
@ -141,7 +170,7 @@ export default {
}; };
</script> </script>
<template> <template>
<Header> <Header>
<div <div
class="page-header min-vh-70" class="page-header min-vh-70"
:style="`background-image: url(${vueMkHeader})`" :style="`background-image: url(${vueMkHeader})`"