Skip to content

Commit

Permalink
Merge branch 'development' into odkhang-tma/fix-9127
Browse files Browse the repository at this point in the history
  • Loading branch information
khangon authored Aug 25, 2023
2 parents 63efd3b + 25ab4c1 commit 3ef0b26
Show file tree
Hide file tree
Showing 16 changed files with 692 additions and 114 deletions.
18 changes: 18 additions & 0 deletions app/components/nav-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ export default class NavBar extends Component {
return !(String(this.session.currentRouteName).includes('events.view'));
}

@computed('isNotPublicPageRoute')
get checkShowClassCssPublic() {
if (this.session.isAuthenticated) {
if (this.isNotPublicPageRoute) {
return 'au-home-page';
} else {
return 'au-public-page';
}
} else {
if (this.isNotPublicPageRoute) {
return 'un-home-page';
} else {
return 'un-public-page';
}
}
}

@action
handleKeyPress() {
if (event.keyCode === 13 || event.which === 13) {
Expand Down Expand Up @@ -120,6 +137,7 @@ export default class NavBar extends Component {
});
}


@action
handleClick() {
this.router.replaceWith('public.index', this.globalData.idEvent);
Expand Down
62 changes: 62 additions & 0 deletions app/controllers/events/view/tickets/attendees.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ import classic from 'ember-classic-decorator';
import { action } from '@ember/object';
import Controller from '@ember/controller';
import { run } from '@ember/runloop';
import { tracked } from '@glimmer/tracking';

@classic
export default class AttendeesController extends Controller {
isLoadingcsv = false;
isLoadingpdf = false;

@tracked
start_date = this.router.currentRoute.queryParams?.start_date;

@tracked
end_date = this.router.currentRoute.queryParams?.end_date;

@action
export(mode) {
this.set(`isLoading${mode}`, true);
Expand All @@ -23,6 +30,61 @@ export default class AttendeesController extends Controller {
});
}

@action
attendeeFilter(name) {
if (name === 'date') {
if (!this.start_date || !this.end_date) {
this.router.transitionTo('events.view.tickets.attendees.list', {
queryParams: {
filter: name
}
});
return;
}
this.router.transitionTo('events.view.tickets.attendees.list', {
queryParams: {
start_date : this.start_date,
end_date : this.end_date,
filter : name
}
});
} else {
this.router.transitionTo('events.view.tickets.attendees.list', {
queryParams: {
filter: name
}
});
}
}

@action
onChangeStartDate() {
if (!this.end_date) {
return;
}
this.router.transitionTo('events.view.tickets.attendees.list', {
queryParams: {
start_date : this.start_date,
end_date : this.end_date,
filter : 'date'
}
});
}

@action
onChangeEndDate() {
if (!this.start_date) {
return;
}
this.router.transitionTo('events.view.tickets.attendees.list', {
queryParams: {
start_date : this.start_date,
end_date : this.end_date,
filter : 'date'
}
});
}

requestLoop(exportJobInfo, mode) {
run.later(() => {
this.loader
Expand Down
62 changes: 62 additions & 0 deletions app/controllers/events/view/tickets/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ import classic from 'ember-classic-decorator';
import { action } from '@ember/object';
import Controller from '@ember/controller';
import { run } from '@ember/runloop';
import { tracked } from '@glimmer/tracking';

@classic
export default class OrdersController extends Controller {
isLoadingcsv = false;
isLoadingpdf = false;

@tracked
start_date = this.router.currentRoute.queryParams?.start_date;

@tracked
end_date = this.router.currentRoute.queryParams?.end_date;

@action
export(mode) {
this.set(`isLoading${mode}`, true);
Expand All @@ -23,6 +30,61 @@ export default class OrdersController extends Controller {
});
}

@action
orderFilter(name) {
if (name === 'date') {
if (!this.start_date || !this.end_date) {
this.router.transitionTo('events.view.tickets.orders.list', {
queryParams: {
filter: name
}
});
return;
}
this.router.transitionTo('events.view.tickets.orders.list', {
queryParams: {
start_date : this.start_date,
end_date : this.end_date,
filter : name
}
});
} else {
this.router.transitionTo('events.view.tickets.orders.list', {
queryParams: {
filter: name
}
});
}
}

@action
onChangeStartDate() {
if (!this.end_date) {
return;
}
this.router.transitionTo('events.view.tickets.orders.list', {
queryParams: {
start_date : this.start_date,
end_date : this.end_date,
filter : 'date'
}
});
}

@action
onChangeEndDate() {
if (!this.start_date) {
return;
}
this.router.transitionTo('events.view.tickets.orders.list', {
queryParams: {
start_date : this.start_date,
end_date : this.end_date,
filter : 'date'
}
});
}

requestLoop(exportJobInfo, mode) {
run.later(() => {
this.loader
Expand Down
12 changes: 12 additions & 0 deletions app/helpers/value-field-link.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { helper } from '@ember/component/helper';
import { htmlSafe } from '@ember/string';

export function valueFieldLink(data) {
let field = '';
if(data){
field = data;
}
return htmlSafe(field);
}

export default helper(valueFieldLink);
9 changes: 9 additions & 0 deletions app/mixins/ember-table-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ export default Mixin.create({
search: {
refreshModel: true
},
filter: {
refreshModel: true
},
start_date: {
refreshModel: true
},
end_date: {
refreshModel: true
},
sort_dir: {
refreshModel: true
},
Expand Down
54 changes: 44 additions & 10 deletions app/routes/events/view/tickets/attendees/list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Route from '@ember/routing/route';
import EmberTableRouteMixin from 'open-event-frontend/mixins/ember-table-route';
import moment from 'moment-timezone';

export default class extends Route.extend(EmberTableRouteMixin) {
titleToken() {
Expand All @@ -23,6 +24,7 @@ export default class extends Route.extend(EmberTableRouteMixin) {

async model(params) {
this.set('params', params);
const eventDetails = this.modelFor('events.view');
let filterOptions = [];
if (params.attendees_status === 'checkedIn') {
filterOptions = [
Expand All @@ -40,20 +42,52 @@ export default class extends Route.extend(EmberTableRouteMixin) {
val : false
}
];
} else if (params.attendees_status === 'all') {
filterOptions = [];
} else {
filterOptions = [
{
if (params.attendees_status !== 'all') {
filterOptions = [
{
name : 'order',
op : 'has',
val : {
name : 'status',
op : 'eq',
val : params.attendees_status
}
}
];
}
}
if (params.filter) {
if (params.filter === 'discount') {
filterOptions.pushObject({
name : 'order',
op : 'has',
val : {
name : 'status',
op : 'eq',
val : params.attendees_status
name : 'discount_code_id',
op : 'isnot',
val : null
}
}
];
});
} else if (params.filter === 'date' && params.start_date && params.end_date) {
filterOptions.pushObject({
name : 'order',
op : 'has',
val : {
name : 'created-at',
op : 'ge',
val : moment.tz(params.start_date, eventDetails.timezone).toISOString()
}
});
filterOptions.pushObject({
name : 'order',
op : 'has',
val : {
name : 'created-at',
op : 'le',
val : moment.tz(params.end_date, eventDetails.timezone).add(1, 'days').toISOString()
}
});
}
}
filterOptions = this.applySearchFiltersExtend(
filterOptions,
Expand All @@ -78,6 +112,6 @@ export default class extends Route.extend(EmberTableRouteMixin) {

queryString = this.applySortFilters(queryString, params);

return this.asArray(this.modelFor('events.view').query('attendees', queryString));
return this.asArray(eventDetails.query('attendees', queryString));
}
}
28 changes: 27 additions & 1 deletion app/routes/events/view/tickets/orders/list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Route from '@ember/routing/route';
import EmberTableRouteMixin from 'open-event-frontend/mixins/ember-table-route';
import moment from 'moment-timezone';

export default class extends Route.extend(EmberTableRouteMixin) {
titleToken() {
Expand All @@ -18,8 +19,33 @@ export default class extends Route.extend(EmberTableRouteMixin) {
}

async model(params) {
const eventDetails = this.modelFor('events.view');
this.set('params', params);
const filterOptions = [];
if (params.filter) {
if (params.filter === 'discount') {
filterOptions.pushObject({
name : 'discount_code_id',
op : 'isnot',
val : null
});
} else if (params.filter === 'date' && params.start_date && params.end_date) {
filterOptions.push({
and: [
{
name : 'created-at',
op : 'ge',
val : moment.tz(params.start_date, eventDetails.timezone).toISOString()
},
{
name : 'created-at',
op : 'le',
val : moment.tz(params.end_date, eventDetails.timezone).add(1, 'days').toISOString()
}
]
});
}
}
if (params.search) {
filterOptions.pushObject({
name : 'user',
Expand Down Expand Up @@ -48,6 +74,6 @@ export default class extends Route.extend(EmberTableRouteMixin) {

queryString = this.applySortFilters(queryString, params);

return this.asArray(this.modelFor('events.view').query('orders', queryString));
return this.asArray(eventDetails.query('orders', queryString));
}
}
12 changes: 12 additions & 0 deletions app/styles/components/ticket-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@
vertical-align: baseline !important;
}
}

.filter-date-mobile-session {
.end-date-session {
.ui.popup.calendar {
inset: 43px !important;

table {
transform: translateX(-62%);
}
}
}
}
10 changes: 2 additions & 8 deletions app/styles/pages/public-event.scss
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,11 @@
}

.logo-event {
margin: 10px !important;
width: 56px !important;
// margin: 10px !important;
// width: 56px !important;
height: auto;
}

.btn-un-bd {
border: unset;
padding: unset !important;
height: 46px !important;
}

.public-social-links {
margin-top: 1.5rem !important;
}
Expand Down
Loading

0 comments on commit 3ef0b26

Please sign in to comment.