Skip to content

Commit 14b50f0

Browse files
authored
Feture/core 4379 update membership form (#723)
* [CORE-4379] Form fields update * [CORE-4379] Form fields update#2 * [CORE-4379] Add planName and price to endpoint * [CORE-4379] Field name update * [CORE-4379] Add validation empty repo * [CORE-4379] husky downgrade * [CORE-4379] husky rollback * [CORE-4379] Checkbox fix * [CORE-4379] fetch price * [CORE-4379] membership price fetch * [CORE-4379] membership price fetch#2 * [CORE-4379] Radiobutton * [CORE-4379] Style upd * [CORE-4379] Uml upd * [CORE-4379] Remove debug code * [CORE-4379] Billing plan starting * [CORE-4379] approveTermsConditions upd * [CORE-4379] Update code style * [CORE-4379] membership plan #1 * [CORE-4379] membership plan #2 * [CORE-4379] membership plan #3 * [CORE-4379] Check price fetch * [CORE-4379] Discount calculate * [CORE-4379] Fix radiobutton * [CORE-4379] Starting plan update layout * [CORE-4379] Fix submit membership endpoint * [CORE-4379] Routes status fix * [CORE-4379] Status pages fix * [CORE-4379] Status pages fix #2 * [CORE-4379] Fix calculating discount * [CORE-4379] Fix calculating discount #2 * [CORE-4379] Fix style * [CORE-4379] Fix style #2 * [CORE-4379] Fix style #3 * [CORE-4379] Fix path payment * [CORE-4379] Fix slug * [CORE-4379] Fix slug #2 * [CORE-4379] Text upd #1 * [CORE-4379] Text upd #2 * [CORE-4379] Price N/A * [CORE-4379] Radiobutton update. Fix status page * [CORE-4379] Fix status page * [CORE-4379] One repo for starting plan * [CORE-4379] add noRepositories * [CORE-4379] add noRepositories * [CORE-4379] fix noRepositories * [CORE-4379] Add error style for select * [fix] Price error * [fix] Update price if user change repository * [fix] Url for Membership fees * Add Icon * [fix] Design up version * [fix] Design version set latest * [fix] Starting plan add caption * [CORE-4379] Add discount to form * [CORE-4379] Price calculated upd * [CORE-4379] Fix route
1 parent f4336f4 commit 14b50f0

31 files changed

+28592
-14948
lines changed

api/services.js

+10
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,13 @@ export const createMembershipPayment = async (body) => {
2323

2424
return response
2525
}
26+
27+
export const getMembershipPrice = async (body) => {
28+
const url = new URL('/internal/membership/price', process.env.API_URL)
29+
const response = await apiRequest(url, {
30+
body,
31+
method: 'POST',
32+
})
33+
34+
return response
35+
}

components/checkbox/animated.jsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import {
66
useSpringRef,
77
useChain,
88
} from 'react-spring'
9+
import { classNames } from '@oacore/design/lib/utils'
910

1011
import styles from './styles.module.scss'
1112

12-
const Checkbox = ({ id, labelText, setCheckbox }) => {
13+
const Checkbox = ({ id, labelText, setCheckbox, className }) => {
1314
const [isChecked, setIsChecked] = useState(false)
1415
const checkboxAnimationRef = useSpringRef()
1516
const checkboxAnimationStyle = useSpring({
@@ -37,7 +38,7 @@ const Checkbox = ({ id, labelText, setCheckbox }) => {
3738

3839
return (
3940
// eslint-disable-next-line jsx-a11y/label-has-associated-control
40-
<label className={styles.labelBox}>
41+
<label key={labelText} className={styles.labelBox}>
4142
<input
4243
id={id}
4344
type="checkbox"
@@ -65,7 +66,9 @@ const Checkbox = ({ id, labelText, setCheckbox }) => {
6566
strokeDashoffset={checkmarkAnimationStyle.x}
6667
/>
6768
</animated.svg>
68-
<div className={styles.label}>{labelText}</div>
69+
<div className={classNames.use(styles.label).join(className)}>
70+
{labelText}
71+
</div>
6972
</label>
7073
)
7174
}

components/checkbox/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// eslint-disable-next-line import/prefer-default-export
21
export { default as Checkbox } from './animated'
2+
export { default as Radiobutton } from './radiobutton'

components/checkbox/radiobutton.jsx

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React, { useEffect } from 'react'
2+
import { classNames } from '@oacore/design/lib/utils'
3+
4+
import styles from './styles.module.scss'
5+
6+
const Radiobutton = ({ id, labelText, options, setRadioButtonsState }) => {
7+
const handleRadioButton = (value) => {
8+
const states = {
9+
[id]: value,
10+
}
11+
setRadioButtonsState(states)
12+
}
13+
14+
useEffect(() => {
15+
handleRadioButton(options[0].id)
16+
}, [])
17+
18+
return (
19+
<div key={labelText}>
20+
<div className={styles.radioTopLabel}>{labelText}:</div>
21+
{options.map((field) => (
22+
<div
23+
key={field.value}
24+
className={classNames.use(styles.radioFormCheck).join('form-check')}
25+
>
26+
<input
27+
className="form-check-input "
28+
type="radio"
29+
name={id}
30+
id={field.id}
31+
onChange={() => handleRadioButton(field.id)}
32+
/>
33+
<label className={styles.radioLabel} htmlFor={field.id}>
34+
{field.value}
35+
</label>
36+
</div>
37+
))}
38+
</div>
39+
)
40+
}
41+
42+
export default Radiobutton

components/checkbox/styles.module.scss

+12-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
border: 2px var(--gray-600) solid;
2323
margin-right: 10px;
2424
border-radius: 2px;
25-
width: 20px;
26-
height: 20px;
2725
}
2826

2927
.label {
@@ -33,3 +31,15 @@
3331
.disabled {
3432
display: none;
3533
}
34+
35+
.radio-top-label {
36+
margin-bottom: 10px;
37+
}
38+
39+
.radio-form-check {
40+
margin-bottom: 5px;
41+
}
42+
43+
.radio-label {
44+
margin-left: 8px;
45+
}

components/utils.js

+8
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ export const patchStats = (text, statistics) => {
2929
}
3030
return processTemplate(text, context)
3131
}
32+
33+
export const patchStatsFull = (text, statistics) => {
34+
const context = {}
35+
// eslint-disable-next-line no-restricted-syntax
36+
for (const [key, value] of Object.entries(statistics)) context[key] = value
37+
38+
return processTemplate(text, context)
39+
}

core.routes.yml

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ membership:
3636

3737
payment:
3838
pattern: /payment
39+
40+
membershipRequestStatus:
41+
pattern: /membership-request-status
3942
children:
4043
success: /success
4144
error: /error

data/membership.yml

+17-8
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,11 @@ plans:
130130
- *statistics
131131
- *discovery-boost
132132
action:
133-
title: Register your interest
134-
url: 'https://docs.google.com/forms/d/e/1FAIpQLSfFJmMIspYfOEM5aOKG4FTZoK4qeqozyds47O75Wm4dJ1ta2w/viewform'
133+
title: Become a member
134+
# url: '/membership/starting'
135+
url: '/member/starting'
136+
# title: Register your interest
137+
# url: 'https://docs.google.com/forms/d/e/1FAIpQLSfFJmMIspYfOEM5aOKG4FTZoK4qeqozyds47O75Wm4dJ1ta2w/viewform'
135138

136139
- title: Supporting
137140
caption: <a href='membership/supporting'>Membership fees</a>
@@ -145,8 +148,11 @@ plans:
145148
- *tech-support
146149
- *api
147150
action:
148-
title: Register your interest
149-
url: https://docs.google.com/forms/d/e/1FAIpQLSfFJmMIspYfOEM5aOKG4FTZoK4qeqozyds47O75Wm4dJ1ta2w/viewform
151+
title: Become a member
152+
url: '/member/supporting'
153+
# url: '/membership/supporting'
154+
# title: Register your interest
155+
# url: https://docs.google.com/forms/d/e/1FAIpQLSfFJmMIspYfOEM5aOKG4FTZoK4qeqozyds47O75Wm4dJ1ta2w/viewform
150156

151157
- title: Sustaining
152158
caption: <a href='membership/sustaining'>Membership fees</a>
@@ -163,8 +169,11 @@ plans:
163169
- *styles
164170
- *health-check
165171
action:
166-
title: Register your interest
167-
url: https://docs.google.com/forms/d/e/1FAIpQLSfFJmMIspYfOEM5aOKG4FTZoK4qeqozyds47O75Wm4dJ1ta2w/viewform
172+
title: Become a member
173+
url: '/member/sustaining'
174+
# url: '/membership/sustaining'
175+
# title: Register your interest
176+
# url: https://docs.google.com/forms/d/e/1FAIpQLSfFJmMIspYfOEM5aOKG4FTZoK4qeqozyds47O75Wm4dJ1ta2w/viewform
168177

169178
box:
170179
description: Here you can find a comparison table with detailed information about each feature. It can help you choose the most suitable membership plan.
@@ -245,8 +254,8 @@ fee:
245254
**This discount is available for those who sign up for 3 or 5 years. Both annual and single payment invocing is possible.
246255
action:
247256
caption: Become member
248-
# url: '/payment'
249-
url: 'https://docs.google.com/forms/d/e/1FAIpQLSfFJmMIspYfOEM5aOKG4FTZoK4qeqozyds47O75Wm4dJ1ta2w/viewform'
257+
url: '/member'
258+
# url: 'https://docs.google.com/forms/d/e/1FAIpQLSfFJmMIspYfOEM5aOKG4FTZoK4qeqozyds47O75Wm4dJ1ta2w/viewform'
250259
table:
251260
headers:
252261
- name: Data provider size

data/payment.yml

+45-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
title: Become a <span>{{planName}}</span> members
1+
title: Become a <span>{{planName}}</span> member
22
short-title: Become our new member!
33
caption: Enter your details and our manager will contact you as soon as possible
44
form:
55
id: Member-details
66
maxRepositoriesCount: 3
7-
price: "Price: <span> £ {{price}} *</span>"
7+
price: "Fee: <span> £ {{price}} *</span>"
8+
price-calculated: "Fee: <span> £ {{priceCalculated}} </span>"
9+
error-price-calculation: |
10+
<div><span>Fee:</span><span>We are afraid that we do not have enough data to calculate the fee automatically at this stage.
11+
A member of the CORE team will be in touch with you shortly after submitting your request.</span></div>
812
action:
913
caption: Become a member
1014
fields:
@@ -30,30 +34,66 @@ form:
3034
type: async-select
3135
options: []
3236
id: repository
37+
optional: true
38+
- label: I cannot find one or more of my repositories in the list.
39+
type: checkbox
40+
id: noRepositories
3341
- label: Can't find repository?
3442
type: caption
3543
options:
3644
- name: Register repository
37-
action: 'benefits'
45+
action: '/benefits'
3846
- name: Contact us
39-
action: 'contact'
47+
action: '/about#contact'
4048
- label: Add
4149
type: button
4250
caption: You can add up to 3 repositories
51+
id: addRepositories
4352
- placeholder: e.g. John
4453
label: Name of contact person
4554
id: contactName
4655
type: input
56+
- placeholder: e.g. Developer
57+
label: What is your role in the organisation?
58+
id: roleInOrganisation
59+
type: input
4760
- placeholder: e.g. [email protected]
4861
label: Email
4962
id: email
5063
type: input
64+
- placeholder: Select the type of your contract
65+
label: Types of contracts
66+
id: typesContracts
67+
type: select
68+
options:
69+
- id: Annual rolling
70+
name: Annual rolling
71+
value: annual-rolling
72+
- id: 3-year
73+
name: 3-year
74+
value: 10
75+
- id: 5-year
76+
name: 5-year
77+
value: 15
78+
- label: Invoicing frequency
79+
type: radio
80+
id: invoicingFrequency
81+
options:
82+
- id: single-payment
83+
name: single-payment
84+
value: Single payment
85+
- id: annually
86+
name: annually
87+
value: Annually
5188
- placeholder: " "
5289
label: Any additional information you want to tell us
5390
id: additionalInfo
5491
type: input
5592
optional: true
5693
appendText: Optional
94+
- label: Please read and agree to the CORE <a href='https://core.ac.uk/terms' target='_blank'>Terms and Conditions</a> and <a href='https://core.ac.uk/privacy' target='_blank'>Privacy notice</a>.
95+
type: checkbox
96+
id: approveTermsConditions
5797

5898
additional-info:
5999
icon: "*"
@@ -70,7 +110,7 @@ success:
70110
description: CORE is a mission-driven and not-for-profit endeavour and we rely on the generous support of our members to support and sustain the service.
71111
image:
72112
url: /images/membership/email.svg
73-
caption: Thank you for apply with CORE Membership for organisations. Your request has been successfully sent. Our teams will contact you shortly.
113+
caption: Thank you for apply with CORE Membership for organisations. Your request has been successfully sent. Our team will contact you shortly.
74114
button:
75115
caption: homepage
76116
url: "/"

0 commit comments

Comments
 (0)