瀏覽代碼

[Backend] Actualités : isSent et demande de confirmation avant envoi

master
Guillaume 4 年之前
父節點
當前提交
1caaf64a1e
共有 4 個檔案被更改,包括 29 行新增0 行删除
  1. +4
    -0
      ShopBundle/Controller/Admin/NewsController.php
  2. +17
    -0
      ShopBundle/Model/News.php
  3. +7
    -0
      ShopBundle/Resources/public/js/backend/script/default/init-common.js
  4. +1
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml

+ 4
- 0
ShopBundle/Controller/Admin/NewsController.php 查看文件

@@ -40,6 +40,10 @@ class NewsController extends AdminController

if($countUsers > 0) {
$this->addFlash('success', 'Actualité envoyée à '.count($users).' utilisateurs.');

$news->setIsSent(true) ;
$this->em->persist($news);
$this->em->flush() ;
}
else {
$this->addFlash('error', 'Aucun utilisateur inscrit à la newsletter.');

+ 17
- 0
ShopBundle/Model/News.php 查看文件

@@ -25,6 +25,11 @@ abstract class News extends AbstractDocumentEntity implements FilterMerchantInte
*/
protected $date;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isSent;

public function getDate(): ?\DateTimeInterface
{
return $this->date;
@@ -48,4 +53,16 @@ abstract class News extends AbstractDocumentEntity implements FilterMerchantInte

return $this;
}

public function getIsSent(): ?bool
{
return $this->isSent;
}

public function setIsSent(?bool $isSent): self
{
$this->isSent = $isSent;

return $this;
}
}

+ 7
- 0
ShopBundle/Resources/public/js/backend/script/default/init-common.js 查看文件

@@ -1,8 +1,15 @@
jQuery(document).ready(function () {
custom_switch_merchants();
initAdminLtePlugin();
initButtonConfirm() ;
});

function initButtonConfirm() {
$('.btn-confirm-js').click(function() {
return confirm('Êtes-vous sûr de vouloir réaliser cette action ?') ;
}) ;
}

function initLcNoty() {
$('.lc-noty').each(function () {
generateNotice($(this).data('type'), $(this).html());

+ 1
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml 查看文件

@@ -120,6 +120,7 @@ field:
monsieur: Monsieur
subscribeNewsletter: S'inscrire à la newsletter
send: Envoyer
isSent: Envoyée

Supplier:
user: Utilisateur lié

Loading…
取消
儲存