Compare commits
2 Commits
ad0ef20fc2
...
feature/gi
| Author | SHA1 | Date | |
|---|---|---|---|
| 484a288da1 | |||
| 7e1560c11f |
@@ -1,5 +1,7 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
jobs:
|
jobs:
|
||||||
deploy-job:
|
deploy-job:
|
||||||
|
|||||||
@@ -118,66 +118,6 @@ class Migrate extends Command
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'Netherlands')->exists()) {
|
|
||||||
Capsule::table('countries')->insert([
|
|
||||||
'countryName' => 'Netherlands',
|
|
||||||
'productsUrl' => 'https://nl.ryobitools.eu/api/product-listing/get-products',
|
|
||||||
'cultureCode' => 'nl-NL',
|
|
||||||
'currency' => 'EUR',
|
|
||||||
'locale' => 'nl',
|
|
||||||
'created_at' => now(),
|
|
||||||
'updated_at' => now(),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'France')->exists()) {
|
|
||||||
Capsule::table('countries')->insert([
|
|
||||||
'countryName' => 'France',
|
|
||||||
'productsUrl' => 'https://fr.ryobitools.eu/api/product-listing/get-products',
|
|
||||||
'cultureCode' => 'fr-FR',
|
|
||||||
'currency' => 'EUR',
|
|
||||||
'locale' => 'fr',
|
|
||||||
'created_at' => now(),
|
|
||||||
'updated_at' => now(),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'Spain')->exists()) {
|
|
||||||
Capsule::table('countries')->insert([
|
|
||||||
'countryName' => 'Spain',
|
|
||||||
'productsUrl' => 'https://es.ryobitools.eu/api/product-listing/get-products',
|
|
||||||
'cultureCode' => 'es-ES',
|
|
||||||
'currency' => 'EUR',
|
|
||||||
'locale' => 'es',
|
|
||||||
'created_at' => now(),
|
|
||||||
'updated_at' => now(),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'Poland')->exists()) {
|
|
||||||
$id = Capsule::table('countries')->insertGetId(
|
|
||||||
[
|
|
||||||
'countryName' => 'Poland',
|
|
||||||
'productsUrl' => 'https://pl.ryobitools.eu/api/product-listing/get-products',
|
|
||||||
'cultureCode' => 'pl-PL',
|
|
||||||
'currency' => 'PLN',
|
|
||||||
'locale' => 'pl',
|
|
||||||
'created_at' => now(),
|
|
||||||
'updated_at' => now(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'UK')->exists()) {
|
|
||||||
Capsule::table('countries')->insert([
|
|
||||||
'countryName' => 'UK',
|
|
||||||
'productsUrl' => 'https://uk.ryobitools.eu/api/product-listing/get-products',
|
|
||||||
'cultureCode' => 'en-GB',
|
|
||||||
'currency' => 'GBP',
|
|
||||||
'locale' => 'uk',
|
|
||||||
'created_at' => now(),
|
|
||||||
'updated_at' => now(),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Capsule::schema()->hasColumn('products', 'country_id')) {
|
if (!Capsule::schema()->hasColumn('products', 'country_id')) {
|
||||||
Capsule::schema()->table('products', function (Blueprint $table) use ($id) {
|
Capsule::schema()->table('products', function (Blueprint $table) use ($id) {
|
||||||
|
|||||||
@@ -20,11 +20,8 @@ final class PromosController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
$promos = Product::select($this->database->getConnection()->raw("distinct json_extract(promotions, '$.slug') as slug, json_extract(promotions, '$.tag') as tag"))
|
$promos = Product::select($this->database->getConnection()->raw("distinct json_extract(promotions, '$.slug') as slug, json_extract(promotions, '$.tag') as tag"))
|
||||||
->addSelect('countries.locale')
|
|
||||||
->whereRaw("json_extract(promotions, '$.tag') is not null")
|
->whereRaw("json_extract(promotions, '$.tag') is not null")
|
||||||
->join('countries', 'products.country_id', '=', 'countries.id')
|
->get();
|
||||||
->get()
|
|
||||||
->groupBy('locale');
|
|
||||||
|
|
||||||
return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'promos' . $promo, 'promos' => $promos->toArray()]);
|
return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'promos' . $promo, 'promos' => $promos->toArray()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,9 @@ use Krzysiej\RyobiCrawler\Twig\AppExtension;
|
|||||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||||
use Symfony\Bundle\TwigBundle\TwigBundle;
|
use Symfony\Bundle\TwigBundle\TwigBundle;
|
||||||
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
|
||||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
|
||||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||||
use Twig\Extra\Cache\CacheExtension;
|
|
||||||
use Twig\Extra\Cache\CacheRuntime;
|
|
||||||
use Twig\Extra\TwigExtraBundle\TwigExtraBundle;
|
use Twig\Extra\TwigExtraBundle\TwigExtraBundle;
|
||||||
|
|
||||||
class Kernel extends BaseKernel
|
class Kernel extends BaseKernel
|
||||||
|
|||||||
@@ -6,17 +6,9 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if listType starts with 'promos' %}
|
{% if listType starts with 'promos' %}
|
||||||
<ul class="list-group list-group-flush">
|
{% for promo in promos %}
|
||||||
{% for locale, promoByLocale in promos %}
|
<a href="{{ path('app_promos', {'promo': promo.slug}) }}"><span class="badge bg-info">PROMO: {{ promo.tag }}</span></a>
|
||||||
<li class="list-group-item">
|
{% endfor %}
|
||||||
<h5 class="d-inline-block"><span class="badge bg-info">{{ locale | upper }}</span></h5>
|
|
||||||
{% for promo in promoByLocale %}
|
|
||||||
<a href="{{ path('app_promos', {'promo': promo.slug}) }}"><span
|
|
||||||
class="badge bg-info">PROMO: {{ promo.tag }} [{{ promo.locale | upper }}]</span></a>
|
|
||||||
{% endfor %}
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
@@ -46,24 +38,22 @@
|
|||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
<a href='{{ path('app_product', {'productId': product.id}) }}'
|
<a href='{{ path('app_product', {'productId': product.id}) }}'
|
||||||
class="text-decoration-none">{{ product.name }}</a>
|
class="text-decoration-none">{{ product.name }}</a>
|
||||||
<br>
|
|
||||||
{% if product.stock > 0 %}
|
{% if product.stock > 0 %}
|
||||||
<span class="badge text-bg-light">stock: {{ product.stock }}</span>
|
<span class="badge text-bg-light">stock: {{ product.stock }}</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="badge text-bg-warning">out of stock</span>
|
<span class="badge text-bg-warning">out of stock</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if product.isDiscontinued() %}
|
{% if product.isDiscontinued() %}
|
||||||
<a href="{{ path('app_discontinued') }}"><span class="badge text-bg-secondary" data-bs-toggle="tooltip"
|
<span class="badge text-bg-secondary" data-bs-toggle="tooltip"
|
||||||
data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span></a>
|
data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if product.isNew() %}
|
{% if product.isNew() %}
|
||||||
<a href="{{ path('app_new') }}"><span class="badge text-bg-success">is new</span></a>
|
<span class="badge text-bg-success">is new</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="badge text-bg-light"><a
|
<span class="badge text-bg-light"><a
|
||||||
href="{{ path('app_search', {'search': product.subTitle}) }}"
|
href="{{ path('app_search', {'search': product.subTitle}) }}"
|
||||||
class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span>
|
class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span>
|
||||||
{% if product.promotions is not null and product.promotions.hasPromotion %}<a href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span></a>{% endif %}
|
{% if product.promotions is not null and product.promotions.hasPromotion %}<a href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span></a>{% endif %}
|
||||||
<span class="badge text-bg-light">{{ product.country.countryName }}</span>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">
|
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">
|
||||||
|
|||||||
Reference in New Issue
Block a user