diff --git a/public/assets/css/css.css b/public/assets/css/css.css index f82c487..4d6aec2 100644 --- a/public/assets/css/css.css +++ b/public/assets/css/css.css @@ -118,4 +118,11 @@ h1, h2, h3, h4, h5 { padding: 5px; border-radius:20%; cursor:pointer; +} + +.jumbotron label { + color: #0d6efd; + font-family: Pattaya, sans-serif; + margin-top: 8px; + font-size: 18px; } \ No newline at end of file diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 03917a1..58736ee 100755 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -3,6 +3,7 @@ namespace App\Controller; use App\Entity\HalfDayAdjustment; +use App\Form\EditCustomerType; use App\Form\HalfDayAdjustmentType; use App\Repository\HalfDayAdjustmentRepository; use App\Repository\CheckInRepository; @@ -140,36 +141,20 @@ public function activate($id) */ public function profile($id, Request $request) { - $customer = $this->customerRepository->findOneBy( - [ - 'id' => $id - ] - ); - - $subscription = $this->subscriptionRepository->findOneBy( - [ - 'customer' => $id - ] - ); - - $promo = $this->promoRepository->findOneBy( - [ - 'customer' => $id - ] - ); + $customer = $this->customerRepository->findOneBy(['id' => $id]); + $subscription = $this->subscriptionRepository->findOneBy(['customer' => $id]); + $promo = $this->promoRepository->findOneBy(['customer' => $id]); $counter = $this->createForm(PromoType::class, $promo); $counter->handleRequest($request); - if ($counter->isSubmitted() && $counter->isValid()) { $this->manager->persist($promo); $this->manager->flush(); }; - $status = $this->createForm(CustomerSettingStatusType::class, $customer); - $status->handleRequest($request); - - if ($status->isSubmitted() && $status->isValid()) { + $customerForm = $this->createForm(EditCustomerType::class, $customer); + $customerForm->handleRequest($request); + if ($counter->isSubmitted() && $counter->isValid()) { $this->manager->persist($customer); $this->manager->flush(); } @@ -178,9 +163,9 @@ public function profile($id, Request $request) 'admin/profile.html.twig', [ 'customer' => $customer, + 'customerForm' => $customerForm->createView(), 'subscription' => $subscription, 'formPromo' => $counter->createView(), - 'formStatus' => $status->createView() ] ); } diff --git a/src/Form/EditCustomerType.php b/src/Form/EditCustomerType.php new file mode 100644 index 0000000..4fc8f83 --- /dev/null +++ b/src/Form/EditCustomerType.php @@ -0,0 +1,58 @@ +add('lastname', TextType::class, [ + 'label' => 'Nom' + ]) + ->add('firstname', TextType::class, [ + 'label' => 'Prénom' + ]) + ->add('society', TextType::class, [ + 'label' => 'Société (facultatif)', + 'required' => false + ]) + ->add('country', TextType::class, [ + 'label' => 'Pays' + ]) + ->add('address', TextType::class, [ + 'label' => 'Adresse' + ]) + ->add('city', TextType::class, [ + 'label' => 'Ville' + ]) + ->add('zip', TextType::class, [ + 'label' => 'Code postal' + ]) + ->add('phone', TextType::class, [ + 'label' => 'Téléphone' + ]) + ->add('mail', EmailType::class, [ + 'label' => 'E-mail' + ]) + ->add('status', TextType::class, [ + 'label' => 'Statut' + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => Customer::class, + ]); + } +} diff --git a/templates/admin/profile.html.twig b/templates/admin/profile.html.twig index 80ab2b1..49fe795 100644 --- a/templates/admin/profile.html.twig +++ b/templates/admin/profile.html.twig @@ -10,36 +10,25 @@
{{ customer.lastname }}
-{{ customer.firstname }}
-{{ customer.phone }}
-{{ customer.mail }}
- {% if customer.society != '' %} -{{ customer.society }}
- {% endif %} + {{ form_start(customerForm) }} +{{ customer.country }}
-{{ customer.address }}
-{{ customer.zip }}
-{{ customer.city }}
-- {{ customer.getStatus }} -
-