Il manquait quelques fichiers dans Git

This commit is contained in:
2024-01-18 12:02:32 +01:00
parent 485580e0b2
commit 15053f58f2
194 changed files with 63120 additions and 9403 deletions

View File

@@ -0,0 +1,450 @@
{form name="credit-note.create"}
{if $creditNote->getInvoiceRef() }
{$invoiced = true}
{else}
{$invoiced = false}
{/if}
<form method="POST" action="{if $creditNote->getId() != null}{url path="/admin/credit-note/%id/_update" id={$creditNote->getId()}}{else}{url path="/admin/credit-note/create"}{/if}">
{if $app->request->get('success-url')}
<input type="hidden" name="success-url" value="{$app->request->get('success-url')}" />
{/if}
<input type="hidden" name="credit-note-create[action]" value="{if $creditNote->getId() != null}update{else}create{/if}" />
<div class="row">
<div class="col-md-6">
<div class="alert alert-info">
{form_field field='currency_id'}
{if $creditNote->getOrder()}
<input type="hidden" name="{$name}" value="{$creditNote->getCurrency()->getId()}">
{intl l="This credit note use the currency : <strong>%currency</strong>" d="creditnote.bo.default" currency=$creditNote->getCurrency()->getSymbol()}
{else}
{capture name="currency"}
<select name="{$name}" class="js-field-currency" {if $invoiced}disabled{/if}>
{loop type="currency" name="currency"}
<option value="{$ID}" {if {$creditNote->getCurrency()->getId()} == $ID}selected{/if}>{$SYMBOL}</option>
{/loop}
</select>
{/capture}
{intl l="This credit note use the currency : %currency" d="creditnote.bo.default" currency=$smarty.capture.currency}
{/if}
{/form_field}
</div>
{if $creditNote->getRef()}
<div class="alert alert-warning">
{intl l="Credit note ref : <strong>%ref</strong>" d="creditnote.bo.default" ref=$creditNote->getRef()}
</div>
{/if}
{if $creditNote->getInvoiceRef()}
<div class="alert alert-success">
{intl l="Invoice ref : <strong>%ref</strong>" d="creditnote.bo.default" ref=$creditNote->getInvoiceRef()}
</div>
{/if}
{* Credit note status select *}
<div class="form-group">
<label>{intl l="Status : " d="creditnote.bo.default"}</label>
{form_field field='status_id'}
<select class="form-control js-select-status" name="{$name}" {if $invoiced}disabled{/if}>
{loop type="credit-note-status" name="credit-note-status" current_status_id=$creditNote->getStatusId()}
<option value="{$ID}" {if $creditNote->getStatusId() == $ID}selected{/if} data-color="{$COLOR}">
{if $TITLE}{$TITLE}{else}{$CODE}{/if}
</option>
{/loop}
</select>
{/form_field}
</div>
{* Credit note type select *}
<div class="form-group">
<label>{intl l="Type : " d="creditnote.bo.default"}</label>
{form_field field='type_id'}
<select class="form-control js-select-type" name="{$name}" {if $invoiced}disabled{/if}>
{loop type="credit-note-type" name="credit-note-type"}
<option value="{$ID}" {if $creditNote->getTypeId() == $ID}selected{/if} data-color="{$COLOR}">
{if $TITLE}{$TITLE}{else}{$CODE}{/if}
</option>
{/loop}
</select>
{/form_field}
</div>
{* Credit note customer select *}
<div class="form-group">
<label>{intl l="Customer : " d="creditnote.bo.default"}</label>
{form_field field='customer_id'}
<select {if $invoiced}disabled{/if} class="form-control js-select-customer" name="{$name}" data-placeholder="{intl l="Search..." d="creditnote.bo.default"}" data-url="{url path="/admin/credit-note/ajax/search/customer"}"
{if $creditNote->getId() || $creditNote->getCustomer() && $creditNote->getOrder()}disabled{/if}>
{if $creditNote->getCustomer()}
{loop type="customer" name="customer" backend_context=true current=false id=$creditNote->getCustomer()->getId()}
<option value="{$ID}">{$REF} : ({$FIRSTNAME} {$LASTNAME})</option>
{/loop}
{else}
<option value="">{intl l="Search..." d="creditnote.bo.default"}</option>
{/if}
</select>
{/form_field}
</div>
{* Credit note order select *}
{if $creditNote->getCreditNoteType()->getRequiredOrder() && !$creditNote->getOrder()}
{$hasError = true}
{/if}
<div class="form-group {if $hasError}has-error{/if}">
<label>{intl l="Order : " d="creditnote.bo.default"}</label>
{form_field field='order_id'}
<select {if $invoiced}disabled{/if} class="form-control js-select-order" name="{$name}" data-customer-id="{$creditNote->getCustomerId()}" data-url="{url path="/admin/credit-note/ajax/search/order"}" {if $creditNote->getId()}disabled{/if}>
{if $creditNote->getOrder() || $creditNote->getCustomer()}
<option value="" {if !$creditNote->getOrder()}selected{/if}>{intl l="No" d="creditnote.bo.default"}</option>
{if $creditNote->getCustomer()}
{$customer = $creditNote->getCustomerId()}
{$order = ''}
{else}
{$customer = '*'}
{$order = $creditNote->getOrderId()}
{/if}
{loop type="order" name="order" customer=$customer backend_context=true id=$order}
{$order_id = $ID}
{loop type="order_address" name="order_address" id=$DELIVERY_ADDRESS backend_context=true}
{if $STATUS != 1 && $STATUS != 5}
<option value="{$order_id}" {if $creditNote->getOrderId() == $order_id}selected{/if}>{$REF} : ({$FIRSTNAME} {$LASTNAME})</option>
{/if}
{/loop}
{/loop}
{else}
<option value="">{intl l="Search..." d="creditnote.bo.default"}</option>
{/if}
</select>
{/form_field}
</div>
</div>
{* address invoice *}
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">{intl l="Invoice address" d="creditnote.bo.default"}</div>
<div class="panel-body">
{$other = false}
<div class="form-group">
{form_field field='invoice_address_id'}
{if !$data}
{$other = true}
{/if}
<select class="form-control js-select-invoice-address" name="{$name}" {if !$creditNote->getCustomer()}disabled{/if} {if $invoiced}disabled{/if}>
{if $creditNote->getCustomer()}
{loop type="address" name="address-invoice" customer=$creditNote->getCustomer()->getId()}
<option value="{$ID}" {if $data == $ID}selected{/if}>
({$FIRSTNAME} {$LASTNAME}) : {$ADDRESS1} {$CITY} {$ZIPCODE}
</option>
{/loop}
<option value="" {if $other}selected{/if}>{intl l="Other" d="creditnote.bo.default"}</option>
{/if}
</select>
{/form_field}
</div>
<div class="row js-other-area {if !$other or !$creditNote->getCustomer()}hide{/if}">
{form_field field='invoice_address_title'}
<div class="form-group col-md-3">
<label for="">{intl l="Title" d="creditnote.bo.default"}</label>
{if !$creditNote->getCreditNoteAddress()->getCustomerTitleId()}
{else}
{$data = $creditNote->getCreditNoteAddress()->getCustomerTitleId()}
{/if}
<select name="{$name}" class="form-control" {if $invoiced}disabled{/if}>
{loop type="title" name="title.invoice"}
<option value="{$ID}" {if $data == $ID}selected{/if} >{$LONG}</option>
{/loop}
</select>
</div>
{/form_field}
{form_field field='invoice_address_firstname'}
<div class="form-group col-md-4">
<label for="">{intl l="Firstname" d="creditnote.bo.default"}</label>
<input type="text" name="{$name}" class="form-control" value="{$creditNote->getCreditNoteAddress()->getFirstname()}" {if $invoiced}disabled{/if} />
</div>
{/form_field}
{form_field field='invoice_address_lastname'}
<div class="form-group col-md-5">
<label for="">{intl l="Lastname : " d="creditnote.bo.default"}</label>
<input type="text" name="{$name}" class="form-control" value="{$creditNote->getCreditNoteAddress()->getLastname()}" {if $invoiced}disabled{/if} />
</div>
{/form_field}
{form_field field='invoice_address_address1'}
<div class="form-group col-md-12">
<label for="">{intl l="Address : " d="creditnote.bo.default"}</label>
<input type="text" name="{$name}" class="form-control" value="{$creditNote->getCreditNoteAddress()->getAddress1()}" {if $invoiced}disabled{/if} />
</div>
{/form_field}
{form_field field='invoice_address_address2'}
<div class="form-group col-md-12">
<label for="">{intl l="Address complement : " d="creditnote.bo.default"}</label>
<input type="text" name="{$name}" class="form-control" value="{$creditNote->getCreditNoteAddress()->getAddress2()}" {if $invoiced}disabled{/if} />
</div>
{/form_field}
{form_field field='invoice_address_city'}
<div class="form-group col-md-6">
<label for="">{intl l="City : " d="creditnote.bo.default"}</label>
<input type="text" name="{$name}" class="form-control" value="{$creditNote->getCreditNoteAddress()->getCity()}" {if $invoiced}disabled{/if} />
</div>
{/form_field}
{form_field field='invoice_address_zipcode'}
<div class="form-group col-md-6">
<label for="">{intl l="Zipcode : " d="creditnote.bo.default"}</label>
<input type="text" name="{$name}" class="form-control" value="{$creditNote->getCreditNoteAddress()->getZipcode()}" {if $invoiced}disabled{/if} />
</div>
{/form_field}
{form_field field='invoice_address_country_id'}
<div class="form-group col-md-6">
<label for="">{intl l="Country : " d="creditnote.bo.default"}</label>
<select name="{$name}" class="form-control" {if $invoiced}disabled{/if}>
{if !$creditNote->getCreditNoteAddress()->getCountryId()}
{$data = 64}
{loop type="country" name="country-address-invoice"}
{if $IS_DEFAULT}
{$data = $ID}
{/if}
{/loop}
{else}
{$data = $creditNote->getCreditNoteAddress()->getCountryId()}
{/if}
{loop type="country" name="country-address-invoice" visible=true}
<option value="{$ID}" {if $data == $ID}selected{/if}>{$TITLE}</option>
{/loop}
</select>
</div>
{/form_field}
{form_field field='invoice_address_company'}
<div class="form-group col-md-6">
<label for="">{intl l="Company : " d="creditnote.bo.default"}</label>
<input type="text" name="{$name}" class="form-control" value="{$creditNote->getCreditNoteAddress()->getCompany()}" {if $invoiced}disabled{/if} />
</div>
{/form_field}
</div>
</div>
</div>
</div>
{* Credit note order *}
{if $creditNote->getOrderId()}
<div class="col-md-12">
{include file="includes/credit-note-order.html" invoiced=$invoiced}
</div>
{/if}
{* Credit note order *}
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">{intl l="Free amount : " d="creditnote.bo.default"}</div>
<div class="panel-body">
<div class="js-ajax-free-amount" data-ajax-url="{url path="/admin/credit-note/ajax/load/order"}">
<table class="table js-table-free-amount">
<thead>
<tr>
<th width="20%">
{intl l="Type" d="creditnote.bo.default"}
</th>
<th width="30%">
{intl l="Title" d="creditnote.bo.default"}
</th>
<th width="15%">
{intl l="Amount without tax %currency" d="creditnote.bo.default" currency=$creditNote->getCurrency()->getSymbol()}
</th>
<th width="20%">
{intl l="Tax rule" d="creditnote.bo.default"}
</th>
<th width="15%">
{intl l="Amount with tax %currency" d="creditnote.bo.default" currency=$creditNote->getCurrency()->getSymbol()}
</th>
<th>
{if !$invoiced}
<button class="btn btn-success js-action-add" data-key="{$creditNote->getCreditNoteDetails()|count - 1}" title="{intl l="Add a free amount" d="creditnote.bo.default"}">+</button>
{/if}
</th>
</tr>
</thead>
<tbody>
{$i = 0}
{foreach from=$creditNote->getCreditNoteDetails() key=key item=creditNoteDetail}
{if !$creditNoteDetail->getOrderProductId()}
{$i = $i + 1}
{include file="includes/credit-note-free-amount.html"}
{/if}
{/foreach}
<tr class="js-no-free-amount {if $i}hidden{/if}">
<td colspan="5">
<div class="text-center">
{intl l="No free amount." d="creditnote.bo.default"}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-md-6">
{if $creditNote->getOrder() !== null && $creditNote->getOrder()->getDiscount() > 0}
<div class="panel panel-default">
<div class="panel-heading">{intl l="Order discount informations : " d="creditnote.bo.default"}</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6">
{form_field field='discount_without_tax'}
<div class="form-group">
<span>{intl l="Discount without tax : " d="creditnote.bo.default"}</span>
<input min="0" max="{$creditNote->getOrder()->getDiscount()}" step="0.00001" type="number" name="{$name}" class="form-control js-action-refresh" value="{$creditNote->getDiscountWithoutTax()}" {if $invoiced || $creditNote->getCreditNoteType()->getCode() == 'order_full_refund'}disabled{/if} />
</div>
{/form_field}
</div>
<div class="col-md-6">
{form_field field='discount_with_tax'}
<div class="form-group">
<span>{intl l="Discount with tax : " d="creditnote.bo.default"}</span>
<input min="0" max="{$creditNote->getOrder()->getDiscount()}" step="0.01" type="number" name="{$name}" class="form-control js-action-refresh" value="{$creditNote->getDiscountWithTax()}" {if $invoiced || $creditNote->getCreditNoteType()->getCode() == 'order_full_refund'}disabled{/if} />
</div>
{/form_field}
</div>
</div>
</div>
</div>
{/if}
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">{intl l="Credit Note Informations : " d="creditnote.bo.default"}</div>
<div class="panel-body">
<div class="row">
<div class="col-md-4 text-center">
<h2>
<span>{intl l="Total without tax : " d="creditnote.bo.default"}</span><span>{format_money number=$creditNote->getTotalPrice() currency_id=$creditNote->getCurrencyId()}</span>
</h2>
</div>
<div class="col-md-4 text-center">
<h2>
<span>{intl l="Taxes : " d="creditnote.bo.default"}</span><span>{format_money number=($creditNote->getTotalPriceWithTax() - $creditNote->getTotalPrice()) currency_id=$creditNote->getCurrencyId()}</span>
</h2>
</div>
<div class="col-md-4 text-center">
<h2>
<span>{intl l="Total with tax : " d="creditnote.bo.default"}</span><span>{format_money number=$creditNote->getTotalPriceWithTax() currency_id=$creditNote->getCurrencyId()}</span>
</h2>
</div>
</div>
</div>
</div>
</div>
{* Credit note comment *}
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">{intl l="Internal comment : " d="creditnote.bo.default"}</div>
<div class="panel-body">
{form_field field='comment'}
<textarea class="form-control" name="{$name}" rows="4">{$data}</textarea>
{/form_field}
</div>
<div class="panel-body">
{if $creditNote->getId()}
{ifloop rel="credit-note-comment"}
<div style="width:100%; max-height: 250px; overflow-y: scroll;">
<div class="alert alert-info">
{loop type="credit-note-comment" name="credit-note-comment" credit_note_id=$creditNote->getId() order="id-reverse"}
<strong>{intl l="User" d="creditnote.bo.default"} : {$ADMIN_FIRST_NAME} {$ADMIN_LAST_NAME}</strong><strong class="pull-right">{format_date date=$CREATE_DATE} :</strong>
<br/><br/>
<div>
{$COMMENT|nl2br nofilter}
</div>
<hr/>
{/loop}
</div>
</div>
{/ifloop}
{elseloop rel="credit-note-comment"}
<div class="alert alert-info">
{intl l="No comments found for this credit note" d="creditnote.bo.default"}
</div>
{/elseloop}
{/if}
</div>
</div>
</div>
{if $invoiced}
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">{intl l="Credit note used : " d="creditnote.bo.default"}</div>
<div class="panel-body">
{loop type="order-credit-note" name="order-credit-note" credit_note_id=$creditNote->getId()}
{loop type="order" name="order" customer="*" backend_context=true id=$ORDER_ID}
<div class="alert alert-success">
{intl l="Used by order :" d="creditnote.bo.default"} <a href="{url path="/admin/order/update/%id" id=$ID}">{$REF}</a>
</div>
{/loop}
{/loop}
</div>
</div>
</div>
{/if}
{* Credit note version *}
{*{if $creditNote->getId()}
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">{intl l="Credit note versions : " d="creditnote.bo.default"}</div>
<div class="panel-body">
{ifloop rel="credit-note-version"}
{loop type="credit-note-version" name="credit-note-version" id=$creditNote->getId()}
// toto : credit note version
{/loop}
{/ifloop}
{elseloop rel="credit-note-version"}
<div class="alert alert-info">
{intl l="No version found for this credit note" d="creditnote.bo.default"}
</div>
{/elseloop}
</div>
</div>
</div>
{/if}*}
<div class="col-md-12 modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span>
{intl l="Cancel" d="creditnote.bo.default"}
</button>
<button type="submit" class="btn btn-primary">
{if $creditNote->getId() != null}
{intl l="Update credit note" d="creditnote.bo.default"}
{else}
{intl l="Create credit note" d="creditnote.bo.default"}
{/if}
</button>
</div>
{form_field field='ui_target'}
<input type="hidden" name="{$name}" value="{$data}" />
{/form_field}
{form_field field='ui_target_id'}
<input type="hidden" name="{$name}" value="{$data}" />
{/form_field}
</form>
{/form}

View File

@@ -0,0 +1,364 @@
"use strict";
(function($) {
var $modal = $('#modal-credit-note-delete');
$modal.on('show.bs.modal', function(event){
var url = $(event.relatedTarget).data('ajax-url');
$modal.find('form').attr('action', url);
});
})(jQuery);
(function($){
var $modal = $('#modal-credit-note');
var currentRequest;
var lastAjaxUrl;
// fix bug bootstrap 3 and select2
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
/****** Modal methods ******/
$modal.loaderOff = function(){
$modal.find('.modal-loader').addClass('hidden');
$modal.find('.modal-body').removeClass('hidden');
};
$modal.loaderOn = function(){
$modal.find('.modal-loader').removeClass('hidden');
$modal.find('.modal-body').addClass('hidden');
};
$modal.reset = function(){
$modal.hideError();
$modal.loaderOn();
};
$modal.loadAjax = function(event, data){
if (typeof data === 'undefined') {
data = {};
}
// kill last ajax request if not if it's not finished
if (currentRequest) currentRequest.abort();
var url = $(event.relatedTarget).data('ajax-url');
if (typeof url === 'undefined') {
url = lastAjaxUrl;
} else {
lastAjaxUrl = url;
$modal.loaderOn();
}
if ($(event.relatedTarget).data('success-url')) {
data['success-url'] = $(event.relatedTarget).data('success-url');
}
if (!data['credit-note-create[action]']) {
data['credit-note-create[action]'] = 'view';
}
if ($(event.relatedTarget).data('credit-note-id')) {
data['credit-note-create[credit_note_id]'] = $(event.relatedTarget).data('credit-note-id');
}
if ($(event.relatedTarget).data('order-id')) {
data['credit-note-create[order_id]'] = $(event.relatedTarget).data('order-id');
}
if ($(event.relatedTarget).data('order-product-id')) {
data['credit-note-create[order_product_quantity][' + $(event.relatedTarget).data('order-product-id') + ']'] = 1;
}
if ($(event.relatedTarget).data('type-id')) {
data['credit-note-create[type_id]'] = $(event.relatedTarget).data('type-id');
}
if ($(event.relatedTarget).data('customer-id')) {
data['credit-note-create[customer_id]'] = $(event.relatedTarget).data('customer-id');
}
// to avoid a display bug with select2
setTimeout(function(data){
// ajax start
currentRequest = $.ajax({
url: url,
data: data,
method: 'POST'
});
// ajax success
currentRequest.done(function(data){
$modal.loaderOff();
$modal.find('.modal-body').html(data);
$modal.modalReady();
});
// ajax error
currentRequest.fail(function(jqXHR, textStatus){
$modal.displayError(jqXHR, textStatus);
});
}, 100, data);
};
$modal.displayError = function(jqXHR, textStatus){
if (jqXHR.statusText === 'abort') return;
$modal.loaderOff();
$modal.find('.modal-body').addClass('hidden');
var $error = $modal.find('.modal-error').removeClass('hidden');
$error.find('.textStatus').html(textStatus);
$error.find('iframe').contents().find('html').html(jqXHR.responseText);
};
$modal.hideError = function(){
$modal.find('.modal-error').addClass('hidden').find('iframe').contents().find('html').empty();
};
/****** End Modal methods ******/
/****** Modal events ******/
$modal.on('show.bs.modal', function(event){
$modal.loadAjax(event);
});
$modal.on('hidden.bs.modal', function(){
$modal.reset();
lastAjaxUrl = undefined;
});
/****** End Modal events ******/
$modal.modalReady = function(){
var $form = $modal.find('.modal-body form');
var initSelect = function($target){
return $target.select2({
templateResult: function(data){
if (!data.id) return data.text;
var prefix = data.element.dataset.color ? '<span class="label" style="background-color: ' + data.element.dataset.color + ';width: 50px;">&nbsp;</span>' : '';
return $(prefix + '<span>' + data.text + '</span>');
},
templateSelection: function(data){
var prefix = data.element.dataset.color ? '<span class="label" style="background-color: ' + data.element.dataset.color + ';width: 50px;">&nbsp;</span>' : '';
return $(prefix + '<span>' + data.text + '</span>');
}
});
};
var initAjaxSelect = function($target){
return $target.select2({
ajax: {
url: $target.data('url'),
dataType: 'json',
delay: 250,
data: function (params){
return {
q: params.term,
customerId: $target.data('customer-id')
};
},
processResults: function (data){
return {results: data.items};
},
error: function(jqXHR, textStatus){
if (jqXHR.statusText === 'abort') return;
$target.select2('destroy');
$modal.displayError(jqXHR, textStatus);
},
cache: false
},
minimumInputLength: 3,
placeholder: $target.data('placeholder'),
templateResult: function(data){
if (data.loading) return data.text;
var markup = "<div class='select2-result-repository clearfix'>";
markup += data.ref + ' : (' + data.firstname + ' ' + data.lastname + ')' + '</br><small>' + data.address + '</small>';
markup += "</div>";
return $(markup);
},
templateSelection: function(data){
if (data.text) {
return data.text;
}
return data.ref + ' : (' + data.firstname + ' ' + data.lastname + ')';
}
});
};
var $selectType = initSelect($form.find('.js-select-type'));
var $selectStatus = initSelect($form.find('.js-select-status'));
var $selectCustomer = initAjaxSelect($form.find('.js-select-customer'));
var $selectInvoiceAddress = initSelect($form.find('.js-select-invoice-address'));
var $selectOrder = $form.find('.js-select-order');
if ($selectOrder.data('customer-id')) {
initSelect($selectOrder);
} else {
initAjaxSelect($selectOrder);
}
var getFormData = function(data){
var formData = $form.serializeArray();
for (var i in formData) {
for (var e in data) {
if (formData[i].name === e) {
formData[i].value = data[e];
delete data[e];
}
}
}
for (var e in data) {
formData.push({
name: i,
value: data[i]
}
);
}
return formData
};
$selectOrder.on('select2:select', function(event){
$modal.loadAjax(event, getFormData({
'credit-note-create[order_id]': event.params.data.id,
'credit-note-create[action]': 'refresh'
}));
});
$selectCustomer.on('select2:select', function(event){
$modal.loadAjax(event, getFormData({
'credit-note-create[customer_id]': event.params.data.id,
'credit-note-create[action]': 'refresh'
}));
});
$selectStatus.on('select2:select', function(event){
$modal.loadAjax(event, getFormData({
'credit-note-create[action]': 'refresh'
}));
});
$selectInvoiceAddress.on('select2:select', function(event){
$modal.loadAjax(event, getFormData({
'credit-note-create[action]': 'refresh'
}));
});
$selectType.on('select2:select', function(event){
$modal.loadAjax(event, getFormData({
'credit-note-create[action]': 'refresh'
}));
});
$form.on('change', '.js-field-currency', function(event){
$modal.loadAjax(event, getFormData({
'credit-note-create[action]': 'refresh'
}));
});
$form.on('change', '.js-order-product-quantity', function(event){
$modal.loadAjax(event, getFormData({
'credit-note-create[action]': 'refresh'
}));
});
$form.on('keyup change', '.js-action-refresh', function(event){
if ($(this).val().length) {
refreshWithTimer($form, event);
}
});
/*******************************************/
/*********** Table Free Amount *************/
/*******************************************/
var $tableFreeAmount = $form.find('.js-table-free-amount');
var templateFreeAmount = $('#template-credit-note-free-amount').html();
$tableFreeAmount.on('click', '.js-action-add', function(event){
event.preventDefault();
$(this).data('key', parseInt($(this).data('key')) + 1);
var templateFreeAmountWithKey = templateFreeAmount.replace(/\[\]/g, '[' + $(this).data('key') + ']');
$tableFreeAmount.find('tbody').append(templateFreeAmountWithKey);
if ($tableFreeAmount.find('tbody tr').not('.js-no-free-amount').length) {
$tableFreeAmount.find('.js-no-free-amount').addClass('hidden');
} else {
$tableFreeAmount.find('.js-no-free-amount').removeClass('hidden');
}
});
$tableFreeAmount.on('click', '.js-action-delete', function(event){
event.preventDefault();
$(this).parents('tr').remove();
if ($tableFreeAmount.find('tbody tr').not('.js-no-free-amount').length) {
$tableFreeAmount.find('.js-no-free-amount').addClass('hidden');
} else {
$tableFreeAmount.find('.js-no-free-amount').removeClass('hidden');
}
$modal.loadAjax(event, getFormData({
'credit-note-create[action]': 'refresh'
}));
});
$tableFreeAmount.on('change', '.js-field-tax-rule', function(event){
$(this).parents('tr').find('.js-field-amount-without-tax').trigger('keyup');
});
var currentRequestFreeAmount;
$tableFreeAmount.on('keyup', '.js-field-amount-without-tax, .js-field-amount-with-tax', function(event){
if (currentRequestFreeAmount) currentRequestFreeAmount.abort();
var $th = $(this), $thr = $th.parents('tr');
currentRequestFreeAmount = $.ajax({
url: $(this).data('url'),
dataType: 'json',
data: {
price: parseFloat($(this).val()),
tax_rule: parseInt($thr.find('.js-field-tax-rule').val())
}
});
// ajax success
currentRequestFreeAmount.done(function(data){
if ($th.hasClass('js-field-amount-without-tax')) {
$thr.find('.js-field-amount-with-tax').val(data.result);
} else {
$thr.find('.js-field-amount-without-tax').val(data.result);
}
refreshWithTimer(event);
});
// ajax error
currentRequestFreeAmount.fail(function(jqXHR, textStatus){
if (jqXHR.statusText === 'abort') return;
$modal.displayError(jqXHR, textStatus);
});
});
var timer = null;
function refreshWithTimer(event) {
if (timer !== null) {
clearTimeout(timer);
timer = null;
}
timer = setTimeout(function(){
$modal.loadAjax(event, getFormData({
'credit-note-create[action]': 'refresh'
}));
}, 700);
}
/*******************************************/
/********* End Table Free Amount ***********/
/*******************************************/
};
})(
jQuery
);

View File

@@ -0,0 +1,46 @@
{extends file="admin-layout.tpl"}
{block name="no-return-functions"}
{$admin_current_location = 'credit-notes'}
{/block}
{block name="page-title"}{intl l='Credit notes' d="creditnote.bo.default"}{/block}
{block name="check-resource"}admin.credit-note{/block}
{block name="check-access"}view{/block}
{block name="main-content"}
<div class="credit-notes" id="module-credit-note">
<div id="wrapper" class="container">
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="#">{intl l="Credit notes" d="creditnote.bo.default"}</a></li>
</ul>
{hook name="credit-notes.top"}
<div class="row">
<div class="col-md-12">
<div class="general-block-decorator">
{include file="includes/credit-note-table.html"}
</div>
</div>
</div>
{hook name="credit-notes.bottom"}
</div>
{include file="includes/credit-note-modal.html"}
</div>
{/block}
{block name="javascript-initialization"}
{include file="includes/credit-note-js.html"}
{/block}
{block name="javascript-last-call"}
{hook name="credit-notes.js"}
{/block}

View File

@@ -0,0 +1,5 @@
<div class="row" id="module-credit-note">
<div class="col-md-12 general-block-decorator">
{include file="includes/credit-note-table.html" customer_id=$customer_id}
</div>
</div>

View File

@@ -0,0 +1,51 @@
<script type="text/html" id="credit_note_menu-template">
{loop name="menu-auth-credit-note" type="auth" role="ADMIN" resource="admin.order" access="VIEW"}
<li class="{if $admin_current_location == 'credit-note'}active{/if}" id="credit_note_menu">
<a title="{intl l="Credit Notes" d="creditnote.bo.default"}" href="#collapse-credit-notes">
<span class="icon-orders"></span>
<span class="item-text">{intl l="Credit Notes" d="creditnote.bo.default"} <span class="caret"></span></span>
</a>
<ul id="collapse-credit-notes" class="collapse {if $admin_current_location == 'credit-note'}in{/if}" role="menu">
<li role="menuitem">
<a class="clearfix" href="{url path='/admin/credit-note'}">
<span class="pull-left">{intl l="All Credit Notes" d="creditnote.bo.default"}</span>
<span class="label label-default pull-right">{count type="credit-note" customer="*" backend_context="1"}</span>
</a>
</li>
{loop name="credit-note-status-list" type="credit-note-status"}
{$count = {count type="credit-note" customer="*" backend_context="1" status_id=$ID}}
{if $count}
<li role="menuitem">
<a class="clearfix" href="{url path="/admin/credit-note" status_id=$ID}">
<span class="pull-left">{$TITLE}</span>
<span class="label pull-right" style="background-color: {$COLOR};">{$count}</span>
</a>
</li>
{/if}
{/loop}
</ul>
</li>
{/loop}
</script>
<script type="text/javascript">
"use strict";
(function($, $module){
$($("#credit_note_menu-template").html()).insertAfter('#orders_menu');
$('#credit_note_menu > a').on('click', function(event){
event.preventDefault();
if ($('#collapse-credit-notes').hasClass('in')) {
$('#collapse-credit-notes').removeClass('in').css('height', 'auto');
$('#credit_note_menu').removeClass('active');
} else {
$('#collapse-credit-notes').addClass('in').css('height', 'auto');
$('#credit_note_menu').addClass('active');
}
});
})(
jQuery, jQuery('#credit-note')
);
</script>

View File

@@ -0,0 +1,41 @@
{if $creditNoteDetails|count > 0}
<table class="table alert alert-info text-center">
<thead>
<tr>
<th class="text-center">
{intl l="Credit Note ref" d="creditnote.bo.default"}
</th>
<th class="text-center">
{intl l="Status" d="creditnote.bo.default"}
</th>
<th class="text-center">
{intl l="Quantity" d="creditnote.bo.default"}
</th>
</tr>
</thead>
<tbody>
{foreach from=$creditNoteDetails item=creditNoteDetail}
{if $creditNoteDetail->getQuantity() > 0}
<tr>
<td class="text-center">
<a href="#" data-toggle="modal"
data-target="#modal-credit-note"
data-action="view"
data-ajax-url="{url path="/admin/credit-note/%id" id=$creditNoteDetail->getCreditNote()->getId()}">
{$creditNoteDetail->getCreditNote()->getRef()}
</a>
</td>
<td class="text-center">
{loop type="credit-note-status" name="credit-note-status" id=$creditNoteDetail->getCreditNote()->getStatusId()}
<span class="label" style="background-color: {$COLOR}">{$TITLE}</span>
{/loop}
</td>
<td class="text-center">
{$creditNoteDetail->getQuantity()}
</td>
</tr>
{/if}
{/foreach}
</tbody>
</table>
{/if}

View File

@@ -0,0 +1,37 @@
{include file="includes/credit-note-js.html"}
<script type="text/html" id="order-credit-note">
{loop type="order" name="order" customer="*" backend_context=true id=$order_id}
{loop type="order-credit-note" name="order-credit-note" order_id=$order_id}
{loop type="credit-note" name="credit-note" id=$CREDIT_NOTE_ID}
<tr class="alert-info">
<td colspan="2" class="td-unstyled"></td>
<td colspan="3"><strong>
{intl l="Credit Note used :" d="creditnote.bo.default" ref=$REF}
<a href="#" data-toggle="modal"
data-target="#modal-credit-note"
data-action="view"
data-ajax-url="{url path="/admin/credit-note/%id" id=$ID}">
{$REF}
</a>
</strong></td>
<td colspan="100" class="text-right">
<strong>{format_money number=$AMOUNT currency_id=$CURRENCY}</strong>
</td>
</tr>
<tr class="alert-info">
<td colspan="2" class="td-unstyled"></td>
<td colspan="3"><strong>{intl l="Remaining to pay : " d="creditnote.bo.default" ref=$REF}</strong></td>
<td colspan="100" class="text-right">
<strong>{format_money number=$TOTAL_TAXED_AMOUNT - $AMOUNT currency_id=$CURRENCY}</strong>
</td>
</tr>
{/loop}
{/loop}
{/loop}
</script>
<script type="text/javascript">
$('#cart tbody.table-condensed').append($('#order-credit-note').html());
</script>

View File

@@ -0,0 +1,28 @@
{loop type="order" name="order-tab-credit-note" id=$id customer="*" backend_context=true}
{if $STATUS != 1 && $STATUS != 5}
<div class="row" id="module-credit-note">
<div class="col-md-12">
{include file="includes/credit-note-table.html" order_id=$id}
</div>
</div>
{else}
<div class="table-responsive">
<table class="table table-striped table-condensed">
<caption>
{intl l="Credit notes" d="creditnote.bo.default"}
</caption>
<tbody>
<tr>
<td>
<div class="alert alert-warning">
{intl l="You can not create a credit note for this order because it is not invoiced." d="creditnote.bo.default"}
</div>
</td>
</tr>
</tbody>
</table>
</div>
{/if}
{/loop}

View File

@@ -0,0 +1,64 @@
<tr>
<td>
{form_field field='free_amount_type' value_key=$key}
<div class="form-group">
<select class="form-control" name="{$name}" {if $invoiced}disabled{/if}>
<option {if $creditNoteDetail and $creditNoteDetail->getType() == 'other'}selected{/if} value="other">
{intl l="Other" d="creditnote.bo.default"}
</option>
<option {if $creditNoteDetail and $creditNoteDetail->getType() == 'shipping'}selected{/if} value="shipping">
{intl l="Shipping" d="creditnote.bo.default"}
</option>
<option {if $creditNoteDetail and $creditNoteDetail->getType() == 'fees'}selected{/if} value="fees">
{intl l="Fees" d="creditnote.bo.default"}
</option>
</select>
</div>
{/form_field}
</td>
<td>
{form_field field='free_amount_title' value_key=$key}
<div class="form-group">
<input type="text" {if $invoiced}disabled{/if} name="{$name}" class="form-control" value="{if $creditNoteDetail}{$creditNoteDetail->getTitle()}{/if}" placeholder="{intl l="Titile" d="creditnote.bo.default"}">
</div>
{/form_field}
</td>
<td>
{form_field field='free_amount_price' value_key=$key}
<div class="form-group">
<input type="number" {if $invoiced}disabled{/if} name="{$name}" value="{if $creditNoteDetail}{$creditNoteDetail->getPrice()}{/if}" step="0.000001" class="form-control js-field-amount-without-tax" placeholder="{intl l="Amount without tax" d="creditnote.bo.default"}" data-url="{url path="/admin/product/calculate-raw-price?action=to_tax"}">
</div>
{/form_field}
</td>
<td>
{form_field field='free_amount_tax_rule_id' value_key=$key}
<div class="form-group">
<select class="form-control js-field-tax-rule" {if $invoiced}disabled{/if} name="{$name}">
{loop type="tax-rule" name="tax-rule"}
<option {if $creditNoteDetail}{if $creditNoteDetail->getTaxRuleId() == $ID}selected{/if}{/if} value="{$ID}">{$TITLE}</option>
{/loop}
</select>
</div>
{/form_field}
</td>
<td>
{form_field field='free_amount_price_with_tax' value_key=$key}
<div class="form-group">
<input type="number" step="0.000001" {if $invoiced}disabled{/if} name="{$name}" value="{if $creditNoteDetail}{$creditNoteDetail->getPriceWithTax()}{/if}" class="form-control js-field-amount-with-tax" placeholder="{intl l="Amount with tax" d="creditnote.bo.default"}" data-url="{url path="/admin/product/calculate-raw-price?action=from_tax"}">
</div>
{/form_field}
</td>
<td class="action">
<div class="form-group">
{form_field field='free_amount_id' value_key=$key}
<input type="hidden" name="{$name}" value="{if $creditNoteDetail}{$creditNoteDetail->getId()}{/if}">
{/form_field}
{if !$invoiced}
<button class="btn btn-danger js-action-delete" title="{intl l="Delete" d="creditnote.bo.default"}">
<span class="glyphicon glyphicon-trash"></span>
</button>
{/if}
</div>
</td>
</tr>

View File

@@ -0,0 +1,11 @@
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/css/select2.min.css" rel="stylesheet" />
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js"></script>
{javascripts file='assets/js/script.js' source="CreditNote"}
<script src="{$asset_url}?v={$moduleVersion}"></script>
{/javascripts}
<script type="text/html" id="template-credit-note-free-amount">
{form name="credit-note.create"}
{$key = ""}
{include file="includes/credit-note-free-amount.html"}
{/form}
</script>

View File

@@ -0,0 +1,53 @@
<div class="modal fade" id="modal-credit-note" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document" style="width: 90%; min-width: 1000px; max-width: 1500px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">{intl l="Credit note" d="creditnote.bo.default"}</h4>
</div>
<div class="modal-loader">
<br/><br/><div class="text-center"><span class="loading">{intl l="Please wait, loading" d="creditnote.bo.default"}</span></div><br/><br/>
</div>
<div class="modal-body">
</div>
<div class="modal-error hidden">
<div class="alert alert-danger">
<strong>{intl l="An error has occurred !!!" d="creditnote.bo.default"}</strong>
<br/>
<span>{intl l="Message status : " d="creditnote.bo.default"} <span class="textStatus"></span></span>
<br/>
<span>{intl l="Message content : " d="creditnote.bo.default"}</span>
<br/>
<iframe width="100%" style="height: 400px;"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{intl l="Close" d="creditnote.bo.default"}</button>
<button type="button" class="btn btn-primary">{intl l="Save" d="creditnote.bo.default"}</button>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal-credit-note-delete" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">{intl l="Delete credit note" d="creditnote.bo.default"}</h4>
</div>
<div class="modal-body">
{intl l="Do you really want to delete this credit note ?" d="creditnote.bo.default"}
</div>
<div class="modal-footer">
{form name="credit-note.create"}
<form method="POST" action="">
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No" d="creditnote.bo.default"}</button>
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes" d="creditnote.bo.default"}</button>
</form>
{/form}
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,156 @@
{loop type="order" name="the-order" id=$creditNote->getOrderId() customer="*" backend_context=true}
<div class="panel panel-default">
<div class="panel-heading">
{intl l="Order Informations : " d="creditnote.bo.default"}
{loop type="order-status" name="all-status" id=$STATUS}
<span class="label" style='background-color: {$COLOR};'>{intl l="Status : %title" d="creditnote.bo.default" title=$TITLE}</span>
{/loop}
<span class="label label-warning" >{intl l="Ref :" d="creditnote.bo.default"} <a style="color: white;" href="{url path="/admin/order/update/%id" id=$ID}">{$REF}</a></span>
</div>
<div class="panel-body">
<div class="js-ajax-order">
<table class="table table-striped table-condensed table-left-aligned">
<thead>
<tr>
<th class="col-md-6">{intl l="Product" d="creditnote.bo.default"}</th>
{hook name="order-edit.order-product-table-header" location="order_edit_table_header" }
<th class="col-md-1 text-right">{intl l="Unit. price" d="creditnote.bo.default"}</th>
<th class="col-md-1 text-right">{intl l="Tax" d="creditnote.bo.default"}</th>
<th class="col-md-1 text-right">{intl l="Unit taxed price" d="creditnote.bo.default"}</th>
<th class="text-right">{intl l="Quantity" d="creditnote.bo.default"}</th>
<th class="col-md-1 text-right">{intl l="Total with tax" d="creditnote.bo.default"}</th>
</tr>
</thead>
<tbody>
{loop type="order_product" name="order-products" order=$ID}
{if $WAS_IN_PROMO == 1}
{assign "realPrice" $PROMO_PRICE}
{assign "realTax" $PROMO_PRICE_TAX}
{assign "realTaxedPrice" $TAXED_PROMO_PRICE}
{assign "realTotalPrice" $TOTAL_TAXED_PROMO_PRICE}
{else}
{assign "realPrice" $PRICE}
{assign "realTax" $PRICE_TAX}
{assign "realTaxedPrice" $TAXED_PRICE}
{assign "realTotalPrice" $TOTAL_TAXED_PRICE}
{/if}
{hook name="order-edit.before-order-product-row" location="before-order-product-row" order_id=$order_id order_product_id=$ID}
<tr>
<td>
{ifloop rel="my_product_loop"}
{loop type="product" name="my_product_loop" visible="*" ref=$REF return_url=false}
<a href="{url path='/admin/products/update' product_id=$ID}" target="_blank">{$REF} - {$TITLE}</a>
{if $VIRTUAL}<span class="glyphicon glyphicon-download text-muted" title="{intl l='Virtual product' d="creditnote.bo.default"}"></span>{/if}
{/loop}
<dl class="dl-horizontal">
<dt>{intl l='Combination reference' d="creditnote.bo.default"}</dt>
<dd>
{$PRODUCT_SALE_ELEMENTS_REF}
</dd>
</dl>
{/ifloop}
{elseloop rel="my_product_loop"}
{* The product doesn't exist anymore *}
{$TITLE}
{if $VIRTUAL}<span class="glyphicon glyphicon-download text-muted"></span>{/if}
{/elseloop}
{ifloop rel="combinations"}
<dl class="dl-horizontal">
{loop type="order_product_attribute_combination" name="combinations" order_product=$ID}
<dt>{$ATTRIBUTE_TITLE}</dt>
<dd>{$ATTRIBUTE_AVAILABILITY_TITLE}</dd>
{/loop}
</dl>
{/ifloop}
{hook name="order-edit.product-list" location="order-product-list" order_id=$order_id order_product_id=$ID}
</td>
{hook name="order-edit.order-product-table-row" location="order_edit_table_row" order_product_id={$ID} }
<td class="text-right">{format_money number=$realPrice currency_id=$CURRENCY}</td>
<td class="text-right">{format_money number=$realTax currency_id=$CURRENCY}</td>
<td class="text-right">{format_money number=$realTaxedPrice currency_id=$CURRENCY}</td>
<td class="text-right">
{if $creditNote->getCreditNoteType()}
{$currentQuantity = 0}
{if $creditNote->getCreditNoteType()->getCode() == 'order_full_refund'}
{$currentQuantity = $QUANTITY}
{else}
{foreach from=$creditNote->getCreditNoteDetails() item=creditNoteDetail}
{if $creditNoteDetail->getOrderProductId() == $ID}
{$currentQuantity = $creditNoteDetail->getQuantity()}
{/if}
{/foreach}
{/if}
{form_field field='order_product_quantity' key=$ID}
{if $invoiced or $creditNote->getCreditNoteType()->getCode() == 'order_full_refund'}
<input type="hidden" name="{$name}[{$ID}]" value="{$currentQuantity}" />
{$currentQuantity}
{else}
<select class="js-order-product-quantity" name="{$name}[{$ID}]">
{for $i=0 to $QUANTITY}<option {if $currentQuantity == $i}selected{/if} value="{$i}">{$i}</option>{/for}
</select>
{/if}
{/form_field}
{/if}
/ {$QUANTITY}
</td>
<td class="text-right">{format_money number=$realTotalPrice currency_id=$CURRENCY}</td>
</tr>
{hook name="order-edit.after-order-product-row" location="after-order-product-row" order_id=$order_id order_product_id=$ID}
{/loop}
</tbody>
<tbody class="table-condensed">
<tr class="active">
<td colspan="2" class="td-unstyled">
</td>
<td colspan="3"><strong>{intl l="Total without discount" d="creditnote.bo.default"}</strong></td>
<td colspan="100" class="text-right"><strong>{format_money number=$TOTAL_TAXED_AMOUNT-$POSTAGE+$DISCOUNT currency_id=$CURRENCY}</strong></td>
</tr>
<tr>
<td colspan="2" class="td-unstyled"></td>
<td colspan="3"><strong>{intl l="Discount" d="creditnote.bo.default"}</strong></td>
<td colspan="100" class="text-right"><strong>{format_money number=$DISCOUNT currency_id=$CURRENCY}</strong></td>
</tr>
<tr class="active">
<td colspan="2" class="td-unstyled"></td>
<td colspan="3"><strong>{intl l="Coupon code" d="creditnote.bo.default"}</strong></td>
<td colspan="100" class="text-right">
{loop type="order_coupon" name="couponcode" order=$ID}
{$CODE}{if $LOOP_COUNT != $LOOP_TOTAL}, {/if}
{/loop}
{elseloop rel="couponcode"}
<strong>Ø</strong>
{/elseloop}
</td>
</tr>
<tr>
<td colspan="2" class="td-unstyled"></td>
<td colspan="3"><strong>{intl l="Total including discount" d="creditnote.bo.default"}</strong></td>
<td colspan="100" class="text-right"><strong>{format_money number=$TOTAL_TAXED_AMOUNT-$POSTAGE currency_id=$CURRENCY}</strong></td>
</tr>
<tr class="active">
<td colspan="2" class="td-unstyled"></td>
<td colspan="3"><strong>{intl l="Postage" d="creditnote.bo.default"}</strong></td>
<td colspan="100" class="text-right">
<strong>{format_money number=$POSTAGE currency_id=$CURRENCY}</strong>
<em title="{intl l='Taxes' d="creditnote.bo.default"}">({format_money number=$POSTAGE_TAX currency_id=$CURRENCY})</em>
</td>
</tr>
<tr class="active">
<td colspan="2" class="td-unstyled"></td>
<td colspan="3" class="last"><strong>{intl l="Total" d="creditnote.bo.default"}</strong></td>
<td colspan="100" class="last text-right"><strong>{format_money number=$TOTAL_TAXED_AMOUNT currency_id=$CURRENCY}</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
{/loop}

View File

@@ -0,0 +1,195 @@
{assign credit_note_page {$smarty.get.credit_note_page|default:1}}
{assign credit_note_order {$smarty.get.credit_note_order|default:'id'}}
{assign credit_note_status {$smarty.get.status_id|default:null}}
<div class="table-responsive">
<table class="table table-striped table-condensed">
<caption>
{intl l="Credit notes" d="creditnote.bo.default"}
<a class="btn btn-primary action-btn" title="{intl l="Add a new credit note" d="creditnote.bo.default"}"
data-toggle="modal"
data-target="#modal-credit-note"
data-customer-id="{$customer_id}"
data-order-id="{$order_id}"
data-ajax-url="{url path="/admin/credit-note/ajax/modal/create"}"
data-action="create"
>
<span class="glyphicon glyphicon-plus-sign"></span> {intl l="Add a new credit note" d="creditnote.bo.default"}
</a>
</caption>
<thead>
<tr>
<th>
{intl l="#" d="creditnote.bo.default"}
</th>
<th>
{intl l="Ref" d="creditnote.bo.default"}
</th>
<th>
{intl l="Invoice ref" d="creditnote.bo.default"}
</th>
<th>
{intl l="Invoice date" d="creditnote.bo.default"}
</th>
<th class="object-title">
{admin_sortable_header
current_order=$credit_note_order
order='create-date'
reverse_order='create-date-reverse'
path={url path='/admin/credit-note'}
request_parameter_name='credit_note_order'
label="{intl l='Create date' d="creditnote.bo.default"}"
}
</th>
<th class="object-title">
{admin_sortable_header
current_order=$credit_note_order
order='update-date'
reverse_order='update-date-reverse'
path={url path='/admin/credit-note'}
request_parameter_name='credit_note_order'
label="{intl l='Update date' d="creditnote.bo.default"}"
}
</th>
{if !$customer_id && !$order_id}
<th>
{intl l="Customer" d="creditnote.bo.default"}
</th>
{/if}
{if !$order_id}
<th>
{intl l="Order" d="creditnote.bo.default"}
</th>
{/if}
<th>
{intl l="Status" d="creditnote.bo.default"}
</th>
<th>
{intl l="Type" d="creditnote.bo.default"}
</th>
<th>
{intl l="Total with tax" d="creditnote.bo.default"}
</th>
<th>
{intl l="Total without tax" d="creditnote.bo.default"}
</th>
<th class="action">
{intl l="Action" d="creditnote.bo.default"}
</th>
</tr>
</thead>
{ifloop rel="credit-note"}
<tbody>
{loop type="credit-note" name="credit-note" status_id=$credit_note_status order=$credit_note_order page=$credit_note_page customer_id=$customer_id order_id=$order_id limit={config key="number_default_results_per_page.credit_note_list" default=20}}
<tr>
<td>
{$ID}
</td>
<td>
{$REF}
</td>
<td>
{$INVOICE_REF}
</td>
<td>
{if $INVOICE_DATE != null}
{format_date date=$INVOICE_DATE}
{/if}
</td>
<td>{format_date date=$CREATE_DATE}</td>
<td>{format_date date=$UPDATE_DATE}</td>
{if !$customer_id && !$order_id}
<td>
<a href="{url path='/admin/customer/update' customer_id=$CUSTOMER_ID}">{$CUSTOMER_NAME}</a>
</td>
{/if}
{if !$order_id}
<td>
{if $ORDER_ID}
<a href="{url path="/admin/order/update/%id" id=$ORDER_ID}">{$ORDER_REF}</a>
{/if}
</td>
{/if}
<td>
<span class="label" style="background-color: {$STATUS_COLOR}">{$STATUS_TITLE}</span>
</td>
<td>
<span class="label" style="background-color: {$TYPE_COLOR}">{$TYPE_TITLE}</span>
</td>
<td>
{format_money number=$TOTAL_PRICE_WITH_TAX currency_id=$CURRENCY_ID}
</td>
<td>
{format_money number=$TOTAL_PRICE currency_id=$CURRENCY_ID}
</td>
<td class="action">
{if !$INVOICE_REF}
<button class="btn btn-info"
data-toggle="modal"
data-target="#modal-credit-note"
data-customer-id="{$customer_id}"
data-order-id="{$order_id}"
data-ajax-url="{url path="/admin/credit-note/%id" id=$ID}"
data-action="view"
>{intl l="Edit" d="creditnote.bo.default"}</button>
{else}
<button class="btn btn-primary"
data-toggle="modal"
data-target="#modal-credit-note"
data-customer-id="{$customer_id}"
data-order-id="{$order_id}"
data-ajax-url="{url path="/admin/credit-note/%id" id=$ID}"
data-action="view"
>{intl l="View" d="creditnote.bo.default"}</button>
<a class="btn btn-default"
href="{url path="/admin/credit-note/pdf/invoice/%id/0" id=$ID}"
>{intl l="PDF" d="creditnote.bo.default"}</a>
{/if}
{if !$INVOICE_REF}
<button class="btn btn-danger"
data-toggle="modal"
data-target="#modal-credit-note-delete"
data-ajax-url="{url path="/admin/credit-note/%id/_delete" id=$ID}"
data-action="delete"
>{intl l="Delete" d="creditnote.bo.default"}</button>
{/if}
</td>
</tr>
{/loop}
</tbody>
<tfoot>
<tr>
<td colspan="100">
{include
file = "includes/pagination.html"
loop_ref = "credit-note"
page_param_name = 'credit_note_page'
max_page_count = 10
page_url = {url path="/admin/credit-note" type=$type_filter status_id=$credit_note_status credit_note_order=$credit_note_order search_term=$search_term search_in=$search_in}
}
</td>
</tr>
</tfoot>
{/ifloop}
{elseloop rel="credit-note"}
<tfoot>
<tr>
<td colspan="99">
<div class="alert alert-info">
{intl l='You have no credit notes for the moment.' d="creditnote.bo.default"}
</div>
</td>
</tr>
</tfoot>
{/elseloop}
</table>
</div>

View File

@@ -0,0 +1,309 @@
{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *}
{default_translation_domain domain="creditnote.pdf.default"}
{literal}
<style>
h1, h2, h3, h4 {
color:#f6993c;
margin: .5em 0;
}
h1 {
font-size: 48px;
}
h2 {
font-size: 16px;
}
h3 {
font-size: 14px;
}
h4 {
color:#58585a;
font-size: 12px;
}
p, td {
color:#58585a;
font-size: 9px;
}
p {
margin: .5em 0;
}
span {
font-size: 9px;
}
table {
border-collapse: collapse;
width: 100%;
}
tr {
width: 100%;
}
td {
vertical-align: top;
}
.table-info h3 {
font-size: 18px;
color: #58585a;
margin-top: 0;
margin-bottom: 15px;
}
.table-info h3 span {
font-size: 18px;
color: #f6993c;
}
.table-1 td {
background: #f1f3f4;
border:solid 1px #bcbdc0;
}
.table-2 td {
border:solid 1px #bcbdc0;
}
.table-3-1, .table-3-2 {
border: solid 1px #bcbdc0;
}
.table-3-1 p {
font-size: 10px;
}
.table-3-2 p {
font-size: 9px;
color: #747475;
}
.table-3-module h3 {
margin-top: 1.5em;
}
.table-3-module span {
font-size: 11px;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-right{
text-align: right;
}
.clear {
padding: 0.5%;
border-bottom:solid 1px #dddddd;
}
.clear-none {
padding: 0.5%;
}
{hook name="invoice.css"}
</style>
{/literal}
<page backtop="10mm" backleft="10mm" backright="10mm" backbottom="10mm">
<page_header>
{hook name="pdf.credit-note.header" credit_note_id=$credit_note_id}
</page_header>
<page_footer>
{hook name="pdf.credit-note.footer-top" credit_note_id=$credit_note_id}
<table>
<col style="width: 80%; padding: 1mm; border: none; text-align: left;" />
<col style="width: 20%; padding: 1mm; border: none; text-align: right;" />
<tbody>
<tr>
<td>
{hook name="pdf.credit-note.imprint" credit_note_id=$credit_note_id}
{elsehook rel="pdf.credit-note.imprint"}
<!-- Imprint -->
{config key="store_name"}
{$addresses="{config key="store_address1"} {config key="store_address2"} {config key="store_address3"}"}
{$city="{config key="store_zipcode"} {config key="store_city"}"}
{if $addresses != " "}- {$addresses}{/if}
{if $city != " " }- {$city}{/if}
{if {config key="store_country"} }
{loop type="country" visible="*" name="address.country.title" id={config key="store_country"}} - {$TITLE}{/loop}
{/if}
{if {config key="store_business_id"} }
- {config key="store_business_id"}
{/if}
<br>
{if {config key="store_phone"} }
{intl l="Phone: "}{config key="store_phone"}
{/if}
{if {config key="store_email"} }
{intl l="Email: "}{config key="store_email"}
{/if}
{/elsehook}
</td>
<td>{intl l="page"} [[page_cu]]/[[page_nb]]</td>
</tr>
</tbody>
</table>
{hook name="pdf.credit-note.footer-bottom" order=$order_id}
</page_footer>
{$taxes = []}
{loop name="credit-note.invoice" type="credit-note" id=$credit_note_id customer="*"}
<table class="table-info">
<col style="width: 100%; padding: 0mm;" />
<tr>
<td>
<h1>{intl l="CREDIT NOTE INVOICE"}</h1>
</td>
</tr>
<tr>
<td><h3>{intl l="Invoice date"} : <span>{format_date date=$INVOICE_DATE output="date"}</span></h3></td>
</tr>
<tr>
<td><h3>{intl l="Invoice REF"} : <span>{$INVOICE_REF}</span></h3></td>
</tr>
<tr>
<td><h3>{intl l="Credit note REF"} : <span>{$REF}</span></h3></td>
</tr>
<tr>
<td><h3>{intl l="Customer Number"} : <span>{loop type="customer" name="customer.invoice" id=$CUSTOMER_ID current="0"}{$REF}{/loop}</span></h3></td>
</tr>
{if $ORDER_ID}
{loop name="order" type="order" id=$ORDER_ID customer="*"}
<tr>
<td><h3>{intl l="Referance invoice REF"} : <span>{$INVOICE_REF}</span></h3></td>
</tr>
<tr>
<td><h3>{intl l="Referance order REF"} : <span>{$REF}</span></h3></td>
</tr>
{/loop}
{/if}
{hookblock name="pdf.credit-note.information" credit_note_id=$credit_note_id fields="title,value"}
{forhook rel="pdf.credit-note.information"}
<tr>
<td><h3>{$title} : <span>{$value}</span></h3></td>
</tr>
{/forhook}
{/hookblock}
</table>
{hook name="pdf.credit-note.after-information" credit_note_id=$credit_note_id}
<table class="table-address">
<col style="width: 50%; padding: 3mm;" />
<col style="padding: 3mm;" />
<tr>
<td style="border-left: solid 1mm #f6993c;">
<h3>{intl l="Invoice address"}</h3>
{credit_note_format_address credit_note_id=$ID locale=$locale}
</td>
</tr>
</table>
{hook name="pdf.credit-note.after-addresses" credit_note_id=$credit_note_id}
<table cellspacing="0" cellpadding="0" style="padding-top: 5mm;">
<col style="width: 40%; padding: 1mm;" />
<col style="width: 12%; padding: 1mm;" />
<col style="width: 12%; padding: 1mm;" />
<col style="width: 12%; padding: 1mm;" />
<col style="width: 12%; padding: 1mm;" />
<col style="width: 12%; padding: 1mm;" />
<tr class="table-1">
<td><h4>{intl l="Product"}</h4></td>
<td><h4 class="align-center">{intl l="Unit. price"}</h4></td>
<td><h4 class="align-center">{intl l="Tax"}</h4></td>
<td><h4 class="align-center">{intl l="Unit taxed price"}</h4></td>
<td><h4 class="align-center">{intl l="Quantity"}</h4></td>
<td style="background:#f6993c"><h4 style="color:white;" class="align-center">{intl l="Total with tax"}</h4></td>
</tr>
{loop type="credit-note-detail" name="credit-note-detail" credit_note_id=$credit_note_id}
{$detailRef = ""}
{$detailPseRef = ""}
{$detailTitle = $TITLE}
{if $ORDER_PRODUCT_ID}
{loop type="order_product" name="order-product-$ORDER_PRODUCT_ID" id=$ORDER_PRODUCT_ID order=$ORDER_ID}
{$detailRef = $REF}
{$detailTitle = $TITLE}
{$detailPseRef = $PRODUCT_SALE_ELEMENTS_REF}
{/loop}
{/if}
<tr class="table-2">
<td>
<p>{$TITLE}</p>
<p>
{if $detailRef}
{intl l="Product ref : "}{$detailRef}<br>
{/if}
{if $detailPseRef}
{intl l="Combination ref : "}{$detailPseRef}
{/if}
</p>
{if $ORDER_PRODUCT_ID}
{ifloop rel="combinations"}
{loop type="order_product_attribute_combination" name="combinations" order_product=$ORDER_PRODUCT_ID}
{$ATTRIBUTE_TITLE} - {$ATTRIBUTE_AVAILABILITY_TITLE}<br>
{/loop}
{/ifloop}
{/if}
{hook name="pdf.credit-note.detail-list" order_product=$ID order=$order_id}
</td>
<td><p class="align-right">{if $QUANTITY}{format_money number={$PRICE / $QUANTITY} currency_id=$CURRENCY_ID}{else}{format_money number=0 currency_id=$CURRENCY_ID}{/if}</p></td>
<td><p class="align-right">{if $QUANTITY}{format_money number={{$PRICE_WITH_TAX - $PRICE} / $QUANTITY} currency_id=$CURRENCY_ID}{else}{format_money number=0 currency_id=$CURRENCY_ID}{/if}</p></td>
<td><p class="align-right">{if $QUANTITY}{format_money number={$PRICE_WITH_TAX / $QUANTITY} currency_id=$CURRENCY_ID}{else}{format_money number=0 currency_id=$CURRENCY_ID}{/if}</p></td>
<td><p class="align-center">{$QUANTITY}</p></td>
<td><p class="align-right">{format_money number=$PRICE_WITH_TAX currency_id=$CURRENCY_ID}</p></td>
</tr>
{hook name="pdf.credit-note.order-product" credit_note_id=$credit_note_id order_product=$ID}
{/loop}
</table>
{hook name="pdf.credit-note.after-products" credit_note_id=$credit_note_id}
<table cellspacing="0" cellpadding="0" style="padding-top: 5mm;">
<col style="width: 60%; padding: 1mm;" />
<col style="width: 40%; padding: 1mm;" />
<tr>
<td>
<table class="table-3">
<col style="width: 50%; padding: 1mm;">
<col style="width: 50%; padding: 1mm;">
<tr>
<td class="table-3-1"><p>{intl l="Discount"}</p></td>
<td class="table-3-1 align-right"><p>{format_money number=$DISCOUNT_WITH_TAX currency_id=$CURRENCY}</p></td>
</tr>
<tr>
<td class="table-3-1"><p>{intl l="Total without tax"}</p></td>
<td class="table-3-1 align-right"><p>{format_money number=$TOTAL_PRICE currency_id=$CURRENCY}</p></td>
</tr>
<tr>
<td class="table-3-1"><p>{intl l="Tax"}</p></td>
<td class="table-3-1 align-right"><p>{format_money number={$TOTAL_PRICE_WITH_TAX - $TOTAL_PRICE} currency_id=$CURRENCY}</p></td>
</tr>
<tr>
<td class="table-3-1"><p>{intl l="Total with tax"}</p></td>
<td class="table-3-1 align-right"><p>{format_money number=$TOTAL_PRICE_WITH_TAX currency_id=$CURRENCY}</p></td>
</tr>
</table>
</td>
</tr>
</table>
{hook name="pdf.credit-note.after-summary" credit_note_id=$credit_note_id}
{/loop}
</page>