add frontend changes
This commit is contained in:
@@ -13,11 +13,11 @@ function ProductSell(o){
|
||||
selector_user_cart: '.user-cart',
|
||||
selector_btn_pay_customer_cart: '#btn_pay_customer_cart',
|
||||
selector_btn_pay_user_cart: '#btn_pay_user_cart',
|
||||
/**mark list paid url*/
|
||||
url_pay_customer_card: '-',
|
||||
url_pay_user_cart: '',
|
||||
/** ajax url for lookup service*/
|
||||
lookup_product_url: '',
|
||||
/**mark list paid url*/
|
||||
url_pay_user_cart: '',
|
||||
/**the id of form*/
|
||||
selector_form: '#product_form',
|
||||
/**form contains error text*/
|
||||
@@ -289,7 +289,8 @@ function ProductSell(o){
|
||||
table.find('.product-barcode').html(product.barcode);
|
||||
table.find('.product-stock').html(product.stock);
|
||||
$('#productsaleform-id_product').val(product.id_product);
|
||||
$('#productsaleform-id_account').val(product.id_account);
|
||||
if ( app.defaults.id_account == null)
|
||||
$('#productsaleform-id_account').val(product.id_account);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,16 @@ function TicketSell(o){
|
||||
price: null,
|
||||
clear_cart_url: '',
|
||||
cart_paid_message: 'Tételek fizetve',
|
||||
transfer_list: [],
|
||||
user_cart: [],
|
||||
customer_cart: [],
|
||||
/**selector for customer cart container*/
|
||||
selector_customer_cart: '.customer-cart',
|
||||
selector_user_cart: '.user-cart',
|
||||
selector_btn_pay_customer_cart: '#btn_pay_customer_cart',
|
||||
selector_btn_pay_user_cart: '#btn_pay_user_cart',
|
||||
/**mark list paid url*/
|
||||
url_pay_customer_card: '-',
|
||||
url_pay_user_cart: '',
|
||||
|
||||
};
|
||||
|
||||
@@ -45,8 +54,10 @@ function TicketSell(o){
|
||||
$.extend(app.defaults, o );
|
||||
addBehaviourTypeChangedListener();
|
||||
useDefaults();
|
||||
createUserSoldItemsTable();
|
||||
addBehaviourBtnCartPaid();
|
||||
createCarts();
|
||||
addPayoutButtons();
|
||||
addSellButtons();
|
||||
// addBehaviourBtnCartPaid();
|
||||
}
|
||||
|
||||
function useDefaults(){
|
||||
@@ -56,33 +67,100 @@ function TicketSell(o){
|
||||
}
|
||||
}
|
||||
|
||||
function createUserSoldItemsTable(){
|
||||
$('.transfer-list-container').transferList({
|
||||
'transfers' : app.defaults.transfer_list
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
// carts
|
||||
////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* payout out user or customer cart
|
||||
* */
|
||||
function addPayoutButtons(){
|
||||
addBehaviourPayoutUserCart();
|
||||
addBehaviourPayoutCustomerCart();
|
||||
}
|
||||
|
||||
/**
|
||||
* display user and customer cart on page load
|
||||
* */
|
||||
function createCarts(){
|
||||
createUserCartTable();
|
||||
createCustomerCartTable();
|
||||
}
|
||||
|
||||
function createUserCartTable(){
|
||||
$(app.defaults.selector_user_cart).transferList({
|
||||
'transfers' : app.defaults.user_cart
|
||||
});
|
||||
}
|
||||
function createCustomerCartTable(){
|
||||
$(app.defaults.selector_customer_cart).transferList({
|
||||
'transfers' : app.defaults.customer_cart
|
||||
});
|
||||
}
|
||||
|
||||
function refreshCart(){
|
||||
$('.transfer-list-container').transferList('option','transfers' , app.defaults.sold_items );
|
||||
function addSellButtons(){
|
||||
addBehaviourBtnSellAndAppendToUserCart();
|
||||
addBehaviourBtnAddToCustomerCart();
|
||||
}
|
||||
|
||||
function addBehaviourBtnCartPaid( ){
|
||||
$('#btn_paid').on('click',function(){
|
||||
|
||||
$.ajax({
|
||||
url: app.defaults.clear_cart_url,
|
||||
type: 'post',
|
||||
data: {},
|
||||
success: function (response) {
|
||||
if ( response.code == 'success'){
|
||||
app.defaults.sold_items= response.transfers;
|
||||
refreshCart();
|
||||
$.notify(app.defaults.cart_paid_message, { 'type' : 'success' });
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
function addBehaviourBtnSellAndAppendToUserCart(){
|
||||
$('#btn_add_to_user_cart').on('click',submitAddTicketToUserCart);
|
||||
}
|
||||
|
||||
function addBehaviourBtnAddToCustomerCart(){
|
||||
$('#btn_add_to_customer_cart').on('click',submitAddTicketToCustomerCart);
|
||||
}
|
||||
|
||||
function submitAddTicketToUserCart(){
|
||||
$('#ticketcreate-cart').val('user');
|
||||
$('#ticket_form').submit();
|
||||
}
|
||||
|
||||
function submitAddTicketToCustomerCart(){
|
||||
$('#ticketcreate-cart').val('customer');
|
||||
$('#ticket_form').submit();
|
||||
}
|
||||
|
||||
|
||||
function addBehaviourPayoutUserCart( ){
|
||||
// $( app.defaults.selector_btn_pay_user_cart ).on('click',function(){
|
||||
//
|
||||
// $.ajax({
|
||||
// url: app.defaults.url_pay_user_cart,
|
||||
// type: 'post',
|
||||
// data: {},
|
||||
// success: function (response) {
|
||||
// if ( response.code == 'success'){
|
||||
// app.defaults.user_cart = response.transfers;
|
||||
// refreshUserCart();
|
||||
// $.notify(app.defaults.message_paid, { 'type' : 'success' });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
// });
|
||||
}
|
||||
function addBehaviourPayoutCustomerCart( ){
|
||||
// $( app.defaults.selector_btn_pay_customer_cart ).on('click',function(){
|
||||
// $.ajax({
|
||||
// url: app.defaults.url_pay_customer_card,
|
||||
// type: 'post',
|
||||
// data: {},
|
||||
// success: function (response) {
|
||||
// if ( response.code == 'success'){
|
||||
// app.defaults.customer_cart = response.customer_cart;
|
||||
// refreshCustomerCart();
|
||||
// }
|
||||
// $.notify(response.message, { 'type' : response.code });
|
||||
// },
|
||||
// error: function(){
|
||||
// alert('Hiba történt');
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user