PointRetrait : création et suppression OK, il reste un peu de boulot sur l'enregistrement.

This commit is contained in:
2021-03-03 13:43:34 +01:00
parent 5c885af961
commit dd7a6d618f
8 changed files with 329 additions and 9 deletions

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

@@ -28,7 +28,7 @@ mais{extends file="admin-layout.tpl"}
<thead>
<tr>
<th>{intl l="Place" d='pointretrait'}</th>
<th>{intl l="Place name" d='pointretrait'}</th>
<th class="col-md-1">{intl l="Active" d='pointretrait'}</th>
<th>{intl l="Address" d='pointretrait'}</th>
<th>{intl l="Withdrawal days" d='pointretrait'}</th>
@@ -38,10 +38,22 @@ mais{extends file="admin-layout.tpl"}
</tr>
</thead>
<caption class="clearfix">
{loop name="auth-create" type="auth" role="ADMIN" resource="admin.pdr.main" access="CREATE" module="PointRetrait"}
<div class="pull-right">
<a class="btn btn-default btn-primary"
title="{intl l='Add a new place' d='pointretrait'}"
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/PointRetrait/edit' place_id=$ID}">{$TITLE}</a></td>
<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>"
@@ -55,7 +67,7 @@ mais{extends file="admin-layout.tpl"}
<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/PointRetrait/edit' place_id=$ID}">
<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}">
@@ -71,6 +83,40 @@ mais{extends file="admin-layout.tpl"}
</div>
</div>
</div>
{* CREATE Modal *}
{form name="pointretrait.place.create"}
{capture "place_create"}
{include file="form/place-create.html" form_name="pointretrait.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/PointRetrait'}"/>
{/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/PointRetrait/delete'}
}
{/block}
{block name="javascript-initialization"}
@@ -78,8 +124,8 @@ mais{extends file="admin-layout.tpl"}
<script src="{$asset_url}"></script>
<script>
$(function() {
$('a.area-delete').click(function(ev) {
$('#area_delete_id').val($(this).data('id'));
$('a.place-delete').click(function(ev) {
$('#attr-place-id').val($(this).data('id'));
});
$(".toggle-visible").on('switch-change', function (event, data) {