bo Articles + Slides
This commit is contained in:
parent
2a67dfadcc
commit
58b868ed32
11 changed files with 227 additions and 479 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,6 +1,8 @@
|
|||
/node_modules
|
||||
/integration/node_modules
|
||||
/public/hot
|
||||
public/uploads/*
|
||||
!public/uploads/.gitkeep
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ class ArticlesController extends Controller
|
|||
{
|
||||
$request->validate([
|
||||
'title' => 'required|max:100',
|
||||
'picture' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=340,height=340',
|
||||
'picture_r' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=780,height=508',
|
||||
'picture' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:max-width=340,max-height=340',
|
||||
'picture_r' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:max-width=780,max-height=508',
|
||||
'content' => 'required',
|
||||
]);
|
||||
|
||||
|
|
@ -39,19 +39,6 @@ class ArticlesController extends Controller
|
|||
$content = $request->content;
|
||||
$categoryId = $request->category;
|
||||
$status = 0;
|
||||
$notification = $request->notification === null ? 0 : 1;
|
||||
|
||||
if ($categoryId === "4") {
|
||||
$question = $request->question;
|
||||
$multipleResponse = $request->multiple_response === null ? 0 : 1;
|
||||
$stopPoll = $request->stop_poll === null ? 0 : 1;
|
||||
$answers = $request->answers;
|
||||
|
||||
$request->validate([
|
||||
'question' => 'required|max:255',
|
||||
'answers' => 'required',
|
||||
]);
|
||||
}
|
||||
|
||||
$imageName = Str::slug($title) .'-le-gaulois-' . date('d-m-Y') . '.' . $picture->extension();
|
||||
$picture->move(public_path('uploads/images/articles/' . date('Y') . '/' . date('m')), $imageName);
|
||||
|
|
@ -65,23 +52,8 @@ class ArticlesController extends Controller
|
|||
$a->picture_r = 'uploads/images/articles/' . date('Y') . '/' . date('m') . '/' . $imageName_r;
|
||||
$a->content = $content;
|
||||
$a->category_id = $categoryId;
|
||||
if ($categoryId === "4") {
|
||||
$a->question = $question;
|
||||
$a->multiple_response = $multipleResponse;
|
||||
$a->stop_poll = $stopPoll;
|
||||
}
|
||||
$a->status = $status;
|
||||
$a->notification = $notification;
|
||||
$a->save();
|
||||
if ($categoryId === "4") {
|
||||
foreach ($answers as $answer) {
|
||||
if (!empty($answer)) {
|
||||
$a->answers()->create([
|
||||
'answer' => $answer,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('bo.articles.index');
|
||||
}
|
||||
|
|
@ -110,19 +82,6 @@ class ArticlesController extends Controller
|
|||
$content = $request->content;
|
||||
$categoryId = $request->category;
|
||||
$status = $request->status === null ? 0 : 1;
|
||||
$notification = $request->notification === null ? 0 : 1;
|
||||
|
||||
if ($categoryId === "4") {
|
||||
$question = $request->question;
|
||||
$multipleResponse = $request->multiple_response === null ? 0 : 1;
|
||||
$stopPoll = $request->stop_poll === null ? 0 : 1;
|
||||
$answers = $request->answers;
|
||||
|
||||
$request->validate([
|
||||
'question' => 'required|max:255',
|
||||
'answers' => 'required',
|
||||
]);
|
||||
}
|
||||
|
||||
if ($picture !== NULL && $picture_r !== NULL){
|
||||
$request->validate([
|
||||
|
|
@ -162,26 +121,7 @@ class ArticlesController extends Controller
|
|||
$a->picture_r = 'uploads/images/articles/' . date('Y') . '/' . date('m') . '/' . $imageName_r;
|
||||
$a->content = $content;
|
||||
$a->category_id = $categoryId;
|
||||
if ($categoryId === "4") {
|
||||
$a->question = $question;
|
||||
$a->multiple_response = $multipleResponse;
|
||||
$a->stop_poll = $stopPoll;
|
||||
$a->answers()->delete();
|
||||
foreach ($answers as $answer) {
|
||||
if (!empty($answer)) {
|
||||
$a->answers()->create([
|
||||
'answer' => $answer,
|
||||
]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$a->question = null;
|
||||
$a->multiple_response = null;
|
||||
$a->stop_poll = null;
|
||||
$a->answers()->delete();
|
||||
}
|
||||
$a->status = $status;
|
||||
$a->notification = $notification;
|
||||
$a->save();
|
||||
|
||||
if ($a->category_id == 1 && $a->status === 1) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bo;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\HomeSliders;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class HomeSlidersController extends Controller
|
||||
{
|
||||
|
|
@ -37,7 +38,39 @@ class HomeSlidersController extends Controller
|
|||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$title = $request->title;
|
||||
$picture = $request->picture;
|
||||
$text = $request->text;
|
||||
$linkLabel = $request->link_label;
|
||||
$link = $request->link;
|
||||
$newTab = $request->link_new_tab === null ? 0 : 1;
|
||||
$status = 0;
|
||||
|
||||
$request->validate([
|
||||
'title' => 'required|max:255',
|
||||
'picture' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:max-width=300,max-height=300',
|
||||
'link_label' => 'required|max:100',
|
||||
'link' => 'required|max:255',
|
||||
]);
|
||||
|
||||
$imageName = Str::slug($title) .'-jeusselin.'.$picture->extension();
|
||||
$picture->move(public_path('uploads/images/slider_accueil/' . date('Y') . '/' . date('m') . '/'), $imageName);
|
||||
// $imageName_r = Str::slug($title) .'-jeusselin_r.'.$picture_r->extension();
|
||||
// $picture_r->move(public_path('uploads/images/slider_accueil/' . date('Y') . '/' . date('m') . '/'), $imageName_r);
|
||||
|
||||
$hsp = new HomeSliders();
|
||||
$hsp->title = $title;
|
||||
$hsp->picture = 'uploads/images/slider_accueil/' . date('Y') . '/' . date('m') . '/' . $imageName;
|
||||
//$hsp->picture_r = 'uploads/images/slider_accueil/' . date('Y') . '/' . date('m') . '/' . $imageName_r;
|
||||
$hsp->text = $text;
|
||||
$hsp->link_label = $linkLabel;
|
||||
$hsp->link = $link;
|
||||
$hsp->link_new_tab = $newTab;
|
||||
$hsp->status = $status;
|
||||
$hsp->order = $this->getLastOrder();
|
||||
$hsp->save();
|
||||
|
||||
return redirect()->route('bo.home-sliders.index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,7 +92,8 @@ class HomeSlidersController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
$h = HomeSliders::findOrFail($id);
|
||||
return view('bo.home-sliders.edit', compact('h'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -71,7 +105,65 @@ class HomeSlidersController extends Controller
|
|||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$title = $request->title;
|
||||
$picture = $request->picture;
|
||||
$picture_r = null; //$request->picture_r;
|
||||
$text = $request->text;
|
||||
$linkLabel = $request->link_label;
|
||||
$link = $request->link;
|
||||
$newTab = $request->link_new_tab === null ? 0 : 1;
|
||||
$status = $request->status === null ? 0 : 1;
|
||||
|
||||
$request->validate([
|
||||
'title' => 'required|max:255',
|
||||
'link_label' => 'required|max:100',
|
||||
'link' => 'required|max:255',
|
||||
]);
|
||||
|
||||
if ($picture !== NULL && $picture_r !== NULL){
|
||||
$request->validate([
|
||||
'picture' => 'image|mimes:jpeg,png,jpg|max:2048|dimensions:max-width=300,max-height=300',
|
||||
'picture_r' => 'image|mimes:jpeg,png,jpg|max:2048|dimensions:width=500,height=671',
|
||||
]);
|
||||
}elseif ($picture !== NULL && $picture_r === NULL){
|
||||
$request->validate([
|
||||
'picture' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:max-width=300,max-height=300'
|
||||
]);
|
||||
}elseif ($picture === NULL && $picture_r !== NULL){
|
||||
$request->validate([
|
||||
'picture_r' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=500,height=671'
|
||||
]);
|
||||
}
|
||||
|
||||
$hsp = HomeSliders::findOrFail($id);
|
||||
|
||||
if ($picture !== NULL){
|
||||
if(file_exists(public_path() . '/' . $hsp->picture))
|
||||
unlink(public_path() . '/' . $hsp->picture);
|
||||
$imageName = Str::slug($title) .'-jeusselin.'.$picture->extension();
|
||||
$picture->move(public_path('uploads/images/slider_accueil/' . date('Y') . '/' . date('m') . '/'), $imageName);
|
||||
}
|
||||
if ($picture_r !== NULL) {
|
||||
if(file_exists(public_path() . '/' . $hsp->picture_r))
|
||||
unlink(public_path() . '/' . $hsp->picture_r);
|
||||
$imageName_r = Str::slug($title) . '-jeusselin_r.' . $picture_r->extension();
|
||||
$picture_r->move(public_path('uploads/images/slider_accueil/' . date('Y') . '/' . date('m') . '/'), $imageName_r);
|
||||
}
|
||||
|
||||
$hsp->title = $title;
|
||||
if ($picture !== null)
|
||||
$hsp->picture = 'uploads/images/slider_accueil/' . date('Y') . '/' . date('m') . '/' . $imageName;
|
||||
if ($picture_r !== null)
|
||||
$hsp->picture_r = 'uploads/images/slider_accueil/' . date('Y') . '/' . date('m') . '/' . $imageName_r;
|
||||
$hsp->text = $text;
|
||||
$hsp->link_label = $linkLabel;
|
||||
$hsp->link = $link;
|
||||
$hsp->link_new_tab = $newTab;
|
||||
|
||||
$hsp->status = $status;
|
||||
$hsp->save();
|
||||
|
||||
return redirect()->route('bo.home-sliders.edit', $hsp->id)->with('success', 'Enregistré !');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -82,6 +174,46 @@ class HomeSlidersController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
$h = HomeSliders::findOrFail($id);
|
||||
|
||||
if(file_exists(public_path() . '/' . $h->picture))
|
||||
unlink(public_path() . '/' . $h->picture);
|
||||
if(!is_null($h->picture_r)) {
|
||||
if(file_exists(public_path() . '/' . $h->picture_r))
|
||||
unlink(public_path() . '/' . $h->picture_r);
|
||||
}
|
||||
|
||||
$h->delete();
|
||||
|
||||
return redirect()->route('bo.home-sliders.index');
|
||||
}
|
||||
|
||||
public function changeOrder($id, $action)
|
||||
{
|
||||
$current = HomeSliders::findOrFail($id);
|
||||
|
||||
if ($action === 'up'){
|
||||
$tmp = HomeSliders::where('order', '<', $current->order)->orderBy('order', 'DESC')->first();
|
||||
$newOrder = $tmp->order;
|
||||
$tmp->order = $current->order;
|
||||
$current->order = $newOrder;
|
||||
}else{
|
||||
$tmp = HomeSliders::where('order', '>', $current->order)->orderBy('order', 'ASC')->first();
|
||||
$newOrder = $tmp->order;
|
||||
$tmp->order = $current->order;
|
||||
$current->order = $newOrder;
|
||||
}
|
||||
$tmp->save();
|
||||
$current->save();
|
||||
|
||||
return redirect()->route('bo.home-sliders.index');
|
||||
}
|
||||
|
||||
private function getLastOrder()
|
||||
{
|
||||
$order = HomeSliders::select('order')->orderBy('order', 'DESC')->first();
|
||||
if ($order === NULL)
|
||||
return 1;
|
||||
return $order->order + 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class CreateHomeSliderPicturesTable extends Migration
|
|||
$table->string('title');
|
||||
$table->text('text');
|
||||
$table->string('picture');
|
||||
$table->string('picture_r');
|
||||
$table->string('picture_r')->nullable();
|
||||
$table->string('link_label', 100);
|
||||
$table->string('link');
|
||||
$table->boolean('link_new_tab')->default(false);
|
||||
|
|
|
|||
|
|
@ -22,10 +22,6 @@ class CreateArticlesTable extends Migration
|
|||
$table->string('picture');
|
||||
$table->string('picture_r');
|
||||
$table->text('content');
|
||||
$table->string('question')->nullable();
|
||||
$table->integer('multiple_response')->nullable();
|
||||
$table->integer('stop_poll')->nullable();
|
||||
$table->integer('notification')->default(0);
|
||||
|
||||
$table->boolean('status')->default(false);
|
||||
|
||||
|
|
|
|||
1
public/uploads/.gitkeep
Normal file
1
public/uploads/.gitkeep
Normal file
|
|
@ -0,0 +1 @@
|
|||
gitkeep
|
||||
|
|
@ -26,11 +26,11 @@
|
|||
<input type="text" class="form-control" name="title" placeholder="Titre *" value="{{ old('title') }}" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Visuel * de type JPEG/PNG - 2Mo max. - 340 x 340px</label></br>
|
||||
<label>Visuel * de type JPEG/PNG - 2Mo max. - Max : 340 x 340px</label></br>
|
||||
<input type="file" name="picture" accept="image/png, image/jpeg" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Visuel * de type JPEG/PNG - 2Mo max. - 780 x 508px</label></br>
|
||||
<label>Visuel * de type JPEG/PNG - 2Mo max. - Max: 780 x 508px</label></br>
|
||||
<input type="file" name="picture_r" accept="image/png, image/jpeg" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
@ -45,44 +45,6 @@
|
|||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" id="div_answers">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="question" value="{{ old('question') }}" placeholder="Question *">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<input type="checkbox" name="multiple_response" @if (old('multiple_response') !== null)checked @endif>
|
||||
Autoriser la réponse multiple
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<input type="checkbox" name="stop_poll" @if (old('stop_poll') !== null)checked @endif>
|
||||
Arrêter le sondage
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<a class="btn btn-primary text-white" onclick="addInput()" id="add_answer" role="button">Ajouter une réponse</a>
|
||||
</div>
|
||||
<div>
|
||||
<table class="table text-center">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">Réponse</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="answers">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<input type="checkbox" name="notification" @if (old('notification') !== null)checked @endif>
|
||||
Notification activé
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" class="btn btn-secondary" value="Ajouter">
|
||||
</div>
|
||||
|
|
@ -95,76 +57,6 @@
|
|||
|
||||
@section('scripts')
|
||||
<script>
|
||||
var addId = 0;
|
||||
// Compte le nombre de champs answer sur la page
|
||||
var nbAnswer = 0;
|
||||
|
||||
function addInput() {
|
||||
// Désactive le bouton ajouter une réponse si il y a déjà 5 inputs présents
|
||||
if (nbAnswer >= 5) {
|
||||
document.getElementById('add_answer').classList.add("disabled");
|
||||
} else {
|
||||
addId++;
|
||||
nbAnswer++;
|
||||
|
||||
var answerTable = document.getElementById('answers');
|
||||
|
||||
var tr = document.createElement('tr');
|
||||
tr.id = "tr_answer_" + addId;
|
||||
|
||||
var td1 = document.createElement('td');
|
||||
td1.className = "w-75";
|
||||
var td2 = document.createElement('td');
|
||||
td2.className = "w-25";
|
||||
|
||||
var input = document.createElement('input');
|
||||
input.className = "form-control";
|
||||
input.name = "answers[]";
|
||||
input.placeholder = "Réponse";
|
||||
|
||||
var a = document.createElement('a');
|
||||
a.href = "#_";
|
||||
a.setAttribute("onclick", "deleteAnswer('tr_answer_" + addId + "')");
|
||||
a.className = "col-form-label";
|
||||
a.innerHTML = "Supprimer"
|
||||
|
||||
td1.appendChild(input);
|
||||
td2.appendChild(a);
|
||||
tr.appendChild(td1);
|
||||
tr.appendChild(td2);
|
||||
answerTable.appendChild(tr);
|
||||
|
||||
if (nbAnswer >= 5) {
|
||||
document.getElementById('add_answer').classList.add("disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Supprime une ligne du tableau de réponses, affiche le bouton ajouter une réponse si il y a moins de 5 champs présents sur la page
|
||||
function deleteAnswer(elementId) {
|
||||
var tr = document.getElementById(elementId);
|
||||
tr.parentNode.removeChild(tr);
|
||||
nbAnswer--;
|
||||
|
||||
if (nbAnswer < 5) {
|
||||
document.getElementById('add_answer').classList.remove("disabled");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var divAnswers = document.getElementById('div_answers');
|
||||
var category = document.getElementById('category');
|
||||
if (category.value !== "4") {
|
||||
divAnswers.style.display = "none";
|
||||
}
|
||||
|
||||
category.onchange = function() {
|
||||
if (category.value === "4") {
|
||||
divAnswers.style.display = "inline";
|
||||
} else {
|
||||
divAnswers.style.display = "none";
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -66,62 +66,6 @@
|
|||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" id="div_answers">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="question" placeholder="Question *" value="{{$a->question}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
@if ($a->multiple_response === 1)
|
||||
<input type="checkbox" name="multiple_response" checked>
|
||||
@else
|
||||
<input type="checkbox" name="multiple_response">
|
||||
@endif
|
||||
Autoriser la réponse multiple
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
@if ($a->stop_poll === 1)
|
||||
<input type="checkbox" name="stop_poll" checked>
|
||||
@else
|
||||
<input type="checkbox" name="stop_poll">
|
||||
@endif
|
||||
Arrêter le sondage
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<a class="btn btn-primary text-white" onclick="addInput()" id="add_answer" role="button">Ajouter une réponse</a>
|
||||
</div>
|
||||
<div>
|
||||
<table class="table text-center">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">Réponse</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="answers">
|
||||
@for($i = 0; $i < count($a->answers); $i++)
|
||||
<tr id="tr_answer_{{$i}}">
|
||||
<td class="w-75"><input class="form-control" name="answers[]" placeholder="Réponse" value="{{$a->answers[$i]->answer}}"></td>
|
||||
<td class="w-25"><a href="#_" onclick="deleteAnswer('tr_answer_{{$i}}')" class="col-form-label">Supprimer</a></td>
|
||||
</tr>
|
||||
@endfor
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
@if ($a->notification === 1)
|
||||
<input type="checkbox" name="notification" checked>
|
||||
@else
|
||||
<input type="checkbox" name="notification">
|
||||
@endif
|
||||
Notification activé
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
@if ($a->status === 1)
|
||||
|
|
@ -144,81 +88,6 @@
|
|||
|
||||
@section('scripts')
|
||||
<script>
|
||||
var addId = 0;
|
||||
// Compte le nombre de champs answer sur la page
|
||||
var nbAnswer = 0;
|
||||
|
||||
function addInput() {
|
||||
// Désactive le bouton ajouter une réponse si il y a déjà 5 inputs présents
|
||||
if (nbAnswer >= 5) {
|
||||
document.getElementById('add_answer').classList.add("disabled");
|
||||
} else {
|
||||
addId++;
|
||||
nbAnswer++;
|
||||
|
||||
var answerTable = document.getElementById('answers');
|
||||
|
||||
var tr = document.createElement('tr');
|
||||
tr.id = "tr_answer_" + addId;
|
||||
|
||||
var td1 = document.createElement('td');
|
||||
td1.className = "w-75";
|
||||
var td2 = document.createElement('td');
|
||||
td2.className = "w-25";
|
||||
|
||||
var input = document.createElement('input');
|
||||
input.className = "form-control";
|
||||
input.name = "answers[]";
|
||||
input.placeholder = "Réponse";
|
||||
|
||||
var a = document.createElement('a');
|
||||
a.href = "#_";
|
||||
a.setAttribute("onclick", "deleteAnswer('tr_answer_" + addId + "')");
|
||||
a.className = "col-form-label";
|
||||
a.innerHTML = "Supprimer"
|
||||
|
||||
td1.appendChild(input);
|
||||
td2.appendChild(a);
|
||||
tr.appendChild(td1);
|
||||
tr.appendChild(td2);
|
||||
answerTable.appendChild(tr);
|
||||
|
||||
if (nbAnswer >= 5) {
|
||||
document.getElementById('add_answer').classList.add("disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Supprime une ligne du tableau de réponses, affiche le bouton ajouter une réponse si il y a moins de 5 champs présents sur la page
|
||||
function deleteAnswer(elementId) {
|
||||
var tr = document.getElementById(elementId);
|
||||
tr.parentNode.removeChild(tr);
|
||||
nbAnswer--;
|
||||
|
||||
if (nbAnswer < 5) {
|
||||
document.getElementById('add_answer').classList.remove("disabled");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var divAnswers = document.getElementById('div_answers');
|
||||
var category = document.getElementById('category');
|
||||
if (category.value !== "4") {
|
||||
divAnswers.style.display = "none";
|
||||
}
|
||||
|
||||
nbAnswer = document.getElementById('answers').getElementsByTagName('input').length;
|
||||
if (nbAnswer >= 5) {
|
||||
document.getElementById('add_answer').classList.add("disabled");
|
||||
}
|
||||
|
||||
category.onchange = function() {
|
||||
if (category.value === "4") {
|
||||
divAnswers.style.display = "inline";
|
||||
} else {
|
||||
divAnswers.style.display = "none";
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<custom-ckeditor name="text" dbtext="{{ old('text') }}"></custom-ckeditor>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Photo * de type JPEG/PNG - 2Mo max. - ?? x ??px</label>
|
||||
<label>Photo * de type JPEG/PNG - 2Mo max. - Max : 300 x 300 px</label>
|
||||
<input type="file" name="picture" accept="image/png, image/jpeg" required>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,169 +1,85 @@
|
|||
@extends('layouts.bo')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Modification d'une slide pour l'accueil
|
||||
<a href="{{route('bo.home-slider-pictures.index')}}" class="btn btn-sm btn-primary float-right ml-2">Retour</a>
|
||||
<form action="{{route('bo.home-slider-pictures.destroy', $h->id)}}" method="POST" class="d-inline">
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<input type="submit" class="btn btn-sm btn-danger float-right" value="Supprimer"
|
||||
onclick="return confirm('Êtes-vous sûr(e) ?')">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form action="{{route('bo.home-slider-pictures.update', $h->id)}}" method="POST" enctype="multipart/form-data">
|
||||
@method('PUT')
|
||||
@csrf
|
||||
@if (session('success'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger">
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item"><em>Champs généraux</em></li>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-10 offset-md-1">
|
||||
<div class="form-group row">
|
||||
<div class="form-group col-md-8">
|
||||
<input type="text" class="form-control" name="catch_phrase" placeholder="Accroche *" value="{{$h->catch_phrase}}" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4 row">
|
||||
<label class="col-md-7 col-form-label">Couleur *</label>
|
||||
<input type="color" class="form-control col-md-5" name="catch_color" value="{{$h->catch_color}}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="form-group col-md-8">
|
||||
<input type="text" class="form-control" name="title" placeholder="Titre *" value="{{$h->title}}" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4 row">
|
||||
<label class="col-md-7 col-form-label">Couleur *</label>
|
||||
<input type="color" class="form-control col-md-5" name="title_color" value="{{$h->title_color}}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Visuel * de type JPEG/PNG - 2Mo max. - 1366 x 553px</label></br>
|
||||
<input type="file" name="picture" accept="image/png, image/jpeg">
|
||||
</br>
|
||||
</br>
|
||||
<img src="{{ asset($h->picture) }}" style="max-height: 200px;">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Visuel sur mobile * de type JPEG/PNG - 2Mo max. - 500 x 671px</label></br>
|
||||
<input type="file" name="picture_r" accept="image/png, image/jpeg">
|
||||
</br>
|
||||
</br>
|
||||
<img src="{{ asset($h->picture_r) }}" style="max-height: 200px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<li class="list-group-item"><em>Options de liens</em></li>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-10 offset-md-1">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="link_label" placeholder="Nom du lien *" value="{{$h->link_label}}" required>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="form-group col-md-8">
|
||||
<input type="text" class="form-control" name="link" placeholder="Lien *" value="{{$h->link}}" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4 row">
|
||||
<label class="col-md-7 col-form-label">Couleur *</label>
|
||||
<input type="color" class="form-control col-md-5" name="link_color" value="{{$h->link_color}}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
@if ($h->new_tab === 1)
|
||||
<input type="checkbox" name="new_tab" checked>
|
||||
@else
|
||||
<input type="checkbox" name="new_tab">
|
||||
@endif
|
||||
Ouvrir dans un nouvel onglet
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<li class="list-group-item"><em>Paramètres de publications</em></li>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-10 offset-md-1 text-center">
|
||||
<div class="form-group form-check-inline">
|
||||
<label>
|
||||
<input type="checkbox" name="mon" @if($h->has(Days::mon())) checked @endif>
|
||||
{{ Days::mon() }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group form-check-inline">
|
||||
<label>
|
||||
<input type="checkbox" name="mon" @if($h->has(Days::tue())) checked @endif>
|
||||
{{ Days::tue() }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group form-check-inline">
|
||||
<label>
|
||||
<input type="checkbox" name="mon" @if($h->has(Days::wed())) checked @endif>
|
||||
{{ Days::wed() }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group form-check-inline">
|
||||
<label>
|
||||
<input type="checkbox" name="mon" @if($h->has(Days::thu())) checked @endif>
|
||||
{{ Days::thu() }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group form-check-inline">
|
||||
<label>
|
||||
<input type="checkbox" name="mon" @if($h->has(Days::fri())) checked @endif>
|
||||
{{ Days::fri() }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group form-check-inline">
|
||||
<label>
|
||||
<input type="checkbox" name="mon" @if($h->has(Days::sat())) checked @endif>
|
||||
{{ Days::sat() }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group form-check-inline">
|
||||
<label>
|
||||
<input type="checkbox" name="mon" @if($h->has(Days::sun())) checked @endif>
|
||||
{{ Days::sun() }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>
|
||||
@if ($h->status === 1)
|
||||
<input type="checkbox" name="status" value="1" checked>
|
||||
@else
|
||||
<input type="checkbox" name="status" value="1">
|
||||
@endif
|
||||
Publié ?
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" class="btn btn-secondary" value="Modifier">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Slides de l'acceuil - edition
|
||||
<a href="{{route('bo.home-sliders.index')}}" class="btn btn-sm btn-primary float-right">Retour</a>
|
||||
<form action="{{route('bo.home-sliders.destroy', $h->id)}}" method="POST" class="d-inline">
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<input type="submit" class="btn btn-sm btn-danger float-right" value="Supprimer"
|
||||
onclick="return confirm('Êtes-vous sûr(e) ?')">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
@if (session('success'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger">
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
<form action="{{route('bo.home-sliders.update', $h->id)}}" method="POST" enctype="multipart/form-data">
|
||||
@method('PUT')
|
||||
@csrf
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item"><em>Champs généraux</em></li>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 offset-md-3">
|
||||
<div class="form-group">
|
||||
<input type="text" name="title" class="form-control" placeholder="Titre" value="{{ $h->title }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<custom-ckeditor name="text" dbtext="{{ $h->text }}"></custom-ckeditor>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Photo * de type JPEG/PNG - 2Mo max. - Max : 300 x 300 px</label>
|
||||
<input type="file" name="picture" accept="image/png, image/jpeg">
|
||||
</br>
|
||||
</br>
|
||||
<img src="{{ asset($h->picture) }}" style="max-height: 200px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<li class="list-group-item"><em>Options de liens</em></li>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 offset-md-3">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="link_label" placeholder="Nom du lien *" value="{{ $h->link_label }}" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="link" placeholder="Lien *" value="{{ $h->link }}" required>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<label>
|
||||
@if ($h->link_new_tab === 1)
|
||||
<input type="checkbox" name="link_new_tab" checked>
|
||||
@else
|
||||
<input type="checkbox" name="link_new_tab">
|
||||
@endif
|
||||
Ouvrir dans un nouvel onglet
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" class="btn btn-secondary" value="Modifier">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@
|
|||
<tr>
|
||||
<th>{{$slide->title}}</th>
|
||||
<th>{{$slide->text}}</th>
|
||||
<th>{{$slide->picture}}</th>
|
||||
<th><img src="{{ asset($slide->picture) }}"></th>
|
||||
<th>{{$slide->link_label}}</th>
|
||||
<th>{{$slide->status}}</th>
|
||||
<td><a href="{{route('bo.home-sliders.edit', ['employee' => $slide->id])}}" class="btn btn-sm btn-primary">Éditer</a></td>
|
||||
<td><a href="{{route('bo.home-sliders.edit', ['home_slider' => $slide->id])}}" class="btn btn-sm btn-primary">Éditer</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue