Skip to content

Commit

Permalink
Merge pull request #14 from Lurivar/main
Browse files Browse the repository at this point in the history
Add 5Y and 5X codes
  • Loading branch information
Lurivar authored Apr 25, 2023
2 parents 0c4c7a0 + 2d2413e commit 77fa643
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 25 deletions.
4 changes: 3 additions & 1 deletion Config/ChronopostPickupPointConst.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class ChronopostPickupPointConst
{
/** Delivery types Name => Code */
const CHRONOPOST_PICKUP_POINT_DELIVERY_CODES = [
"ChronoRelais" => "86",
"ChronoRelais" => "86",
"Chrono2ShopDirect" => "5X",
"Chrono2ShopRetour" => "5Y",
];
/** @TODO Add other delivery types */

Expand Down
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>2.0.2</version>
<version>2.0.3</version>
<authors>
<author>
<name>Thelia</name>
Expand Down
189 changes: 166 additions & 23 deletions templates/frontOffice/default/ChronopostPickupPoint.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,88 @@

{* ChronoRelais *}
{if $isChronoRelaisEnabled !== false}
{chronopostPickupPointDeliveryPrice delivery-mode="86" country=$country}
<div class="panel panel-default">
<div class="panel-heading">
<strong>{intl l="Chrono 13H relay delivery" d='chronopost.pickup.point.fo.default'}</strong> / {$chronopostPickupPointDeliveryModePrice->getAmount()} {currency attr="symbol"}
</div>
<div class="panel-body">
<div class="container-fluid">
{chronopostPickupPointDeliveryPrice delivery-mode="86" country=$country}
<div class="panel panel-default">
<div class="panel-heading">
<strong>{intl l="Chrono 13H relay delivery" d='chronopost.pickup.point.fo.default'}</strong> / {$chronopostPickupPointDeliveryModePrice->getAmount()} {currency attr="symbol"}
</div>
<div class="panel-body">
<div class="container-fluid">

<div style="padding-top: 15px;">
{intl l="Delivery in a relay of your choice, before tomorrow 13H." d='chronopost.pickup.point.fo.default'}

<div style="padding-top: 15px;">
{intl l="Delivery in a relay of your choice, before tomorrow 13H." d='chronopost.pickup.point.fo.default'}
<div class="clearfix hidden">
<button type="submit" id='chronopostPickupPointSubmitButton-86' name="deliveryModuleOptionCode" value="86" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d="chronopost.pickup.point.fo.default"}</button>
</div>

<div class="clearfix hidden">
<button type="submit" id='chronopostPickupPointSubmitButton' name="deliveryModuleOptionCode" value="86" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d="chronopost.pickup.point.fo.default"}</button>
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>{intl l="Name" d='chronopost.pickup.point.fo.default'}</th>
<th>{intl l="City" d='chronopost.pickup.point.fo.default'}</th>
<th>{intl l="Zip Code" d='chronopost.pickup.point.fo.default'}</th>
<th>{intl l="Address" d='chronopost.pickup.point.fo.default'}</th>
<th>{intl l="Country" d='chronopost.pickup.point.fo.default'}</th>
<th></th>
</tr>
</thead>
<tbody>
{loop type="address" name="delivery-address" id={order attr="delivery_address"}}
{loop type="chronopost.pickup.point.get.relay" name="chronopost_pickup_point_relay_loop" orderweight="10000" countryid=$COUNTRY zipcode=$ZIPCODE city=$CITY address=$ADDRESS1}
<tr>
<td>{$NOM}</td>
<td>{$LOCALITE}</td>
<td>{$CODEPOSTAL}</td>
<td>{$ADRESSE1}</td>
<td>{$CODEPAYS}</td>
<td>
<div class="clearfix">
<button type="button" class="btn btn-primary pull-right pickup-point-submit"
data-company="{$NOM}"
data-addr1="{$ADRESSE1}"
data-addr2="{$ADRESSE2}"
data-addr3="{$ADRESSE3}"
data-zip="{$CODEPOSTAL}"
data-country="{$CODEPAYS}"
data-city="{$LOCALITE}"
data-deliverycode="86"
>
{intl l="Choose this pickup point" d="chronopost.pickup.point.fo.default"}
</button>
</div>
</td>
</tr>
{/loop}
{/loop}
</tbody>
</table>
</div>

<table class="table table-condensed table-striped">
<thead>
</div>
</div>
</div>
{/if}

{* Chrono2ShopDirect *}
{if $isChrono2ShopDirectEnabled !== false}
{chronopostPickupPointDeliveryPrice delivery-mode="5X" country=$country}
<div class="panel panel-default">
<div class="panel-heading">
<strong>{intl l="Chrono 2Shop Direct delivery" d='chronopost.pickup.point.fo.default'}</strong> / {$chronopostPickupPointDeliveryModePrice->getAmount()} {currency attr="symbol"}
</div>
<div class="panel-body">
<div class="container-fluid">

<div style="padding-top: 15px;">
{intl l="Delivery in a shop relay of your choice." d='chronopost.pickup.point.fo.default'}

<div class="clearfix hidden">
<button type="submit" id='chronopostPickupPointSubmitButton-5X' name="deliveryModuleOptionCode" value="5X" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d="chronopost.pickup.point.fo.default"}</button>
</div>

<table class="table table-condensed table-striped">
<thead>
<tr>
<th>{intl l="Name" d='chronopost.pickup.point.fo.default'}</th>
<th>{intl l="City" d='chronopost.pickup.point.fo.default'}</th>
Expand All @@ -33,9 +98,9 @@
<th>{intl l="Country" d='chronopost.pickup.point.fo.default'}</th>
<th></th>
</tr>
</thead>
<tbody>
{loop type="address" name="delivery-address" id={order attr="delivery_address"}}
</thead>
<tbody>
{loop type="address" name="delivery-address" id={order attr="delivery_address"}}
{loop type="chronopost.pickup.point.get.relay" name="chronopost_pickup_point_relay_loop" orderweight="10000" countryid=$COUNTRY zipcode=$ZIPCODE city=$CITY address=$ADDRESS1}
<tr>
<td>{$NOM}</td>
Expand All @@ -45,21 +110,95 @@
<td>{$CODEPAYS}</td>
<td>
<div class="clearfix">
<button type="button" class="btn btn-primary pull-right pickup-point-submit" data-company="{$NOM}" data-addr1="{$ADRESSE1}" data-addr2="{$ADRESSE2}" data-addr3="{$ADRESSE3}" data-zip="{$CODEPOSTAL}" data-country="{$CODEPAYS}" data-city="{$LOCALITE}">
<button type="button" class="btn btn-primary pull-right pickup-point-submit"
data-company="{$NOM}"
data-addr1="{$ADRESSE1}"
data-addr2="{$ADRESSE2}"
data-addr3="{$ADRESSE3}"
data-zip="{$CODEPOSTAL}"
data-country="{$CODEPAYS}"
data-city="{$LOCALITE}"
data-deliverycode="5X"
>
{intl l="Choose this pickup point" d="chronopost.pickup.point.fo.default"}
</button>
</div>
</td>
</tr>
{/loop}
{/loop}
</tbody>
</table>
{/loop}
</tbody>
</table>
</div>

</div>
</div>
</div>
{/if}

{* Chrono2ShopRetour *}
{if $isChrono2ShopRetourEnabled !== false}
{chronopostPickupPointDeliveryPrice delivery-mode="5Y" country=$country}
<div class="panel panel-default">
<div class="panel-heading">
<strong>{intl l="Chrono 2Shop Retour delivery" d='chronopost.pickup.point.fo.default'}</strong> / {$chronopostPickupPointDeliveryModePrice->getAmount()} {currency attr="symbol"}
</div>
<div class="panel-body">
<div class="container-fluid">

<div style="padding-top: 15px;">
{intl l="Delivery in a shop relay of your choice." d='chronopost.pickup.point.fo.default'}

<div class="clearfix hidden">
<button type="submit" id='chronopostPickupPointSubmitButton-5Y' name="deliveryModuleOptionCode" value="5Y" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d="chronopost.pickup.point.fo.default"}</button>
</div>

<table class="table table-condensed table-striped">
<thead>
<tr>
<th>{intl l="Name" d='chronopost.pickup.point.fo.default'}</th>
<th>{intl l="City" d='chronopost.pickup.point.fo.default'}</th>
<th>{intl l="Zip Code" d='chronopost.pickup.point.fo.default'}</th>
<th>{intl l="Address" d='chronopost.pickup.point.fo.default'}</th>
<th>{intl l="Country" d='chronopost.pickup.point.fo.default'}</th>
<th></th>
</tr>
</thead>
<tbody>
{loop type="address" name="delivery-address" id={order attr="delivery_address"}}
{loop type="chronopost.pickup.point.get.relay" name="chronopost_pickup_point_relay_loop" orderweight="10000" countryid=$COUNTRY zipcode=$ZIPCODE city=$CITY address=$ADDRESS1}
<tr>
<td>{$NOM}</td>
<td>{$LOCALITE}</td>
<td>{$CODEPOSTAL}</td>
<td>{$ADRESSE1}</td>
<td>{$CODEPAYS}</td>
<td>
<div class="clearfix">
<button type="button" class="btn btn-primary pull-right pickup-point-submit"
data-company="{$NOM}"
data-addr1="{$ADRESSE1}"
data-addr2="{$ADRESSE2}"
data-addr3="{$ADRESSE3}"
data-zip="{$CODEPOSTAL}"
data-country="{$CODEPAYS}"
data-city="{$LOCALITE}"
data-deliverycode="5Y"
>
{intl l="Choose this pickup point" d="chronopost.pickup.point.fo.default"}
</button>
</div>
</td>
</tr>
{/loop}
{/loop}
</tbody>
</table>
</div>

</div>
</div>
</div>
</div>
{/if}

{* TODO Add other delivery types *}
Expand Down Expand Up @@ -95,7 +234,11 @@

});

$(".pickup-point-submit").on("click", function () {
$(".pickup-point-submit").on("click", function (event) {
console.log(this);
console.log($(this));
console.log(event);
let deliveryCode = this.dataset.deliverycode;
$.getJSON('{url path="/chronopost/pickup-point/save"}', {
company: this.dataset.company,
addr1: this.dataset.addr1,
Expand All @@ -105,7 +248,7 @@
city: this.dataset.city,
country: this.dataset.country
}).done(function () {
$("#chronopostPickupPointSubmitButton").click();
$("#chronopostPickupPointSubmitButton-" + deliveryCode).click();
})
})
</script>
Expand Down

0 comments on commit 77fa643

Please sign in to comment.