summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/jingles.js40
1 files changed, 31 insertions, 9 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js
index 5037382..9284fd6 100644
--- a/www/js/jingles.js
+++ b/www/js/jingles.js
@@ -22,10 +22,10 @@
var jingles_group_list = [];
var jingles_group_carts = {};
-function jingles_newCartEntry(cart) {
+function jingles_newCartEntry(cut) {
- return $('<tr>').append($('<td>').text(cart.number))
- .append($('<td>').text(cart.title))
+ return $('<tr>').append($('<td>').text(cut.name))
+ .append($('<td>').text(cut.title))
.append($('<td>'))//.text(msToTimeString(cart.length)))
.append($('<td>'))//.text(cart.imported))
.append($('<td>'))//.text(cart.playcnt))
@@ -35,9 +35,19 @@ function jingles_newCartEntry(cart) {
}
function jingles_updateCartListing() {
- $('#jingle-carts-left tbody').find('tr').remove();
- $.each(jingles_group_carts, function(cart) {
- $('#jingle-carts-left > tbody:last').append(jingles_newCartEntry(cart));
+ $('#jingles-jingAllgem table tbody').find('tr').remove();
+ $('#jingles-jingAnlass table tbody').find('tr').remove();
+ $.each(jingles_group_carts, function(key, cart) {
+ console.log(cart);
+ if (cart.group.name === 'jingAllgem') {
+ $.each(cart.cutList, function(key, cut) {
+ $('#jingles-jingAllgem table > tbody:last').append(jingles_newCartEntry(cut));
+ });
+ } else if (cart.group.name === 'jingAnlass') {
+ $.each(cart.cutList, function(key, cut) {
+ $('#jingles-jingAnlass table > tbody:last').append(jingles_newCartEntry(cut));
+ });
+ }
});
}
@@ -45,20 +55,32 @@ function jingles_updateGroupCartList(data, status, req) {
var cartlist = $(data).find("cartList");
var carts = cartlist.children();
carts.each(function() {
- var cut = $(this).find("cutList").get(0);
var number = $(this).find('number').text();
var cart = {
title: $(this).find('title').text(),
+ group: {
+ name: $(this).find('groupName').text(),
+ },
+ cutList: [],
//length: Number($(cut).find('length').text()),
//imported: new Date($(cut).find('originDatetime').text()),
//playcnt: $(cut).find('playCounter').text(),
//lastplayed: new Date($(cut).find('lastPlayDatetime').text()),
};
+ var cutList = $(this).find("cutList");
+ cutList.each(function() {
+ cart.cutList.push({
+ name: $(this).find('cutName').text(),
+ title: $(this).find('description').text(),
+ });
+ });
+
//cart.imported = isNaN(cart.imported) ? '-' : cart.imported;
//cart.lastplayed = isNaN(cart.lastplayed) ? '-' : cart.lastplayed;
jingles_group_carts[number] = cart;
}
);
+ console.log(jingles_group_carts);
jingles_updateCartListing();
}
@@ -71,7 +93,7 @@ function jingles_show() {
})[0];
if(jingAllgem) {
- $('#jingle-title-left').text(jingAllgem.title);
+ $('#jingles-jingAllgem h2').text(jingAllgem.title);
jingles_group_carts = {};
data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: jingAllgem.group.lowcart, INCLUDE_CUTS: 1 };
@@ -79,7 +101,7 @@ function jingles_show() {
}
if(jingAnlass) {
- $('#jingle-title-right').text(jingAnlass.title);
+ $('#jingles-jingAnlass h2').text(jingAnlass.title);
jingles_group_carts = {};
data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: jingAnlass.group.lowcart, INCLUDE_CUTS: 1 };