PointRetrait : OK sur création de créneau et modification

Il reste :
- suppression d'un créneau
- liste des jours dans places-list.html
This commit is contained in:
2021-03-03 18:42:54 +01:00
parent dd7a6d618f
commit dc939c1e29
48 changed files with 700 additions and 3809 deletions

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

@@ -1,4 +1,4 @@
{form name='pdr-place-main-update'}
{form name='pdr.place.view.main'}
<div class="form-container">
{if $form_error}
@@ -6,16 +6,15 @@
{/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}"
close_url = "{url path='/admin/module/PointRetrait'}"
current_tab = "main"
{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"}
@@ -163,6 +162,7 @@
<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}

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="PointRetrait"}
<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="PointRetrait"}
<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="PointRetrait"}
<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,40 @@
<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-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,59 @@
{* 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=""/>
<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_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" id="attr-place-schedule-id-update" name="place-schedule_id" value=""/>
{/form_field}
{form_field form=$form field="place_id"}
<input type="hidden" id="place_id" name="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="Modify a 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

@@ -33,15 +33,13 @@
<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">
<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="PointRetrait"}
<div class="tab-pane fade" id="schedule">
{*
{include file="includes/schedule.html"}
*}
</div>
{/loop}
</div>
@@ -50,9 +48,7 @@
<input type="hidden" id="message-pas-de-coordonnees" value="{intl l='Message no location' d='pointretrait'}" />
</div>
{*
{include file="modal/schedule-modal.html"}
*}
{/block}
@@ -82,7 +78,5 @@
</script>
{/javascripts}
{include file="js/main-js.html"}
{*
{include file="js/schedule-js.html"}
*}
{/block}

View File

@@ -85,9 +85,9 @@ mais{extends file="admin-layout.tpl"}
</div>
{* CREATE Modal *}
{form name="pointretrait.place.create"}
{form name="pdr.place.create"}
{capture "place_create"}
{include file="form/place-create.html" form_name="pointretrait.place.create"}
{include file="form/place-create.html" form_name="pdr.place.create"}
{/capture}
{include file="includes/generic-create-dialog.html"