Initial Commit
This commit is contained in:
168
local/modules/OrderCreation/AdminIncludes/customer-edit-js.html
Normal file
168
local/modules/OrderCreation/AdminIncludes/customer-edit-js.html
Normal file
@@ -0,0 +1,168 @@
|
||||
<script>
|
||||
var nb_products = 0;
|
||||
//Automatic product add during order creation
|
||||
$('#add-cart-item').click(function(ev) {
|
||||
$.get("{url path='/admin/module/OrderCreation/add-item'}/"+nb_products, function(data){
|
||||
nb_products += 1;
|
||||
$('#body-order-cart').append(data);
|
||||
},'html');
|
||||
});
|
||||
|
||||
$('#body-order-cart').on('change', '.category-list', function(clickEvent){
|
||||
var target_id = $(this).data('target');
|
||||
var target_destination_id = $(this).data('destination');
|
||||
|
||||
$.ajax({
|
||||
url : '{url path="/admin/module/OrderCreation/0/list-products/"}' + $(this).val() + '.xml',
|
||||
type : 'get',
|
||||
dataType : 'json',
|
||||
success : function(json) {
|
||||
$('#'+target_id).empty();
|
||||
|
||||
var have_content = false;
|
||||
var oldValue = null;
|
||||
var isOptGroupOpen = false;
|
||||
var listOfOptions = "";
|
||||
|
||||
$.each(json, function(idx, value) {
|
||||
|
||||
if (oldValue == null) {
|
||||
oldValue = value;
|
||||
} else {
|
||||
|
||||
if (oldValue.product_id == value.product_id) {
|
||||
|
||||
if (isOptGroupOpen == false) {
|
||||
listOfOptions +=
|
||||
'<optgroup label="' + oldValue.title + '">' +
|
||||
'<option value="' + oldValue.id + '">' + oldValue.ref + '(' + oldValue.quantity + ')' + '</option>'
|
||||
;
|
||||
|
||||
isOptGroupOpen = true;
|
||||
} else {
|
||||
listOfOptions +=
|
||||
'<option value="' + oldValue.id + '">' + oldValue.ref + '(' + oldValue.quantity + ')' + '</option>'
|
||||
;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (isOptGroupOpen == true) {
|
||||
listOfOptions +=
|
||||
'</optgroup>'
|
||||
;
|
||||
}
|
||||
|
||||
listOfOptions +=
|
||||
'<option value="' + oldValue.id + '">' + oldValue.title + '(' + oldValue.quantity + ')' + '</option>'
|
||||
;
|
||||
}
|
||||
|
||||
oldValue = value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//$('#'+target_id).append($('<option>').text(value.title+" ("+value.quantity+")").attr('value', value.id));
|
||||
have_content = true;
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (isOptGroupOpen == true) {
|
||||
listOfOptions +=
|
||||
'<option value="' + oldValue.id + '">' + oldValue.ref + '(' + oldValue.quantity + ')' + '</option>' +
|
||||
'</optgroup>'
|
||||
;
|
||||
} else {
|
||||
listOfOptions +=
|
||||
'<option value="' + oldValue.id + '">' + oldValue.title + '(' + oldValue.quantity + ')' + '</option>'
|
||||
;
|
||||
}
|
||||
$('#'+target_id).append(listOfOptions);
|
||||
if (have_content) {
|
||||
$('#'+target_destination_id).removeClass('hide');
|
||||
}
|
||||
else {
|
||||
$('#'+target_destination_id).addClass('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#body-order-cart').on('click', '.item-ajax-delete', function(clickEvent){
|
||||
$('#'+$(this).data('target')).remove();
|
||||
});
|
||||
|
||||
$('#type_order_form').change(function(ev) {
|
||||
if($(this).val() == 2){
|
||||
$('#type_order_info').removeClass('hide');
|
||||
}else{
|
||||
$('#type_order_info').addClass('hide');
|
||||
}
|
||||
});
|
||||
|
||||
$('#delivery_address_id_form').on('change', function(){
|
||||
|
||||
if ($(this).val() > 0) {
|
||||
$('#list-delivery').addClass('loading');
|
||||
|
||||
//update the country in the request
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/admin/module/OrderCreation/update/country/request",
|
||||
data: {
|
||||
address_id: $(this).val()
|
||||
}
|
||||
})
|
||||
.done(function(response){
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/order/deliveryModuleList"
|
||||
})
|
||||
.done(function(response){
|
||||
$('#list-delivery').removeClass('loading');
|
||||
$('#list-delivery').html(response);
|
||||
|
||||
$('#list-delivery input.delivery-method').each(function(){
|
||||
if ($(this).is(':checked')) {
|
||||
$('#delivery_module_id').val($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
//clear both between all radio button
|
||||
$('#list-delivery .radio').each(function(){
|
||||
$(this).css('clear', 'both');
|
||||
});
|
||||
})
|
||||
.error(function(error){
|
||||
$('#list-delivery').removeClass('loading');
|
||||
if (typeof(error.statusTexddt) != 'undefined') {
|
||||
$('#list-delivery').html('<div class="alert alert-danger">' + error.statusText + '</div>');
|
||||
}
|
||||
});
|
||||
})
|
||||
.error(function(error){
|
||||
|
||||
$('#list-delivery').removeClass('loading');
|
||||
if (typeof(error.statusTexddt) != 'undefined') {
|
||||
$('#list-delivery').html('<div class="alert alert-danger">' + error.statusText + '</div>');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#delivery_module_id').val(0);
|
||||
$('#list-delivery').removeClass('loading');
|
||||
$('#list-delivery').html(
|
||||
'<div class="alert alert-danger">' +
|
||||
"{intl l='Choose a delivery address first' d='ordercreation'}" +
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#list-delivery').on('change', '.delivery-method', function(){
|
||||
$('#delivery_module_id').val($(this).val());
|
||||
})
|
||||
</script>
|
||||
29
local/modules/OrderCreation/AdminIncludes/customer-edit.html
Normal file
29
local/modules/OrderCreation/AdminIncludes/customer-edit.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<div class="row">
|
||||
{if $order_creation_error}
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">{$order_creation_error}</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $order_creation_success}
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-success">{$order_creation_success}</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="col-md-12 title title-without-tabs">
|
||||
{intl l="Create an order for this customer" d='ordercreation'}
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.ordercreation" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Generate a new order' d='ordercreation'}" href="#order_create_dialog" data-toggle="modal">
|
||||
<span>{intl l="Generate a new order" d="ordercreation"}</span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* -- Create a new order -------------------- *}
|
||||
{include file="forms/create-order-form.html"}
|
||||
9
local/modules/OrderCreation/AdminIncludes/head_css.html
Normal file
9
local/modules/OrderCreation/AdminIncludes/head_css.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<style type="text/css">
|
||||
.label-credit{
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
.label-credit-payed{
|
||||
background-color: hotpink;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,6 @@
|
||||
<th class="object-title text-center">
|
||||
{intl l="Invoice" d="ordercreation"}
|
||||
</th>
|
||||
<th class="object-title text-center">
|
||||
{intl l="Invoice date" d="ordercreation"}
|
||||
</th>
|
||||
@@ -0,0 +1,6 @@
|
||||
<td class="text-center">
|
||||
{$INVOICE_REF}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{format_date date=$INVOICE_DATE output="date"}
|
||||
</td>
|
||||
Reference in New Issue
Block a user