namespace App\Models;
use Cubist\Backpack\app\Magic\Models\CubistMagicModel;
+use Cubist\Util\Json;
+use Illuminate\Support\Facades\App;
use Illuminate\Support\Str;
use Spatie\MediaLibrary\Models\Media;
return count($this->getDocuments()) > 0;
}
+
public function getSpecificationsValues()
{
$res = [];
- $allspecs = Specification::all();
- $mytype = ProductType::find($this->productType);
+ $allspecs = Specification::all()->keyBy('id');
+ $mytype = ProductType::find($this->product_type);
$myspecs = $mytype->specifications;
- foreach ($myspecs as $spec) {
+
+ foreach ($myspecs as $spec) {
+ $specEntity = $allspecs[$spec];
+ $val = Json::decodeRecursive($this->{'s_' . Str::snake($specEntity->name)}, Json::TYPE_ARRAY);
+ $specValue = ' - ';
+ if ($specEntity->type == 'numeric' || $specEntity->type == 'numeric_list') {
+ $specValue = $specEntity->prefix;
+ if ($specEntity->type == 'numeric_list') {
+ $specValue .= ' ' . implode(' ' . $specEntity->separator . ' ', $val);
+ } else {
+ $specValue = $val;
+ }
+ $specValue .= ' ' . $specEntity->unit;
+ } else if ($specEntity->type == 'text') {
+ $specValue = trim($val);
+ } else if ($specEntity->type == 'range') {
+ $specValue = $val['first'] . ' ' . __('à') . ' ' . $val['second'] . ' ' . $specEntity->unit;
+ } else if ($specEntity->type == 'list') {
+ $option=Json::decodeRecursive($specEntity->options, Json::TYPE_ARRAY)[$val];
+ $locale=App::getLocale();
+ if(!isset($option->$locale) || !$option->$locale){
+ $specValue=$option->fr;
+ }else{
+ $specValue=$option->$locale;
+ }
+ }
+ $res[$specEntity->label] = $specValue;
}
return $res;
}
<text-block title="Wheel Force Transducer" title-class="h1 text-inherit">
<p>
- Wheel Force Transducers (WFT) are used for measuring all wheel forces and moments. Field and laboratory test of passenger cars, light duty trucks, heavy duty trucks, vans, SUVs, class 8 trucks, heavy duty construction and farm equipment.
+ {{$test}}Wheel Force Transducers (WFT) are used for measuring all wheel forces and moments.
+ Field and laboratory test of passenger cars, light duty trucks, heavy duty trucks, vans,
+ SUVs, class 8 trucks, heavy duty construction and farm equipment.
</p>
<p>
</column>
<column class="overlap-bottom md:-mr-2v sm:-ml-2v sm:mb-0">
- <flexible-image src="storage/uploads/images/home-car.jpg" />
+ <flexible-image src="storage/uploads/images/home-car.jpg"/>
</column>
</columns>
<full-width class="bg-grey-100">
<content>
- <text-block class="mb-2v" title="Nos Produits" />
+ <text-block class="mb-2v" title="Nos Produits"/>
<columns>
<column>
<grid cols="2" gap="md" class="xs:grid-cols-1 pr-1v border-r border-grey-300 sm:pr-0 sm:border-0">
@for ($i = 1; $i <= 6; $i++)
<div class="bg-white px-1v py-6 flex">
- <a class="animated-underline partial-underline flex flex-col justify-between w-full" href="#">
+ <a class="animated-underline partial-underline flex flex-col justify-between w-full"
+ href="#">
<div class="flex items-center justify-center flex-grow">
<img class="mb-4" src="{{ asset("storage/products/$i.png") }}">
</div>
<grid cols="2" gap="md" class="xs:grid-cols-1 pl-1v sm:pl-0">
@for ($i = 1; $i <= 6; $i++)
<div class="bg-white px-1v py-6 flex">
- <a class="animated-underline partial-underline flex flex-col justify-between w-full" href="#">
+ <a class="animated-underline partial-underline flex flex-col justify-between w-full"
+ href="#">
<div class="flex items-center justify-center flex-grow">
<img class="mb-4" src="{{ asset("storage/products/$i.png") }}">
</div>
{{-- Solutions / Applications --}}
<full-width class="bg-navy text-white antialiased">
<content>
- <text-block title-class="h1 text-inherit" title="Solutions / Applications" />
+ <text-block title-class="h1 text-inherit" title="Solutions / Applications"/>
@php
// TEMPORARY DATA
@foreach ($solutions as $i => $solution)
@php($i++)
<a class="solutions-link">
- <span class="solutions-link-bg" style="background-image:url({{ asset("storage/uploads/images/solutions-{$i}.jpg") }})"></span>
+ <span class="solutions-link-bg"
+ style="background-image:url({{ asset("storage/uploads/images/solutions-{$i}.jpg") }})"></span>
<span class="solutions-link-text">{{ $solution }}</span>
</a>
@endforeach
{{-- News --}}
<full-width>
<content>
- <text-block title="Actualités" />
+ <text-block title="Actualités"/>
<grid cols="4" class="md:grid-cols-2 xs:grid-cols-1 xs:grid-gap-20v">
@for ($i = 1; $i <= 4; $i++)
<div>
<img class="mb-4" src="{{ asset('storage/uploads/images/news-1.jpg') }}" alt="">
<h4 class="font-display">News 0{{ $i }}</h4>
- <p>PM instrumentation distribue depuis 1986 des Capteurs et Systèmes de haute technicité. Issue de la société Schaevitz,...</p>
+ <p>PM instrumentation distribue depuis 1986 des Capteurs et Systèmes de haute technicité. Issue
+ de la société Schaevitz,...</p>
<p><a href="#">Lire la suite</a></p>
</div>
@endfor
{{-- Our Clients --}}
<full-width class="bg-grey-100">
<content>
- <text-block title="Nos clients" />
+ <text-block title="Nos clients"/>
<grid cols="4" class="sm:grid-cols-2">
@for ($i = 1; $i <= 8; $i++)