diff --git a/local/modules/PointRetrait/Config/config.xml b/local/modules/PointRetrait/Config/config.xml index d85852cb..bd969275 100644 --- a/local/modules/PointRetrait/Config/config.xml +++ b/local/modules/PointRetrait/Config/config.xml @@ -5,6 +5,11 @@ xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd"> + + + + + diff --git a/local/modules/PointRetrait/Config/routing.xml b/local/modules/PointRetrait/Config/routing.xml index f50d2344..5909739b 100644 --- a/local/modules/PointRetrait/Config/routing.xml +++ b/local/modules/PointRetrait/Config/routing.xml @@ -15,6 +15,9 @@ PointRetrait\Controller\backOffice\PlaceController::viewPlace + + PointRetrait\Controller\backOffice\PlaceController::editPlace + diff --git a/local/modules/PointRetrait/Config/schema.xml b/local/modules/PointRetrait/Config/schema.xml index 49fc907b..dcebb1fa 100644 --- a/local/modules/PointRetrait/Config/schema.xml +++ b/local/modules/PointRetrait/Config/schema.xml @@ -11,11 +11,11 @@ - - - - - + + + + + diff --git a/local/modules/PointRetrait/Config/thelia.sql b/local/modules/PointRetrait/Config/thelia.sql index a00460f3..c7483862 100644 --- a/local/modules/PointRetrait/Config/thelia.sql +++ b/local/modules/PointRetrait/Config/thelia.sql @@ -18,11 +18,11 @@ CREATE TABLE `pdr_places` `minimum_amount` FLOAT DEFAULT 0 NOT NULL, `latitude` DOUBLE, `longitude` DOUBLE, - `address1` VARCHAR(255) NOT NULL, - `address2` VARCHAR(255), - `address3` VARCHAR(255), + `address1` VARCHAR(100) NOT NULL, + `address2` VARCHAR(100), `zipcode` VARCHAR(10) NOT NULL, - `city` VARCHAR(255) NOT NULL, + `city` VARCHAR(100) NOT NULL, + `access_comment` VARCHAR(400), PRIMARY KEY (`id`) ) ENGINE=InnoDB; diff --git a/local/modules/PointRetrait/Controller/backOffice/ListController.php b/local/modules/PointRetrait/Controller/backOffice/ListController.php new file mode 100644 index 00000000..1472525f --- /dev/null +++ b/local/modules/PointRetrait/Controller/backOffice/ListController.php @@ -0,0 +1,35 @@ +render("places-list"); + } + + + public function toggleActive($id) + { + // Check current user authorization + if (null !== $response = $this->checkAuth(AdminResources::MODULE, LivraisonParSecteurs::getModuleCode(), AccessManager::UPDATE)) + return $response; + + $place = PdrPlacesQuery::create()->findOneById(($id)); + $place->setActive($place->getActive() ? 0 : 1)->save(); + + return $this->render("places-list"); + } +} \ No newline at end of file diff --git a/local/modules/PointRetrait/Controller/backOffice/PlaceController.php b/local/modules/PointRetrait/Controller/backOffice/PlaceController.php new file mode 100644 index 00000000..7fcd35c6 --- /dev/null +++ b/local/modules/PointRetrait/Controller/backOffice/PlaceController.php @@ -0,0 +1,65 @@ +findOneById($this->getRequest()->query->get("place_id")); + + return $this->render("place-edit", array('module_code' => PointRetrait::getModuleCode(), + 'place_id' => $selectedPlace)); + } + + + public function editPlace() + { + // Check current user authorization + if (null !== $response = $this->checkAuth(AdminResources::MODULE, PointRetrait::getModuleCode(), AccessManager::VIEW)) + return $response; + + $con = Propel::getConnection(); + $con->beginTransaction(); + + $error_msg = ""; + $changeForm = $this->createForm("pdr-place-main-update", "form"); + + try { + $form = $this->validateForm($changeForm, "POST"); + + $data = $form->getData(); + $place = PdrPlacesQuery::create()->findOneById($data['place_id']); + if ($place === null) { + $error_msg = "Withdrawal place not found by Id"; + } + else { + $place->fromArray($data, TableMap::TYPE_FIELDNAME); + $place->save(); + $con->commit(); + } + } catch (FormValidationException $ex) { + $error_msg = $this->createStandardFormValidationErrorMessage($ex); + } + + if ($this->getRequest()->get('save_mode') == 'stay') + return $this->render("place-edit"); + + return $this->render("places-list"); + } + +} \ No newline at end of file diff --git a/local/modules/PointRetrait/Form/MainForm.php b/local/modules/PointRetrait/Form/MainForm.php index b2d46307..26f13c44 100644 --- a/local/modules/PointRetrait/Form/MainForm.php +++ b/local/modules/PointRetrait/Form/MainForm.php @@ -21,15 +21,13 @@ class MainForm extends BaseForm { $this->formBuilder ->add( - "place_id", - "integer", + "place_id","integer", [ "required" => true, "constraints" => [new Constraints\NotBlank()] ]) ->add( - "title", - "text", + "title","text", [ "required" => true, "constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()], @@ -37,8 +35,7 @@ class MainForm extends BaseForm "label_attr" => ['for' => 'title'] ]) ->add( - "price", - "number", + "price","number", [ "required" => true, "constraints" => [new GreaterThanOrEqual(["value" => 0])], @@ -46,8 +43,7 @@ class MainForm extends BaseForm "label_attr" => ['for' => 'price'] ]) ->add( - "minimum_amount", - "number", + "minimum_amount","number", [ "required" => true, "constraints" => [new GreaterThanOrEqual(["value" => 0])], @@ -65,13 +61,50 @@ class MainForm extends BaseForm "required" => false ]) ->add( - "active", - "number", + "active","number", [ "required" => true, "constraints" => [new Constraints\NotBlank()], "label" => $this->translator->trans('Active', [], PointRetrait::DOMAIN_NAME), "label_attr" => ['for' => 'active'] + ]) + ->add( + "address1","text", + [ + "required" => true, + "constraints" => [new Constraints\NotBlank()], + "label" => $this->translator->trans('Address1', [], PointRetrait::DOMAIN_NAME), + "label_attr" => ['for' => 'address1'] + ]) + ->add( + "address2","text", + [ + "required" => false, + "label" => $this->translator->trans('Address2', [], PointRetrait::DOMAIN_NAME), + "label_attr" => ['for' => 'address2'] + ]) + ->add( + "zipcode","text", + [ + "required" => true, + "constraints" => [new Constraints\NotBlank()], + "label" => $this->translator->trans('Zipcode', [], PointRetrait::DOMAIN_NAME), + "label_attr" => ['for' => 'zipcode'] + ]) + ->add( + "city","text", + [ + "required" => true, + "constraints" => [new Constraints\NotBlank()], + "label" => $this->translator->trans('City', [], PointRetrait::DOMAIN_NAME), + "label_attr" => ['for' => 'city'] + ]) + ->add( + "access_comment","textarea", + [ + "required" => false, + "label" => $this->translator->trans('Access comment', [], PointRetrait::DOMAIN_NAME), + "label_attr" => ['for' => 'access_comment'] ] ); } diff --git a/local/modules/PointRetrait/Hook/CssHook.php b/local/modules/PointRetrait/Hook/CssHook.php new file mode 100644 index 00000000..69e06668 --- /dev/null +++ b/local/modules/PointRetrait/Hook/CssHook.php @@ -0,0 +1,17 @@ +add($this->addCSS('assets/css/styles.css')); + } +} diff --git a/local/modules/PointRetrait/I18n/fr_FR.php b/local/modules/PointRetrait/I18n/fr_FR.php index 50ffe383..111f7a6c 100644 --- a/local/modules/PointRetrait/I18n/fr_FR.php +++ b/local/modules/PointRetrait/I18n/fr_FR.php @@ -1,6 +1,11 @@ 'Commentaire d\'accès', 'Active' => 'Actif', + 'Address' => 'Adresse', + 'Address1' => 'Adresse', + 'Address2' => 'Complément d\'adresse', + 'City' => 'Commune', 'Delivery delay' => 'Délai avant retrait', 'Edit a place' => 'Modifier un lieu de retrait', 'Location set' => 'Coordonnées GPS présentes ?', @@ -10,7 +15,8 @@ return array( 'My places' => 'Point de retrait AuxBieauxLegumes', 'My withdrawal places' => 'Mes points de retrait AuxBieauxLegumes', 'Order number' => 'N° de commande', - 'Place' => 'Lieu de retrait', + 'Place' => 'Point de retrait', + 'Revert origin position' => 'Revenir à la position d\'origine', 'Schedule' => 'Horaires de retrait', 'Scheduled date' => 'Date de retrait prévue', 'Scheduled withdrawals' => 'Commandes à retirer en Point Retrait', @@ -18,6 +24,7 @@ return array( 'There is no order to withdraw' => 'Aucune commande à retirer en Point Retrait', 'Withdrawal days' => 'Jours de retrait', 'Withdrawal price' => 'Coût du retrait', + 'Zipcode' => 'Code postal', 'Monday' => 'Lundi', 'Tuesday' => 'Mardi', 'Wednesday' => 'Mercredi', diff --git a/local/modules/PointRetrait/Loop/GeneralLoop.php b/local/modules/PointRetrait/Loop/GeneralLoop.php index a1606010..0c976288 100644 --- a/local/modules/PointRetrait/Loop/GeneralLoop.php +++ b/local/modules/PointRetrait/Loop/GeneralLoop.php @@ -51,6 +51,11 @@ class GeneralLoop extends BaseLoop implements PropelSearchLoopInterface ->set("DELIVERY_DAYS", $deliveryDays) ->set("LATITUDE", $places->getLatitude()) ->set("LONGITUDE", $places->getLongitude()) + ->set("ADDRESS1", $places->getAddress1()) + ->set("ADDRESS2", $places->getAddress2()) + ->set("ZIPCODE", $places->getZipcode()) + ->set("CITY", $places->getCity()) + ->set("ACCESS_COMMENT", $places->getAccessComment()) ; $loopResult->addRow($loopResultRow); } diff --git a/local/modules/PointRetrait/templates/backOffice/default/assets/css/styles.css b/local/modules/PointRetrait/templates/backOffice/default/assets/css/styles.css new file mode 100644 index 00000000..51b10a72 --- /dev/null +++ b/local/modules/PointRetrait/templates/backOffice/default/assets/css/styles.css @@ -0,0 +1,45 @@ +.etroit { + width: 80px !important; +} + +.large { + width: 250px !important; +} + +.custom-map-control-button { + appearance: button; + background-color: #fff; + border: 0; + border-radius: 2px; + box-shadow: 0 1px 4px -1px rgba(0, 0, 0, 0.3); + cursor: pointer; + margin: 10px; + padding: 0 0.5em; + height: 40px; + font: 400 18px Roboto, Arial, sans-serif; + overflow: hidden; +} +.custom-map-control-button:hover { + background: #ebebeb; +} + +.locationMap { + height:600px; + width:100%; + margin-top: 20px; +} + +.city-remove { + height: 30px !important; +} + +.pin { + height: 25px; + margin-left: 12px; +} + +.legende { + margin-top: 25px; + text-align: center; + font-style: italic; +} \ No newline at end of file diff --git a/local/modules/PointRetrait/templates/backOffice/default/assets/img/logo-reserve.png b/local/modules/PointRetrait/templates/backOffice/default/assets/img/logo-reserve.png new file mode 100644 index 00000000..4c3a5ae9 Binary files /dev/null and b/local/modules/PointRetrait/templates/backOffice/default/assets/img/logo-reserve.png differ diff --git a/local/modules/PointRetrait/templates/backOffice/default/includes/main.html b/local/modules/PointRetrait/templates/backOffice/default/includes/main.html index ffe3e97c..f33ab611 100644 --- a/local/modules/PointRetrait/templates/backOffice/default/includes/main.html +++ b/local/modules/PointRetrait/templates/backOffice/default/includes/main.html @@ -1,47 +1,3 @@ - - {form name='pdr-place-main-update'}
@@ -66,85 +22,171 @@ {/form_field} -
- -
-
- {form_field form=$form field="title"} -
- -   -
- {form_error form=$form field="title"}{$message}{/form_error} - {/form_field} +
+
+ {form_field form=$form field="title"} +
+ +  
- -
- {form_field form=$form field="active"} -
- - -
- -
- -
- {/form_field} -
- -
- {form_field form=$form field="price"} -
- - -  € -
- {form_error form=$form field="price"}{$message}{/form_error} - {/form_field} -
- -
- {form_field form=$form field="minimum_amount"} -
- - -  € -
- {form_error form=$form field="minimum_amount"}{$message}{/form_error} - {/form_field} -
- -
- {form_field form=$form field="latitude"} - - {/form_field} - {form_field form=$form field="longitude"} - - {/form_field} -
- + {form_error form=$form field="title"}{$message}{/form_error} + {/form_field}
-
-
- -
+
+ {form_field form=$form field="active"} +
+ + +
+ +
+
+ {/form_field}
+
+ {form_field form=$form field="price"} +
+ + +  € +
+ {form_error form=$form field="price"}{$message}{/form_error} + {/form_field} +
+ +
+ {form_field form=$form field="minimum_amount"} +
+ + +  € +
+ {form_error form=$form field="minimum_amount"}{$message}{/form_error} + {/form_field} +
+ +
+ {form_field form=$form field="latitude"} + + {/form_field} + {form_field form=$form field="longitude"} + + {/form_field} +
+ + +
+ +
+
+ {form_field form=$form field="address1"} +
+ + +
+ +
+
+ {form_error form=$form field="address1"}{$message}{/form_error} + {/form_field} +
+
+ +
+
+ {form_field form=$form field="address2"} +
+ + +
+ +
+
+ {form_error form=$form field="address2"}{$message}{/form_error} + {/form_field} +
+
+ +
+
+ {form_field form=$form field="zipcode"} +
+ + +
+ +
+
+ {form_error form=$form field="zipcode"}{$message}{/form_error} + {/form_field} +
+
+ {form_field form=$form field="city"} +
+ + +
+ +
+
+ {form_error form=$form field="city"}{$message}{/form_error} + {/form_field} +
+
+ +
+
+ {form_field form=$form field="access_comment"} +
+ + +
+ +
+
+ {form_error form=$form field="access_comment"}{$message}{/form_error} + {/form_field} +
+
+ +
+
+ +
+
+
+ {/loop}
diff --git a/local/modules/PointRetrait/templates/backOffice/default/js/main-js.html b/local/modules/PointRetrait/templates/backOffice/default/js/main-js.html index d260a2e9..7e6157d1 100644 --- a/local/modules/PointRetrait/templates/backOffice/default/js/main-js.html +++ b/local/modules/PointRetrait/templates/backOffice/default/js/main-js.html @@ -1,6 +1,7 @@ \ No newline at end of file diff --git a/local/modules/PointRetrait/templates/backOffice/default/places-list.html b/local/modules/PointRetrait/templates/backOffice/default/places-list.html index 83ac09f3..00ae4307 100644 --- a/local/modules/PointRetrait/templates/backOffice/default/places-list.html +++ b/local/modules/PointRetrait/templates/backOffice/default/places-list.html @@ -30,10 +30,10 @@ mais{extends file="admin-layout.tpl"} {intl l="Place" d='pointretrait'} {intl l="Active" d='pointretrait'} + {intl l="Address" d='pointretrait'} + {intl l="Withdrawal days" d='pointretrait'} {intl l="Withdrawal price" d='pointretrait'} {intl l="Minimum amount" d='pointretrait'} - {intl l="Withdrawal days" d='pointretrait'} - {intl l="Location set" d='pointretrait'}   @@ -49,10 +49,10 @@ mais{extends file="admin-layout.tpl"}
+ {$ADDRESS1}
{$ZIPCODE} {$CITY} + {$DELIVERY_DAYS}{if $DELIVERY_DAYS eq ''}{intl l="There is no schedule for this place" d='pointretrait'}{/if} {$PRICE} € {$MINIMUM_AMOUNT} € - {$DELIVERY_DAYS}{if $DELIVERY_DAYS eq ''}{intl l="There is no schedule for this place" d='pointretrait'}{/if} - {if $LATITUDE != ''}Oui{else}Non{/if}