correction ellipse sur titre produit

This commit is contained in:
Olivier Legat 2021-04-15 13:07:46 +02:00
parent cedb0b7a4d
commit 1b64c6ba1a
5 changed files with 116 additions and 25 deletions

View file

@ -37,6 +37,7 @@ class CustomerController extends Controller
{
/** @var \App\Lib\LDCCRM\ApiV1 */
$crm = app('crmApi');
$crmCustomer = $crm->createCustomer(
$request->email,
$request->password,
@ -53,8 +54,8 @@ class CustomerController extends Controller
);
if ($crmCustomer->status === "OK") {
$customer = new Customers($request->all());
$customer->crm_id = $crmCustomer->user->crm_id;
$customer = new Customers($request->all());
$customer->crm_id = $crmCustomer->user->crm_id;
$customer->hashcode = $crmCustomer->user->hashcode;
$customer->save();
@ -104,7 +105,7 @@ class CustomerController extends Controller
'password' => 'required',
]);
$email = filter_var($request->email, FILTER_SANITIZE_EMAIL);
$email = filter_var($request->email, FILTER_SANITIZE_EMAIL);
$password = $request->password;
$remember = $request->remember !== null ? true : false;
@ -113,6 +114,7 @@ class CustomerController extends Controller
if ($customer) {
/** @var \App\Lib\LDCCRM\ApiV1 */
$crm = app('crmApi');
$result = $crm->loginCustomer($email, $password);
if ($result->status === "OK") {
/** @var \Illuminate\Auth\SessionGuard */
@ -121,16 +123,18 @@ class CustomerController extends Controller
$url = Session::pull('url.intended');
Session::forget('url.intended');
Session::save();
if(empty($url)) {
if (empty($url)) {
return redirect()->route('account.dashboard');
}
return redirect()->to($url);
} else {
switch ($result->code) {
case 115:
// @phpcs:ignore Generic.Files.LineLength
return back()->withErrors("Veuillez vérifier que vous avez correctement rempli les champs obligatoires.");
case 116:
Mail::to($email)->send(new RegisterConfirmMail($customer, null));
// @phpcs:ignore Generic.Files.LineLength
return back()->withErrors("Votre compte n'est pas activé, vérifier dans vos emails pour y trouver le mail de confirmation. Un lien d'activation vous a été renvoyer.");
case 117 || 118 || 119:
return back()->withErrors("Email ou mot de passe incorrect.");
@ -152,9 +156,10 @@ class CustomerController extends Controller
$customer = Customers::select('crm_id')->where('hashcode', $hashcode)->first();
if ($customer) {
/** @var \App\Lib\LDCCRM\ApiV1 */
$crm = app('crmApi');
$crm = app('crmApi');
$result = $crm->activateCustomer($customer->crm_id);
if ($result->status === "OK") {
// @phpcs:ignore Generic.Files.LineLength
return view('auth.activate')->with('message', 'Votre compte a bien été activé, vous pouvez désormais vous connecter.');
} else {
return view('auth.activate')->with('message', "Ce lien d'activation n'est pas valide.");
@ -202,13 +207,14 @@ class CustomerController extends Controller
$token = Str::random(80);
$passwordReset = new PasswordReset();
$passwordReset->email = $email;
$passwordReset->token = $token;
$passwordReset = new PasswordReset();
$passwordReset->email = $email;
$passwordReset->token = $token;
$passwordReset->created_at = now();
$passwordReset->save();
Mail::to($email)->send(new PasswordResetMail($token));
// @phpcs:ignore Generic.Files.LineLength
return back()->with('success', __("La procédure pour changer votre mot de passe a été envoyé sur votre email."));
} else {
return back()->withErrors(__("Cette adresse email n'est pas enregistrée dans nos services."));
@ -247,13 +253,14 @@ class CustomerController extends Controller
try {
$passwordReset = PasswordReset::where('token', $token)->first();
$customer = Customers::where('email', $passwordReset->email)->first();
$crmId = $customer->crm_id;
$customer = Customers::where('email', $passwordReset->email)->first();
$crmId = $customer->crm_id;
} catch (Exception $e) {
return back()->withErrors("Changement du mot de passe impossible, les données envoyés sont incorrectes.");
}
/** @var \App\Lib\LDCCRM\ApiV1 */
$crm = app('crmApi');
$result = $crm->changePwdCustomer($crmId, $password);
if ($result->status === "OK") {
$passwordReset->delete();
@ -284,12 +291,12 @@ class CustomerController extends Controller
}
/** @var \App\Lib\LDCCRM\ApiV1 */
$crm = app('crmApi');
$crm = app('crmApi');
$crmCustomer = $crm->getCustomer($customer->crm_id);
if ($crmCustomer->status === "KO") {
abort(503);
}
$crmInfos = $crmCustomer->user;
$crmInfos = $crmCustomer->user;
$birthDate = explode('-', $crmInfos->birth_date);
return view('customer.dashboard', compact('customer', 'crmInfos', 'birthDate'));
@ -298,14 +305,14 @@ class CustomerController extends Controller
/**
* Send a request to the CRM to change the given customer's informations
* @param Request $request
* @param UpdateInfosRequest $request
*
*/
public function updateInfos(UpdateInfosRequest $request)
{
// TODO : Activer le changement d'email quand ce sera possible dans la CRM
/** @var \App\Lib\LDCCRM\ApiV1 */
$crm = app('crmApi');
$crm = app('crmApi');
$crmCustomer = $crm->updateCustomer(
Auth::guard('customer')->user()->crm_id,
$request->firstname,
@ -337,7 +344,7 @@ class CustomerController extends Controller
'password' => 'required|min:8|confirmed|max:255'
]);
$crm = app('crmApi');
$crm = app('crmApi');
$customer = $crm->changePwdCustomer(Auth::guard('customer')->user()->crm_id, $request->password);
if ($customer->status === "OK") {
@ -350,12 +357,14 @@ class CustomerController extends Controller
/**
* affichage des commandes du customer connecté
*/
public function myOrders(Request $request) {
public function myOrders(Request $request)
{
$orders = Order::where('customer_id', Auth::guard('customer')->user()->id)->orderBy('date', 'DESC')->get();
return view('customer.my-orders', compact('orders'));
}
public function orderDetail($reference) {
public function orderDetail($reference)
{
$order = Order::where('reference', '=', $reference)
->where('customer_id', Auth::guard('customer')->user()->id)
->firstOrFail();
@ -375,8 +384,9 @@ class CustomerController extends Controller
// TODO : Suppression via la CRM
if (Auth::guard('customer')->user()->id === $customer->id)
if (Auth::guard('customer')->user()->id === $customer->id) {
Auth::guard('customer')->logout();
}
$customer->delete();
return redirect()->route('home');

View file

@ -26,7 +26,9 @@
<rule ref="Generic.ControlStructures.InlineControlStructure" />
<rule ref="Generic.Files.ByteOrderMark" />
<rule ref="Generic.Files.LineEndings" />
<rule ref="Generic.Files.LineLength" />
<rule ref="Generic.Files.LineLength">
<severity>0</severity>
</rule>
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
<rule ref="Generic.Formatting.MultipleStatementAlignment" />
<rule ref="Generic.Formatting.NoSpaceAfterCast" />

View file

@ -2875,15 +2875,51 @@ input.product__qty-input {
}
.pl-item__title {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
padding: 0 10px;
height: 50px;
overflow: hidden;
margin-bottom: 15px;
}
.pl-item__title > span.ellipse {
display: block;
/* hide text if it more than N lines */
overflow: hidden;
/* for set '...' in absolute position */
position: relative;
/* use this value to count block height */
/* max-height = line-height (1.2) * lines max number (3) */
max-height: 50px;
/* fix problem when last visible word doesn't adjoin right side */
text-align: justify;
/* place for '...' */
margin-right: -1em;
padding-right: 1em;
}
.pl-item__title > span.ellipse:before {
/* points in the end */
content: "...";
/* absolute position */
position: absolute;
/* set position to right bottom corner of block */
right: 0;
bottom: 0;
}
.pl-item__title > span.ellipse:after {
/* points in the end */
content: "";
/* absolute position */
position: absolute;
/* set position to right bottom corner of text */
right: 0;
/* set width and height */
width: 1em;
height: 1em;
margin-top: 0.2em;
/* bg color = bg color under block */
background: white;
}
.pl-item__title:hover {
text-decoration: underline;

View file

@ -48,7 +48,11 @@
@foreach ($products as $product)
<div class="product-list__block">
<div class="pl-item">
<a class="pl-item__title title title_xs" href="{{route('product', ['productSlug' => $product->slug])}}">{{ $product->name }}</a>
<a class="pl-item__title title title_xs"
href="{{route('product', ['productSlug' => $product->slug])}}"
title="{{ $product->name }}">
<span class="ellipse">{{ $product->name }}</span>
</a>
<a class="pl-item__image" href="{{route('product', ['productSlug' => $product->slug])}}">
@if($product->promotions->count())
<div class="pl-item__specialoffer">Offre spéciale</div>

View file

@ -1700,14 +1700,53 @@ input.product__qty-input {
}
.pl-item__title {
display: flex;
//display: flex;
align-items: center;
justify-content: center;
text-align: center;
padding: 0 10px;
height: 50px;
overflow: hidden;
//overflow: hidden;
margin-bottom: 15px;
& > span.ellipse {
display: block;
/* hide text if it more than N lines */
overflow: hidden;
/* for set '...' in absolute position */
position: relative;
/* use this value to count block height */
//line-height: 1.2em;
/* max-height = line-height (1.2) * lines max number (3) */
max-height: 50px;
/* fix problem when last visible word doesn't adjoin right side */
text-align: justify;
/* place for '...' */
margin-right: -1em;
padding-right: 1em;
&:before {
/* points in the end */
content: '...';
/* absolute position */
position: absolute;
/* set position to right bottom corner of block */
right: 0;
bottom: 0;
}
&:after {
/* points in the end */
content: '';
/* absolute position */
position: absolute;
/* set position to right bottom corner of text */
right: 0;
/* set width and height */
width: 1em;
height: 1em;
margin-top: 0.2em;
/* bg color = bg color under block */
background: white;
}
}
}
.pl-item__title:hover {