mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
361f6f245a
* [web] hide the monthly/annual switch for small screens via css Co-Authored-By: Jakob Ackermann <jakob.ackermann@overleaf.com> * [web] merge logic for hiding elements shown in a subset of view Co-Authored-By: M Fahru <m.fahru@overleaf.com> * [web] hide the monthly/annual switch for small screens via css Co-Authored-By: M Fahru <m.fahru@overleaf.com> * [web] merge logic for hiding elements shown in a subset of view Co-Authored-By: M Fahru <m.fahru@overleaf.com> * fix inverted logic on monthly annual checking * delete some duplicated logic and refactor * merge switch functions * move global variable into the main module * simplify the enable and disable switch * remove unused parseFloat * simplify group plan pricing calculation * simplify discount group plan logic * simplify sticky header logic * merge view and period switching * fix underlining of switch text * simplify class list toggling * merging two function of the group plan Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> GitOrigin-RevId: 5e51690514bbf1dee2639011748c6a8470e1c19a
32 lines
1,010 B
JavaScript
32 lines
1,010 B
JavaScript
import { updateGroupModalPlanPricing } from '../../../../features/plans/group-plan-modal'
|
|
|
|
function showGroupPlanModal(el) {
|
|
const plan = el.getAttribute('data-ol-start-new-subscription')
|
|
|
|
// plan is either `group_collaborator` or `group_professional`
|
|
// we want to get the suffix (collaborator or professional)
|
|
const groupPlan = plan.split('_')[1]
|
|
|
|
const groupModalRadioInputEl = document.querySelector(
|
|
`[data-ol-group-plan-code="${groupPlan}"]`
|
|
)
|
|
|
|
groupModalRadioInputEl.checked = true
|
|
updateGroupModalPlanPricing()
|
|
|
|
const modalEl = $('[data-ol-group-plan-modal]')
|
|
modalEl.modal()
|
|
}
|
|
|
|
export function setUpGroupSubscriptionButtonAction() {
|
|
document.querySelectorAll('[data-ol-start-new-subscription]').forEach(el => {
|
|
const plan = el.getAttribute('data-ol-start-new-subscription')
|
|
|
|
if (plan === 'group_collaborator' || plan === 'group_professional') {
|
|
el.addEventListener('click', e => {
|
|
e.preventDefault()
|
|
showGroupPlanModal(el)
|
|
})
|
|
}
|
|
})
|
|
}
|