404 : fix camp / add publish and unpublish
This commit is contained in:
parent
c7f9c37e2e
commit
554aeca6c4
10 changed files with 203 additions and 8 deletions
|
|
@ -63,6 +63,27 @@ class AjaxController extends Controller
|
|||
return json_encode($coupon);
|
||||
}
|
||||
|
||||
// ---- Dépublie une campagne
|
||||
public function unpublish_camp_ajax(Request $request){
|
||||
$campid = $request->input('campid');
|
||||
$campagne = Campagne::find($campid);
|
||||
$campagne->camp_published = 0;
|
||||
$campagne->save();
|
||||
|
||||
return json_encode($campagne);
|
||||
}
|
||||
|
||||
// ---- Publie une campagne
|
||||
public function publish_camp_ajax(Request $request){
|
||||
$campid = $request->input('campid');
|
||||
$campagne = Campagne::find($campid);
|
||||
$campagne->camp_published = 1;
|
||||
$campagne->save();
|
||||
|
||||
return json_encode($campagne);
|
||||
}
|
||||
|
||||
|
||||
// ---- Impression des BR
|
||||
public function impression_ajax(Request $request){
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ class MurController extends Controller
|
|||
$ref = $campagne->camp_id;
|
||||
}
|
||||
|
||||
if($campagne->camp_published == 0){
|
||||
abort(404);
|
||||
}
|
||||
|
||||
if(isset($datas['hash'])){
|
||||
$contact = Contact::where([
|
||||
'contact_hash' => $datas['hash'], 'contact_siteId' => $campagne->camp_siteId
|
||||
|
|
|
|||
48
public/css/app.css
vendored
48
public/css/app.css
vendored
|
|
@ -202,6 +202,50 @@ p {
|
|||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.code404 {
|
||||
background-color: #adb5bd;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.code404 div {
|
||||
width: 400px;
|
||||
padding: 20px;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.code404 div h2 {
|
||||
color: #df0000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.code404 div p {
|
||||
color: #000;
|
||||
text-align: center;
|
||||
line-height: 1.2em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Font Awesome Free 5.3.1 by @fontawesome - https://fontawesome.com
|
||||
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||
|
|
@ -6570,6 +6614,10 @@ main section .alert {
|
|||
margin: 10px 0;
|
||||
}
|
||||
|
||||
main section .pub i {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#coupons-list {
|
||||
background-color: #2d2d2d;
|
||||
padding: 20px;
|
||||
|
|
|
|||
2
public/js/ajax.js
vendored
2
public/js/ajax.js
vendored
File diff suppressed because one or more lines are too long
71
resources/js/ajax.js
vendored
71
resources/js/ajax.js
vendored
|
|
@ -84,7 +84,6 @@ $('body').on('click', '.unpublish', function(event){
|
|||
event.preventDefault();
|
||||
var couponid = $(this).attr('data-couponid');
|
||||
var element = $(this).parent();
|
||||
//var icon = $(this).find('.pub');
|
||||
$.fancyConfirm({
|
||||
title : "<i class='fas fa-times-circle'></i> Dépublier",
|
||||
message : "Êtes-vous sûr de vouloir dépublier ce coupon ?",
|
||||
|
|
@ -105,7 +104,6 @@ $('body').on('click', '.unpublish', function(event){
|
|||
},
|
||||
dataType: 'JSON',
|
||||
success: function (reponse) {
|
||||
//icon.remove();
|
||||
element.empty().html('<i data-couponid="'+couponid+'" class="fas fa-times-circle red publish"></i>')
|
||||
}
|
||||
});
|
||||
|
|
@ -119,7 +117,6 @@ $('body').on('click', '.publish', function(event){
|
|||
event.preventDefault();
|
||||
var couponid = $(this).attr('data-couponid');
|
||||
var element = $(this).parent();
|
||||
//var icon = $(this).find('.pub');
|
||||
$.fancyInfo({
|
||||
title : "<i class='fas fa-check-circle'></i> Publier",
|
||||
message : "Êtes-vous sûr de vouloir publier ce coupon ?",
|
||||
|
|
@ -140,7 +137,6 @@ $('body').on('click', '.publish', function(event){
|
|||
},
|
||||
dataType: 'JSON',
|
||||
success: function (reponse) {
|
||||
//icon.remove();
|
||||
element.empty().html('<i data-couponid="'+couponid+'" class="fas fa-check-circle green unpublish"></i>')
|
||||
}
|
||||
});
|
||||
|
|
@ -148,4 +144,71 @@ $('body').on('click', '.publish', function(event){
|
|||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('body').on('click', '.unpublishcamp', function(event){
|
||||
event.preventDefault();
|
||||
var campid = $(this).attr('data-campid');
|
||||
var element = $(this).parent();
|
||||
$.fancyConfirm({
|
||||
title : "<i class='fas fa-times-circle'></i> Dépublier",
|
||||
message : "Êtes-vous sûr de vouloir dépublier cette campagne ?",
|
||||
okButton : 'Dépublier',
|
||||
noButton : 'Annuler',
|
||||
callback : function (value) {
|
||||
if (value) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('#csrf').val()
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: '/unpublish-camp-ajax',
|
||||
type: 'POST',
|
||||
data: {
|
||||
campid: campid
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function (reponse) {
|
||||
element.empty().html('<i data-campid="'+campid+'" class="fas fa-times-circle red publishcamp"></i>')
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$('body').on('click', '.publishcamp', function(event){
|
||||
event.preventDefault();
|
||||
var campid = $(this).attr('data-campid');
|
||||
var element = $(this).parent();
|
||||
$.fancyInfo({
|
||||
title : "<i class='fas fa-check-circle'></i> Publier",
|
||||
message : "Êtes-vous sûr de vouloir publier cette campagne ?",
|
||||
okButton : 'Publier',
|
||||
noButton : 'Annuler',
|
||||
callback : function (value) {
|
||||
if (value) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('#csrf').val()
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: '/publish-camp-ajax',
|
||||
type: 'POST',
|
||||
data: {
|
||||
campid: campid
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function (reponse) {
|
||||
element.empty().html('<i data-campid="'+campid+'" class="fas fa-check-circle green unpublishcamp"></i>')
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
7
resources/sass/partials/content.scss
vendored
7
resources/sass/partials/content.scss
vendored
|
|
@ -469,3 +469,10 @@ table {
|
|||
font-family: 'Nunito-Regular', sans-serif;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.pub {
|
||||
i {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
28
resources/sass/partials/reset.scss
vendored
28
resources/sass/partials/reset.scss
vendored
|
|
@ -146,4 +146,30 @@ p {
|
|||
i {
|
||||
margin-right:10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.code404{
|
||||
background-color: $lightgrey;
|
||||
display:flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
div {
|
||||
width:400px;
|
||||
padding:20px;
|
||||
display:flex;
|
||||
flex-direction: column;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
background-color:#FFF;
|
||||
h2 {
|
||||
color:#df0000;
|
||||
font-weight: bold;
|
||||
}
|
||||
p {
|
||||
color:#000;
|
||||
text-align:center;
|
||||
line-height:1.2em;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21,9 +21,9 @@
|
|||
<td><a href="{{ route('campagne.edit', $c) }}">{{ $c->camp_name }}</a></td>
|
||||
<td>{{ $c->camp_createdate }}</td>
|
||||
@if ( $c->camp_published === 1)
|
||||
<td class="center"><i class="fas fa-check-circle green"></i></td>
|
||||
<td class="pub center"><i data-campid="{{ $c->camp_id }}" class="fas fa-check-circle green unpublishcamp"></i></td>
|
||||
@else
|
||||
<td class="center"><i class="fas fa-times-circle red"></i></td>
|
||||
<td class="pub center"><i data-campid="{{ $c->camp_id }}" class="fas fa-times-circle red publishcamp"></i></td>
|
||||
@endif
|
||||
<td class="center"><i class="fas fa-eye showTemplate" data-campid="{{ $c->camp_id }}"></i></td>
|
||||
<td><a href="{{ route('campagne.destroy', $c) }}"><i class="fas fa-times delete-icon"></i></a></td>
|
||||
|
|
|
|||
23
resources/views/errors/404.blade.php
Normal file
23
resources/views/errors/404.blade.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<title>{{ config('app.name', 'Laravel') }}</title>
|
||||
|
||||
|
||||
<!-- Styles -->
|
||||
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||
<link href="{{ asset('css/jquery.fancybox.min.css') }}" rel="stylesheet">
|
||||
</head>
|
||||
<body class="code404">
|
||||
<div>
|
||||
<h2>Erreur 404</h2>
|
||||
<p>La page que vous essayez d'atteindre n'existe pas ou a été déplacée</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -52,6 +52,9 @@ Route::group(['prefix' => 'bo', 'middleware' => ['auth', 'saveroute']], function
|
|||
// ---- Publier/Depublier des coupons
|
||||
Route::post('/unpublish-coupons-ajax', 'AjaxController@unpublish_coupons_ajax');
|
||||
Route::post('/publish-coupons-ajax', 'AjaxController@publish_coupons_ajax');
|
||||
// ---- Publier/Depublier des campagnes
|
||||
Route::post('/unpublish-camp-ajax', 'AjaxController@unpublish_camp_ajax');
|
||||
Route::post('/publish-camp-ajax', 'AjaxController@publish_camp_ajax');
|
||||
// ---- Impressions de coupons
|
||||
Route::post('/ajx_impression', 'AjaxController@impression_ajax');
|
||||
// ---- Recherche Contact
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue