-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: allow attendee multiple day checkin #7623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MeghalBisht
merged 6 commits into
fossasia:development
from
maze-runnar:attendee-checkin
Aug 2, 2021
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eb69d87
f
maze-runnar c9affdd
width
maze-runnar 483cfdf
Merge branch 'development' into multiple
MeghalBisht ed4c99a
Merge branch 'development' into attendee-checkin
maze-runnar 1feb559
Update app/controllers/events/view/tickets/attendees/list.js
maze-runnar f8ea325
Merge branch 'development' into attendee-checkin
MeghalBisht File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
53 changes: 51 additions & 2 deletions
53
app/components/ui-table/cell/events/view/tickets/attendees/cell-action.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,54 @@ | ||
| import classic from 'ember-classic-decorator'; | ||
| import Component from '@ember/component'; | ||
|
|
||
| import moment from 'moment'; | ||
| @classic | ||
| export default class CellAction extends Component {} | ||
| export default class CellAction extends Component { | ||
| currentlyCheckedin = []; | ||
| eventdates = []; | ||
| get allDates() { | ||
| const dates = []; | ||
| const date1 = moment(this.extraRecords.event.get('endsAtDate')); | ||
| const date2 = moment(this.extraRecords.event.get('startsAtDate')); | ||
| const diff = date1.diff(date2, 'days'); | ||
| for (let i = 0; i < diff; i++) { | ||
| dates.push((moment(this.extraRecords.event.get('startsAtDate'), 'MM-DD-YYYY').add(i, 'days').format('MM-DD-YYYY'))); | ||
| this.eventdates.push(moment(this.extraRecords.event.get('startsAtDate'), 'MM-DD-YYYY').add(i, 'days').format('MM-DD-YYYY')); | ||
| } | ||
| return dates; | ||
| } | ||
|
|
||
| get checkinTimes() { | ||
| if (this.extraRecords.checkinTimes) { | ||
| const x = this.extraRecords.checkinTimes?.split(','); | ||
| const checkinDates = []; | ||
| for (const i of x) { | ||
| checkinDates.push(moment(i).format('MM-DD-YYYY')); | ||
| } | ||
| return checkinDates; | ||
| } | ||
| return []; | ||
| } | ||
|
|
||
| get checkoutTimes() { | ||
| if (this.extraRecords.checkoutTimes) { | ||
| const x = this.extraRecords.checkoutTimes?.split(','); | ||
| const checkoutDates = []; | ||
| for (const i of x) { | ||
| checkoutDates.push(moment(i).format('MM-DD-YYYY')); | ||
| } | ||
| return checkoutDates; | ||
| } | ||
| return []; | ||
| } | ||
|
|
||
| get currentlyChecked() { | ||
| for (const i of this.eventdates) { | ||
| const checkinCount = this.checkinTimes?.filter(x => x === i).length || 0; | ||
| const checkoutCount = this.checkoutTimes?.filter(x => x === i).length || 0; | ||
| if (checkinCount > checkoutCount && !this.currentlyCheckedin.includes(i)) { | ||
| this.currentlyCheckedin.push(i); | ||
| } | ||
| } | ||
| return this.currentlyCheckedin; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 16 additions & 5 deletions
21
app/templates/components/ui-table/cell/events/view/tickets/attendees/cell-action.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,18 @@ | ||
| {{#if (eq this.extraRecords.order.status 'completed')}} | ||
| {{#if this.extraRecords.isCheckedIn}} | ||
| <button class="tiny ui labeled icon negative button" {{action this.props.actions.toggleCheckIn this.record}}><i class="remove icon"></i>{{t 'Check-Out'}}</button> | ||
| {{else}} | ||
| <button class="tiny ui labeled icon positive button" {{action this.props.actions.toggleCheckIn this.record}}><i class="checkmark icon"></i>{{t 'Check‑In'}}</button> | ||
| {{/if}} | ||
| <UiDropdown @class="d-flex items-center pl-4 fluid multiple selection"> | ||
| <div class="default"> | ||
| {{t 'Checkin'}} | ||
| </div> | ||
| <i class="dropdown icon"></i> | ||
| <div class="menu"> | ||
| {{#each this.allDates as |date|}} | ||
| <UiCheckbox | ||
| @class="item" | ||
| @label={{date}} | ||
| @checked={{if (includes this.currentlyChecked date) true}} | ||
| @onChange={{action this.props.actions.toggleCheckIn this.record date (includes this.currentlyChecked date)}} | ||
| /> | ||
| {{/each}} | ||
| </div> | ||
| </UiDropdown> | ||
| {{/if}} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maze-runnar shouldn't these all be computed properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No