256 lines
9.9 KiB
HTML
256 lines
9.9 KiB
HTML
{extends file="admin-layout.tpl"}
|
|
|
|
{block name="page-title"}{intl l='Edit a tax rule'}{/block}
|
|
|
|
{block name="check-permissions"}admin.configuration.taxes-rules.edit{/block}
|
|
|
|
{block name="main-content"}
|
|
<div class="taxes-rules edit-taxes-rules">
|
|
|
|
<div id="wrapper" class="container">
|
|
|
|
<ul class="breadcrumb">
|
|
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
|
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
|
<li><a href="{url path='/admin/configuration/taxes_rules'}">{intl l="Taxes rules"}</a></li>
|
|
<li>{intl l='Editing tax rule "%name"' name="{$TITLE}"}</li>
|
|
</ul>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12 general-block-decorator clearfix">
|
|
|
|
<div class="title title-without-tabs">
|
|
{intl l="Edit tax rule $TITLE"}
|
|
</div>
|
|
|
|
<form action="" method="post">
|
|
|
|
<div class="form-group">
|
|
<label for="" class="label-control">{intl l="Choose a country"} :</label>
|
|
<div class="input-group">
|
|
<select name="" id="" data-toggle="selectpicker">
|
|
<option value="">France</option>
|
|
<option value="">Spanish</option>
|
|
</select>
|
|
<span class="input-group-btn">
|
|
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span></button>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<p><strong>{intl l="Countries that have the same tax rule"} :<strong></p>
|
|
<p class="lead">
|
|
<span class="label label-info">Italy</span>
|
|
<span class="label label-info">England</span>
|
|
<span class="label label-info">Japan</span>
|
|
</p>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
|
|
<div id="panel" class="panel panel-default place">
|
|
<div class="panel-heading">
|
|
<h3 class="panel-title">Create a tax rule</h3>
|
|
</div>
|
|
<div class="panel-body">
|
|
|
|
<div class="drop-group droppable add-to-group">
|
|
<p class="drop-message">
|
|
<span class="glyphicon glyphicon-plus"></span>
|
|
<span class="message">{intl l="Add tax to this group"}</span>
|
|
</p>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="panel-footer droppable create-group">
|
|
<p class="drop-message">
|
|
<span class="glyphicon glyphicon-plus"></span>
|
|
<span class="message">{intl l="Drop tax here to create a tax group"}</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<a href="#confirmation_dialog" data-toggle="modal" id="apply-taxes-rules" class="btn btn-default btn-primary btn-block"><span class="glyphicon glyphicon-check"></span> {intl l="Apply"}</a>
|
|
|
|
</div>
|
|
<div class="col-md-6">
|
|
|
|
<div id="panel-list" class="panel panel-default take">
|
|
<div class="panel-heading">
|
|
<h3 class="panel-title">List of taxes</h3>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="draggable">Cras justo odio</div>
|
|
<div class="draggable">Dapibus ac facilisis in</div>
|
|
<div class="draggable">Morbi leo risus</div>
|
|
<div class="draggable">Porta ac consectetur ac</div>
|
|
<div class="draggable">Vestibulum at eros</div>
|
|
</div>
|
|
<div class="panel-footer droppable remove-from-group">
|
|
<p class="drop-message">
|
|
<span class="glyphicon glyphicon-minus"></span>
|
|
<span class="message">{intl l="Drop tax here to delete from group"}</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{* Confirmation dialog *}
|
|
|
|
{capture "confirmation_dialog"}
|
|
|
|
<form action="" method="post">
|
|
<div class="form-group">
|
|
<select name="" id="" data-toggle="selectpicker" multiple>
|
|
<option value="1">France</option>
|
|
<option value="2">England</option>
|
|
<option value="3">Spain</option>
|
|
</select>
|
|
</div>
|
|
</form>
|
|
|
|
{/capture}
|
|
|
|
{include
|
|
file = "includes/generic-create-dialog.html"
|
|
|
|
dialog_id = "confirmation_dialog"
|
|
dialog_title = {intl l="Create a new tax rule"}
|
|
dialog_body = {$smarty.capture.confirmation_dialog nofilter}
|
|
|
|
dialog_ok_label = {intl l="Create this tax rule"}
|
|
|
|
form_action = {url path='/admin/categories/create'}
|
|
|
|
form_error_message = $form_error_message
|
|
}
|
|
|
|
{/block}
|
|
|
|
{block name="javascript-initialization"}
|
|
|
|
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
|
|
<script src="{$asset_url}"></script>
|
|
{/javascripts}
|
|
|
|
{javascripts file='assets/js/main.js'}
|
|
<script src="{$asset_url}"></script>
|
|
{/javascripts}
|
|
|
|
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
|
|
{literal}
|
|
<script>
|
|
$(function() {
|
|
|
|
// Cache jQuery Objects
|
|
var $group = $('#panel');
|
|
var $list = $('#panel-list');
|
|
|
|
// Build array of taxes rules
|
|
$('#apply-taxes-rules').click(function(){
|
|
var taxesRules = [],
|
|
index;
|
|
|
|
$('.drop-group', $group).each(function(i){
|
|
var $this = $(this);
|
|
index = i;
|
|
taxesRules[index] = [];
|
|
|
|
$('.drag', $this).each(function(j){
|
|
taxesRules[index][j] = [];
|
|
taxesRules[index][j] = $(this).text();
|
|
});
|
|
});
|
|
|
|
console.log(taxesRules);
|
|
});
|
|
|
|
// Default options for draggable
|
|
var dragOptions = {
|
|
cursor: 'move',
|
|
containment: "document",
|
|
opacity: 0.5,
|
|
revert: "invalid", // when not dropped, the item will revert back to its initial position
|
|
zIndex: 10
|
|
};
|
|
|
|
// Default options for sortabble
|
|
var sortOptions = {
|
|
cursor: 'move',
|
|
items: 'div',
|
|
update: function( event, ui ){
|
|
// Check if we have an empty group
|
|
var $zone = $('.add-to-group', $group);
|
|
if($zone.size() > 1 && $(this).find('> div').size() == 0){ // Remove empty group only if we have more than 1 group
|
|
$(this).slideUp(function(){ $(this).remove(); });
|
|
}
|
|
}
|
|
};
|
|
|
|
// Default options for droppable
|
|
var dropOptions = {
|
|
accept: "#panel-list .draggable", // Controls which draggable elements are accepted
|
|
hoverClass: "over",
|
|
drop: function( event, ui ) {
|
|
var $drop = $(this);
|
|
|
|
if($(this).hasClass('create-group')){
|
|
// Check if we have already an empty group
|
|
var $empty_group = $group.find('.drop-group:not(:has(> div))');
|
|
if($empty_group.size() > 0){ // if yes (Use the first empty group)
|
|
$drop = $empty_group.filter(':first');
|
|
}else{ //if no (Create a new group)
|
|
$drop = $group.find('.drop-group:last-child').clone().appendTo($group.find('.panel-body'));
|
|
|
|
// Remove taxes
|
|
$drop.find('> div').remove();
|
|
|
|
// Make the new group droppable
|
|
$drop
|
|
.droppable(dropOptions)
|
|
.sortable(sortOptions);
|
|
}
|
|
}
|
|
$("<div></div>").addClass('drag').text( ui.draggable.text() ).appendTo( $drop );
|
|
ui.draggable.remove();
|
|
}
|
|
};
|
|
|
|
|
|
// Make the list of taxes draggable
|
|
$('.draggable', $list).draggable(dragOptions);
|
|
|
|
|
|
// let the drop-group be droppable & sortable, accepting the tax items
|
|
$('.droppable', $group)
|
|
.droppable(dropOptions)
|
|
.sortable(sortOptions);
|
|
|
|
$('.place .panel-body').sortable(sortOptions);
|
|
|
|
// let the gallery be droppable as well, accepting items from the trash
|
|
$('.remove-from-group', $list)
|
|
.droppable({
|
|
accept: "#panel .drag",
|
|
hoverClass: 'over',
|
|
drop: function( event, ui ) {
|
|
|
|
$("<div></div>").addClass('draggable').text( ui.draggable.text() ).draggable(dragOptions).appendTo( $list.find('.panel-body') );
|
|
ui.draggable.remove();
|
|
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{/literal}
|
|
|
|
{/block} |