Skip to content

Commit d28227f

Browse files
author
DIVYAM TAYAL
authored
Merge branch 'development' into ticket-table-resp-3511
2 parents 868d89a + 7d00804 commit d28227f

File tree

75 files changed

+1154
-439
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1154
-439
lines changed

app/components/footer-main.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@ import classic from 'ember-classic-decorator';
22
import { classNames, tagName } from '@ember-decorators/component';
33
import { action, computed } from '@ember/object';
44
import Component from '@ember/component';
5+
import { filterBy } from '@ember/object/computed';
6+
import { inject as service } from '@ember/service';
7+
import { sortBy } from 'lodash-es';
58

69
@classic
710
@tagName('footer')
811
@classNames('ui', 'inverted', 'vertical', 'footer', 'segment')
912
export default class FooterMain extends Component {
13+
14+
@service cache;
15+
16+
@filterBy('pages', 'place', 'footer')
17+
footerPages;
18+
1019
@computed
1120
get currentLocale() {
1221
return this.l10n.getLocale();
@@ -17,17 +26,7 @@ export default class FooterMain extends Component {
1726
this.l10n.switchLanguage(locale);
1827
}
1928

20-
didInsertElement() {
21-
this.set('eventLocations', this.eventLocations.sortBy('name'));
22-
23-
const eventTypes = this.eventTypes.sortBy('name').toArray();
24-
eventTypes.forEach(eventType => {
25-
if (eventType.name === 'Other') {
26-
const other = eventType;
27-
eventTypes.splice(eventTypes.indexOf(eventType), 1);
28-
eventTypes.push(other);
29-
}
30-
});
31-
this.set('eventTypes', eventTypes);
29+
async didInsertElement() {
30+
this.set('pages', sortBy(await this.cache.findAll('page'), 'index'));
3231
}
3332
}

app/components/forms/admin/settings/billing.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export default class Billing extends Component.extend(FormMixin) {
100100
}
101101

102102
@action
103-
submit() {
103+
submit(e) {
104+
e.preventDefault();
104105
this.onValid(() => {
105106
this.save();
106107
});
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<div class="row">
2+
<div class="ui grid">
3+
<div class="ui left aligned sixteen wide mobile eight wide computer column">
4+
<h3 class="ui header">
5+
{{t 'Video Channel'}}
6+
</h3>
7+
</div>
8+
<div class="ui right aligned sixteen wide mobile eight wide computer column">
9+
<button class='ui labeled icon blue button {{if this.jitsiButtonLoading 'loading' }}' {{action 'addJitsi'}}>
10+
<i class="video icon"></i>
11+
{{t 'Add Jitsi Room'}}
12+
</button>
13+
</div>
14+
</div>
15+
</div>
16+
<br>
17+
<form class="ui form {{if this.isLoading 'loading'}}">
18+
<div class="field">
19+
<label class="required">{{t 'Room'}}</label>
20+
<input type="hidden" id="rooms">
21+
<UiDropdown
22+
@class="fluid selection"
23+
@selected={{this.room}}
24+
@onChange={{action this.setRoom}} as |execute mapper|>
25+
<i class="dropdown icon"></i>
26+
<div class="default text">
27+
{{t 'Select Rooms'}}
28+
</div>
29+
<div class="menu">
30+
{{#each this.rooms as |room|}}
31+
{{#if room.name}}
32+
<div data-value="{{map-value mapper room}}" class="item">
33+
{{room.name}}
34+
</div>
35+
{{/if}}
36+
{{/each}}
37+
</div>
38+
</UiDropdown>
39+
</div>
40+
<div class="field">
41+
<label class="required">{{t 'Video Room URL'}}</label>
42+
<Widgets::Forms::LinkField
43+
@inputId="url"
44+
@value={{this.data.stream.url}}
45+
@onChange={{action (mut this.data.stream.url)}} />
46+
</div>
47+
<div class="field">
48+
<label>{{t 'Pin'}}</label>
49+
<Input
50+
@value={{this.data.stream.password}} />
51+
</div>
52+
<div class="field">
53+
<label>{{t 'Additional Information'}}</label>
54+
<Textarea
55+
@value={{this.data.stream.additionalInformation}} />
56+
</div>
57+
<div class="ui divider"></div>
58+
<div class="grouped fields">
59+
<label>{{t 'Access'}}</label>
60+
<div class="field"><UiCheckbox class="read-only disabled" @checked={{true}} @label={{t 'Organization Team'}} /></div>
61+
<div class="field"><UiCheckbox class="read-only disabled" @checked={{true}} @label={{t 'Speakers'}} /></div>
62+
<div class="field"><UiCheckbox class="read-only disabled" @checked={{true}} @label={{t 'Attendees'}} /></div>
63+
<div class="field"><UiCheckbox class="read-only disabled" @label={{t 'All logged in users'}} /></div>
64+
<div class="field"><UiCheckbox class="read-only disabled" @label={{t 'Public (no restriction)'}} /></div>
65+
</div>
66+
<div class="ui hidden divider"></div>
67+
<button type="submit" class="ui teal submit button" name="submit">{{t 'Save'}}</button>
68+
</form>
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
import Component from '@ember/component';
2+
import { action, computed } from '@ember/object';
3+
import { tracked } from '@glimmer/tracking';
4+
import classic from 'ember-classic-decorator';
5+
import FormMixin from 'open-event-frontend/mixins/form';
6+
import { protocolLessValidUrlPattern } from 'open-event-frontend/utils/validators';
7+
import { allSettled } from 'rsvp';
8+
9+
10+
@classic
11+
export default class VideoroomForm extends Component.extend(FormMixin) {
12+
@tracked jitsiButtonLoading = false;
13+
@tracked loading = false;
14+
15+
@computed('data.stream.rooms.[]')
16+
get room() {
17+
return this.data.stream.rooms.toArray()[0];
18+
}
19+
20+
@action
21+
setRoom(room) {
22+
this.data.stream.rooms = [room];
23+
this.data.stream.name = room.name;
24+
}
25+
26+
getValidationRules() {
27+
window.$.fn.form.settings.rules.checkVideoRoomsLength = () => {
28+
return this.data.stream.rooms.length > 0;
29+
};
30+
const validationRules = {
31+
inline : true,
32+
delay : false,
33+
on : 'blur',
34+
35+
fields: {
36+
name: {
37+
rules: [
38+
{
39+
type : 'empty',
40+
prompt : this.l10n.t('Please enter a name')
41+
}
42+
]
43+
},
44+
url: {
45+
rules: [
46+
{
47+
type : 'empty',
48+
prompt : this.l10n.t('Please enter a url')
49+
},
50+
{
51+
type : 'regExp',
52+
value : protocolLessValidUrlPattern,
53+
prompt : this.l10n.t('Please enter a valid url')
54+
}
55+
]
56+
},
57+
rooms: {
58+
rules: [
59+
{
60+
type : 'checkVideoRoomsLength',
61+
prompt : this.l10n.t('Please select a room')
62+
}
63+
]
64+
}
65+
}
66+
};
67+
68+
return validationRules;
69+
}
70+
71+
get randomIdentifier() {
72+
return Math.random().toString(36).replace(/[^a-z]+/g, '');
73+
}
74+
75+
generateMeetingInformation(phoneNumbers, pin) {
76+
return `To join your meeting, dial one of these numbers and then enter the pin.\n\nPIN: ${pin}\n\n`
77+
+ Object.entries(phoneNumbers).map(([country, numbers]) => `${country}: ${numbers.join(', ')}\n`).join('');
78+
}
79+
80+
@action
81+
async addJitsi() {
82+
const { event } = this.data;
83+
const { id, name } = this.data.stream;
84+
const identifier = [event.identifier, 'stream', name?.replace(/[^a-z0-9\.]/gi, '')?.toLowerCase(), id ?? this.randomIdentifier].filter(Boolean).join('-');
85+
86+
this.data.stream.set('url', 'https://meet.jit.si/eventyay/' + identifier);
87+
88+
this.jitsiButtonLoading = true;
89+
90+
try {
91+
const [phoneNumbers, pin] = (await allSettled([
92+
this.loader.load(`https://api.jitsi.net/phoneNumberList?conference=${identifier}@conference.eventyay.meet.jit.si`, { isExternal: true }),
93+
this.loader.load(`https://api.jitsi.net/conferenceMapper?conference=${identifier}@conference.eventyay.meet.jit.si`, { isExternal: true })
94+
])).map(promise => promise.value);
95+
96+
this.data.stream.additionalInformation = this.generateMeetingInformation(phoneNumbers.numbers, pin.id);
97+
} catch (e) {
98+
this.notify.error(this.l10n.t('An unexpected error has occurred.'));
99+
}
100+
101+
this.jitsiButtonLoading = false;
102+
}
103+
104+
@action
105+
submit(event) {
106+
event.preventDefault();
107+
this.onValid(async() => {
108+
try {
109+
this.loading = true;
110+
await this.data.stream.save();
111+
this.notify.success(this.l10n.t('Your stream has been saved'),
112+
{
113+
id: 'stream_save'
114+
});
115+
this.router.transitionTo('events.view.videoroom', this.data.event.id);
116+
} catch (e) {
117+
console.error('Error while saving session', e);
118+
this.notify.error(this.l10n.t('Oops something went wrong. Please try again'),
119+
{
120+
id: 'stream_save_error'
121+
});
122+
} finally {
123+
this.loading = false;
124+
}
125+
});
126+
}
127+
}

app/components/forms/login-form.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export default class LoginForm extends Component.extend(FormMixin) {
4444
}
4545

4646
@action
47-
async submit() {
47+
async submit(e) {
48+
e.preventDefault();
4849
this.onValid(async() => {
4950
const credentials = { username: this.identification, password: this.password };
5051
const authenticator = 'authenticator:jwt';

app/components/forms/orders/order-form.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import moment from 'moment';
88
import { groupBy, orderBy } from 'lodash-es';
99
import {
1010
compulsoryProtocolValidUrlPattern, validTwitterProfileUrlPattern, validFacebookProfileUrlPattern,
11-
validGithubProfileUrlPattern
11+
validGithubProfileUrlPattern, validEmail
1212
} from 'open-event-frontend/utils/validators';
1313
import { genders } from 'open-event-frontend/utils/dictionary/genders';
1414
import { ageGroups } from 'open-event-frontend/utils/dictionary/age-groups';
1515
import { countries } from 'open-event-frontend/utils/dictionary/demography';
1616

17+
1718
export default Component.extend(FormMixin, {
1819
router: service(),
1920

@@ -53,10 +54,12 @@ export default Component.extend(FormMixin, {
5354
run.later(() => {
5455
const currentTime = moment();
5556
const diff = moment.duration(willExpireAt.diff(currentTime));
56-
this.set('getRemainingTime', moment.utc(diff.asMilliseconds()).format('mm:ss'));
5757
if (diff > 0) {
58+
this.set('getRemainingTime', moment.utc(diff.asMilliseconds()).format('mm:ss'));
5859
this.timer(willExpireAt, orderIdentifier);
5960
} else {
61+
this.set('getRemainingTime', '00:00');
62+
this.data.set('status', 'expired');
6063
this.data.reload();
6164
this.router.transitionTo('orders.expired', orderIdentifier);
6265
}
@@ -87,7 +90,8 @@ export default Component.extend(FormMixin, {
8790
prompt : this.l10n.t('Please enter your email')
8891
},
8992
{
90-
type : 'email',
93+
type : 'regExp',
94+
value : validEmail,
9195
prompt : this.l10n.t('Please enter a valid email address')
9296
}
9397
]
@@ -202,7 +206,7 @@ export default Component.extend(FormMixin, {
202206
};
203207

204208
const companyValidation = {
205-
rules : [
209+
rules: [
206210
{
207211
type : 'empty',
208212
prompt : this.l10n.t('Please enter your company')
@@ -380,7 +384,8 @@ export default Component.extend(FormMixin, {
380384
identifier : 'email',
381385
rules : [
382386
{
383-
type : 'email',
387+
type : 'regExp',
388+
value : validEmail,
384389
prompt : this.l10n.t('Please enter a valid email address')
385390
}
386391
]

app/components/forms/user-payment-info-form.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ export default class UserPaymentInfoForm extends Component.extend(FormMixin) {
9797
}
9898

9999
@action
100-
submit() {
100+
submit(e) {
101+
e.preventDefault();
101102
this.onValid(async() => {
102103
this.set('isLoading', true);
103104
try {

app/components/forms/wizard/attendee-step.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,12 @@ export default Component.extend(FormMixin, EventWizardMixin, {
1717

1818
showEditColumn: computed('editableFields.@each', function() {
1919
return this.editableFields?.some(field => field.isComplex);
20-
})
20+
}),
21+
22+
actions: {
23+
removeField(field) {
24+
this.data.customForms.removeObject(field);
25+
}
26+
}
2127
});
28+

app/components/forms/wizard/custom-forms/table.hbs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@
7171
<button class="ui compact icon positive circular button" data-tooltip="{{t 'Edit'}}" {{action @updateField field}}>
7272
<i class="pencil icon"></i>
7373
</button>
74-
{{!-- Hiding till implemented --}}
75-
<button class="ui compact icon negative circular button hidden-item" data-tooltip="{{t 'Delete'}}">
74+
<button class="ui compact icon negative circular button" data-tooltip="{{t 'Delete'}}" {{action (confirm (t "Are you sure you want to delete this?") (action @removeField field))}}>
7675
<i class="trash icon"></i>
7776
</button>
7877
{{/if}}

app/components/forms/wizard/custom-forms/table.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Component from '@glimmer/component';
22

3-
43
interface CustomForm { isComplex: boolean }
54

65
interface Args {
76
fields: CustomForm[],
8-
updateField: (field: CustomForm) => void
9-
}
7+
removeField: (field: any) => void,
8+
updateField: (field: any) => void
9+
}
1010

1111
export default class CustomFormTable extends Component<Args> {
1212
get editColumn(): boolean {

0 commit comments

Comments
 (0)