Commit 145f15d4 authored by chaiwat's avatar chaiwat

add

parent 5e99d003
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"dependencies": { "dependencies": {
"@ant-design/charts": "^1.3.5", "@ant-design/charts": "^1.3.5",
"@craco/craco": "^6.4.3", "@craco/craco": "^6.4.3",
"@emailjs/browser": "^3.4.0",
"@line/liff": "^2.17.0", "@line/liff": "^2.17.0",
"@testing-library/jest-dom": "^5.11.4", "@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0", "@testing-library/react": "^11.1.0",
...@@ -3164,6 +3165,14 @@ ...@@ -3164,6 +3165,14 @@
"lodash": "^4.11.1" "lodash": "^4.11.1"
} }
}, },
"node_modules/@emailjs/browser": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/@emailjs/browser/-/browser-3.4.0.tgz",
"integrity": "sha512-pTR9wEj0KLrJBVWFfB6IFEwmGIod/6cfN541Y0TVN2+9Bbn+R9a8gq6GeJZ6ggbYs36J3gCTXDyVKhtxjRsjtw==",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@eslint/eslintrc": { "node_modules/@eslint/eslintrc": {
"version": "0.4.3", "version": "0.4.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz",
...@@ -31875,6 +31884,11 @@ ...@@ -31875,6 +31884,11 @@
"lodash": "^4.11.1" "lodash": "^4.11.1"
} }
}, },
"@emailjs/browser": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/@emailjs/browser/-/browser-3.4.0.tgz",
"integrity": "sha512-pTR9wEj0KLrJBVWFfB6IFEwmGIod/6cfN541Y0TVN2+9Bbn+R9a8gq6GeJZ6ggbYs36J3gCTXDyVKhtxjRsjtw=="
},
"@eslint/eslintrc": { "@eslint/eslintrc": {
"version": "0.4.3", "version": "0.4.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz",
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"dependencies": { "dependencies": {
"@ant-design/charts": "^1.3.5", "@ant-design/charts": "^1.3.5",
"@craco/craco": "^6.4.3", "@craco/craco": "^6.4.3",
"@emailjs/browser": "^3.4.0",
"@line/liff": "^2.17.0", "@line/liff": "^2.17.0",
"@testing-library/jest-dom": "^5.11.4", "@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0", "@testing-library/react": "^11.1.0",
......
...@@ -17,7 +17,7 @@ import FullLayout from "../Layouts/FullLayout"; ...@@ -17,7 +17,7 @@ import FullLayout from "../Layouts/FullLayout";
// Components // Components
import ProtectedRoute from "../ProtectdRoute"; import from "../ProtectdRoute";
export default function Routers() { export default function Routers() {
......
import React, { useState } from "react"; import React, { useState, useRef } from "react";
import emailjs from "@emailjs/browser";
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
...@@ -14,7 +15,6 @@ import { ...@@ -14,7 +15,6 @@ import {
import { ApproveGarage } from "../../../services"; import { ApproveGarage } from "../../../services";
import IconCar from "../../../assets/icons/car.png"; import IconCar from "../../../assets/icons/car.png";
function DetailApprove() { function DetailApprove() {
...@@ -22,6 +22,8 @@ function DetailApprove() { ...@@ -22,6 +22,8 @@ function DetailApprove() {
const [visible2, setVisible2] = useState(false); const [visible2, setVisible2] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false); const [confirmLoading, setConfirmLoading] = useState(false);
const form = useRef();
let location = useLocation; let location = useLocation;
const data = location().state.data; const data = location().state.data;
...@@ -50,22 +52,25 @@ function DetailApprove() { ...@@ -50,22 +52,25 @@ function DetailApprove() {
const showModal = () => { const showModal = () => {
setVisible2(true); setVisible2(true);
}; };
// console.log("data", data); // console.log("data", data);
const handleOk = (id) => { const handleOk = (id) => {
let data = { let data = {
garageID: id garageID: id,
} };
ApproveGarage(data)
sendEmail();
// console.log('email', sendEmail())
ApproveGarage(data);
// console.log("id", id); // console.log("id", id);
setConfirmLoading(true); setConfirmLoading(true);
setTimeout(() => { setTimeout(() => {
setVisible2(false); setVisible2(false);
setConfirmLoading(false); setConfirmLoading(false);
window.location.reload(false) window.location.reload(false);
}, 2000); }, 2000);
}; };
...@@ -74,9 +79,48 @@ function DetailApprove() { ...@@ -74,9 +79,48 @@ function DetailApprove() {
setVisible2(false); setVisible2(false);
}; };
const sendEmail = () => {
// e.preventDefault();
emailjs
.sendForm(
"service_fvdfink",
"template_f4fea9i",
form.current,
"RxwNfn5jn6WDcuzBK"
)
// console.log(form.current)
.then(
(result) => {
console.log(result.text);
},
(error) => {
console.log(error.text);
}
);
};
console.log("data => ", data);
// function FormEmail() {
// return (
// <>
// <form ref={form} onSubmit={sendEmail}>
// <label>Name</label>
// <input value="chaiwat 555" type="text" name="user_name" />
// <label>Email</label>
// <input type="email" name="user_email" />
// <label>Message</label>
// <textarea name="message" />
// <input type="submit" value="Send" />
// </form>
// </>
// );
// }
return ( return (
<> <>
<Row className="div-p-5"> <Row className="div-p-5" ref={form}>
<Col span={24} className="pageHeader" style={{ padding: "2%" }}> <Col span={24} className="pageHeader" style={{ padding: "2%" }}>
<PageHeader <PageHeader
className="site-page-header" className="site-page-header"
...@@ -118,10 +162,7 @@ function DetailApprove() { ...@@ -118,10 +162,7 @@ function DetailApprove() {
</Col> </Col>
</Row> </Row>
<Col style={{ padding: "3% 0 0 0" }} span={24}> <Col style={{ padding: "3% 0 0 0" }} span={24}>
<Button <Button className="bt-them" onClick={showModal}>
className="bt-them"
onClick={showModal}
>
อนุมัติ อนุมัติ
</Button> </Button>
</Col> </Col>
...@@ -154,8 +195,23 @@ function DetailApprove() { ...@@ -154,8 +195,23 @@ function DetailApprove() {
confirmLoading={confirmLoading} confirmLoading={confirmLoading}
onCancel={handleCancel} onCancel={handleCancel}
> >
<p>ยืนยันที่จะให้ร้าน {data.garage_name} เข้าร่วมกับระบบจัดการร้านซ่อม</p> <p>
ยืนยันที่จะให้ร้าน {data.garage_name} เข้าร่วมกับระบบจัดการร้านซ่อม
</p>
</Modal> </Modal>
{/* Send Email To Email Garage */}
<div>
<form hidden ref={form} onSubmit={sendEmail}>
<input value={data.user_name} type="text" name="user_name" />
<input value={data.garage_name} type="text" name="garage_name" />
<input value={data.registration_date} type="text" name="regis_date" />
<input value={data.email} type="email" name="user_email" />
<label>Message</label>
<textarea name="message" />
<input type="submit" value="Send" />
</form>
</div>
</> </>
); );
} }
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { Col, Row, Card, Typography } from "antd"; import { Col, Row, Card, Typography, Avatar, Image } from "antd";
// import Service // import Service
import { FetchDetailByMember } from "../../../services"; import { FetchDetailByMember } from "../../../services";
import IconGarage from '../../../assets/icons/garage.png'
const { Text } = Typography; const { Text } = Typography;
export default function ContentSearch(props) { export default function ContentSearch(props) {
...@@ -31,7 +33,7 @@ export default function ContentSearch(props) { ...@@ -31,7 +33,7 @@ export default function ContentSearch(props) {
getDetailByMember(); getDetailByMember();
}, [tel]); }, [tel]);
// console.log("datas", datas, "tel", tel); console.log("datas", datas, "tel", tel);
return ( return (
<> <>
...@@ -48,7 +50,9 @@ export default function ContentSearch(props) { ...@@ -48,7 +50,9 @@ export default function ContentSearch(props) {
> >
<Card <Card
type="inner" type="inner"
title={val.garage_name + " " + val.repair_date} title={<> <Avatar
src={<Image src={IconGarage} style={{ width: 32 }} />}
/> {val.garage_name} {val.repair_date}</>}
extra={ extra={
<Link <Link
to={{ to={{
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { Col, Row, Typography, Table, Divider } from "antd"; import { Col, Row, Typography, Table, Divider, Avatar, Image } from "antd";
import { MobileOutlined } from "@ant-design/icons"; import { MobileOutlined } from "@ant-design/icons";
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
...@@ -110,6 +110,10 @@ export default function App() { ...@@ -110,6 +110,10 @@ export default function App() {
<Col xs={24} md={{ span: 11, offset: 1 }} lg={{ span: 7, offset: 1 }}> <Col xs={24} md={{ span: 11, offset: 1 }} lg={{ span: 7, offset: 1 }}>
<Text className="color-bfbf">ลูกค้า</Text> <Text className="color-bfbf">ลูกค้า</Text>
<br /> <br />
<Avatar
src={<Image src={datas.imageUrl} style={{ width: 32 }} />}
/>
<Title level={4} className="color-fff"> <Title level={4} className="color-fff">
<Text className="color-fff">คุณ {datas.member_name}</Text> <Text className="color-fff">คุณ {datas.member_name}</Text>
</Title> </Title>
......
...@@ -46,7 +46,6 @@ const MapWithAMarker = withScriptjs( ...@@ -46,7 +46,6 @@ const MapWithAMarker = withScriptjs(
const { Option } = Select; const { Option } = Select;
const { Title } = Typography; const { Title } = Typography;
//Main Function //Main Function
export default function RegistrationForm() { export default function RegistrationForm() {
const [ontime, setOnTime] = useState(); const [ontime, setOnTime] = useState();
...@@ -83,7 +82,7 @@ export default function RegistrationForm() { ...@@ -83,7 +82,7 @@ export default function RegistrationForm() {
if (response.code === 200) { if (response.code === 200) {
Modal.info({ Modal.info({
title: "เรียบร้อยแล้ว", title: "เรียบร้อยแล้ว",
content: `สมัครสมาชิกให้ลูกค้าเรียบร้อยแล้ว`, content: `ได้รับข้อมูลของร้านท่านแล้ว ระบบจะทำการตรวจสอบข้อมูลของร้านและยืนการเข้าร่วมกับระบบ โดยจะแจ้งไปยังอีเมลล์ของท่านที่ได้ลงทะเบียนไว้`,
onOk: () => { onOk: () => {
window.location.reload(false); window.location.reload(false);
}, },
...@@ -558,7 +557,7 @@ export default function RegistrationForm() { ...@@ -558,7 +557,7 @@ export default function RegistrationForm() {
</Row> </Row>
</div> </div>
<Col span={24}> <Col span={24}>
<Form.Item > <Form.Item>
<Button <Button
className="bt-them" className="bt-them"
htmlType="submit" htmlType="submit"
...@@ -572,6 +571,5 @@ export default function RegistrationForm() { ...@@ -572,6 +571,5 @@ export default function RegistrationForm() {
</Col> </Col>
</Row> </Row>
</> </>
); );
} }
...@@ -2393,6 +2393,11 @@ ...@@ -2393,6 +2393,11 @@
dependencies: dependencies:
"lodash" "^4.11.1" "lodash" "^4.11.1"
"@emailjs/browser@^3.4.0":
"integrity" "sha512-pTR9wEj0KLrJBVWFfB6IFEwmGIod/6cfN541Y0TVN2+9Bbn+R9a8gq6GeJZ6ggbYs36J3gCTXDyVKhtxjRsjtw=="
"resolved" "https://registry.npmjs.org/@emailjs/browser/-/browser-3.4.0.tgz"
"version" "3.4.0"
"@eslint/eslintrc@^0.4.3": "@eslint/eslintrc@^0.4.3":
"integrity" "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==" "integrity" "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw=="
"resolved" "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz" "resolved" "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment