diff --git a/src/new/src/PSC/Shop/MediaBundle/Document/MediaItem.php b/src/new/src/PSC/Shop/MediaBundle/Document/MediaItem.php
new file mode 100644
index 000000000..f698099de
--- /dev/null
+++ b/src/new/src/PSC/Shop/MediaBundle/Document/MediaItem.php
@@ -0,0 +1,6 @@
+add('name', null, [
+ // added because setDescription() doesn't allow null
+ // it would be simpler to make the arg to that method nullable
+ 'empty_data' => '',
+ ])
+ ->add('description')
+ ;
+ }
+
+ public function configureOptions(OptionsResolver $resolver): void
+ {
+ $resolver->setDefaults(['data_class' => MediaItem::class]);
+ }
+}
diff --git a/src/new/src/PSC/Shop/MediaBundle/Model/MediaItem.php b/src/new/src/PSC/Shop/MediaBundle/Model/MediaItem.php
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/new/src/PSC/Shop/NewsBundle/Entity/News.php b/src/new/src/PSC/Shop/NewsBundle/Entity/News.php
index 74af3a32a..70ac3fb35 100755
--- a/src/new/src/PSC/Shop/NewsBundle/Entity/News.php
+++ b/src/new/src/PSC/Shop/NewsBundle/Entity/News.php
@@ -34,66 +34,68 @@ class News
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $uid;
-/**
- * Titel
- *
- * @var string
- */
+ /**
+ * Titel
+ *
+ * @var string
+ */
#[ORM\Column(name: 'title', type: 'string', length: 255)]
protected $title;
-/**
- * Titel
- *
- * @var string
- */
+ /**
+ * Titel
+ *
+ * @var string
+ */
#[ORM\Column(name: 'url', type: 'string', length: 255)]
protected $url;
-/**
- * Titel
- *
- * @var string
- */
+ /**
+ * Titel
+ *
+ * @var string
+ */
#[ORM\Column(name: 'einleitung', type: 'string', length: 255)]
protected $introduction;
-/**
- * Language
- *
- * @var string
- */
+ /**
+ * Language
+ *
+ * @var string
+ */
#[ORM\Column(name: 'language', type: 'string', length: 5)]
protected $language;
-/**
- * Text
- *
- * @var string
- */
+ /**
+ * Text
+ *
+ * @var string
+ */
#[ORM\Column(name: 'text', type: 'string')]
protected $text;
-/**
- * Shop zu welcher die News gehört
- *
- * @var int
- */
+ /**
+ * Shop zu welcher die News gehört
+ *
+ * @var int
+ */
#[ORM\ManyToOne(targetEntity: 'PSC\Shop\EntityBundle\Entity\Shop')]
#[ORM\JoinColumn(name: 'shop_id', referencedColumnName: 'id')]
protected $shop;
-/**
- * SortDate
- *
- * @var date
- */
+
#[ORM\Column(name: 'sort_date', type: 'date')]
protected $sortDate;
-/**
- * enable
- *
- * @var boolean
- */
+
+ #[ORM\Column(name: 'from_date', type: 'datetime')]
+ protected ?\DateTime $fromDate;
+ #[ORM\Column(name: 'to_date', type: 'datetime')]
+ protected ?\DateTime $toDate;
+
+ /**
+ * enable
+ *
+ * @var boolean
+ */
#[ORM\Column(name: 'active', type: 'boolean')]
protected $enable;
-/**
- * @return int
- */
+ /**
+ * @return int
+ */
public function getUid()
{
return $this->uid;
@@ -237,4 +239,21 @@ class News
{
$this->language = $language;
}
+
+ public function getFromDate(): ?\DateTime
+ {
+ return $this->fromDate;
+ }
+ public function setFromDate(?\DateTime $fromDate): void
+ {
+ $this->fromDate = $fromDate;
+ }
+ public function getToDate(): ?\DateTime
+ {
+ return $this->toDate;
+ }
+ public function setToDate(?\DateTime $toDate): void
+ {
+ $this->toDate = $toDate;
+ }
}
diff --git a/src/new/src/PSC/Shop/NewsBundle/Form/Backend/NewsType.php b/src/new/src/PSC/Shop/NewsBundle/Form/Backend/NewsType.php
index a3bb661dd..cb1760884 100755
--- a/src/new/src/PSC/Shop/NewsBundle/Form/Backend/NewsType.php
+++ b/src/new/src/PSC/Shop/NewsBundle/Form/Backend/NewsType.php
@@ -18,6 +18,7 @@ use PSC\System\PluginBundle\Form\Chain\Field;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
+use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
@@ -42,6 +43,8 @@ class NewsType extends AbstractType
->add('title', TextType::class, ['label' => 'Title', 'required' => false])
->add('enable', CheckboxType::class, ['label' => 'active', 'required' => false])
->add('sortDate', DateType::class, ['label' => 'Sortdate', 'required' => false])
+ ->add('toDate', DateTimeType::class, ['label' => 'toDate', 'required' => false])
+ ->add('fromDate', DateTimeType::class, ['label' => 'fromDate', 'required' => false])
->add('url', TextType::class, ['label' => 'Url', 'required' => false])
->add('introduction', TextareaType::class, ['label' => 'Introduction', 'required' => false])
->add('language', ChoiceType::class, [
@@ -52,6 +55,14 @@ class NewsType extends AbstractType
'Englisch' => 'en_EN'
],
'required' => true])
+ ->add('todoItems', LiveCollectionType::class, [
+ 'entry_type' => MediaItemForm::class,
+ 'entry_options' => ['label' => 'media'],
+ 'label' => false,
+ 'allow_add' => true,
+ 'allow_delete' => true,
+ 'by_reference' => false,
+ ])
->add('text', CKEditor5Type::class, array(
'label' => 'Text',
'required' => false
diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250313154423.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250313154423.php
new file mode 100644
index 000000000..257788215
--- /dev/null
+++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250313154423.php
@@ -0,0 +1,12 @@
+entityManager->getConnection()->exec("ALTER TABLE news ADD from_date datetime NULL DEFAULT null");
+ $this->entityManager->getConnection()->exec("ALTER TABLE news ADD to_date datetime NULL DEFAULT null");
+ }
+}
diff --git a/src/new/templates/tailwind_formtheme.html.twig b/src/new/templates/tailwind_formtheme.html.twig
index c8fc31ce5..1072aa6f2 100644
--- a/src/new/templates/tailwind_formtheme.html.twig
+++ b/src/new/templates/tailwind_formtheme.html.twig
@@ -159,11 +159,16 @@
{%- if widget == 'single_text' -%}
{{ block('form_widget_simple') }}
{%- else -%}
-
+ {%- set attr = attr|merge({'class': attr.class|default('flex')|trim}) -%}
+ {%- set attr_class_error = '' -%}
+ {%- if not valid -%}
+ {%- set attr_class_error = ' ' ~ block('class_input_error') -%}
+ {%- endif -%}
+
{{- date_pattern|replace({
- '{{ year }}': form_widget(form.year),
- '{{ month }}': form_widget(form.month),
- '{{ day }}': form_widget(form.day),
+ '{{ year }}': form_widget(form.year, { attr: { class: (block('class_widget_addon_append') ~ ' ' ~ attr_class_error|trim) }}),
+ '{{ month }}': form_widget(form.month, { attr: { class: (block('class_widget_addon_prepend') ~ ' ' ~ attr_class_error|trim) }}),
+ '{{ day }}': form_widget(form.day, { attr: { class: ('rounded-none' ~ attr_class_error)|trim }}),
})|raw -}}
{%- endif -%}
@@ -173,9 +178,21 @@
{%- if widget == 'single_text' -%}
{{ block('form_widget_simple') }}
{%- else -%}
- {%- set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} -%}
+ {%- set attr = attr|merge({'class': attr.class|default('flex')|trim}) -%}
+ {%- set attr_class_error = '' -%}
+ {%- if not valid -%}
+ {%- set attr_class_error = ' ' ~ block('class_input_error') -%}
+ {%- endif -%}
- {{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %}
+ {{- form_widget(form.hour, { attr: { class: ((with_minutes or with_seconds ? block('class_widget_addon_prepend') : '') ~ attr_class_error)|trim }}) -}}
+ {%- if with_minutes -%}
+ :
+ {{- form_widget(form.minute, { attr: { class: ((with_seconds ? 'rounded-none' : block('class_widget_addon_append')) ~ attr_class_error|trim) }}) -}}
+ {%- endif -%}
+ {%- if with_seconds -%}
+ :
+ {{- form_widget(form.second, { attr: { class: (block('class_widget_addon_append') ~ attr_class_error)|trim }}) -}}
+ {%- endif -%}
{%- endif -%}
{%- endblock time_widget -%}
@@ -466,3 +483,115 @@
{%- endfor -%}
{%- endblock attributes -%}
+
+
+
+{# Class #}
+
+{% block class_label -%}
+ block mb-2 text-sm font-medium text-gray-900 dark:text-white
+{%- endblock class_label %}
+
+{% block class_input_radio_label -%}
+ ml-2 text-sm font-medium text-gray-900 dark:text-gray-300
+{%- endblock class_input_radio_label %}
+
+{% block class_input_switch_label -%}
+ {{ block('class_input_radio_label') }}
+{%- endblock class_input_switch_label %}
+
+{% block class_input_switch_label_container -%}
+ relative inline-flex items-center cursor-pointer
+{%- endblock class_input_switch_label_container %}
+
+{% block class_input_text -%}
+ text-gray-900 bg-gray-50 rounded-lg text-sm block w-full p-2.5 border border-gray-300 focus:z-10 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500
+{%- endblock class_input_text %}
+
+{% block class_input_range -%}
+ w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700
+{%- endblock class_input_range %}
+
+{% block class_input_file -%}
+ block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 dark:text-gray-400 focus:outline-none dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400
+{%- endblock class_input_file %}
+
+{% block class_input_radio -%}
+ w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600
+{%- endblock class_input_radio %}
+
+{% block class_input_checkbox -%}
+ rounded {{ block('class_input_radio') }}
+{%- endblock class_input_checkbox %}
+
+{% block class_input_switch -%}
+ relative w-11 h-6 bg-gray-200 rounded-full peer peer-focus:ring-2 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 dark:bg-gray-700 dark:border-gray-600 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600
+{%- endblock class_input_switch %}
+
+{% block class_select -%}
+ {{ block('class_input_text') }}
+{%- endblock class_select %}
+
+{% block class_textarea -%}
+ {{ block('class_input_text') }}
+{%- endblock class_textarea %}
+
+{% block class_button -%}
+ text-gray-900 bg-white font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 border border-gray-200 hover:text-blue-700 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:bg-gray-800 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700
+{%- endblock class_button %}
+
+{% block class_submit -%}
+ text-white bg-blue-700 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800
+{%- endblock class_submit %}
+
+{% block class_time_separator -%}
+ inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-x-0 border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600
+{%- endblock class_time_separator %}
+
+{% block class_addon -%}
+ inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-gray-300 dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600
+{%- endblock class_addon %}
+
+{% block class_widget_addon_prepend -%}
+ rounded-none rounded-l-lg
+{%- endblock class_widget_addon_prepend %}
+
+{% block class_widget_addon_append -%}
+ rounded-none rounded-r-lg
+{%- endblock class_widget_addon_append %}
+
+{% block class_addon_prepend -%}
+ border-r-0 rounded-l-md
+{%- endblock class_addon_prepend %}
+
+{% block class_addon_append -%}
+ border-l-0 rounded-r-md
+{%- endblock class_addon_append %}
+
+{% block class_help_text -%}
+ mt-2 text-sm text-gray-500 dark:text-gray-400
+{%- endblock class_help_text %}
+
+{% block class_label_error -%}
+ block mb-2 text-sm font-medium text-red-600 dark:text-red-500
+{%- endblock class_label_error %}
+
+{% block class_input_radio_label_error -%}
+ ml-2 text-sm font-medium text-red-600 dark:text-red-500
+{%- endblock class_input_radio_label_error %}
+
+{% block class_input_switch_label_error -%}
+ {{ block('class_input_radio_label_error') }}
+{%- endblock class_input_switch_label_error %}
+
+{% block class_input_error -%}
+ bg-red-50 border-red-500 text-red-900 placeholder-red-700 dark:bg-red-100 dark:border-red-500 dark:text-red-500 dark:placeholder-red-500 focus:z-10 focus:ring-red-500 focus:border-red-500 dark:focus:ring-red-500 dark:focus:border-red-500
+{%- endblock class_input_error %}
+
+{% block class_text_error -%}
+ mt-2 text-sm text-red-600 dark:text-red-500
+{%- endblock class_text_error %}
+
+{% block class_input_disabled -%}
+ disabled:bg-gray-100 disabled:border-gray-300 disabled:cursor-not-allowed dark:disabled:text-gray-400
+{%- endblock class_input_disabled %}
diff --git a/src/new/var/plugins/Custom/PSC/WMD_API/Api/Base.php b/src/new/var/plugins/Custom/PSC/WMD_API/Api/Base.php
index e3b8eb855..5364967b7 100755
--- a/src/new/var/plugins/Custom/PSC/WMD_API/Api/Base.php
+++ b/src/new/var/plugins/Custom/PSC/WMD_API/Api/Base.php
@@ -6,7 +6,6 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
abstract class Base
{
-
protected $tokenUrl = 'https://oauth.cimpress.io/v2/token';
protected $stagingUrl = 'https://staging.orders.api.erfolgreich-drucken.de/v1/';
@@ -29,12 +28,14 @@ abstract class Base
$this->token();
$domain = $this->liveUrl;
- if($this->test) {
+ if ($this->test) {
$domain = $this->stagingUrl;
}
$response = $this->client->request(
- 'GET', $domain . $url, [
+ 'GET',
+ $domain . $url,
+ [
'headers' =>
[...$this->buildHeaders(), ...$this->buildBearerTokenHeader()]
]
@@ -44,11 +45,13 @@ abstract class Base
}
- public function token() : void
+ public function token(): void
{
$response = $this->client->request(
- 'POST', $this->tokenUrl, [
+ 'POST',
+ $this->tokenUrl,
+ [
'headers' =>
$this->buildHeaders()
,
@@ -72,14 +75,14 @@ abstract class Base
public function setShop(\PSC\Shop\EntityBundle\Document\Shop $shop): void
{
- if($shop->getPluginSettingModule('wmd', 'clientId')) {
+ if ($shop->getPluginSettingModule('wmd', 'clientId')) {
$this->clientId = $shop->getPluginSettingModule('wmd', 'clientId');
$this->clientSecret = $shop->getPluginSettingModule('wmd', 'clientSecret');
$this->test = $shop->getPluginSettingModule('wmd', 'useTestSystem');
}
}
- protected function buildQuery(Array $data): string
+ protected function buildQuery(array $data): string
{
return base64_encode(json_encode($data));
}