diff --git a/local/modules/LivraisonParSecteurs/Config/insert.sql b/local/modules/LivraisonParSecteurs/Config/insert.sql index 92173faf..13a635a6 100644 --- a/local/modules/LivraisonParSecteurs/Config/insert.sql +++ b/local/modules/LivraisonParSecteurs/Config/insert.sql @@ -6,33 +6,47 @@ INSERT INTO `lps_area`(`id`,`title`) VALUES -INSERT INTO `lps_area_city`(`id_area`,`zipcode`) VALUES -(1,'62120'), -(1,'62129'), -(1,'62219'), -(1,'62500'), -(1,'62510'), -(1,'62570'), -(1,'62575'), -(1,'62910'); +INSERT INTO `lps_area_city`(`id_area`,`zipcode`,`title`,`latitude`,`longitude`) VALUES +(1,'62120','CAMPAGNE LES WARDRECQUES','50.7136140049','2.33349766884'), +(1,'62120','AIRE SUR LA LYS','50.6441641115','2.39533267946'), +(1,'62120','WITTES','50.6716650445','2.38817871374'), +(1,'62129','ECQUES','50.6751011115','2.28909761313'), +(1,'62219','LONGUENESSE','50.7356717764','2.24445927669'), +(1,'62500','CLAIRMARAIS','50.7691557578','2.34273928671'), +(1,'62500','ST MARTIN LEZ TATINGHEM','50.7568801196','2.2297072767'), +(1,'62500','ST OMER','50.7679781717','2.26334881482'), +(1,'62500','SALPERWICK','50.768362521','2.21963774504'), +(1,'62500','TILQUES','50.7728122391','2.20152463188'), +(1,'62510','ARQUES','50.7402216255','2.31902794783'), +(1,'62570','HALLINES','50.7007255503','2.20827364581'), +(1,'62570','HELFAUT','50.6917027903','2.25015585426'), +(1,'62570','WIZERNES','50.7153325042','2.22913159655'), +(1,'62575','BLENDECQUES','50.7159944346','2.27536301448'), +(1,'62575','HEURINGHEM','50.6957474078','2.29391988057'), +(1,'62910','BAYENGHEM LES SENINGHEM','50.7048864835','2.07577387326'), +(1,'62910','EPERLECQUES','50.8183914819','2.16069366951'), +(1,'62910','HOULLE','50.7969936327','2.16484725691'), +(1,'62910','MORINGHEM','50.7633897725','2.12682414351'), +(1,'62910','MOULLE','50.7883148321','2.1706543981'), +(1,'62910','SERQUES','50.7907495973','2.20166097242'); -INSERT INTO `lps_area_city`(`id_area`,`zipcode`) VALUES -(2,'62010'), -(2,'62024'), -(2,'62088'), -(2,'62229'), -(2,'62292'), -(2,'62309'), -(2,'62504'), -(2,'62534'), -(2,'62613'), -(2,'62656'), -(2,'62674'), -(2,'62702'), -(2,'62788'), -(2,'62794'), -(2,'62803'), -(2,'62882'), -(2,'62897'), -(2,'62898'), -(2,'62905'); +INSERT INTO `lps_area_city`(`id_area`,`zipcode`,`title`,`latitude`,`longitude`) VALUES +(2,'62010','AFFRINGUES','50.6903350571','2.07492436119'), +(2,'62024','ALQUINES','50.7335685811','1.99279258078'), +(2,'62088','BAYENGHEM LES SENINGHEM','50.7048864835','2.07577387326'), +(2,'62229','CLETY','50.6533415783','2.18209813078'), +(2,'62292','ELNES','50.6860806657','2.11534643648'), +(2,'62309','ESQUERDES','50.7009057679','2.17889940044'), +(2,'62504','LEULINGHEM','50.7346790388','2.16911709043'), +(2,'62534','LUMBRES','50.705094418','2.11706482499'), +(2,'62613','NIELLES LES BLEQUIN','50.675332061','2.03042491518'), +(2,'62656','PIHEM','50.6761891157','2.21194474254'), +(2,'62674','QUELMES','50.7344041405','2.12647655403'), +(2,'62702','REMILLY WIRQUIN','50.6699885591','2.17457011207'), +(2,'62788','SENINGHEM','50.6984836133','2.02702639439'), +(2,'62794','SETQUES','50.7145017028','2.15645765074'), +(2,'62803','SURQUES','50.7434489941','1.92294829855'), +(2,'62882','WAVRANS SUR L AA','50.6749530079','2.13817752788'), +(2,'62897','WISMES','50.6613559583','2.07972084711'), +(2,'62898','WISQUES','50.7269504581','2.1911996601'), +(2,'62905','ZUDAUSQUES','50.7526605163','2.16024730203'); diff --git a/local/modules/LivraisonParSecteurs/Config/schema.xml b/local/modules/LivraisonParSecteurs/Config/schema.xml index e6ae0b13..a5757c5a 100644 --- a/local/modules/LivraisonParSecteurs/Config/schema.xml +++ b/local/modules/LivraisonParSecteurs/Config/schema.xml @@ -17,6 +17,9 @@ + + + diff --git a/local/modules/LivraisonParSecteurs/Config/sqldb.map b/local/modules/LivraisonParSecteurs/Config/sqldb.map deleted file mode 100644 index 63a93baa..00000000 --- a/local/modules/LivraisonParSecteurs/Config/sqldb.map +++ /dev/null @@ -1,2 +0,0 @@ -# Sqlfile -> Database map -thelia.sql=thelia diff --git a/local/modules/LivraisonParSecteurs/Config/thelia.sql b/local/modules/LivraisonParSecteurs/Config/thelia.sql deleted file mode 100644 index 0405e3e5..00000000 --- a/local/modules/LivraisonParSecteurs/Config/thelia.sql +++ /dev/null @@ -1,68 +0,0 @@ - -# This is a fix for InnoDB in MySQL >= 4.1.x -# It "suspends judgement" for fkey relationships until are tables are set. -SET FOREIGN_KEY_CHECKS = 0; - --- --------------------------------------------------------------------- --- lps_area --- --------------------------------------------------------------------- - -DROP TABLE IF EXISTS `lps_area`; - -CREATE TABLE `lps_area` -( - `id` INTEGER NOT NULL, - `title` VARCHAR(50) NOT NULL, - `active` TINYINT DEFAULT 1 NOT NULL, - `price` FLOAT DEFAULT 0 NOT NULL, - `created_at` DATETIME, - `updated_at` DATETIME, - PRIMARY KEY (`id`) -) ENGINE=InnoDB; - --- --------------------------------------------------------------------- --- lps_area_city --- --------------------------------------------------------------------- - -DROP TABLE IF EXISTS `lps_area_city`; - -CREATE TABLE `lps_area_city` -( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `id_area` INTEGER NOT NULL, - `zipcode` VARCHAR(10) NOT NULL, - `created_at` DATETIME, - `updated_at` DATETIME, - PRIMARY KEY (`id`), - INDEX `fi_area_area_city` (`id_area`), - CONSTRAINT `fk_area_area_city` - FOREIGN KEY (`id_area`) - REFERENCES `lps_area` (`id`) - ON DELETE CASCADE -) ENGINE=InnoDB; - --- --------------------------------------------------------------------- --- lps_area_schedule --- --------------------------------------------------------------------- - -DROP TABLE IF EXISTS `lps_area_schedule`; - -CREATE TABLE `lps_area_schedule` -( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `id_area` INTEGER NOT NULL, - `day` INTEGER NOT NULL, - `begin_time` TIME NOT NULL, - `end_time` TIME NOT NULL, - `created_at` DATETIME, - `updated_at` DATETIME, - PRIMARY KEY (`id`), - INDEX `fi_area_area_schedule` (`id_area`), - CONSTRAINT `fk_area_area_schedule` - FOREIGN KEY (`id_area`) - REFERENCES `lps_area` (`id`) - ON DELETE CASCADE -) ENGINE=InnoDB; - -# This restores the fkey checks, after having unset them earlier -SET FOREIGN_KEY_CHECKS = 1; diff --git a/local/modules/LivraisonParSecteurs/I18n/fr_FR.php b/local/modules/LivraisonParSecteurs/I18n/fr_FR.php index b053cbeb..fcc05b82 100644 --- a/local/modules/LivraisonParSecteurs/I18n/fr_FR.php +++ b/local/modules/LivraisonParSecteurs/I18n/fr_FR.php @@ -5,8 +5,10 @@ return array( 'Add a new delivery day' => 'Ajouter un jour de livraison', 'Area name' => 'Nom du secteur', 'Cities' => 'Communes desservies', + 'City' => 'Commune', 'Create a delivery day' => 'Créer un nouveau jour de livraison', 'Delete an entry of schedule' => 'Supprimer un jour de livraison', + 'Delivered cities count' => 'Nb de communes desservies', 'Delivery beginning time' => 'Début de la tournée', 'Delivery day' => 'Jour de livraison', 'Delivery days' => 'Jours de livraison', @@ -22,6 +24,7 @@ return array( 'Schedule' => 'Horaires de livraison', 'There is no schedule for this area' => 'Aucune livraison actuellement sur ce secteur', 'Title of config view' => 'Module LivraisonParSecteurs - Configuration', + 'Zipcode' => 'Code postal', 'Monday' => 'Lundi', 'Tuesday' => 'Mardi', 'Wednesday' => 'Mercredi', diff --git a/local/modules/LivraisonParSecteurs/Loop/AreaCitiesLoop.php b/local/modules/LivraisonParSecteurs/Loop/AreaCitiesLoop.php index 0f7d3b78..c625faec 100644 --- a/local/modules/LivraisonParSecteurs/Loop/AreaCitiesLoop.php +++ b/local/modules/LivraisonParSecteurs/Loop/AreaCitiesLoop.php @@ -33,6 +33,9 @@ class AreaCitiesLoop extends BaseLoop implements PropelSearchLoopInterface $loopResultRow ->set("ID", $lps_area_cities->getId()) ->set("ZIPCODE", $lps_area_cities->getZipcode()) + ->set("TITLE", $lps_area_cities->getTitle()) + ->set("LATITUDE", $lps_area_cities->getLatitude()) + ->set("LONGITUDE", $lps_area_cities->getLongitude()) ; $loopResult->addRow($loopResultRow); } diff --git a/local/modules/LivraisonParSecteurs/Loop/AreaLoop.php b/local/modules/LivraisonParSecteurs/Loop/AreaLoop.php index 32cb562f..7373fc47 100644 --- a/local/modules/LivraisonParSecteurs/Loop/AreaLoop.php +++ b/local/modules/LivraisonParSecteurs/Loop/AreaLoop.php @@ -3,6 +3,7 @@ namespace LivraisonParSecteurs\Loop; use LivraisonParSecteurs\LivraisonParSecteurs; +use LivraisonParSecteurs\Model\LpsAreaCityQuery; use LivraisonParSecteurs\Model\LpsAreaScheduleQuery; use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; @@ -40,12 +41,15 @@ class AreaLoop extends BaseLoop implements PropelSearchLoopInterface } $deliveryDays = substr($deliveryDays, 0, strlen($deliveryDays)-2); + $citiesCount = LpsAreaCityQuery::create()->findByIdArea($lps_area->getId())->count(); + $loopResultRow ->set("ID", $lps_area->getId()) ->set("TITLE", $lps_area->getTitle()) ->set("ACTIVE", $lps_area->getActive()) ->set("PRICE", $lps_area->getPrice()) ->set("DELIVERY_DAYS", $deliveryDays) + ->set("COVERED_CITIES_NUMBER", $citiesCount) ; $loopResult->addRow($loopResultRow); } diff --git a/local/modules/LivraisonParSecteurs/Model/LpsArea.php b/local/modules/LivraisonParSecteurs/Model/LpsArea.php deleted file mode 100644 index 85a202f5..00000000 --- a/local/modules/LivraisonParSecteurs/Model/LpsArea.php +++ /dev/null @@ -1,20 +0,0 @@ - {/javascripts} {include file="js/area-schedule-js.html"} + {include file="js/area-cities-js.html"} {/block} diff --git a/local/modules/LivraisonParSecteurs/templates/backOffice/default/deliveryarea-list.html b/local/modules/LivraisonParSecteurs/templates/backOffice/default/deliveryarea-list.html index aacf38b2..5e1514fd 100644 --- a/local/modules/LivraisonParSecteurs/templates/backOffice/default/deliveryarea-list.html +++ b/local/modules/LivraisonParSecteurs/templates/backOffice/default/deliveryarea-list.html @@ -29,10 +29,11 @@ {intl l="Area name" d='livraisonparsecteurs'} - {intl l="Active" d='livraisonparsecteurs'} + {intl l="Active" d='livraisonparsecteurs'} {intl l="Delivery price" d='livraisonparsecteurs'} {intl l="Delivery days" d='livraisonparsecteurs'} - + {intl l="Delivered cities count" d='livraisonparsecteurs'} +   @@ -49,6 +50,7 @@ {$PRICE} € {$DELIVERY_DAYS} + {$COVERED_CITIES_NUMBER}
diff --git a/local/modules/LivraisonParSecteurs/templates/backOffice/default/includes/area-cities.html b/local/modules/LivraisonParSecteurs/templates/backOffice/default/includes/area-cities.html index 327fcac1..ec2064b2 100644 --- a/local/modules/LivraisonParSecteurs/templates/backOffice/default/includes/area-cities.html +++ b/local/modules/LivraisonParSecteurs/templates/backOffice/default/includes/area-cities.html @@ -1,3 +1,34 @@ + + + {form name='lps-area-cities-update'}
@@ -5,33 +36,78 @@
{$form_error_message}
{/if} - {loop name="area" type="lps_area" id="$area_id"} -
- {form_hidden_fields form=$form} +
+
- {include - file = "includes/inner-form-toolbar.html" - hide_flags = true - hide_submit_buttons = false - page_url = "{url path='/admin/module/LivraisonParSecteurs/edit' area_id=$area_id}" - close_url = "{url path='/admin/module/LivraisonParSecteurs'}" - current_tab = "general" - } + {loop name="area" type="lps_area" id="$area_id"} + + {form_hidden_fields form=$form} - {form_field form=$form field="area_id"} - - {/form_field} + {form_field form=$form field="area_id"} + + {/form_field} - - - - {loop name="cities" type="lps_area_cities" area_id="$area_id"} - - {/loop} - -
{$ZIPCODE}
+
+
+ + + + + + + + + + {loop name="cities" type="lps_area_cities" area_id="$area_id"} + + + + + + {/loop} + +
{intl l="Zipcode" d="livraisonparsecteurs"}{intl l="City" d="livraisonparsecteurs"} +
+ + + +
+
{$ZIPCODE}{$TITLE} +
+ + + +
+
+
+
- - {/loop} + + + + {loop name="cities-coordinates" type="lps_area_cities" area_id="$area_id"} + + + + + + {/loop} + + + + + {/loop} +
+ +
+ + + +
+ +
+
{/form} diff --git a/local/modules/LivraisonParSecteurs/templates/backOffice/default/js/area-cities-js.html b/local/modules/LivraisonParSecteurs/templates/backOffice/default/js/area-cities-js.html new file mode 100644 index 00000000..cc971214 --- /dev/null +++ b/local/modules/LivraisonParSecteurs/templates/backOffice/default/js/area-cities-js.html @@ -0,0 +1,42 @@ + \ No newline at end of file