Skip to content

Commit

Permalink
Merge pull request #6 from GlideRide-online/patch-01
Browse files Browse the repository at this point in the history
fixed rozarpay error and added new notavailable ui
  • Loading branch information
Akshat2Jain committed Dec 5, 2023
2 parents 4732843 + 0e140e5 commit 4c90f00
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
15 changes: 8 additions & 7 deletions client/src/Steps/Summary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const Summary = () => {
};
const initPayment = (data) => {
const options = {
key: process.env.RAZORPAY_KEY_ID,
key: process.env.REACT_APP_RAZORPAY_KEY_ID,
amount: data.amount,
currency: data.currency,
name: "GlideRide",
Expand All @@ -93,6 +93,7 @@ const Summary = () => {

if (data.success) {
sentEmail();
sentEmailToAdmin();
navigate("/thankyou");
} else {
console.log("something went wrong");
Expand Down Expand Up @@ -126,11 +127,11 @@ const Summary = () => {
}
};

const handleTestPayment = async () => {
sentEmail();
sentEmailToAdmin();
navigate("/thankyou");
};
// const handleTestPayment = async () => {
// sentEmail();
// sentEmailToAdmin();
// navigate("/thankyou");
// };

return (
<>
Expand Down Expand Up @@ -212,7 +213,7 @@ const Summary = () => {
<div className="mt-6 grid gap-1">
<button
className="bg-blue-500 font-mono hover:bg-blue-600 text-white px-6 py-2 rounded-md font-semibold transition duration-300"
onClick={handleTestPayment}
onClick={handlePayment}
>
Pay Now {state.step1Data.securtiy}
</button>
Expand Down
32 changes: 12 additions & 20 deletions client/src/pages/NoRIdeAvailable.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { message } from "antd";
import React, { useState } from "react";
import React from "react";

const NoRIdeAvailable = () => {
const [whatsappNumber, setWhatsappNumber] = useState("");

const handleNumberChange = (e) => {
setWhatsappNumber(e.target.value);
};
const addToWaitingList = (e) => {
e.preventDefault();
console.log("User's WhatsApp number:", whatsappNumber);
sendMessage();
message.success("Thanks for your Patience!");
setWhatsappNumber("");
};
const sendMessage = () => {
// let number = whatsappNumber.replace(/[^\w\s]/gi, "").replace(/ /g, "");
let url = `https://web.whatsapp.com/send?phone=${process.env.REACT_APP_NUMBER}`;
url += `&text=${encodeURI(
"Hi Glideride! Please add me to waiting list and Notify me as soon as ride is possible"
)}&app_absent=0`;
window.open(url);
};
return (
<form onSubmit={addToWaitingList}>
Expand All @@ -30,21 +32,11 @@ const NoRIdeAvailable = () => {
htmlFor="whatsappNumber"
className="block text-gray-600 text-sm"
>
WhatsApp Number
Click Here to add You to our waiting List
</label>

<input
type="text"
id="whatsappNumber"
className="block w-full bg-gray-100 text-gray-800 border border-gray-300 rounded-md p-2 focus:outline-none focus:border-blue-400"
placeholder="Enter your WhatsApp number"
value={whatsappNumber}
onChange={handleNumberChange}
required
/>
</div>
<button className="bg-yellow-500 text-black font-sans px-4 py-2 rounded-md">
Notify Me
Add Me!
</button>
</div>
</form>
Expand Down

0 comments on commit 4c90f00

Please sign in to comment.