Premiers écrans sur module PointRetrait

This commit is contained in:
2021-02-26 21:10:10 +01:00
parent 86d849a059
commit 1276d9bf3d
34 changed files with 1200 additions and 100 deletions

View File

@@ -0,0 +1,151 @@
<style>
.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;
}
</style>
{form name='pdr-place-main-update'}
<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 form-inline">
<div class="row">
<div class="col-md-3">
{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-3">
{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 class="col-md-2">
{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=AIzaSyBb07YA_unrh5w821I1xHxbeYb5KCF_WaM&callback=initMap&libraries=&v=weekly" async></script>
<div id="map" class="locationMap"></div>
</div>
</div>
</div>
</form>
{/loop}
</div>
{/form}

View File

@@ -0,0 +1,32 @@
<script>
let map;
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();
}
function displayPlace() {
var marker = new google.maps.Marker({
position: new google.maps.LatLng($("#latitude").val(), $("#longitude").val()),
map: map,
title: $(document.getElementById("title")).val()
});
}
</script>

View File

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

View File

@@ -0,0 +1,79 @@
{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"}
<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="PointRetrait"}
<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="PointRetrait"}
<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="PointRetrait"}
<div class="tab-pane fade in active" id="general">
{include file="includes/main.html"}
</div>
{/loop}
{loop name="auth-schedule-tab" type="auth" role="ADMIN" resource="admin.schedule" access="VIEW" module="PointRetrait"}
<div class="tab-pane fade" id="schedule">
{*
{include file="includes/schedule.html"}
*}
</div>
{/loop}
</div>
</div>
</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');
});
</script>
{/javascripts}
{include file="js/main-js.html"}
{*
{include file="js/schedule-js.html"}
*}
{/block}

View File

@@ -0,0 +1,94 @@
mais{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='pointretrait'}{/block}
{block name="check-resource"}admin.module{/block}
{block name="check-access"}view{/block}
{block name="check-module"}PointRetrait{/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 withdrawal places' d='pointretrait'}
</caption>
<thead>
<tr>
<th>{intl l="Place" d='pointretrait'}</th>
<th class="col-md-1">{intl l="Active" d='pointretrait'}</th>
<th>{intl l="Withdrawal price" d='pointretrait'}</th>
<th>{intl l="Minimum amount" d='pointretrait'}</th>
<th>{intl l="Withdrawal days" d='pointretrait'}</th>
<th>{intl l="Location set" d='pointretrait'}</th>
<th class="col-md-1">&nbsp;</th>
</tr>
</thead>
<tbody>
{loop name="places" type="pdr_places"}
<tr>
<td><a href="{url path='/admin/module/PointRetrait/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>{$PRICE} €</td>
<td>{$MINIMUM_AMOUNT} €</td>
<td>{$DELIVERY_DAYS}{if $DELIVERY_DAYS eq ''}<i>{intl l="There is no schedule for this place" d='pointretrait'}</i>{/if}</td>
<td>{if $LATITUDE != ''}Oui{else}Non{/if}</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/PointRetrait/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>
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
<script>
$(function() {
$('a.area-delete').click(function(ev) {
$('#area_delete_id').val($(this).data('id'));
});
$(".toggle-visible").on('switch-change', function (event, data) {
$.ajax({
method: "POST",
url: "{url path='admin/module/PointRetrait/toggle-online/'}" + $(this).data('id')
});
});
});
</script>
{/javascripts}
{/block}

View File

@@ -0,0 +1,75 @@
<style>
#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;
}
</style>
<div class="scheduled-withdrawal-list">
<table class="table table-striped">
<thead>
<th>&nbsp;</th>
<th>{intl l="Order number" d="pointretrait"}</th>
<th>{intl l="Scheduled date" d="pointretrait"}</th>
<th>{intl l="Delivery delay" d="pointretrait"}</th>
<th>{intl l="Place" d="pointretrait"}</th>
</thead>
<tbody>
{loop name="deliveries-loop" type="scheduled_deliveries" domicile_ou_retrait="retrait" only_future="true" order="date"}
{if $DELTA <= 7}
{assign var=path value="{image file='/assets/img/flag-green.png'}"}
{assign var=alt value='Drapeau vert'}
{/if}
{if $DELTA <= 4}
{assign var=path value="{image file='/assets/img/flag-orange.png'}"}
{assign var=alt value='Drapeau orange'}
{/if}
{if $DELTA <= 1}
{assign var=path value="{image file='/assets/img/flag-red.png'}"}
{assign var=alt value='Drapeau rouge'}
{/if}
{assign var=title value="{$DELTA} jour(s) de délai"}
{loop name="order-loop" type="order" id={$ORDER_ID} customer="*"}
{loop type="customer" name="customer-loop" current="false" id=$CUSTOMER}
{assign var=client value="$FIRSTNAME $LASTNAME"}
{/loop}
{/loop}
<tr>
<td><img src={$path} alt="{$alt}" title="{$title}" style="margin-left: 30px; width:25px"></td>
<td><a href="/admin/order/update/{$ORDER_ID}" target="_blank" title="Client : {$client}">{$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>{$DELTA} jour(s)</td>
<td>Point de retrait</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 withdraw" d="pointretrait"}
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
<span class="nb-commandes">Total :&nbsp;&nbsp;<b>{$nbCommandes}</b>&nbsp;&nbsp;commande(s)</span>
</div>