WIP
Refonte et mise en place du minibrowser
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
(function($, window, document){
|
(function($, window, document){
|
||||||
|
|
||||||
$(function($){
|
$(function(){
|
||||||
|
|
||||||
// -- Init datepicker --
|
// -- Init datepicker --
|
||||||
if($('.date').length){
|
if($('.date').length){
|
||||||
@@ -41,76 +41,71 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
// -- Mini browser --
|
||||||
|
miniBrowser = function (root, url){
|
||||||
|
|
||||||
|
|
||||||
}(window.jQuery, window, document));
|
|
||||||
|
|
||||||
// -- Mini browser --
|
|
||||||
function miniBrowser(root, url){
|
|
||||||
|
|
||||||
$.getJSON(url, {
|
|
||||||
root: root
|
|
||||||
})
|
|
||||||
.done(function(data) {
|
|
||||||
var resultat = data;
|
|
||||||
|
|
||||||
var breadcrumb = $('<div />');
|
$.getJSON(url, {
|
||||||
$(resultat.breadcrumb).each(function(k, v){
|
root: root
|
||||||
breadcrumb.append(
|
})
|
||||||
$('<span />').html(' > '),
|
.done(function(data) {
|
||||||
$('<a />').attr('href', '#').html(v.display).click(function(e){
|
var resultat = data;
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
miniBrowser(v.url)
|
var breadcrumb = $('<div />');
|
||||||
})
|
$(resultat.breadcrumb).each(function(k, v){
|
||||||
);
|
breadcrumb.append(
|
||||||
});
|
$('<span />').html(' > '),
|
||||||
|
$('<a />').attr('href', '#').html(v.display).click(function(e){
|
||||||
var categories = $('<div />');
|
e.preventDefault();
|
||||||
$(resultat.categories).each(function(k, v){
|
miniBrowser(v.url);
|
||||||
categories.append(
|
})
|
||||||
$('<p />').append(
|
);
|
||||||
$('<a />').attr('href', '#').html(v.titre).click(function(e){
|
});
|
||||||
e.preventDefault();
|
|
||||||
|
var categories = $('<div />');
|
||||||
|
$(resultat.categories).each(function(k, v){
|
||||||
|
categories.append(
|
||||||
|
$('<p />').append(
|
||||||
|
$('<a />').attr('href', '#').html(v.titre).click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
miniBrowser(v.id);
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
var products = $('<div />');
|
||||||
|
$(resultat.products).each(function(k, v){
|
||||||
|
products.append(
|
||||||
|
$('<p />').append(
|
||||||
|
$('<a />').attr('href', '#').html(v.titre).click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
miniBrowser(v.id)
|
$('#productToAdd_ref').val(v.ref);
|
||||||
})
|
$('#productToAdd_titre').val(v.titre);
|
||||||
)
|
$('#productToAdd_quantite').val(1);
|
||||||
);
|
|
||||||
});
|
manageStock(v.variants, v.promo?v.prix2:v.prix);
|
||||||
|
|
||||||
var products = $('<div />');
|
$('#productToAdd_tva').val(v.tva);
|
||||||
$(resultat.products).each(function(k, v){
|
|
||||||
products.append(
|
$('.productToAddInformation').show();
|
||||||
$('<p />').append(
|
$('#btn_ajout_produit').show();
|
||||||
$('<a />').attr('href', '#').html(v.titre).click(function(e){
|
})
|
||||||
e.preventDefault();
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#minibrowser-breadcrumb').unbind().empty().append(breadcrumb);
|
||||||
|
$('#minibrowser-categories').unbind().empty().append(categories);
|
||||||
|
})
|
||||||
|
.fail(function() {
|
||||||
|
console.log('The JSON file cant be read');
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$('#productToAdd_ref').val(v.ref);
|
|
||||||
$('#productToAdd_titre').val(v.titre);
|
|
||||||
$('#productToAdd_quantite').val(1);
|
|
||||||
|
|
||||||
manageStock(v.variants, v.promo?v.prix2:v.prix);
|
|
||||||
|
|
||||||
$('#productToAdd_tva').val(v.tva);
|
|
||||||
|
|
||||||
$('.productToAddInformation').show();
|
|
||||||
$('#btn_ajout_produit').show();
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#fastBrowser_breadcrumb').unbind().empty().append(breadcrumb);
|
|
||||||
$('#fastBrowser_categories').unbind().empty().append(categories);
|
|
||||||
$('#fastBrowser_products').unbind().empty().append(products);
|
|
||||||
})
|
|
||||||
.fail(function() {
|
|
||||||
console.log('The JSON file cant be read');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}(window.jQuery, window, document));
|
||||||
@@ -201,7 +201,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group span6">
|
||||||
<label for="operator">Operator :</label>
|
<label for="operator">Operator :</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<select name="operator" id="operator">
|
<select name="operator" id="operator">
|
||||||
@@ -244,21 +244,15 @@
|
|||||||
</select>
|
</select>
|
||||||
<input type="text" name="value" class="input-mini">
|
<input type="text" name="value" class="input-mini">
|
||||||
|
|
||||||
<table class="table-bordered">
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" id="fastBrowser_breadcrumb"></td>
|
<td id="minibrowser-breadcrumb"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="span6">
|
<th><span class="icon-th-list"></span> Categories list</th>
|
||||||
<?php echo trad('categories_list', 'admin'); ?>
|
|
||||||
</th>
|
|
||||||
<th class="span6">
|
|
||||||
<?php echo trad('products_list', 'admin'); ?>
|
|
||||||
</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td id="fastBrowser_categories"></td>
|
<td id="minibrowser-categories"></td>
|
||||||
<td id="fastBrowser_products"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user