- fix create gamme bug

- css modifications
This commit is contained in:
Sebastien Hattry 2022-03-04 17:59:10 +01:00
parent c240bea8c1
commit 7a27f3f015
13 changed files with 106 additions and 64 deletions

View file

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bo;
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreGammeRequest;
use App\Http\Requests\UpdateGammeRequest;
use App\Lib\Utils;
use App\Models\Gamme;
class GammesController extends Controller
@ -57,6 +58,12 @@ class GammesController extends Controller
public function store(StoreGammeRequest $request)
{
$gamme = new Gamme($request->validated());
if (is_a($request->picture, "SplFileInfo")) {
$gamme->picture = Utils::storeImage($request->picture, $gamme->getTable());
}
if (is_a($request->banner, "SplFileInfo")) {
$gamme->banner = Utils::storeImage($request->banner, $gamme->getTable());
}
if (!$gamme->saveOrFail()) {
return redirect()->route('bo.gammes.edit', $gamme->id)->with('error', 'L\'actualité n\'a pas été créee');
@ -90,6 +97,12 @@ class GammesController extends Controller
public function update(Gamme $gamme, UpdateGammeRequest $request)
{
$gamme->fill($request->validated());
if (is_a($request->picture, "SplFileInfo")) {
$gamme->picture = Utils::storeImage($request->picture, $gamme->getTable());
}
if (is_a($request->banner, "SplFileInfo")) {
$gamme->banner = Utils::storeImage($request->banner, $gamme->getTable());
}
if (!$gamme->saveOrFail()) {
return redirect()->route('bo.gammes.edit', $gamme->id)

View file

@ -43,11 +43,12 @@ class PictosController extends Controller
public function store(StorePictoRequest $request)
{
$picto = new Picto($request->validated());
if (is_a($request->picture,"SplFileInfo")) {
if (is_a($request->picture, "SplFileInfo")) {
$picto->picture = Utils::storeImage($request->picture, $picto->getTable());
}
//on ne peut pas arbitrairement créer tous les pictos à cet endroit
//$picto->page = Page::marqueBloc2();
//j'ai du décommenter cette ligne pour la création picto fonctionne
$picto->page = Page::marqueBloc2();
if (!$picto->saveOrFail()) {
return redirect()->route('bo.pictos.edit', $picto->id)->with('error', 'Le pictogramme n\'a pas été crée');
@ -77,7 +78,7 @@ class PictosController extends Controller
public function update(Picto $picto, StorePictoRequest $request)
{
$picto->fill($request->validated());
if (is_a($request->picture,"SplFileInfo")) {
if (is_a($request->picture, "SplFileInfo")) {
$picto->picture = Utils::storeImage($request->picture, $picto->getTable());
}

View file

@ -47,11 +47,11 @@ class TextsController extends Controller
if (!$text->saveOrFail()) {
return redirect()
->route('bo.texts.edit', $text->id)
->with('error', 'La question/réponse n\'a pas été crée');
->with('error', 'La question/réponse n\'a pas été créée');
}
return redirect()
->route('bo.texts.edit', $text->id)
->with('success', 'Question/réponse créé !');
->with('success', 'Question/réponse créée !');
}
/**

View file

@ -45,13 +45,13 @@ class Product extends Model
protected static function boot()
{
static::creating(function (Product $product) {
if (is_a($product->picture,"SplFileInfo")) {
if (is_a($product->picture, "SplFileInfo")) {
$product->picture = Utils::storeImage($product->picture, $product->getTable());
}
});
static::updating(function (Product $product) {
if (is_a($product->picture,"SplFileInfo")) {
if (is_a($product->picture, "SplFileInfo")) {
$product->picture = Utils::storeImage($product->picture, $product->getTable());
}
});
@ -67,7 +67,7 @@ class Product extends Model
}
//delete des images de plus produit
$plusproduit = json_decode($product->plusproduit);
foreach($plusproduit as $plus) {
foreach ($plusproduit as $plus) {
$urlPicture = public_path() . $plus->url;
if ($urlPicture) {
if (File::exists($urlPicture)) {

View file

@ -4428,12 +4428,13 @@ ul.infos span{
position:absolute;
}
#list .p-abs{
position:static;
}
.p-abs.dual-center{
padding-left:0 !important;
padding-right:0 !important;
left:50% !important;
top:50% !important;
transform:translate(-50%, -50%) !important;
}
.color-red{
@ -4453,6 +4454,16 @@ ul.infos span{
}
@media screen and (min-width: 800px){
#list .p-abs{
position:absolute;
}
.p-abs.dual-center{
left:50% !important;
top:50% !important;
transform:translate(-50%, -50%) !important;
}
.is-flex .w25{
flex-basis:25%;
}
@ -4674,7 +4685,7 @@ h3:not(.item__title, .product-card__title){
@media screen and (max-width: 799px){
.breadcrumb{
max-width:70%;
top:-60px;
top:-20px;
right:0;
justify-content:flex-end;
flex-direction:initial;
@ -4980,6 +4991,8 @@ h3:not(.item__title, .product-card__title){
.footer-widgets .footer-widgets__content{
left:20%;
right:0;
top:50%;
transform:translateY(-50%);
}
.footer-widgets .footer-widgets__content.white-color p{
color:white;
@ -5038,6 +5051,7 @@ h3:not(.item__title, .product-card__title){
.footer-widgets .footer-widgets__content{
text-align:center;
left:50%;
top:unset;
transform:translateX(-50%);
bottom:20px;
}
@ -5394,17 +5408,11 @@ input[type=text]{
flex-direction:initial;
}
#list .section-header{
margin-bottom:30px;
color:#fff;
}
#list .section-header .title{
margin-bottom:5px;
}
#list .section-header .content{
top:30px;
padding-left:30px;
padding-right:30px;
}
#list .section-header > img{
-o-object-fit:cover;
object-fit:cover;
@ -5505,6 +5513,9 @@ input[type=text]{
max-width:49%;
}
#list .section-header{
margin-bottom:80px;
}
#list .section-header .content{
position:absolute;
width:100%;
@ -5522,9 +5533,6 @@ input[type=text]{
}
}
@media (max-width: 1024px){
#list .section-header{
margin-bottom:80px;
}
#list .is-flex{
justify-content:center;
}
@ -5535,10 +5543,6 @@ input[type=text]{
}
}
@media (max-width: 768px){
#list .section-header .content{
position:relative;
}
#posts > img{
position:absolute;
top:0;

View file

@ -10,14 +10,17 @@
// require('./bootstrap');
// require('./vuejs');
var selectElement = document.getElementById('gamme_id');
selectElement.addEventListener('change', function (event) {
var selectSubRange = document.getElementById('sous_gamme_id');
var length = selectSubRange.options.length;
for (i = length - 1; i > 0; i--) {
selectSubRange.options[i] = null;
}
});
if (selectElement != null) {
selectElement.addEventListener('change', function (event) {
var selectSubRange = document.getElementById('sous_gamme_id');
var length = selectSubRange.options.length;
for (i = length - 1; i > 0; i--) {
selectSubRange.options[i] = null;
}
});
}
/***/ }),

16
resources/js/back.js vendored
View file

@ -3,10 +3,12 @@
const selectElement = document.getElementById('gamme_id');
selectElement.addEventListener('change', (event) => {
let selectSubRange = document.getElementById('sous_gamme_id');
let length = selectSubRange.options.length;
for (i = length - 1; i > 0; i--) {
selectSubRange.options[i] = null;
}
});
if (selectElement != null) {
selectElement.addEventListener('change', (event) => {
let selectSubRange = document.getElementById('sous_gamme_id');
let length = selectSubRange.options.length;
for (i = length - 1; i > 0; i--) {
selectSubRange.options[i] = null;
}
});
}

View file

@ -16,6 +16,9 @@
.footer-widgets__content {
left: 20%;
right: 0;
top: 50%;
transform: translateY(-50%);
&.white-color {
p {
color: white;
@ -85,6 +88,7 @@
.footer-widgets__content {
text-align: center;
left: 50%;
top: unset;
transform: translateX(-50%);
bottom: 20px;

View file

@ -52,7 +52,7 @@
@media screen and (max-width: 799px) {
.breadcrumb {
max-width: 70%;
top: -60px;
top: -20px;
right: 0;
justify-content: flex-end;
flex-direction: initial;

View file

@ -98,17 +98,17 @@
flex-direction: initial;
}
.section-header {
margin-bottom: 30px;
// margin-bottom: 30px;
color: $color-light;
.title {
margin-bottom: 5px;
}
.content {
top: 30px;
padding-left: 30px;
padding-right: 30px;
}
// .content {
// top: 30px;
// padding-left: 30px;
// padding-right: 30px;
// }
& > img {
object-fit: cover;
max-height: 243px;
@ -352,6 +352,8 @@
#list {
.section-header {
margin-bottom: 80px;
.content {
position: absolute;
width: 100%;
@ -374,9 +376,9 @@
@media (max-width: 1024px) {
#list {
.section-header {
margin-bottom: 80px;
}
// .section-header {
// margin-bottom: 80px;
// }
.is-flex {
justify-content: center;
}
@ -394,16 +396,16 @@
}
@media (max-width: 768px) {
#list {
// .wrapper > div:not(:last-child) {
// margin-bottom: 2rem;
// }
.section-header {
.content {
position: relative;
}
}
}
// #list {
// .wrapper > div:not(:last-child) {
// margin-bottom: 2rem;
// }
// .section-header {
// .content {
// position: relative;
// }
// }
// }
#posts {
> img {
position: absolute;

View file

@ -62,12 +62,15 @@
.p-abs {
position: absolute;
}
#list .p-abs {
position: static;
}
.p-abs.dual-center {
padding-left: 0 !important;
padding-right: 0 !important;
left: 50% !important;
top: 50% !important;
transform: translate(-50%, -50%) !important;
// left: 50% !important;
// top: 50% !important;
// transform: translate(-50%, -50%) !important;
}
.color-red {
@ -87,6 +90,14 @@
}
@media screen and (min-width: 800px) {
#list .p-abs {
position: absolute;
}
.p-abs.dual-center {
left: 50% !important;
top: 50% !important;
transform: translate(-50%, -50%) !important;
}
.is-flex .w25 {
flex-basis: 25%;
}

View file

@ -6,7 +6,8 @@
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">
<a href="{{route('bo.home')}}" class="h2 text-decoration-none"> < </a>
{{ __('Pictogrammes') }} <small class="text-muted">{{ __('Création') }}</small></h1>
{{ __('Pictogrammes') }} <small class="text-muted">{{ __('Création') }}</small>
</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<button type="submit" class="btn btn-sm btn-primary">{{ __('Enregistrer') }}</a>
</div>

View file

@ -6,7 +6,8 @@
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">
<a href="{{route('bo.home')}}" class="h2 text-decoration-none"> < </a>
{{ __('Questions / Réponses') }} <small class="text-muted">{{ __('Création') }}</small></h1>
{{ __('Questions / Réponses') }} <small class="text-muted">{{ __('Création') }}</small>
</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<button type="submit" class="btn btn-sm btn-primary">{{ __('Enregistrer') }}</a>
</div>