PointRetrait : finalisation de la partie backOffice

This commit is contained in:
2021-03-04 12:59:55 +01:00
parent dc939c1e29
commit b98e6f7590
9 changed files with 32 additions and 29 deletions

View File

@@ -4,34 +4,35 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="pointretrait.places.list" path="/admin/module/PointRetrait" methods="get">
<route id="pdr.places.list" path="/admin/module/PointRetrait" methods="get">
<default key="_controller">PointRetrait\Controller\backOffice\ListController::viewAction</default>
</route>
<route id="pointretrait.toggle.active" path="/admin/module/PointRetrait/toggle-online/{id}" methods="post">
<route id="pdr.toggle.active" path="/admin/module/PointRetrait/toggle-online/{id}" methods="post">
<default key="_controller">PointRetrait\Controller\backOffice\ListController::toggleActive</default>
<requirement key="id">\d+</requirement>
</route>
<route id="pointretrait.place.view" path="/admin/module/PointRetrait/edit" methods="get">
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::viewPlace</default>
</route>
<route id="pointretrait.place.create" path="/admin/module/PointRetrait" methods="post">
<route id="pdr.place.create" path="/admin/module/PointRetrait" methods="post">
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::createPlace</default>
</route>
<route id="pointretrait.place.edit" path="/admin/module/PointRetrait/edit" methods="post">
<route id="pdr.place.view" path="/admin/module/PointRetrait/edit" methods="get">
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::viewPlace</default>
</route>
<route id="pdr.place.edit" path="/admin/module/PointRetrait/edit" methods="post">
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::editPlace</default>
</route>
<route id="pointretrait.place.delete" path="/admin/module/PointRetrait/delete" methods="post">
<route id="pdr.place.delete" path="/admin/module/PointRetrait/delete" methods="post">
<default key="_controller">PointRetrait\Controller\backOffice\PlaceController::deletePlace</default>
</route>
<route id="pointretrait.schedule.create" path="admin/module/PointRetrait/schedule/create" methods="post">
<route id="pdr.schedule.create" path="admin/module/PointRetrait/schedule/create" methods="post">
<default key="_controller">PointRetrait\Controller\backOffice\ScheduleController::createSchedule</default>
</route>
<route id="pointretrait.schedule.update" path="admin/module/PointRetrait/schedule/update" methods="post">
<route id="pdr.schedule.update" path="admin/module/PointRetrait/schedule/update" methods="post">
<default key="_controller">PointRetrait\Controller\backOffice\ScheduleController::updateSchedule</default>
</route>
<route id="pointretrait.schedule.delete" path="/admin/module/PointRetrait/schedule/delete" methods="post">
<route id="pdr.schedule.delete" path="/admin/module/PointRetrait/schedule/delete" methods="post">
<default key="_controller">PointRetrait\Controller\backOffice\ScheduleController::deleteSchedule</default>
</route>

View File

@@ -5,7 +5,6 @@ namespace PointRetrait\Controller\backOffice;
use PointRetrait\Model\PdrPlaces;
use PointRetrait\Model\PdrPlacesQuery;
use PointRetrait\PointRetrait;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Propel;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -41,7 +40,7 @@ class PlaceController extends BaseAdminController
$con->beginTransaction();
$error_msg = "";
$changeForm = $this->createForm("pointretrait.place.view.main", "form");
$changeForm = $this->createForm("pdr.place.view.main", "form");
try {
$form = $this->validateForm($changeForm, "POST");
@@ -77,7 +76,7 @@ class PlaceController extends BaseAdminController
$con->beginTransaction();
$error_msg = "";
$createForm = $this->createForm("pointretrait.place.create", "form");
$createForm = $this->createForm("pdr.place.create", "form");
try {
$form = $this->validateForm($createForm, "POST");

View File

@@ -34,8 +34,8 @@ class ScheduleController extends BaseAdminController
if (null !== $response = $this->checkAuth(AdminResources::MODULE, PointRetrait::getModuleCode(), AccessManager::UPDATE))
return $response;
$placeScheduleId = $this->getRequest()->get('place-schedule_id');
$query = PdrPlacesQuery::create()->findById($placeScheduleId);
$placeScheduleId = $this->getRequest()->get('schedule_id');
$query = PdrScheduleQuery::create()->findById($placeScheduleId);
if ($query === null)
$error_msg = "Delivery area schedule not found by Id";
else
@@ -72,7 +72,7 @@ class ScheduleController extends BaseAdminController
$form = $this->validateForm($changeForm, "POST");
$data = $form->getData();
$placeScheduleId = $this->getRequest()->get('place-schedule_id');
$placeScheduleId = $this->getRequest()->get('schedule_id');
$query = PdrScheduleQuery::create()->findOneById($placeScheduleId);
if ($query === null)
$error_msg = "Withdrawal place schedule not found by Id";

View File

@@ -9,10 +9,12 @@ return array(
'Address2' => 'Complément d\'adresse',
'City' => 'Commune',
'Create a new place' => 'Créer un nouveau point de retrait',
'Do you really want to remove this place ?' => 'Voulez-vous réellement supprimer ce point de retrait ?',
'Delete a place' => 'Supprimer un point de retrait',
'Delete an entry of schedule' => 'Supprimer un créneau de retrait',
'Delete this withdrawal day' => 'Supprimer ce jour de retrait',
'Delivery delay' => 'Délai avant retrait',
'Do you really want to remove this place ?' => 'Voulez-vous réellement supprimer ce point de retrait ?',
'Do you really want to remove this schedule entry ?' => 'Voulez-vous réellement supprimer ce créneau de retrait ?',
'Edit a place' => 'Modifier un lieu de retrait',
'Edit this withdrawal day' => 'Modifier ce jour de retrait',
'Location set' => 'Coordonnées GPS présentes ?',

View File

@@ -34,7 +34,9 @@ class GeneralLoop extends BaseLoop implements PropelSearchLoopInterface
$loopResultRow = new LoopResultRow($places);
$schedule = PdrScheduleQuery::create()->findById($places->getId());
$schedule = PdrScheduleQuery::create()
->filterByIdPlace($places->getId())
->orderByDay();
$deliveryDays = "";
foreach ($schedule as $day) {
$deliveryDays .= PointRetrait::getDayLabel($day->getDay()) . ', ';

View File

@@ -6,13 +6,13 @@
{/if}
{loop name="places" type="pdr_places" id="$place_id"}
<form action="{url path="/admin/module/PointRetrait/edit&place_id={$place_id}"}" method="POST" class="clearfix" {form_enctype form=$form}>
<form action="{url path='/admin/module/PointRetrait/edit' place_id=$place_id}" method="POST" class="clearfix" {form_enctype form=$form}>
{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/PointRetrait/edit&place_id=$place_id"}"
page_url = "{url path='/admin/module/PointRetrait/edit&place_id=$place_id'}"
close_url = "{url path='/admin/module/PointRetrait'}"
current_tab = "main"
}

View File

@@ -23,7 +23,6 @@
displayPlace();
addListener();
const geocoder = new google.maps.Geocoder();
document.getElementById("submit-geoloc").addEventListener("click", () => {
geocodeAddress(geocoder, map);
@@ -73,5 +72,4 @@
});
}
</script>

View File

@@ -17,6 +17,7 @@
});
$('a.place-schedule-create').click(function (ev) {
$('#attr-place-id').val($(this).data('id'));
$("#attr-place-schedule-begin input, #attr-place-schedule-end input").prop('required', true);
$("#attr-place-schedule-day").prop('required', true);
});

View File

@@ -1,13 +1,13 @@
{* DELETE modal *}
{capture "schedule_delete"}
{intl l="Do you really want to delete this delivery day ?" d="pointretrait"}
<input type="text" name="schedule_id" id="attr-schedule-id-delete" value=""/>
{intl l="Do you really want to remove this schedule entry ?" d="pointretrait"}
<input type="hidden" name="schedule_id" id="attr-place-schedule-id-delete" value=""/>
<input type="hidden" name="place_id" value="{$smarty.get.place_id}"/>
<input type="hidden" name="success_url" value="{url path="/admin/module/PointRetrait/edit?area_id={$area_id}#schedule"}"/>
{/capture}
{include file="includes/generic-confirm-dialog.html"
dialog_id = "area-schedule-delete"
dialog_id = "place-schedule-delete"
dialog_title = {intl l="Delete an entry of schedule" d="pointretrait"}
dialog_message = {$smarty.capture.schedule_delete nofilter}
dialog_ok_label = {intl l="Delete"}
@@ -20,10 +20,10 @@
{form name="pdr.place.update.schedule"}
{capture "schedule_update"}
{form_field form=$form field="place-schedule_id"}
<input type="hidden" id="attr-place-schedule-id-update" name="place-schedule_id" value=""/>
<input type="hidden" name="schedule_id" id="attr-place-schedule-id-update" value=""/>
{/form_field}
{form_field form=$form field="place_id"}
<input type="hidden" id="place_id" name="place_id" value="{$smarty.get.place_id}"/>
<input type="hidden" name="place_id" id="place_id" value="{$smarty.get.place_id}"/>
{/form_field}
{include file="form/place-schedule-create.html" form_name="pdr.place.update.schedule" update=true}
@@ -31,7 +31,7 @@
{include file="includes/generic-create-dialog.html"
dialog_id = "place-schedule-update"
dialog_title = {intl l="Modify a withdrawal day" d="pointretrait"}
dialog_title = {intl l="Edit this withdrawal day" d="pointretrait"}
dialog_body = {$smarty.capture.schedule_update nofilter}
dialog_ok_label = {intl l="Save"}
dialog_cancel_label = {intl l="Cancel"}