Merge branch 'trunk'
This commit is contained in:
commit
9e2fe9cc73
6 changed files with 60 additions and 13 deletions
|
|
@ -143,7 +143,7 @@ class CustomerController extends Controller
|
|||
if (!$calendars->isEmpty()) {
|
||||
$pub = false;
|
||||
foreach ($calendars as $calendar) {
|
||||
if (strtotime(date('Y-m-d H:i:s')) > strtotime($calendar->calendrier_startdate) && strtotime(date('Y-m-d H:i:s')) < strtotime($calendar->calendrier_enddate)) {
|
||||
if ($calendar->isPublished()) {
|
||||
$pub = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ class CustomerController extends Controller
|
|||
if (!$calendars->isEmpty()) {
|
||||
$published = false;
|
||||
foreach ($calendars as $calendar) {
|
||||
if (strtotime(date('Y-m-d H:i:s')) > strtotime($calendar->calendrier_startdate) && strtotime(date('Y-m-d H:i:s')) < strtotime($calendar->calendrier_enddate)) {
|
||||
if ($calendar->isPublished()) {
|
||||
$published = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class MurController extends Controller
|
|||
if (!$calendars->isEmpty()) {
|
||||
$pub = false;
|
||||
foreach ($calendars as $calendar) {
|
||||
if (strtotime(date('Y-m-d H:i:s')) > strtotime($calendar->calendrier_startdate) && strtotime(date('Y-m-d H:i:s')) < strtotime($calendar->calendrier_enddate)) {
|
||||
if ($calendar->isPublished()) {
|
||||
$pub = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,4 +39,16 @@ class Calendrier extends Model
|
|||
{
|
||||
return $this->belongsTo('App\Models\Coupon', 'calendrier_couponId');
|
||||
}
|
||||
|
||||
// * METHODS
|
||||
|
||||
/**
|
||||
* Check if the current date is between the calendar publication dates.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPublished(): bool
|
||||
{
|
||||
return now()->betweenIncluded($this->calendrier_startdate, $this->calendrier_enddate->endOfDay());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ trait CouponTrait
|
|||
if (isset($calendars) && !$calendars->isEmpty()) {
|
||||
$pub = false;
|
||||
foreach ($calendars as $calendar) {
|
||||
if (strtotime(date('Y-m-d H:i:s')) > strtotime($calendar->calendrier_startdate) && strtotime(date('Y-m-d H:i:s')) < strtotime($calendar->calendrier_enddate)) {
|
||||
if ($calendar->isPublished()) {
|
||||
$pub = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ trait CouponTrait
|
|||
if (isset($calendars) && !$calendars->isEmpty()) {
|
||||
$pub = false;
|
||||
foreach ($calendars as $calendar) {
|
||||
if (strtotime(date('Y-m-d H:i:s')) > strtotime($calendar->calendrier_startdate) && strtotime(date('Y-m-d H:i:s')) < strtotime($calendar->calendrier_enddate)) {
|
||||
if ($calendar->isPublished()) {
|
||||
$pub = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ trait CouponTrait
|
|||
if (isset($calendars) && !$calendars->isEmpty()) {
|
||||
$pub = false;
|
||||
foreach ($calendars as $calendar) {
|
||||
if (strtotime(date('Y-m-d H:i:s')) > strtotime($calendar->calendrier_startdate) && strtotime(date('Y-m-d H:i:s')) < strtotime($calendar->calendrier_enddate)) {
|
||||
if ($calendar->isPublished()) {
|
||||
$pub = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ trait CouponTrait
|
|||
if (isset($calendars) && !$calendars->isEmpty()) {
|
||||
$pub = false;
|
||||
foreach ($calendars as $calendar) {
|
||||
if (strtotime(date('Y-m-d H:i:s')) > strtotime($calendar->calendrier_startdate) && strtotime(date('Y-m-d H:i:s')) < strtotime($calendar->calendrier_enddate)) {
|
||||
if ($calendar->isPublished()) {
|
||||
$pub = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -211,7 +211,7 @@ trait CouponTrait
|
|||
if (isset($calendars) && !$calendars->isEmpty()) {
|
||||
$pub = false;
|
||||
foreach ($calendars as $calendar) {
|
||||
if (strtotime(date('Y-m-d H:i:s')) > strtotime($calendar->calendrier_startdate) && strtotime(date('Y-m-d H:i:s')) < strtotime($calendar->calendrier_enddate)) {
|
||||
if ($calendar->isPublished()) {
|
||||
$pub = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterCalendrierTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('calendrier', function (Blueprint $table) {
|
||||
$table->date('calendrier_startdate')->default(DB::raw("1970-01-01"))->change();
|
||||
$table->date('calendrier_enddate')->default(DB::raw("1970-01-01"))->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('calendrier', function (Blueprint $table) {
|
||||
$table->timestamp('calendrier_startdate')->default(DB::raw("1970-01-01 00:00:01"))->change();
|
||||
$table->timestamp('calendrier_enddate')->default(DB::raw("1970-01-01 00:00:01"))->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
10
resources/js/app.js
vendored
10
resources/js/app.js
vendored
|
|
@ -33,7 +33,7 @@ const changeIcon = $('.marque')
|
|||
const dropDownMarque = $('.marque-select')
|
||||
|
||||
// FancyBox Communes
|
||||
// Confirmation
|
||||
// Confirmation
|
||||
$.fancyConfirm = function( opts ) {
|
||||
opts = $.extend( true, {
|
||||
title : 'Are you sure?',
|
||||
|
|
@ -42,7 +42,7 @@ $.fancyConfirm = function( opts ) {
|
|||
noButton : 'Cancel',
|
||||
callback : $.noop
|
||||
}, opts || {} );
|
||||
|
||||
|
||||
$.fancybox.open({
|
||||
type : 'html',
|
||||
src :
|
||||
|
|
@ -68,7 +68,7 @@ $.fancyConfirm = function( opts ) {
|
|||
afterClose : function( instance, current, e ) {
|
||||
var button = e ? e.target || e.currentTarget : null;
|
||||
var value = button ? $(button).data('value') : 0;
|
||||
|
||||
|
||||
opts.callback( value );
|
||||
}
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ $.fancyConfirm = function( opts ) {
|
|||
noButton : 'Cancel',
|
||||
callback : $.noop
|
||||
}, opts || {} );
|
||||
|
||||
|
||||
$.fancybox.open({
|
||||
type : 'html',
|
||||
src :
|
||||
|
|
@ -92,7 +92,7 @@ $.fancyConfirm = function( opts ) {
|
|||
'<h3 class="info">' + opts.title + '</h3>' +
|
||||
'<p>' + opts.message + '</p>' +
|
||||
'<p class="tright">' +
|
||||
'<a data-value="0" data-fancybox-close>' + opts.noButton + '</a>' +
|
||||
'<a data-value="0" data-fancybox-close>' + opts.noButton + '</a>' +
|
||||
'<button data-value="1" data-fancybox-close class="btn">' + opts.okButton + '</button>' +
|
||||
'</p>' +
|
||||
'</div>',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue