diff --git a/src/components/Section2Green.vue b/src/components/Section2Green.vue index c1299b5..0fba25b 100644 --- a/src/components/Section2Green.vue +++ b/src/components/Section2Green.vue @@ -14,8 +14,10 @@ ขั้นตอนที่ 2 -
มาลองสร้างตัวตนสมัคร สว.
-
ลงทะเบียนแสดงตัวตน แสดงความคิดเห็น สมัคร สว.
+ +
+ ลงทะเบียนแสดงตัวตน / ค้นหาผู้แสดงตนเป็นผู้สมัคร สว. +
ลงทะเบียนผู้สมัคร -
-
ค้นหาผู้แสดงตนเป็นผู้สมัคร สว.
-
- ค้นหาผู้แสดงตนเป็นผู้สมัคร สว. ใน จังหวัด/อำเภอ ที่ตัวเองเป็นผู้แสดงตน +
+
+
ค้นหาผู้แสดงตนเป็นผู้สมัคร สว.
+
+ ค้นหาผู้แสดงตนเป็นผู้สมัคร สว. ใน จังหวัด/อำเภอ ที่ตัวเองเป็นผู้แสดงตน +
+ > + + diff --git a/src/components/search/CardUserGroup.vue b/src/components/search/CardUserGroup.vue index 4a5c089..f20db4f 100644 --- a/src/components/search/CardUserGroup.vue +++ b/src/components/search/CardUserGroup.vue @@ -14,7 +14,7 @@
- {{ group.id }} @@ -22,6 +22,7 @@
+ - + - +
- - - - - - -
- -
-
- - - -
-
กลุ่มที่
-
- {{ item.group.id }} -
-
-
-
-
- -
-
หมายเลขผู้สมัคร
-
-
- {{ item.registerno }} -
-
-
-
-
- -
-
- {{ item.zone.province.name }} -
- {{ - item.zone.name - }} -
-
-
-
-
-
+
+
+
-
- {{ item.zone.province.name }} | - {{ - item.zone.name - }} -
+ {{ item.firstName }} + {{ item.lastName }}
-
-
-
- {{ item.firstName }} - - {{ item.lastName }} - -
-
-
- -
-
- อายุ : - - {{ item.age }} - - ปี -
- -
- อาชีพ : - {{ item.job }} - - -
-
- การศึกษา : - - {{ item.education }} - - -
-
-
-
- - - +
+
+ +
+
@@ -218,6 +122,16 @@ export default { type: Object, }, }, + computed: { + chunkedResults() { + const chunkSize = 3; + let chunks = []; + for (let i = 0; i < this.result.length; i += chunkSize) { + chunks.push(this.result.slice(i, i + chunkSize)); + } + return chunks; + }, + }, data() { return { overlay: false, @@ -241,18 +155,18 @@ export default { this.$emit("valueSent", true); // this.load2 = true; let data = {}; - if (this.province && this.province.id) { - data.province = this.province.id; + if (this.province) { + data.province = this.province; } if (this.district) { - data.zone = this.district.id; + data.zone = this.district; } if (this.group) { data.group = this.group.id; } - data.limit = 5; + data.limit = 30; if (data) { - client.user.getAllUser + client.user.getAllUser .query(data) .then((rs) => { this.cardCount = rs.length; @@ -302,10 +216,69 @@ export default { }) .catch((error) => { this.load = false; - - // alert("ไม่สามารถโหลดข้อมูลได้"); console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); }); + + // let param = { input: JSON.stringify({ 0: data }) }; + // var axios = require("axios"); + + // const config = { + // method: "get", + // url: "http://localhost:3000/api/user.getAllUser", + // params: param, + // headers: {}, + // }; + + // axios(config) + // .then((response) => { + // const rs = response.data.result.data; + // this.cardCount = rs.length; + // if (rs.length) { + // this.show = true; + // this.result = rs; + // } else { + // this.overlay = true; + // this.show = false; + // this.result = [ + // { + // show: false, + // id: 56, + // firstName: "", + // lastName: "", + // title: "", + // cid: "1767250304480", + // age: " -", + // job: " -", + // education: " -", + // vision: null, + // reason: null, + // group: { + // id: this.group.id, + // name: " -", + // }, + // zone: { + // id: " -", + // name: this.district.name, + // province: { + // id: "", + // name: this.province.name, + // }, + // }, + // }, + // ]; + // } + // console.log(rs); + // this.load = false; + // if (rs.length == 0) { + // this.show = true; + // } + // this.$emit("valueSent", false); + // }) + // .catch((error) => { + // this.load = false; + // console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); + // }); + } }, }; @@ -334,13 +307,15 @@ export default { div.v-window__container > div.v-window__controls > button.v-btn.v-btn--elevated.v-btn--icon.v-theme--light.v-btn--density-default.v-btn--size-default.v-btn--variant-elevated { - background-color: #00000078; + background-color: #3d763d8c; color: white; } .v-carousel__controls { - border-bottom-right-radius: 24px; - border-bottom-left-radius: 24px; - background-color: #00000078; + margin-top: 40px; + border-bottom-right-radius: 10px; + border-bottom-left-radius: 10px; + background-color: #3d763d8c; + height: 23px; } .img-display-g { height: 450px; @@ -398,7 +373,7 @@ div.v-window__container margin-bottom: 0px !important; } .v-carousel__controls { - height: 35px; + height: 23px; } div.mx-auto.text-md-left.text-sub2.my-1 { margin: 0 !important; diff --git a/src/components/search/SearchMain.vue b/src/components/search/SearchMain.vue index 791fee6..69e0860 100644 --- a/src/components/search/SearchMain.vue +++ b/src/components/search/SearchMain.vue @@ -17,10 +17,9 @@
- + --> + + + + + + + + + + + + + + + + + + + + + + + + + + - ค้นหาทุกกลุ่มอาชีพ +
ค้นหาต่างกลุ่มอาชีพ
+ +
@@ -169,10 +271,10 @@
-
+
x.id !== this.group.id); + this.apiGroup = filteredGroup; + }, handleValueSent(value) { this.load2 = value; console.log("Received value from child:", value); // ทำงานกับค่าที่ได้รับ }, + getUserItems(offset) { + this.show = false; + this.loadname = true; + if (offset == 0) { + this.page = 1; + } + let data = { + offset: offset, + }; + if (this.province) { + data.province = this.province; + // data.province = this.province; + } + if (this.group && this.group.id) { + // console.log(this.group.id); + data.group = this.group.id; + } + if (this.district) { + data.zone = this.district; + } + + // let param = { input: JSON.stringify({ 0: data }) }; + // var axios = require("axios"); + // var config = { + // method: "get", + // url: "http://localhost:3000/api/user.getAllUser", + // params: param, + // headers: {}, + // }; + + // axios(config) + // .then((response) => { + // this.nameUserItems = response.data.result.data; + // this.loadname = false; + // console.log("nameUserItems", this.nameUserItems); + // }) + // .catch((error) => { + // this.loadname = false; + // console.log(error); + // }); + + client.user.getAllUser + .query(data) + .then((rs) => { + this.nameUserItems = rs; + console.log(rs); + this.loadname = false; + }) + .catch((error) => { + this.loadname = false; + alert("ไม่สามารถโหลดข้อมูลรายชื่อได้ได้"); + console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); + }); + }, searchUser(offset) { this.show = false; this.load = true; @@ -233,7 +409,7 @@ export default { limit: 2, }; if (this.province) { - data.province = this.province.id; + data.province = this.province; // data.province = this.province; } if (this.group) { @@ -242,10 +418,12 @@ export default { } } if (this.district) { - data.zone = this.district.id; + data.zone = this.district; + } + if (this.nameUser) { + data.userId = this.nameUser; } - // console.log(data); client.user.getAllUser .query(data) .then((rs) => { @@ -255,8 +433,6 @@ export default { if (rs.length == 0) { this.show = true; } - - // this.districtItems = rs; }) .catch((error) => { this.load = false; @@ -278,7 +454,7 @@ export default { limit: 2, }; if (this.province) { - data.province = this.province.id; + data.province = this.province; // data.province = this.province; } @@ -288,19 +464,65 @@ export default { } } if (this.district) { - data.zone = this.district.id; + data.zone = this.district; } - // console.log(data); - client.user.getAllUserCount - .query(data) - .then((rs) => { - this.count = rs; - }) - .catch((error) => { - alert("ไม่สามารถโหลดข้อมูลได้"); - console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); - }); + if (this.nameUser) { + data.userId = this.nameUser; + } + + // let param = { input: JSON.stringify({ 0: data }) }; + // var axios = require("axios"); + // if (this.nameUser) { + // this.count = 1; + // } else { + // var config = { + // method: "get", + // url: "http://localhost:3000/api/user.getAllUserCount", + // params: param, + // headers: {}, + // }; + + // axios(config) + // .then((response) => { + // this.count = response.data.result.data; + // console.log("getAllUserCount", this.count); + // }) + // .catch((error) => { + // console.log(error); + // }); + // } + if (this.nameUser) { + this.count = 1; + } else { + client.user.getAllUserCount + .query(data) + .then((rs) => { + this.count = rs; + }) + .catch((error) => { + alert("ไม่สามารถโหลดข้อมูลได้"); + console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); + }); + } + // var config2 = { + // method: "get", + // url: "http://localhost:3000/api/user.getAllUser", + // params: param, + // headers: {}, + // }; + + // axios(config2) + // .then((response) => { + // this.result = response.data.result.data; + // this.load = false; + // console.log("nameUserItems", this.nameUserItems); + // }) + // .catch((error) => { + // this.load = false; + + // console.log(error); + // }); client.user.getAllUser .query(data) @@ -312,11 +534,9 @@ export default { this.show = true; } - // this.districtItems = rs; }) .catch((error) => { this.load = false; - // alert("ไม่สามารถโหลดข้อมูลได้"); console.error("เกิดข้อผิดพลาดในการโหลดข้อมูล:", error); }); @@ -373,7 +593,9 @@ export default { .query({}) .then((data) => { this.provinceItems = data; - this.getUser(data); + if (this.getUsername) { + this.getUser(data); + } }) .catch((error) => { // alert("ไม่สามารถโหลดข้อมูลได้"); @@ -383,6 +605,9 @@ export default { };