add shipping rules

This commit is contained in:
Ludovic CANDELLIER
2023-07-16 14:45:42 +02:00
parent 297dcc62d2
commit 39c80ce6d1
459 changed files with 6219 additions and 5416 deletions

View File

@@ -3,16 +3,11 @@
namespace App\Repositories\Core;
use Carbon\Carbon;
use League\Period\Period;
use League\Period\Duration;
use League\Period\Sequence;
use League\Period\Chart\Dataset;
use function League\Period\duration;
use function League\Period\interval_after;
use League\Period\Period;
class DateRange
{
public static function today()
{
return self::previousDay(0);
@@ -72,6 +67,7 @@ class DateRange
foreach ($labels as $label) {
$data[$label] = $periods;
}
return $data;
}
@@ -85,6 +81,7 @@ class DateRange
$end = $with_actual ? Carbon::now()->endOfMonth() : self::lastMonth();
$begin = ($nb == 1) ? $end->copy()->startOfMonth() : $end->copy()->startOfMonth()->subMonth($nb - 1);
$t = self::getPeriodsbyMonth($begin, $end);
return self::getPeriodsbyMonth($begin, $end);
}
@@ -95,6 +92,7 @@ class DateRange
$date = self::DatePointToCarbon($period->getStartDate());
$months[] = DateTime::getMonthName($date);
}
return $months;
}
@@ -104,6 +102,7 @@ class DateRange
foreach ($periods as $period) {
$months[] = DateTime::getMonthName($period['start']);
}
return $months;
}
@@ -111,6 +110,7 @@ class DateRange
{
$end = $with_actual ? Carbon::now()->endOfWeek() : self::lastWeek();
$begin = $end->copy()->subWeek($nb);
return self::getPeriodsbyWeek($begin, $end);
}
@@ -118,6 +118,7 @@ class DateRange
{
$end = $with_actual ? Carbon::now()->endOfDay() : static::lastDay();
$begin = $end->copy()->subDay($nb);
return self::getPeriodsbyDay($begin, $end);
}
@@ -156,6 +157,7 @@ class DateRange
$date = Carbon::now()->subMonth(3)->startOfQuarter();
break;
}
return [$date, $date->addMonth(6)];
}
@@ -200,6 +202,7 @@ class DateRange
foreach ($period->getDatePeriod($duration) as $day) {
$daterange[] = interval_after($day, $duration);
}
return $daterange;
}
@@ -209,6 +212,7 @@ class DateRange
foreach ($periods as $period) {
$data[] = self::PeriodToCarbon($period);
}
return $data;
}