Quelques corrections + init du module ClickAndCollect

This commit is contained in:
2021-03-11 18:47:03 +01:00
parent 2e82f5643a
commit 57e69ddd2f
48 changed files with 2224 additions and 57 deletions

View File

@@ -0,0 +1,86 @@
.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;
}
#submit-geoloc {
width: 50px;
cursor: pointer;
}
.bouton-geoloc {
display: inline-block;
align-items: center;
margin-top: 25px;
}
.bouton-geoloc span {
font-size: larger;
font-weight: 600;
}
.pin-pdr {
height: 25px;
margin-left: 12px;
}
.titre {
font-weight: 900;
color: red;
}
#block-scheduled-deliveries > div.scheduled-deliveries-list > table > thead > tr > th,
#block-scheduled-deliveries > div.scheduled-deliveries-list > table > tbody > tr > td {
text-align: center;
}
.nb-commandes {
font-size: 14px;
margin-left: 30px;
}
.nb-commandes b {
color: orange;
font-weight: bold;
}

View File

@@ -0,0 +1 @@
<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><title>Compass</title><path d='M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z' fill='none' stroke='currentColor' stroke-miterlimit='10' stroke-width='32'/><path d='M350.67 150.93l-117.2 46.88a64 64 0 00-35.66 35.66l-46.88 117.2a8 8 0 0010.4 10.4l117.2-46.88a64 64 0 0035.66-35.66l46.88-117.2a8 8 0 00-10.4-10.4zM256 280a24 24 0 1124-24 24 24 0 01-24 24z'/></svg>

After

Width:  |  Height:  |  Size: 468 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 117 KiB

View File

@@ -0,0 +1,140 @@
{extends file="admin-layout.tpl"}
{block name="no-return-functions"}
{$admin_current_location = 'module'}
{/block}
{block name="page-title"}{intl l='Title of config view' d='clickandcollect'}{/block}
{block name="check-resource"}admin.module{/block}
{block name="check-access"}view{/block}
{block name="check-module"}ClickAndCollect{/block}
{block name="main-content"}
<div id="wrapper" class="container">
{if $general_error}
<div class="alert alert-danger">
{$general_error}
</div>
{/if}
<div class="general-block-decorator">
<div class="table-responsive">
<table class="table table-striped table-condensed" id="areas-table">
<caption class="clearfix">
{intl l='My deposit places' d='clickandcollect'}
</caption>
<thead>
<tr>
<th>{intl l="Place name" d='clickandcollect'}</th>
<th class="col-md-1">{intl l="Active" d='clickandcollect'}</th>
<th>{intl l="Address" d='clickandcollect'}</th>
<th>{intl l="Opening hours" d='clickandcollect'}</th>
<th>{intl l="Additional cost" d='clickandcollect'}</th>
<th>{intl l="Minimum amount" d='clickandcollect'}</th>
<th class="col-md-1">&nbsp;</th>
</tr>
</thead>
<caption class="clearfix">
{loop name="auth-create" type="auth" role="ADMIN" resource="admin.pdr.main" access="CREATE" module="ClickAndCollect"}
<div class="pull-right">
<a class="btn btn-default btn-primary"
title="{intl l='Add a new place' d='clickandcollect'}"
data-target="#place-create-modal" data-toggle="modal">
<i class="glyphicon glyphicon-plus-sign"></i>
</a>
</div>
{/loop}
</caption>
<tbody>
{loop name="places" type="pdr_places"}
<tr>
<td><a href="{url path="/admin/module/ClickAndCollect/edit?place_id=$ID"}">{$TITLE}</a></td>
<td>
<div class="make-switch switch-small toggle-visible" data-id="{$ID}" data-on="success"
data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>"
data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input type="checkbox" class="link" {if $ACTIVE == 1}checked="checked"{/if}>
</div>
</td>
<td>{$ADDRESS1}<br>{$ZIPCODE} {$CITY}{if $LATITUDE eq '' or $LONGITUDE eq ''}<img src="{image file='assets/img/pin.svg' source='PointRetrait'}" title="Pas de coordonnées pour ce point de retrait" alt="Pas de coordonnées" class="pin-pdr" />{/if}</td>
<td>{$DELIVERY_DAYS}{if $DELIVERY_DAYS eq ''}<i>{intl l="There is no schedule for this place" d='clickandcollect'}</i>{/if}</td>
<td>{$PRICE} €</td>
<td>{$MINIMUM_AMOUNT} €</td>
<td class="actions">
<div class="btn-group" role="group">
<a class="btn btn-info btn-responsive" title="{intl l='Edit this place'}" href="{url path="/admin/module/ClickAndCollect/edit?place_id=$ID"}">
<i class="glyphicon glyphicon-edit"></i>
</a>
<a class="btn btn-danger btn-responsive place-delete" title="{intl l='Delete this place'}" data-target="#place-delete" data-toggle="modal" data-id="{$ID}">
<i class="glyphicon glyphicon-trash"></i>
</a>
</div>
</td>
</tr>
{/loop}
</tbody>
</table>
</div>
</div>
</div>
{* CREATE Modal *}
{form name="pdr.place.create"}
{capture "place_create"}
{include file="form/place-create.html" form_name="pdr.place.create"}
{/capture}
{include file="includes/generic-create-dialog.html"
dialog_id = "place-create-modal"
dialog_title = {intl l="Create a new place" d="pointretrait"}
dialog_body = {$smarty.capture.place_create nofilter}
dialog_ok_label = {intl l="Create"}
dialog_cancel_label = {intl l="Cancel"}
form_action = {$current_url}
form_enctype = {form_enctype form=$form}
}
{/form}
{* DELETE modal *}
{capture "place_delete"}
{intl l="Do you really want to remove this place ?" d="pointretrait"}
<input type="hidden" name="attr-place-id" id="attr-place-id" value="999"/>
<input type="hidden" name="success_url" value="{url path='/admin/module/ClickAndCollect'}"/>
{/capture}
{include file="includes/generic-confirm-dialog.html"
dialog_id = "place-delete"
dialog_title = {intl l="Delete a place" d="pointretrait"}
dialog_message = {$smarty.capture.place_delete nofilter}
dialog_ok_label = {intl l="Delete"}
dialog_cancel_label = {intl l="Cancel"}
form_action = {token_url path='/admin/module/ClickAndCollect/delete'}
}
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
<script>
$(function() {
$('a.place-delete').click(function(ev) {
$('#attr-place-id').val($(this).data('id'));
});
$(".toggle-visible").on('switch-change', function (event, data) {
$.ajax({
method: "POST",
url: "{url path='admin/module/ClickAndCollect/toggle-online/'}" + $(this).data('id')
});
});
});
</script>
{/javascripts}
{/block}

View File

@@ -0,0 +1,8 @@
<tr><td>&nbsp;</td></tr>
<tr style="background-color:#1A712C; color:white">
<th>{intl l="Scheduled date" d="pointretrait"}</th>
<td>{$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"}</td>
</tr>
<tr><td>&nbsp;</td></tr>

View File

@@ -0,0 +1,102 @@
{form name=$form_name}
{form_hidden_fields form=$form}
{render_form_field form=$form field="success_url" value={$success_url|default:{url path='/admin/module/PointRetrait'}}}
{form_field form=$form field="title"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
{form_error form=$form field="title"}{$message}{/form_error}
<input type="text" class="form-control" name="{$name}" id="{$label_attr.for}" {if $required}required{/if} />
</div>
{/form_field}
{form_field form=$form field="price"}
<div class="form-group form-inline">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" {if $required}required{/if} />&nbsp;
</div>
{form_error form=$form field="price"}{$message}{/form_error}
{/form_field}
{form_field form=$form field="minimum_amount"}
<div class="form-group form-inline">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" {if $required}required{/if} />&nbsp;
</div>
{form_error form=$form field="minimum_amount"}{$message}{/form_error}
{/form_field}
{form_field form=$form field="address1"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<div class="control-input">
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" maxlength="100" {if $required}required{/if} />
</div>
</div>
{form_error form=$form field="address1"}{$message}{/form_error}
{/form_field}
{form_field form=$form field="address2"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<div class="control-input">
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" maxlength="100" {if $required}required{/if} />
</div>
</div>
{form_error form=$form field="address2"}{$message}{/form_error}
{/form_field}
{form_field form=$form field="zipcode"}
<div class="form-group form-inline">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<div class="control-input">
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" maxlength="10" {if $required}required{/if} />
</div>
</div>
{form_error form=$form field="zipcode"}{$message}{/form_error}
{/form_field}
{form_field form=$form field="city"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<div class="control-input">
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" maxlength="100" {if $required}required{/if} />
</div>
</div>
{form_error form=$form field="city"}{$message}{/form_error}
{/form_field}
{form_field form=$form field="active"}
<input type="hidden" id="{$label_attr.for}" name="{$name}" value="1"/>
{/form_field}
{/form}

View File

@@ -0,0 +1,114 @@
{form name=$form_name}
{form_hidden_fields form=$form}
{render_form_field form=$form field="success_url" value={url path="/admin/module/PointRetrait/edit?place_id={$place_id}#schedule"}}
{render_form_field form=$form field="error_url" value={url path="/admin/module/PointRetrait/edit?place_id={$place_id}#schedule"}}
{form_field form=$form field="place_id"}
<div class="form-group hidden">
<input type="text" class="form-control" name="{$name}" id="{$label_attr.for}" value="{$place_id}"/>
</div>
{/form_field}
{if {$update|default:false} == true}
{form_field form=$form field="place-schedule_id"}
<div class="form-group hidden">
<input type="text" class="form-control" name="{$name}" id="{$label_attr.for}" value=""/>
</div>
{/form_field}
{/if}
{form_field form=$form field="day"}
<div class="form-group {if $error}has-error{/if}">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
{form_error form=$form field="day"}{$message}{/form_error}
<select class="form-control" name="{$name}" id="{$label_attr.for}">
{if {$update|default:false} == true}
<option value="" selected></option>
{/if}
{foreach $choices as $choice}
<option value="{$choice->value}" {if $DAY == $choice->value}selected{/if} >{$choice->label}</option>
{/foreach}
</select>
</div>
{/form_field}
{if {$update|default:false} == false}
<!-- Mode Création d'un nouveau créneau /-->
<div class="row">
<div class="col-sm-12">
{form_field form=$form field="begin_time"}
<div class="form-group {if $error}has-error{/if}">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d='pointretrait'}
{if $required}<span class="required">*</span>{/if}
</label>
{form_error form=$form field="begin_time"}{$message}{/form_error}
<div class='input-group time' id="{$label_attr.for}">
<input type='text' class="form-control" name="{$name}" value="{$BEGIN|default:"14:00"}"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
{/form_field}
{form_field form=$form field="end_time"}
<div class="form-group {if $error}has-error{/if}">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d='pointretrait'}
{if $required}<span class="required">*</span>{/if}
</label>
{form_error form=$form field="end_time"}{$message}{/form_error}
<div class='input-group time' id="{$label_attr.for}">
<input type='text' class="form-control" name="{$name}" value="{$END|default:"16:00"}"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
{/form_field}
</div>
</div>
{else}
<!-- Mode Modification d'un créneau existant /-->
{form_field form=$form field="begin_time"}
<div class="form-group {if $error}has-error{/if}">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d='pointretrait'}
{if $required}<span class="required">*</span>{/if}
</label>
{form_error form=$form field="begin_time"}{$message}{/form_error}
<div class='input-group time' id="{$label_attr.for}">
<input type='text' class="form-control" name="{$name}" value="{$BEGIN}"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
{/form_field}
{form_field form=$form field="end_time"}
<div class="form-group {if $error}has-error{/if}">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d='pointretrait'}
{if $required}<span class="required">*</span>{/if}
</label>
{form_error form=$form field="end_time"}{$message}{/form_error}
<div class='input-group time' id="{$label_attr.for}">
<input type='text' class="form-control" name="{$name}" value="{$END}"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
{/form_field}
{/if}
{/form}

View File

@@ -0,0 +1,195 @@
{form name='pdr.place.view.main'}
<div class="form-container">
{if $form_error}
<div class="alert alert-danger">{$form_error_message}</div>
{/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_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'}"
close_url = "{url path='/admin/module/PointRetrait'}"
current_tab = "main"
}
{form_field form=$form field="place_id"}
<input type="hidden" name="{$name}" value="{$place_id}"/>
{/form_field}
<div class="row">
<div class="col-md-4 form-inline">
{form_field form=$form field="title"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d='pointretrait'}
</label>
<input type="text" id="{$label_attr.for}" class="form-control large" name="{$name}" value="{$TITLE}" {if $required}required{/if} />&nbsp
</div>
{form_error form=$form field="title"}{$message}{/form_error}
{/form_field}
</div>
<div class="col-md-2">
{form_field form=$form field="active"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
</label>
<div class="make-switch switch-small toggle-active" data-id="{$ID}" data-on="success"
data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>"
data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input type="checkbox" class="link" {if $ACTIVE == 1}checked="checked"{/if}>
</div>
<input type="hidden" id="{$label_attr.for}" name="{$name}" value="{$ACTIVE}"/>
</div>
{/form_field}
</div>
<div class="col-md-2">
{form_field form=$form field="price"}
<div class="form-group form-inline">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" value="{$PRICE}" {if $required}required{/if} />&nbsp;
</div>
{form_error form=$form field="price"}{$message}{/form_error}
{/form_field}
</div>
<div class="col-md-4">
{form_field form=$form field="minimum_amount"}
<div class="form-group form-inline">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" value="{$MINIMUM_AMOUNT}" {if $required}required{/if} />&nbsp;
</div>
{form_error form=$form field="minimum_amount"}{$message}{/form_error}
{/form_field}
</div>
</div>
<div class="row">
<div class="col-md-10">
{form_field form=$form field="address1"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<div class="control-input">
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$ADDRESS1}" maxlength="100" {if $required}required{/if} />
</div>
</div>
{form_error form=$form field="address1"}{$message}{/form_error}
{/form_field}
</div>
</div>
<div class="row">
<div class="col-md-10">
{form_field form=$form field="address2"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<div class="control-input">
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$ADDRESS2}" maxlength="100" {if $required}required{/if} />
</div>
</div>
{form_error form=$form field="address2"}{$message}{/form_error}
{/form_field}
</div>
</div>
<div class="row">
<div class="col-md-2">
{form_field form=$form field="zipcode"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<div class="control-input">
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$ZIPCODE}" maxlength="10" {if $required}required{/if} />
</div>
</div>
{form_error form=$form field="zipcode"}{$message}{/form_error}
{/form_field}
</div>
<div class="col-md-8">
{form_field form=$form field="city"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<div class="control-input">
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$CITY}" maxlength="100" {if $required}required{/if} />
</div>
</div>
{form_error form=$form field="city"}{$message}{/form_error}
{/form_field}
</div>
</div>
<div class="row">
<div class="col-md-8">
{form_field form=$form field="access_comment"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
{intl l=$label d="pointretrait"}
{if $required}<span class="required">*</span>{/if}
</label>
<div class="control-input">
<textarea id="{$label_attr.for}" name="{$name}" maxlength="400" class="form-control">{if $form_error}{$value}{/if}{$ACCESS_COMMENT}</textarea>
</div>
<span class="help-block">{intl l="Access comment help" d="pointretrait"}</span>
</div>
{form_error form=$form field="access_comment"}{$message}{/form_error}
{/form_field}
</div>
<div class="col-md-4">
<div class="bouton-geoloc">
<img src="{image file='assets/img/compass.svg' source='PointRetrait'}" alt="Geolocate" id="submit-geoloc"/>
<span>{intl l="Recenter map" d="pointretrait"}</span>
</div>
{form_field form=$form field="latitude"}
<input type="hidden" value="{$LATITUDE}" id="{$label_attr.for}" name="{$name}">
{/form_field}
{form_field form=$form field="longitude"}
<input type="hidden" value="{$LONGITUDE}" id="{$label_attr.for}" name="{$name}">
{/form_field}
</div>
</div>
<div class="row">
<div class="col-md-12">
<script src="https://maps.googleapis.com/maps/api/js?key={module_config module='PlanificationLivraison' key='googlemap_api_key' locale='en_US'}&callback=initMap&libraries=&v=weekly" async></script>
<div id="map" class="locationMap"></div>
</div>
</div>
</form>
{/loop}
</div>
{/form}

View File

@@ -0,0 +1,97 @@
{form name='pdr.place.view.schedule'}
<div class="form-container">
{if $form_error}
<div class="alert alert-danger">{$form_error_message}</div>
{/if}
<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 = true
close_url = "{url path='/admin/module/PointRetrait'}"
current_tab = "schedule"
}
{form_field form=$form field="place_id"}
<input type="hidden" name="{$name}" value="{$place_id}"/>
{/form_field}
<div class="row">
<div class="col-md-12">
<table class="table table-striped table-condensed">
<caption class="clearfix">
{loop name="auth-create" type="auth" role="ADMIN" resource="admin.pdr.schedule" access="CREATE" module="ClickAndCollect"}
<div class="pull-right">
<a class="btn btn-default btn-primary place-schedule-create"
title="{intl l='Add a new withdrawal day' d='pointretrait'}"
data-target="#place-schedule-create" data-toggle="modal">
<i class="glyphicon glyphicon-plus-sign"></i>
</a>
</div>
{/loop}
</caption>
<thead>
<tr>
<th>{intl l="Withdrawal day" d="pointretrait"}</th>
<th>{intl l="Withdrawal beginning time" d="pointretrait"}</th>
<th>{intl l="Withdrawal ending time" d="pointretrait"}</th>
<th>{intl l="Actions" d="pointretrait"}</th>
</tr>
</thead>
<tbody>
{loop name="place-schedule-loop" type="pdr_schedule" place_id=$place_id}
<tr>
<td>{$DAY_LABEL}</td>
<td>{format_date date=$BEGIN format="H\hi"}</td>
<td>{format_date date=$END format="H\hi"}</td>
{* Actions *}
<td>
<div class="btn-group">
{loop name="auth-edit" type="auth" role="ADMIN" resource="admin.pdr.schedule" access="UPDATE" module="ClickAndCollect"}
<a class="btn btn-info btn-responsive place-schedule-update-default"
title="{intl l='Edit this withdrawal day' d='pointretrait'}"
data-target="#place-schedule-update" data-toggle="modal" data-id="{$ID}"
data-day="{$DAY}"
data-begin="{format_date date=$BEGIN format='H:i'}"
data-end="{format_date date=$END format='H:i'}">
<i class="glyphicon glyphicon-edit"></i>
</a>
{/loop}
{loop name="auth-delete" type="auth" role="ADMIN" resource="admin.pdr.schedule" access="DELETE" module="ClickAndCollect"}
<a class="btn btn-danger btn-responsive place-schedule-delete"
title="{intl l='Delete this withdrawal day' d='pointretrait'}"
data-target="#place-schedule-delete" data-toggle="modal" data-id="{$ID}">
<i class="glyphicon glyphicon-trash"></i>
</a>
{/loop}
</div>
<input type="hidden" name="{$name}" value="{$ID}"/>
</td>
</tr>
{/loop}
{elseloop rel="place-schedule-loop"}
<tr>
<td colspan="1000">
<div class="alert alert-info">
{intl l="There is no schedule for this place" d="pointretrait"}
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
</div>
</div>
</form>
</div>
{/form}

View File

@@ -0,0 +1,75 @@
<script>
let map;
let marker;
function initMap() {
var opt = {
center: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
zoom: 15,
streetViewControl: true,
mapTypeControl: false
};
map = new google.maps.Map(document.getElementById("map"), opt);
var markerOpts = {
title: $(document.getElementById("title")).val(),
position: opt.center,
draggable: true,
map: map
};
displayPlace();
addListener();
const geocoder = new google.maps.Geocoder();
document.getElementById("submit-geoloc").addEventListener("click", () => {
geocodeAddress(geocoder, map);
});
}
function displayPlace() {
marker = new google.maps.Marker({
position: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
map: map,
draggable: true,
title: $(document.getElementById("title")).val()
});
}
function clearMarkers(map) {
marker.setMap(map);
marker = "";
}
function geocodeAddress(geocoder, resultsMap) {
const address = document.getElementById("address1").value + ', ' + document.getElementById("zipcode").value + ' ' + document.getElementById("city").value;
geocoder.geocode({ address: address }, (results, status) => {
if (status === "OK") {
clearMarkers(null);
resultsMap.setCenter(results[0].geometry.location);
marker = new google.maps.Marker({
map: resultsMap,
position: results[0].geometry.location,
draggable: true
});
$("#latitude").val(results[0].geometry.location.lat);
$("#longitude").val(results[0].geometry.location.lng);
addListener();
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
function addListener() {
google.maps.event.addListener(marker, 'dragend', function(evt) {
$("#latitude").val(evt.latLng.lat());
$("#longitude").val(evt.latLng.lng());
});
}
</script>

View File

@@ -0,0 +1,41 @@
<script>
$(function () {
$('a.place-schedule-delete').click(function (ev) {
$('#attr-place-schedule-id-delete').val($(this).data('id'));
$("#attr-place-schedule-begin input, #attr-place-schedule-end input").prop('required', false);
$("#attr-place-schedule-day").prop('required', false);
});
$('a.place-schedule-update-default').click(function (ev) {
$("#attr-place-schedule-id-update").val($(this).data('id'));
$("#attr-place-schedule-id").val($(this).data('id'));
$("#attr-place-schedule-begin input", "#place-schedule-update").val($(this).data('begin'));
$("#attr-place-schedule-end input", "#place-schedule-update").val($(this).data('end'));
$('#attr-place-schedule-day option[value="' + $(this).data('day') + '"]', '#place-schedule-update').prop('selected', true);
$("#attr-place-schedule-day").prop('required', true);
});
$('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);
});
{$langcode = {lang attr="code"}|substr:0:2}
$(document).ready(function () {
$('.input-group.time').datetimepicker({
locale: "{$langcode}",
format: 'HH:mm',
stepping: 15
});
});
$(document).ready(function () {
$('.input-group.date').datetimepicker({
locale: "{$langcode}",
format: 'YYYY-MM-DD'
});
});
});
</script>

View File

@@ -0,0 +1,3 @@
<li class="{if $admin_current_location == 'clickandcollect'}active{/if}" id="clickandcollect">
<a title="{intl l='Module name' d='clickandcollect'}" href="{url path='/admin/module/ClickAndCollect'}" ><span class="glyphicon glyphicon-pushpin"></span> {intl l='Module name' d='clickandcollect'}</a>
</li>

View File

@@ -0,0 +1,59 @@
{* DELETE modal *}
{capture "schedule_delete"}
{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 = "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"}
dialog_cancel_label = {intl l="Cancel"}
form_action = {token_url path='/admin/module/PointRetrait/schedule/delete'}
}
{* UPDATE Modal*}
{form name="pdr.place.update.schedule"}
{capture "schedule_update"}
{form_field form=$form field="place-schedule_id"}
<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" 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}
{/capture}
{include file="includes/generic-create-dialog.html"
dialog_id = "place-schedule-update"
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"}
form_action = {url path='admin/module/PointRetrait/schedule/update'}
form_enctype = {form_enctype form=$form}
}
{/form}
{* CREATE Modal *}
{form name="pdr.place.create.schedule"}
{capture "schedule_create"}
{include file="form/place-schedule-create.html" form_name="pdr.place.create.schedule" place_id=$smarty.get.place_id}
{/capture}
{include file="includes/generic-create-dialog.html"
dialog_id = "place-schedule-create"
dialog_title = {intl l="Add a new withdrawal day" d="pointretrait"}
dialog_body = {$smarty.capture.schedule_create nofilter}
dialog_ok_label = {intl l="Create"}
dialog_cancel_label = {intl l="Cancel"}
form_action = {url path="admin/module/PointRetrait/schedule/create"}
form_enctype = {form_enctype form=$form}
}
{/form}

View File

@@ -0,0 +1,82 @@
{extends file="admin-layout.tpl"}
{block name="page-title"}{intl l='My places' d="pointretrait"}{/block}
{block name="check-access"}update{/block}
{block name="check-module"}PointRetrait{/block}
{block name="after-bootstrap-css"}
<link rel="stylesheet"
href="{stylesheet file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css'}">
{/block}
{block name="main-content"}
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
<div id="wrapper" class="container">
{assign "place_id" $smarty.get.place_id}
<div class="general-block-decorator">
<div class="title title-without-tabs">
{intl l="Edit a place" d="pointretrait"}&nbsp;: <b>{loop name="places" type="pdr_places" id={$place_id}}{$TITLE}{/loop}</b>
</div>
<ul class="nav nav-tabs" id="tabbed-menu">
{loop name="auth-general" type="auth" role="ADMIN" resource="admin" access="VIEW" module="ClickAndCollect"}
<li class="active"><a href="#main" data-toggle="tab">{intl l="Main" d="pointretrait"}</a></li>
{/loop}
{loop name="auth-schedule" type="auth" role="ADMIN" resource="admin.schedule" access="VIEW" module="ClickAndCollect"}
<li><a href="#schedule" data-toggle="tab">{intl l="Schedule" d="pointretrait"}</a></li>
{/loop}
</ul>
<div class="tab-content">
{loop name="auth-general-tab" type="auth" role="ADMIN" resource="admin" access="VIEW" module="ClickAndCollect"}
<div class="tab-pane fade in active" id="main">
{include file="includes/main.html"}
</div>
{/loop}
{loop name="auth-schedule-tab" type="auth" role="ADMIN" resource="admin.schedule" access="VIEW" module="ClickAndCollect"}
<div class="tab-pane fade" id="schedule">
{include file="includes/schedule.html"}
</div>
{/loop}
</div>
</div>
<input type="hidden" id="message-pas-de-coordonnees" value="{intl l='Message no location' d='pointretrait'}" />
</div>
{include file="modal/schedule-modal.html"}
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/moment-with-locales.min.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
<script>
$(function() {
$(".toggle-active").on('switch-change', function (event, data) {
$("#active").val(data['value'] ? 1 : 0);
});
var hash = location.hash.slice(1);
if (!hash) hash = "main";
$('#tabbed-menu a[href="#' + hash + '"]').tab('show');
if ($("#latitude").val() == '')
alert ($('#message-pas-de-coordonnees').val());
});
</script>
{/javascripts}
{include file="js/main-js.html"}
{include file="js/schedule-js.html"}
{/block}

View File

@@ -0,0 +1,49 @@
<div class="scheduled-withdrawal-list">
<table class="table table-striped">
<thead>
<th>{intl l="Order number" d="clickandcollect"}</th>
<th>{intl l="Scheduled date" d="clickandcollect"}</th>
<th>{intl l="Delay" d="clickandcollect"}</th>
<th>{intl l="Place name" d="clickandcollect"}</th>
</thead>
<tbody>
{loop name="deliveries-loop" type="scheduled_deliveries" list_type="clickandcollect" only_future="true" order="date"}
{if $DELTA <= {module_config module="PlanificationLivraison" key='delay_red_alert' locale="en_US"}}
{assign var=path value="{image file='assets/img/drapeau-rouge.png' source='PlanificationLivraison'}"}
{assign var=alt value='Drapeau rouge'}
{else}
{if $DELTA <= {module_config module="PlanificationLivraison" key='delay_orange_alert' locale="en_US"}}
{assign var=path value="{image file='assets/img/drapeau-orange.png' source='PlanificationLivraison'}"}
{assign var=alt value='Drapeau orange'}
{else}
{assign var=path value="{image file='assets/img/drapeau-vert.png' source='PlanificationLivraison'}"}
{assign var=alt value='Drapeau vert'}
{/if}
{/if}
{assign var=title value="{$DELTA} jour(s) de délai"}
<tr>
<td style="text-align: center"><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$CUSTOMER}">{$ORDER_ID}</a></td>
<td>
{format_date date=$START_DATE format="d/m/Y"} entre {format_date date=$START_DATE format="H\hi"} et {format_date date=$END_DATE format="H\hi"}
</td>
<td><img src={$path} alt="{$alt}" title="{$title}" style="margin-right: 10px; width:25px">{$DELTA} jour(s)</td>
<td>{$PLACE}</td>
</tr>
{if $LOOP_COUNT == $LOOP_TOTAL}{assign var=nbCommandes value=$LOOP_TOTAL}{/if}
{/loop}
{elseloop rel="deliveries-loop"}
<tr>
<td colspan="1000">
<div class="alert alert-info">
{intl l="There is no order to deliver" d="clickandcollect"}
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
<span class="nb-commandes">Total :&nbsp;&nbsp;<b>{$nbCommandes}</b>&nbsp;&nbsp;commande(s)</span>
</div>