Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e78c9e5

Browse files
committedOct 22, 2021
fix: issue #504
1 parent b93bc40 commit e78c9e5

File tree

3 files changed

+139
-20
lines changed

3 files changed

+139
-20
lines changed
 

‎src/routes/CreateNewTeam/pages/CreateTaasPayment/PaymentForm/index.jsx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState } from "react";
2+
import cn from "classnames";
23
import { useDispatch, useSelector } from "react-redux";
34
import {
45
CardNumberElement,
@@ -15,6 +16,9 @@ import Typography from "@material-ui/core/Typography";
1516
import Box from "@material-ui/core/Box";
1617

1718
import { postTeamPayment, postTeamRequest } from "services/teams";
19+
import Button from "components/Button";
20+
import Checkbox from "components/Checkbox";
21+
import Spinner from "components/CenteredSpinner";
1822
import { clearSearchedRoles } from "../../../actions";
1923
import StripeElement from "../StripeElement";
2024
import FormField from "../FormField";
@@ -53,6 +57,7 @@ const PaymentForm = ({ calculatedAmount }) => {
5357
const [dropdownValue, setDropdownValue] = useState("");
5458
const [processing, setProcessing] = useState(false);
5559
const [showPaymentResultPopup, setShowPaymentResultPopup] = useState(false);
60+
const [isChecked, setIsChecked] = useState(false);
5661
const [requestLoading, setRequestLoading] = useState(false);
5762
const [errors, setErrors] = useState({
5863
card: true,
@@ -162,6 +167,22 @@ const PaymentForm = ({ calculatedAmount }) => {
162167
}
163168
};
164169

170+
const handlePostTeam = async (e) => {
171+
setProcessing(true);
172+
postTeamRequest(teamObject)
173+
.then((res) => {
174+
const projectId = _.get(res, "data.projectId");
175+
dispatch(clearSearchedRoles());
176+
navigate(`/taas/myteams/${projectId}`);
177+
})
178+
.catch((err) => {
179+
toastr.error("Error Requesting Team", err.message);
180+
})
181+
.finally(() => {
182+
setProcessing(false);
183+
});
184+
};
185+
165186
const formIsValid = (fieldValues = formValues) => {
166187
// check card valid
167188
const cardValid =
@@ -179,6 +200,51 @@ const PaymentForm = ({ calculatedAmount }) => {
179200
};
180201

181202
const classes = useStyles();
203+
if (!calculatedAmount) {
204+
return (
205+
<div styleName="commitment-container">
206+
<div styleName="commitment-title">
207+
Our commitment to you
208+
</div>
209+
<div styleName="commitment-content">
210+
We will do everything we can to find the talent you need within the Topcoder Community.
211+
</div>
212+
<div styleName="commitment-title">
213+
Your commitment to us
214+
</div>
215+
<div styleName="commitment-content">
216+
You will only post genuine job opportunities, and will be responsive and communicative with the candidates provided. You recognize the freelancers in the Topcoder Community are real people making big decisions based on your engagement with them.
217+
</div>
218+
<div>
219+
<Checkbox
220+
label="I agree to the above commitments."
221+
checked={isChecked}
222+
onClick={()=> setIsChecked(!isChecked)}
223+
/>
224+
</div>
225+
<Button
226+
size="medium"
227+
disabled={!isChecked || processing}
228+
styleName={cn({ processing })}
229+
size="medium"
230+
type="primary"
231+
onClick={handlePostTeam}
232+
>
233+
{processing ? (
234+
<>
235+
<div styleName="spinner">
236+
<Spinner stype="Oval" width="16" height="16" />
237+
</div>
238+
Confirm
239+
</>
240+
) :
241+
<>Confirm</>
242+
}
243+
</Button>
244+
</div>
245+
)
246+
}
247+
182248
return (
183249
<>
184250
<form onSubmit={handleFormSubmit}>

‎src/routes/CreateNewTeam/pages/CreateTaasPayment/PaymentForm/styles.module.scss

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import "styles/include";
2+
13
.button {
24
background: #137d60;
35
border-radius: 20px;
@@ -19,3 +21,52 @@
1921
display: flex;
2022
width: "100%";
2123
}
24+
25+
.commitment-container {
26+
display: flex;
27+
flex-direction: column;
28+
margin: 0 10px;
29+
30+
label {
31+
margin-top: 20px;
32+
}
33+
34+
35+
button[disabled] {
36+
background-color: #e9e9e9;
37+
color: #fff;
38+
opacity: 1;
39+
filter: none;
40+
}
41+
button {
42+
margin-top: 10px;
43+
display: flex;
44+
width: 100%;
45+
justify-content: center;
46+
&.processing {
47+
pointer-events: none;
48+
}
49+
.spinner {
50+
margin-top: 3px;
51+
margin-right: 5px;
52+
}
53+
}
54+
}
55+
.commitment-title {
56+
@include font-barlow;
57+
58+
font-weight: 600;
59+
color: #2A2A2A;
60+
font-size: 16px;
61+
line-height: 20px;
62+
text-transform: uppercase;
63+
}
64+
65+
.commitment-content {
66+
@include font-roboto;
67+
68+
color: #2A2A2A;
69+
font-size: 14px;
70+
line-height: 22px;
71+
margin-bottom: 10px;
72+
}

‎src/routes/CreateNewTeam/pages/CreateTaasPayment/index.jsx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -134,26 +134,28 @@ const CreateTassPayment = () => {
134134
))}
135135
</div>
136136
</div>
137-
<p styleName="heading terms-title">Deposit & Refund Terms</p>
138-
<ul styleName="terms">
139-
<li>This is a refundable deposit payment.</li>
140-
<li>
141-
Topcoder will find you qualified candidates within 2 weeks, or
142-
your money back.
143-
</li>
144-
<li>
145-
If we find you talent that meets your needs, this deposit will
146-
be credited towards your payment.
147-
</li>
148-
<li>
149-
If we are only able to partially fill your talent order, we
150-
will refund any portion we cannot fulfill.
151-
</li>
152-
<li>
153-
Future payments can be processed on this credit card or you
154-
can arrange invoicing.
155-
</li>
156-
</ul>
137+
{calculatedAmount ? <>
138+
<p styleName="heading terms-title">Deposit & Refund Terms</p>
139+
<ul styleName="terms">
140+
<li>This is a refundable deposit payment.</li>
141+
<li>
142+
Topcoder will find you qualified candidates within 2 weeks, or
143+
your money back.
144+
</li>
145+
<li>
146+
If we find you talent that meets your needs, this deposit will
147+
be credited towards your payment.
148+
</li>
149+
<li>
150+
If we are only able to partially fill your talent order, we
151+
will refund any portion we cannot fulfill.
152+
</li>
153+
<li>
154+
Future payments can be processed on this credit card or you
155+
can arrange invoicing.
156+
</li>
157+
</ul>
158+
</>: null}
157159
</div>
158160
<div styleName="payment">
159161
<p styleName="amount">${calculatedAmount}</p>

0 commit comments

Comments
 (0)
This repository has been archived.