Commit du répertoire FedEx

This commit is contained in:
2020-11-13 10:50:08 +01:00
parent 898aa9df75
commit 63504d5f90
21 changed files with 1102 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
{javascripts file="assets/js/bootstrap-switch/bootstrap-switch.js"}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(document).ready(function() {
/*
$(".freeshipping-activation-FedEx").bootstrapSwitch();
$(".freeshipping-activation-FedEx").on("switch-change", function(e, data){
var is_checked = data.value;
var form = $("#freeshippingform");
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
$.ajax({
url: form.attr('action'),
type: form.attr('method'),
data: form.serialize()
}).done(function(){
$("#loading-event").remove();
})
.success(function() {
if (is_checked) {
$('#config-btn-0').removeClass('disabled');
$('#table-prices-FedEx').hide('slow');
} else {
$('#config-btn-0').addClass('disabled');
$('#table-prices-FedEx').show('slow');
}
})
.fail(function(jqXHR, textStatus, errorThrown){
$("#loading-event").remove();
$('#freeshipping-failed-body').html(jqXHR.responseJSON.error);
$("#freeshipping-failed").modal("show");
});
});
*/
});
</script>

View File

@@ -0,0 +1,175 @@
<div class="row">
<!-- Errors -->
{loop name="checkrights.fedex" type="fedex.check.rights"}
<div class="alert alert-danger">
<p>{$ERRMES} {$ERRFILE} | {intl d='fedex.bo.default' l="Please change the access rights"}.</p>
</div>
{/loop}
</div>
{elseloop rel="checkrights.fedex"}
<div class="alert alert-info">
<p>{intl d='fedex.bo.default' l="FedEx Module allows to send your products all around the world with FedEx."}</p>
</div>
<div class="modal fade" id="freeshipping-failed" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{intl d='fedex.bo.default' l="An error occured"}</h3>
</div>
<div class="modal-body" id="freeshipping-failed-body">
</div>
</div>
</div>
</div>
<div class="general-block-decorator">
<div class="row">
<div class="col-md-12">
{form name="fedex.configuration"}
<form method="POST" action="{url path='/admin/module/fedex/configuration/update'}">
{form_hidden_fields form=$form}
{form_field form=$form field="tracking_url"}
<div class="form-group">
<label class="control-label" for="{$label_attr.for}">
<input type="text" name="{$name}" id="{$label_attr.for}" />
{$label}
{form_error form=$form field="tracking_url" value={module_config module="FedEx" key='tracking_url' locale="en_US"}}
<br />
<span class="error">{$message}</span>
{/form_error}
</label>
{if ! empty($label_attr.help)}
<span class="help-block">{$label_attr.help}</span>
{/if}
</div>
{/form_field}
<button type="submit" name="fedex_save_configuration" value="save" class="form-submit-button btn btn-sm btn-default" title="{intl d='fedex.bo.default' l='Save'}">
{intl d='fedex.bo.default' l='Save'}
</button>
</form>
{/form}
</div>
</div>
</div>
<div class="general-block-decorator">
<div class="row">
<div class="col-md-12">
<!-- Tab menu -->
<ul id="tabbed-menu" class="nav nav-tabs">
<li class="{if $tab eq "1"}active{/if}"><a data-toggle="tab" href="#prices_slices_tab">{intl d='fedex.bo.default' l="Price slices"}</a></li>
</ul>
<div class="tab-content">
<div id="prices_slices_tab" class="tab-pane {if $tab eq 1}active{/if} form-container">
<div id="table-prices-fedex">
<!-- Prices editing -->
{* -- Add price slice confirmation dialog ----------------------------------- *}
{loop type="area" name="list area" backend_context=true module_id=$module_id}
{include
file = "includes/generic-create-dialog.html"
dialog_id = "price_slice_create_dialog_{$ID}"
dialog_title = {intl d='fedex.bo.default' l="Create a price slice"}
dialog_body = "<input type=\"hidden\" name=\"operation\" value=\"add\"/>
<input type=\"hidden\" name=\"area\" value=\"{$ID}\" />
<label for=\"weight_{$ID}\">{intl d='fedex.bo.default' l="Weight up to ... (kg)"}</label></label>
<input type=\"number\" step=\"0.01\" id=\"weight_{$ID}\" name=\"weight\" value=\"1\" class=\"form-control\" pattern=\"\d+\.?\d*\" required/>
<label for=\"price_{$ID}\">{intl d='fedex.bo.default' l="Price (€)"}</label></label>
<input type=\"number\" step=\"0.01\" id=\"price_{$ID}\" name=\"price\" value=\"1\" class=\"form-control\" pattern=\"\d+\.?\d*\" required/>"
form_action="{url path="/admin/module/fedex/prices"}"
dialog_ok_label = {intl d='fedex.bo.default' l="Create"}
dialog_cancel_label = {intl d='fedex.bo.default' l="Cancel"}
}
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<caption class="clearfix">
{intl d='fedex.bo.default' l="Area : "}{$NAME}
{loop type="auth" name="can_create" role="ADMIN" module="fedex" access="CREATE"}
<a class="btn btn-default btn-primary pull-right" title="{intl d='fedex.bo.default' l='Create a new price slice'}" href="#price_slice_create_dialog_{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-plus"></span>
</a>
{/loop}
</caption>
<thead>
<tr>
<th class="col-md-3">{intl d='fedex.bo.default' l="Weight up to ... (kg)"}</th>
<th class="col-md-5">{intl d='fedex.bo.default' l="Price (€)"}</th>
<th class="col-md-1">{intl d='fedex.bo.default' l="Actions"}</th>
</tr>
</thead>
<tbody>
{loop type="fedex" name="fedex" area=$ID}
{* -- EDIT price slice confirmation dialog ----------------------------------- *}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "price_slice_edit_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}"
dialog_title = {intl d='fedex.bo.default' l="Edit a price slice"}
dialog_message = "<input type=\"hidden\" name=\"operation\" value=\"add\"/>
<input type=\"hidden\" name=\"area\" value=\"{$ID}\"/>
<input type=\"hidden\" name=\"weight\" value=\"{$MAX_WEIGHT}\"/>
<label for=\"price_edit_{$ID}_{$MAX_WEIGHT}\">{intl d='fedex.bo.default' l='Price (€)'}</label>
<input type=\"number\" step=\"0.01\" id=\"price_edit_{$ID}_{$MAX_WEIGHT}\" class=\"form-control\" name=\"price\" value=\"{$PRICE}\" pattern=\"\d+\.?\d*\" required/>"
form_action="{url path="/admin/module/fedex/prices"}"
dialog_ok_label = {intl d='fedex.bo.default' l="Edit"}
dialog_cancel_label = {intl d='fedex.bo.default' l="Cancel"}
}
{* -- Delete price slice confirmation dialog ----------------------------------- *}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "price_slice_delete_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}"
dialog_title = {intl d='fedex.bo.default' l="Delete a price slice"}
dialog_message = "<input type=\"hidden\" name=\"operation\" value=\"delete\"/>
<input type=\"hidden\" name=\"area\" value=\"{$ID}\"/>
<input type=\"hidden\" name=\"weight\" value=\"{$MAX_WEIGHT}\"/>
{intl d='fedex.bo.default' l="Do you really want to delete this slice ?"}"
form_action="{url path="/admin/module/fedex/prices"}"
dialog_ok_label = {intl d='fedex.bo.default' l="Delete"}
dialog_cancel_label = {intl d='fedex.bo.default' l="Cancel"}
}
<tr>
<td>{$MAX_WEIGHT}</td>
<td>{$PRICE}</td>
<td>
<div class="btn-group">
{loop type="auth" name="can_change" role="ADMIN" module="fedex" access="UPDATE"}
<a class="btn btn-default btn-xs" title="{intl d='fedex.bo.default' l='Edit this price slice'}" href="#price_slice_edit_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" data-toggle="modal">
<span class="glyphicon glyphicon-edit"></span>
</a>
<a class="btn btn-default btn-xs" title="{intl d='fedex.bo.default' l='Delete this price slice'}" href="#price_slice_delete_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
{/loop}
</div>
</td>
</tr>
{/loop}
</tbody>
</table>
</div>
{/loop}
</div>
</div>
</div>
</div>
</div>
</div>
{/elseloop}