Skip to content
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

VCST-916: Update last-xxx filters #414

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected virtual IList<IFilter> GetPermanentFilters(CustomerOrderSearchCriteria

if (criteria.StartDate.HasValue && criteria.EndDate.HasValue)
{
result.Add(FilterHelper.CreateDateRangeFilter("createddate", criteria.StartDate, null, true, true));
result.Add(FilterHelper.CreateDateRangeFilter("createddate", criteria.StartDate, criteria.EndDate, true, true));
}
else if (criteria.StartDate.HasValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
"labels": {
"new-filter": "Neuen Filter hinzufügen",
"unnamed-filter": "Unbenannter Filter",
"today-filter": "Heute",
"last-day-filter": "Gestern",
"last-week-filter": "Letzte Woche",
"last-month-filter": "Letzter Monat",
"last-year-filter": "Letztes Jahr",
"number": "Bestellnummer",
"customer": "Kunde",
"confirmed": "Bestätigt",
Expand All @@ -68,8 +73,8 @@
"name": "Name des Filters",
"name_": "Wie werden Sie diesen Filter?",
"criteria": "Filterkriterien",
"from": "Erstellt von",
"to": "Bis erstellt"
"from": "Erstellt am oder nach",
"to": "Erstellt vor"
},
"placeholders": {
"all": "Nicht angegeben"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"labels": {
"new-filter": "Add new filter",
"unnamed-filter": "Unnamed filter",
"last-day-filter": "Last 24 hours",
"today-filter": "Today",
"last-day-filter": "Yesterday",
"last-week-filter": "Last week",
"last-month-filter": "Last month",
"last-year-filter": "Last year",
Expand All @@ -74,8 +75,8 @@
"name": "Filter name",
"name_": "Please give this filter a name",
"criteria": "Filter criteria",
"from": "Created at",
"to": "Valid until"
"from": "Created after",
"to": "Created before"
},
"placeholders": {
"all": "Not specified"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
"labels": {
"new-filter": "Добавить новый фильтр",
"unnamed-filter": "Фильтр по умолчанию",
"today-filter": "Сегодня",
"last-day-filter": "Вчера",
"last-week-filter": "Прошлая неделч",
"last-month-filter": "Прошлый месяц",
"last-year-filter": "Прошлый год",
"number": "Номер заказа",
"customer": "Покупатель",
"confirmed": "Подтвержден",
Expand All @@ -69,8 +74,8 @@
"name": "Название фильтра",
"name_": "Как Вы назовете этот фильтр?",
"criteria": "Критерии фильтра",
"from": "Действует с",
"to": "Действует до"
"from": "Создано с",
"to": "Создано до"
},
"placeholders": {
"all": "Не определено"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,36 +246,64 @@ function ($rootScope, $scope, $localStorage, customerOrders, bladeUtils, dialogS

function buildPredefinedFilters() {
var currentDate = new Date();
var day = 24 * 60 * 60 * 1000;
var days7 = 7 * day;
var days30 = 30 * day;
var days365 = 365 * day;
var currentDateUtcString = currentDate.toISOString();
currentDate.setHours(0, 0, 0, 0);

const lastDayStartDate = new Date(currentDate);
lastDayStartDate.setDate(currentDate.getDate() - 1);

const lastWeekStartDate = new Date(currentDate);
lastWeekStartDate.setDate(currentDate.getDate() - currentDate.getDay() - 6);

const lastWeekEndDate = new Date(currentDate);
lastWeekEndDate.setDate(currentDate.getDate() - currentDate.getDay() + 1);

const lastMonthStartDate = new Date(currentDate);
lastMonthStartDate.setMonth(currentDate.getMonth() - 1);
lastMonthStartDate.setDate(1);

const lastMonthEndDate = new Date(currentDate);
lastMonthEndDate.setDate(1);

const lastYearStartDate = new Date(currentDate);
lastYearStartDate.setFullYear(currentDate.getFullYear() - 1);
lastYearStartDate.setMonth(0);
lastYearStartDate.setDate(1);

const lastYearEndDate = new Date(currentDate);
lastYearEndDate.setFullYear(currentDate.getFullYear());
lastYearEndDate.setMonth(0);
lastYearEndDate.setDate(1);


return [
{
name: 'orders.blades.customerOrder-list.labels.today-filter',
id: 'today',
startDate: currentDate.toISOString()
},
{
name: 'orders.blades.customerOrder-list.labels.last-day-filter',
id: 'last-day',
startDate: new Date(currentDate.getTime() - day).toISOString(),
endDate: currentDateUtcString
startDate: lastDayStartDate.toISOString(),
endDate: currentDate.toISOString()
},
{
name: 'orders.blades.customerOrder-list.labels.last-week-filter',
id: 'last-week',
startDate: new Date(currentDate.getTime() - days7).toISOString(),
endDate: currentDateUtcString
startDate: lastWeekStartDate.toISOString(),
endDate: lastWeekEndDate.toISOString()
},
{
name: 'orders.blades.customerOrder-list.labels.last-month-filter',
id: 'last-month',
startDate: new Date(currentDate.getTime() - days30).toISOString(),
endDate: currentDateUtcString
startDate: lastMonthStartDate.toISOString(),
endDate: lastMonthEndDate.toISOString()
},
{
name: 'orders.blades.customerOrder-list.labels.last-year-filter',
id: 'last-year',
startDate: new Date(currentDate.getTime() - days365).toISOString(),
endDate: currentDateUtcString
startDate: lastYearStartDate.toISOString(),
endDate: lastYearEndDate.toISOString()
}
];
}
Expand Down
Loading