From 63bb45452e0d695bd3dba704a63d814be60633e2 Mon Sep 17 00:00:00 2001 From: kamoa457 Date: Wed, 8 Nov 2023 04:36:13 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=87=E0=B9=88=E0=B8=A7=E0=B8=87=E0=B8=99?= =?UTF-8?q?=E0=B8=AD=E0=B8=99=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B9=84=E0=B8=AB?= =?UTF-8?q?=E0=B8=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appserver/Expenses.json | 27 ++ appserver/building.json | 348 ++++++++++++++++++ appserver/history.json | 1 + appserver/queue.json | 84 ++++- appserver/report.json | 1 + appserver/ro.json | 132 +++++++ appserver/rooms.json | 226 +++++------- appserver/server.js | 165 +++++++-- appserver/users.json | 246 ++++++++++--- appserver/้history.json | 176 +++++++++ webapp/src/views/Expenses/ExpensesView.vue | 223 +++++++---- webapp/src/views/Queue/QueueView.vue | 150 +++++--- webapp/src/views/Reports/ReportlistView.vue | 19 +- webapp/src/views/Restroom/DetailRoomPage.vue | 166 ++++++++- webapp/src/views/Restroom/RoomView.vue | 240 ++++++++---- webapp/src/views/Restroom/UpdateRoom.vue | 36 +- .../src/views/RoomLayout/RoomLayoutView.vue | 316 ++++++++-------- webapp/src/views/Users/UserlistView.vue | 170 ++++++--- webapp/src/views/Users/newCustomer.json | 0 19 files changed, 2070 insertions(+), 656 deletions(-) create mode 100644 appserver/Expenses.json create mode 100644 appserver/building.json create mode 100644 appserver/history.json create mode 100644 appserver/report.json create mode 100644 appserver/ro.json create mode 100644 appserver/้history.json delete mode 100644 webapp/src/views/Users/newCustomer.json diff --git a/appserver/Expenses.json b/appserver/Expenses.json new file mode 100644 index 0000000..ffeefac --- /dev/null +++ b/appserver/Expenses.json @@ -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": "..." + } +] \ No newline at end of file diff --git a/appserver/building.json b/appserver/building.json new file mode 100644 index 0000000..64202a3 --- /dev/null +++ b/appserver/building.json @@ -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 + } + ] + } +] \ No newline at end of file diff --git a/appserver/history.json b/appserver/history.json new file mode 100644 index 0000000..ac28f3b --- /dev/null +++ b/appserver/history.json @@ -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"}] \ No newline at end of file diff --git a/appserver/queue.json b/appserver/queue.json index 9682973..279500c 100644 --- a/appserver/queue.json +++ b/appserver/queue.json @@ -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"}] \ No newline at end of file +[ + { + "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" + } +] \ No newline at end of file diff --git a/appserver/report.json b/appserver/report.json new file mode 100644 index 0000000..5b5d6a2 --- /dev/null +++ b/appserver/report.json @@ -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"}] \ No newline at end of file diff --git a/appserver/ro.json b/appserver/ro.json new file mode 100644 index 0000000..383ca7f --- /dev/null +++ b/appserver/ro.json @@ -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" + } +] \ No newline at end of file diff --git a/appserver/rooms.json b/appserver/rooms.json index 383ca7f..e0d54b4 100644 --- a/appserver/rooms.json +++ b/appserver/rooms.json @@ -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" + } ] \ No newline at end of file diff --git a/appserver/server.js b/appserver/server.js index 62793de..e9f75ab 100644 --- a/appserver/server.js +++ b/appserver/server.js @@ -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.`) }) diff --git a/appserver/users.json b/appserver/users.json index 7ca3539..abc2f31 100644 --- a/appserver/users.json +++ b/appserver/users.json @@ -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": "" + } ] \ No newline at end of file diff --git a/appserver/้history.json b/appserver/้history.json new file mode 100644 index 0000000..a4de30b --- /dev/null +++ b/appserver/้history.json @@ -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": "" + } +] \ No newline at end of file diff --git a/webapp/src/views/Expenses/ExpensesView.vue b/webapp/src/views/Expenses/ExpensesView.vue index c3f2e00..9047e73 100644 --- a/webapp/src/views/Expenses/ExpensesView.vue +++ b/webapp/src/views/Expenses/ExpensesView.vue @@ -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 { ]" /> +
+
+ + +
@@ -216,24 +290,24 @@ export default { - - 1 - ส.ต.ต.โชคดี มีชัย - อาคารแฟลต 1/11 - 2 - 202 - 201 - 205 - 4 - 8,000 - 20,000 - 8,000 - 20,000 - 10,000 - 5/10 - / + + {{ index + 1 }} + {{ item?.rank }} {{ item?.firstName }} {{ item?.lastName }} + {{ item?.building }} + {{ item?.floor }} + {{ item?.roomnumber }} + {{ item?.installments }} + {{ item?.insurancecost }} + {{ item?.sumCost }} + {{ item?.waterbill }} + {{ item?.electricitybill }} + {{ item?.central }} + {{ item?.costs }} + {{ item?.roomnumber }} + {{ item?.typeContract }} + {{ item?.typeContract }} - 5555 + {{ item?.contract }}
- +
@@ -358,11 +432,7 @@ export default {
-
+
-
-
- -
+
+ +
+
+
+ + +
+
@@ -222,8 +253,8 @@ export default { type="radio" name="inlineRadioOptions" id="inlineRadio1" - value="Radio1" - checked + value="ตร." + @change="typeUserfilter($event)" />
@@ -233,7 +264,8 @@ export default { type="radio" name="inlineRadioOptions" id="inlineRadio2" - value="Radio2" + value="บช.ตชด." + @change="typeUserfilter($event)" />
@@ -247,7 +279,6 @@ export default { type="text" placeholder="Search" :value="searchName" - @change="filteredData()" @input="(event) => (searchName = event.target.value)" />
@@ -279,10 +310,22 @@ export default { type="radio" name="inlineRadioOptions1" id="inlineRadio4" - value="Radio4" + value="สัญญาบัตร" + @change="rankrfilter($event)" /> +
+ + +
@@ -353,6 +396,32 @@ export default {