PageSourceSearch

https://www.77jili7.com/ac/v.1.0.1/manifest/ac-ui-shanshan.4fd61a57.js

js 77jili7.com collected 2026-09-25 02:34:34 UTC 436,479 bytes, 10,321 lines download raw bytes

1(function (window, document, $, tcg) {
2  // Agent Center UI Events
3  tcg.ac.ui = {};
4  tcg.ac.ui.loadRebateQuota = function (quotas) {
5    globalVar.quotaObj = [];
6    globalVar.quotaObj.length = 0;
7    var _html = "";
8    _html += '<ul id="dira-regdline-quota-tabs">';
9    if (quotas.length > 0) {
10      globalVar.quotaObj = quotas;
11      for (var i = 0; i < quotas.length; i++) {
12        _html += "<li class='clearfix'>";
13        _html +=
14          "<input type='radio' name='dira-regdline-rquota' id='rquota" +
15          quotas[i].quotaId +
16          "' disabled='disabled' class='disabled' quota-id='" +
17          quotas[i].quotaId +
18          "' value='0'>";
19        _html +=
20          "<label for='rquota" +
21          quotas[i].quotaId +
22          "' class='disabled' disabled='disabled'>" +
23          quotas[i].templateName +
24          " / " +
25          quotas[i].quotaRemaining +
26          "个</label>";
27        _html += "</li>";
28      }
29      _html += "</ul>";
30      $("#qoutaWrapper").removeClass("hide");
31    } else {
32      $("#qoutaWrapper").addClass("hide");
33    }
34    $("#rebateQuota").html(_html);
35  };
36
37  tcg.ac.ui.agentInformation = function (rs) {
38    var agentInfoResult = rs.value;
39    var basic_html = "";
40    basic_html +=
41      '<div class="dac_div_rscontent">' +
42      '<div class="div-sq dac_div_rstitle"><span>' +
43      tcg.lib.prop("ac_agent_info_table_1") +
44      "</span></div>" +
45      '<div class="dac_div_rsq">' +
46      '<div class="div-sq1">' +
47      '<div class="cirle-info">' +
48      (agentInfoResult.linearLower || "-") +
49      "</div>" +
50      "<p>" +
51      tcg.lib.prop("ac_agent_info_table_1_column_1") +
52      "</p>" +
53      "</div>" +
54      '<div class="div-sq1">' +
55      '<div class="cirle-info">' +
56      (agentInfoResult.teamNumber || "-") +
57      "</div>" +
58      "<p>" +
59      tcg.lib.prop("ac_agent_info_table_1_column_2") +
60      "</p>" +
61      "</div>" +
62      '<div class="div-sq1">' +
63      '<div class="cirle-info">' +
64      (agentInfoResult.todayRegNum || "-") +
65      "</div>" +
66      "<p>" +
67      tcg.lib.prop("ac_agent_info_table_1_column_3") +
68      "</p>" +
69      "</div>" +
70      '<div class="div-sq1">' +
71      '<div class="cirle-info">' +
72      (agentInfoResult.totalDepositCount || "-") +
73      "</div>" +
74      "<p>" +
75      tcg.lib.prop("ac_agent_info_table_1_column_4") +
76      "</p>" +
77      "</div>" +
78      '<div class="div-sq1">' +
79      '<div class="cirle-info">' +
80      (agentInfoResult.todayFirstDepositMemberCounter || "-") +
81      "</div>" +
82      "<p>" +
83      tcg.lib.prop("ac_agent_info_table_1_column_5") +
84      "</p>" +
85      "</div>" +
86      "</div>" +
87      "</div>";
88    basic_html +=
89      '<div class="dac_div_rscontent">' +
90      '<div class="div-sq dac_div_rstitle"><span>' +
91      tcg.lib.prop("ac_agent_info_table_2") +
92      "</span></div>" +
93      '<div class="dac_div_rsq">' +
94      '<div class="div-sq1">' +
95      '<div class="cirle-info">' +
96      (agentInfoResult.todayRebate || "-") +
97      "</div>" +
98      "<p>" +
99      tcg.lib.prop("ac_agent_info_table_2_column_1") +
100      "</p>" +
101      "</div>" +
102      '<div class="div-sq1">' +
103      '<div class="cirle-info">' +
104      (agentInfoResult.todaylottPlayerRebate || "-") +
105      "</div>" +
106      "<p>" +
107      tcg.lib.prop("ac_agent_info_table_2_column_2") +
108      "</p>" +
109      "</div>" +
110      '<div class="div-sq1">' +
111      '<div class="cirle-info">' +
112      (agentInfoResult.todaylivePlayerRebate || "-") +
113      "</div>" +
114      "<p>" +
115      tcg.lib.prop("ac_agent_info_table_2_column_3") +
116      "</p>" +
117      "</div>" +
118      '<div class="div-sq1">' +
119      '<div class="cirle-info">' +
120      (agentInfoResult.todayrngPlayerRebate || "-") +
121      "</div>" +
122      "<p>" +
123      tcg.lib.prop("ac_agent_info_table_2_column_4") +
124      "</p>" +
125      "</div>" +
126      '<div class="div-sq1">' +
127      '<div class="cirle-info">' +
128      (agentInfoResult.todaysportPlayerRebate || "-") +
129      "</div>" +
130      "<p>" +
131      tcg.lib.prop("ac_agent_info_table_2_column_5") +
132      "</p>" +
133      "</div>" +
134      "</div>" +
135      "</div>";
136    basic_html +=
137      '<div class="dac_div_rscontent">' +
138      '<div class="div-sq dac_div_rstitle"><span>' +
139      tcg.lib.prop("ac_agent_info_table_3") +
140      "</span></div>" +
141      '<div class="dac_div_rsq">' +
142      '<div class="div-sq1">' +
143      '<div class="cirle-info">' +
144      (agentInfoResult.rebate_SSC_1 || "-") +
145      "</div>" +
146      "<p>" +
147      tcg.lib.prop("ac_agent_info_table_3_column_1") +
148      "</p>" +
149      "</div>" +
150      '<div class="div-sq1">' +
151      '<div class="cirle-info">' +
152      (agentInfoResult.rebate_11X5_1 || "-") +
153      "</div>" +
154      "<p>" +
155      tcg.lib.prop("ac_agent_info_table_3_column_2") +
156      "</p>" +
157      "</div>" +
158      '<div class="div-sq1">' +
159      '<div class="cirle-info">' +
160      (agentInfoResult.rebate_PK10_1 || "-") +
161      "</div>" +
162      "<p>" +
163      tcg.lib.prop("ac_agent_info_table_3_column_3") +
164      "</p>" +
165      "</div>" +
166      '<div class="div-sq1">' +
167      '<div class="cirle-info">' +
168      (agentInfoResult.rebate_LF_1 || "-") +
169      "</div>" +
170      "<p>" +
171      tcg.lib.prop("ac_agent_info_table_3_column_4") +
172      "</p>" +
173      "</div>" +
174      '<div class="div-sq1">' +
175      '<div class="cirle-info">' +
176      (agentInfoResult.rebate_LHC_1 == undefined ? "-" : agentInfoResult.rebate_LHC_1) +
177      "</div>" +
178      "<p>" +
179      tcg.lib.prop("ac_agent_info_table_3_column_11") +
180      "</p>" +
181      "</div>" +
182      '<div class="div-sq1">' +
183      '<div class="cirle-info">' +
184      (agentInfoResult.rebate_PVP == undefined ? "-" : agentInfoResult.rebate_PVP * 0.025 + "%") +
185      "</div>" +
186      "<p>" +
187      tcg.lib.prop("ac_agent_info_table_3_column_6") +
188      "</p>" +
189      "</div>" +
190      '<div class="div-sq1">' +
191      '<div class="cirle-info">' +
192      (agentInfoResult.rebate_LIVE == undefined ? "-" : agentInfoResult.rebate_LIVE + "%") +
193      "</div>" +
194      "<p>" +
195      tcg.lib.prop("ac_agent_info_table_3_column_7") +
196      "</p>" +
197      "</div>" +
198      '<div class="div-sq1">' +
199      '<div class="cirle-info">' +
200      (agentInfoResult.rebate_RNG == undefined ? "-" : agentInfoResult.rebate_RNG + "%") +
201      "</div>" +
202      "<p>" +
203      tcg.lib.prop("ac_agent_info_table_3_column_8") +
204      "</p>" +
205      "</div>" +
206      '<div class="div-sq1">' +
207      '<div class="cirle-info">' +
208      (agentInfoResult.rebate_SPORTS == undefined ? "-" : agentInfoResult.rebate_SPORTS + "%") +
209      "</div>" +
210      "<p>" +
211      tcg.lib.prop("ac_agent_info_table_3_column_9") +
212      "</p>" +
213      "</div>" +
214      '<div class="div-sq1">' +
215      '<div class="cirle-info">' +
216      (agentInfoResult.rebate_FISH == undefined ? "-" : agentInfoResult.rebate_FISH + "%") +
217      "</div>" +
218      "<p>" +
219      tcg.lib.prop("ac_agent_info_table_3_column_10") +
220      "</p>" +
221      "</div>" +
222      "</div>" +
223      "</div>";
224    $("#dac_basic_info").append(basic_html);
225    $("#dac_safety_info").append(
226      '<div class="infor1"><p>' +
227        tcg.lib.prop("ac_agent_info_table_4") +
228        "</p><p>" +
229        agentInfoResult.totalDepositMoney.toFixed(2) +
230        '</p></div><div class="infor2"><p>' +
231        tcg.lib.prop("ac_agent_info_table_5") +
232        "</p><p>" +
233        tcg.lib.prop("ac_agent_info_table_5_column_1") +
234        "</p><p>" +
235        agentInfoResult.logonTime +
236        "</p><p>" +
237        tcg.lib.prop("ac_agent_info_table_5_column_2") +
238        "</p><p>" +
239        agentInfoResult.logonIP +
240        "</p></div>"
241    );
242  };
243  tcg.ac.ui.agentInformationCopy = function (rs) {
244    var agentInfoResult = rs.value;
245    var basic_html = "";
246    basic_html +=
247      '<div class="dac_div_rscontent">' +
248      '<div class="div-sq dac_div_rstitle"><span>' +
249      tcg.lib.prop("ac_agent_info_table_1") +
250      "</span></div>" +
251      '<div class="dac_div_rsq">' +
252      '<div class="div-sq1">' +
253      '<div class="cirle-info">' +
254      (agentInfoResult.linearLower || "-") +
255      "</div>" +
256      "<p>" +
257      tcg.lib.prop("ac_agent_info_table_1_column_1") +
258      "</p>" +
259      "</div>" +
260      '<div class="div-sq1">' +
261      '<div class="cirle-info">' +
262      (agentInfoResult.teamNumber || "-") +
263      "</div>" +
264      "<p>" +
265      tcg.lib.prop("ac_agent_info_table_1_column_2") +
266      "</p>" +
267      "</div>" +
268      '<div class="div-sq1">' +
269      '<div class="cirle-info">' +
270      (agentInfoResult.todayRegNum || "-") +
271      "</div>" +
272      "<p>" +
273      tcg.lib.prop("ac_agent_info_table_1_column_3") +
274      "</p>" +
275      "</div>" +
276      '<div class="div-sq1">' +
277      '<div class="cirle-info">' +
278      (agentInfoResult.totalDepositCount || "-") +
279      "</div>" +
280      "<p>" +
281      tcg.lib.prop("ac_agent_info_table_1_column_4") +
282      "</p>" +
283      "</div>" +
284      '<div class="div-sq1">' +
285      '<div class="cirle-info">' +
286      (agentInfoResult.todayFirstDepositMemberCounter || "-") +
287      "</div>" +
288      "<p>" +
289      tcg.lib.prop("ac_agent_info_table_1_column_5") +
290      "</p>" +
291      "</div>" +
292      "</div>" +
293      "</div>";
294    /*basic_html += '<div class="dac_div_rscontent">' +
295            '<div class="div-sq dac_div_rstitle"><span>' +tcg.lib.prop("ac_agent_info_table_2")+ '</span></div>' +
296            '<div class="dac_div_rsq">' +
297            '<div class="div-sq1">' +
298            '<div class="cirle-info">' + (agentInfoResult.todayRebate || "-") + '</div>' +
299            '<p>' +tcg.lib.prop("ac_agent_info_table_2_column_1")+ '</p>' +
300            '</div>' +
301            '<div class="div-sq1">' +
302            '<div class="cirle-info">' + (agentInfoResult.todaylottPlayerRebate || "-") + '</div>' +
303            '<p>' +tcg.lib.prop("ac_agent_info_table_2_column_2")+ '</p>' +
304            '</div>' +
305            '<div class="div-sq1">' +
306            '<div class="cirle-info">' + (agentInfoResult.todaylivePlayerRebate || "-") + '</div>' +
307            '<p>' +tcg.lib.prop("ac_agent_info_table_2_column_3")+ '</p>' +
308            '</div>' +
309            '<div class="div-sq1">' +
310            '<div class="cirle-info">' + (agentInfoResult.todayrngPlayerRebate || "-") + '</div>' +
311            '<p>' +tcg.lib.prop("ac_agent_info_table_2_column_4")+ '</p>' +
312            '</div>' +
313            '<div class="div-sq1">' +
314            '<div class="cirle-info">' + (agentInfoResult.todaysportPlayerRebate || "-") + '</div>' +
315            '<p>' +tcg.lib.prop("ac_agent_info_table_2_column_5")+ '</p>' +
316            '</div>' +
317            '</div>' +
318            '</div>';
319        basic_html += '<div class="dac_div_rscontent">' +
320            '<div class="div-sq dac_div_rstitle"><span>' +tcg.lib.prop("ac_agent_info_table_3")+ '</span></div>' +
321            '<div class="dac_div_rsq">' +
322            '<div class="div-sq1">' +
323            '<div class="cirle-info">' + (agentInfoResult.rebate_SSC_1 || "-") + '</div>' +
324            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_1")+ '</p>' +
325            '</div>' +
326            '<div class="div-sq1">' +
327            '<div class="cirle-info">' + (agentInfoResult.rebate_11X5_1 || "-") + '</div>' +
328            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_2")+ '</p>' +
329            '</div>' +
330            '<div class="div-sq1">' +
331            '<div class="cirle-info">' + (agentInfoResult.rebate_PK10_1 || "-") + '</div>' +
332            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_3")+ '</p>' +
333            '</div>' +
334            '<div class="div-sq1">' +
335            '<div class="cirle-info">' + (agentInfoResult.rebate_LF_1 || "-") + '</div>' +
336            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_4")+ '</p>' +
337            '</div>' +
338            '<div class="div-sq1">' +
339            '<div class="cirle-info">' + (agentInfoResult.rebate_ELOTTO == undefined ? "-" : agentInfoResult.rebate_ELOTTO+"%") + '</div>' +
340            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_5")+ '</p>' +
341            '</div>' +
342            '<div class="div-sq1">' +
343            '<div class="cirle-info">' + (agentInfoResult.rebate_PVP == undefined ? "-" : (agentInfoResult.rebate_PVP * 0.025)+"%") + '</div>' +
344            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_6")+ '</p>' +
345            '</div>' +
346            '<div class="div-sq1">' +
347            '<div class="cirle-info">' + (agentInfoResult.rebate_LIVE == undefined ? "-" : agentInfoResult.rebate_LIVE+"%") + '</div>' +
348            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_7")+ '</p>' +
349            '</div>' +
350            '<div class="div-sq1">' +
351            '<div class="cirle-info">' + (agentInfoResult.rebate_RNG == undefined ? "-" : agentInfoResult.rebate_RNG+"%") + '</div>' +
352            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_8")+ '</p>' +
353            '</div>' +
354            '<div class="div-sq1">' +
355            '<div class="cirle-info">' + (agentInfoResult.rebate_SPORTS == undefined ? "-" : agentInfoResult.rebate_SPORTS+"%") + '</div>' +
356            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_9")+ '</p>' +
357            '</div>' +
358            '<div class="div-sq1">' +
359            '<div class="cirle-info">' + (agentInfoResult.rebate_FISH == undefined ? "-" : agentInfoResult.rebate_FISH+"%") + '</div>' +
360            '<p>' +tcg.lib.prop("ac_agent_info_table_3_column_10")+ '</p>' +
361            '</div>' +
362            '</div>' +
363            '</div>';*/
364    $("#dac_basic_info").append(basic_html);
365    $("#dac_safety_info").append(
366      '<div class="infor1"><p>' +
367        tcg.lib.prop("ac_agent_info_table_4") +
368        "</p><p>" +
369        agentInfoResult.totalDepositMoney.toFixed(2) +
370        '</p></div><div class="infor2"><p>' +
371        tcg.lib.prop("ac_agent_info_table_5") +
372        "</p><p>" +
373        tcg.lib.prop("ac_agent_info_table_5_column_1") +
374        "</p><p>" +
375        agentInfoResult.logonTime +
376        "</p><p>" +
377        tcg.lib.prop("ac_agent_info_table_5_column_2") +
378        "</p><p>" +
379        agentInfoResult.logonIP +
380        "</p></div>"
381    );
382  };
383  tcg.ac.ui.onRegTypeSwitch = function (form) {
384    $(document)
385      .off("click", form + " .new-switch-con")
386      .on("click", form + " .new-switch-con", function () {
387        var selected = $(this).find(".selected");
388        selected.siblings().addClass("selected");
389        selected.siblings().removeClass("hide");
390        selected.removeClass("selected");
391        selected.addClass("hide");
392      });
393  };
394  tcg.ac.ui.onQuotaSwitch = function (form) {
395    $(document)
396      .off("change", form + " #rQuotaSwitch")
397      .on("change", form + " #rQuotaSwitch", function () {
398        tcg.ac.ui.rQuotaSwitch(form, "#dira-regdline-quota-tabs", ".dira-regdline-gb-list");
399      });
400  };
401  tcg.ac.ui.customSelect = function (id) {
402    var prop = {
403      width: "100%",
404      disable_search: true,
405    };
406    $(id)
407      .chosen(prop)
408      .on("chosen:showing_dropdown", function () {
409        $(this).parents("div").addClass("red-up");
410      })
411      .on("chosen:hiding_dropdown", function () {
412        $(this).parents("div").removeClass("red-up");
413      });
414  };
415  tcg.ac.ui.register_downline_confirmation = function (data) {
416    var TYPE = [tcg.lib.prop("label_member"), tcg.lib.prop("label_agent")];
417    var _html = "";
418    _html += '<div class="bet_content">';
419    _html += "    <p>" + tcg.lib.prop("ac_bet_content") + "</p>";
420    _html += '   <ul class="">';
421    _html += "   <li><span>" + tcg.lib.prop("ac_bet_content_1") + " : </span><span>" + TYPE[data.type] + "</span></li>";
422    _html +=
423      "   <li><span>" +
424      tcg.lib.prop("label_registration_account") +
425      " : </span><span>" +
426      data.username +
427      "</span></li>";
428    _html +=
429      "   <li><span>" +
430      tcg.lib.prop("label_pwd_login") +
431      " : </span><span>" +
432      (data.password ? data.password : "123456") +
433      "</span></li>";
434
435    if ($.trim(data.nickname) !== "") {
436      _html += "<li><span>" + tcg.lib.prop("label_remark") + " : </span><span>" + data.nickname + "</span></li>";
437    }
438
439    for (var i = 0; i < data.rebateSettingConfigs.length; i++) {
440      var e = data.rebateSettingConfigs[i];
441      _html +=
442        "<li><span>" +
443        tcg.ac.lotto_translate(e.type) +
444        ": </span><span>" +
445        ((e.rebateValue + "").indexOf(".") > -1 ? e.rebateValue.toFixed(2) : e.rebateValue) +
446        "</span></li>";
447    }
448    _html += "</ul>";
449    _html += "</div>";
450  
450  return _html;
451  };
452
453  tcg.ac.ui.registerDownlineSetQuta = function (id, rs, _let, data) {
454    var _html = "";
455    $(id).empty();
456    $.each(rs, function (key, vl) {
457      if (data[key] != undefined && data[key] != "") {
458        _html += '<div id="deleQutarebateEache' + _let + key + '" class="dele_qutarebate_eache ' + key + '">';
459        _html += '<div id="hagDlqutaList' + key + '" class="hag_dlquta_list">';
460        _html += '<div class="hag_register_commun hag_register_communnf hac_link_mangslc">';
461        _html +=
462          '<span class="hag_regcom_lt hag_reg_fc142">' +
463          tcg.lib.prop(key.toUpperCase()) +
464          tcg.lib.prop("ac_quota") +
465          "</span>";
466        _html += '<div class="switch-conmg switch-conmg-quta">';
467        _html += '<div class="onoffswitch">';
468        _html +=
469          '<input type="checkbox" name="reg_rebateType' +
470          _let +
471          '" data-value="' +
472          key +
473          '" class="onoffswitch-checkbox" id="reg_qutaType' +
474          _let +
475          key +
476          '">';
477        _html += '<label class="onoffswitch-label" for="reg_qutaType' + _let + key + '">';
478        _html += '<span class="onoffswitch-inner"></span>';
479        _html += '<span class="onoffswitch-switch"></span>';
480        _html += "</label>";
481        _html += "</div>";
482        _html += "</div>";
483        _html += "</div>";
484        _html += '<div id="hagDlqutaSelect' + _let + key + '" class="hag_register_commun hac_link_mangslc hide">';
485        _html += '<span class="hag_regcom_lt hag_reg_fc142">' + tcg.lib.prop("ac_select_quota") + "</span>";
486        _html +=
487          '<div class="hag_regcom_nameinp hag_regcom_nameinsl customquta_dropdown"><input type="text" name="qutaId" value="" data-value="" placeholder="' +
488          tcg.lib.prop("ac_select_quota_placeholder") +
489          '" readonly="readonly">';
490        _html += '<div class="hag_regcom_tmslcac hide">';
491        _html += '<ul class="chosen-results1 hag_alluse_scroll" id="hagDlqutaSelectList' + key + '">';
492        $.each(vl, function (idx, data) {
493          _html +=
494            '<li value="' +
495            data.quotaId +
496            '" data-type="' +
497            key +
498            '" data-num="' +
499            idx +
500            '">' +
501            data.templateName +
502            "/" +
503            data.quotaRemaining +
504            "个</li>";
505        });
506        _html += "</ul>";
507        _html += "</div>";
508        _html += "</div>";
509        _html += "</div>";
510        _html += "</div>";
511        _html += data[key];
512        _html += "</div>";
513      }
514    });
515    $(id).append(_html);
516  };
517
518  tcg.ac.ui.quotaNameList = function (data_rs) {
519    var _html = "";
520    for (var i = 0; i < data_rs.value.length; i++) {
521      _html +=
522        '<li value="' +
523        data_rs.value[i].quotaId +
524        '">' +
525        data_rs.value[i].templateName +
526        "/" +
527        data_rs.value[i].quotaRemaining +
528        tcg.lib.prop("label_unite_ge") +
529        "</li>";
530    }
531    $("#quotaNameList").html(_html);
532  };
533
534  tcg.ac.ui._changeSlideText = function (elem, ui) {
535    var maxSeries = $(elem).attr("max"),
536      group_code = $(elem).attr("data-type"),
537      minSeries = $(elem).attr("min"),
538      rebate_interval_item = ui.value;
539    $(elem).attr("data-value", ui.value);
540
541    if ($(elem).hasClass("lotto_slider_controller")) {
542      $(elem)
543        .parent()
544        .find("span")
545        .html((rebate_interval_item + "").indexOf(".") > -1 ? rebate_interval_item.toFixed(2) : rebate_interval_item);
546    } else {
547      $(elem)
548        .parent()
549        .find("span")
550        .html(
551          ((rebate_interval_item + "").indexOf(".") > -1 ? rebate_interval_item.toFixed(2) : rebate_interval_item) +
552            tcg.ac.rebateTransformOther(rebate_interval_item, group_code, minSeries)
553        );
554    }
555    var val = (ui.value - $(elem).attr("min")) / ($(elem).attr("max") - $(elem).attr("min"));
556
557    $(elem).find("input").attr("data-value", ui.value);
558    $(elem).find("input").attr("value", ui.value);
559
560    $(elem).css("background", "");
561    $(elem).css(
562      "background-image",
563      "-webkit-gradient(linear, left top, right top, " +
564        "color-stop(" +
565        val +
566        ", rgb(100, 200, 20)), " +
567        "color-stop(" +
568        val +
569        ", #C5C5C5)" +
570        ")"
571    );
572  };
573
574  tcg.ac.ui._build_slider = function (id) {
575    $.each($("" + id + " .range_slider_rebate"), function () {
576      $(this).slider({
577        value: $(this).attr("value") * 1,
578        min: $(this).attr("min") * 1,
579        max: $(this).attr("max") * 1,
580        step: $(this).attr("data-steps") * 1,
581        slide: function (event, ui) {
582          tcg.ac.ui._changeSlideText(this, ui);
583          if ($(this).hasClass("lotto_slider_controller")) {
584            tcg.ac.ui._changeSlideText(this, ui);
585            var min_max = ui.value;
586            var lottoRangeSliders = $("#main_lotto_group_sub_container").find(".range_slider_rebate");
587
588            $.each(lottoRangeSliders, function () {
589              var fval = min_max;
590              if (min_max > $(this).attr("max")) {
591                fval = $(this).attr("max");
592              } else if (min_max < $(this).attr("min")) {
593                fval = $(this).attr("min");
594              }
595              $(this).slider("value", fval);
596              $(this).slider("enable");
597              tcg.ac.ui._changeSlideText(this, { value: fval });
598            });
599          }
600        },
601      });
602    });
603  };
604
605  tcg.ac.ui._createQouta_lotto = function (data) {
606    var qouta_li = "<li>" + tcg.lib.prop("no_qouta") + "</li>";
607
608    for (var i = data.length - 1; i >= 0; i--) {
609      qouta_li +=
610        '<li value="' +
611        data[i].quotaId +
612        '" data-num="' +
613        i +
614        '"  data-type="' +
615        data[i].productType +
616        '">' +
617        data[i].templateName +
618        "/" +
619        data[i].quotaRemaining +
620        "个</li>";
621    }
622
623    var str = "";
624    str += '<div class="hag_register_commun hac_link_mangslc hac_link_mangschw45 lotto_dropdown_head">';
625    str +=
626      '<span class="hag_regcom_lt hag_reg_fc142 label" translate="ac_link_register_deadline_label">' +
627      tcg.lib.prop("quota_label") +
628      "</span>";
629    str += '<div class="hag_regcom_nameinp hag_regcom_nameinsl custom_dropdown qouta_dropdown custom_dropdownelem">';
630    str += '<input type="text" name="qutaId" readonly="readonly" placeholder=' + tcg.lib.prop("quota_label") + ">";
631    str += '<div class="hag_regcom_tmslcac hide">';
632    str += '<ul class="chosen-results1 hag_alluse_scroll hide">';
633    str += qouta_li;
634    str += "</ul>";
635    str += "</div>";
636    str += "</div>";
637    str += "</div>";
638
639    return str;
640  };
641
642  tcg.ac.ui._createQouta_others = function (data) {
643    var qouta_li = "<li>" + tcg.lib.prop("no_qouta") + "</li>";
644    for (var i = data.length - 1; i >= 0; i--) {
645      qouta_li +=
646        '<li value="' +
647        data[i].quotaId +
648        '"  data-num="' +
649        i +
650        '" data-type="' +
651        data[i].productType +
652        '">' +
653        data[i].templateName +
654        "/" +
655        data[i].quotaRemaining +
656        "个</li>";
657    }
658
659    var str = "";
660    str += '<div class="hag_regcom_nameinp hag_regcom_nameinsl custom_dropdown custom_dropdownelem qouta_dropdown">';
661    str += '<input type="text" name="qutaId" readonly="readonly" placeholder=' + tcg.lib.prop("quota_label") + ">";
662    str += '<div class="hag_regcom_tmslcac hide">';
663    str += '<ul class="chosen-results1 hag_alluse_scroll hide">';
664    str += qouta_li;
665    str += "</ul>";
666    str += "</div>";
667    str += "</div>";
668
669    return str;
670  };
671
672  tcg.ac.ui.loadRebateDropdown = function (id, bol, _qt) {
673    var slider_array = [];
674    var data_html = {
675      lott: "",
676      rng: "",
677      live: "",
678      pvp: "",
679      elotto: "",
680      sports: "",
681      fish: "",
682      others: "",
683      _maxrateArr: [],
684      _minrateArr: [],
685    };
686
687    var lotto_qouta = "";
688    if (_qt) {
689      if (!$.isEmptyObject(_qt.value)) {
690        if (_qt.value["4"]) {
691          if (_qt.value["4"].length) {
692            lotto_qouta = tcg.ac.ui._createQouta_lotto(_qt.value["4"]); //qouta html for lotto
693          }
694        }
695      }
696    }
697
698    for (var _groups in globalVar.globeRebate) {
699      var data = globalVar.series;
700      var global_rebates = {};
701      var gReb = globalVar.globeRebate[_groups].map(function (e) {
702        global_rebates[e.gameType] = e;
703      });
704
705      for (var i = 0; i < data.length; i++) {
706        var e = data[i];
707        var group_code = e.type;
708        var _html = "";
709
710        if (global_rebates[group_code]) {
711          var maxSeries =
712            global_rebates[group_code].highestRebate < e.rebateValue
713              ? global_rebates[group_code].highestRebate
714              : e.rebateValue;
715          maxSeries =
716            maxSeries == global_rebates[group_code].minSeries
717              ? maxSeries
718              : maxSeries - global_rebates[group_code].rebateDifference;
719          var rebate_interval =
720            global_rebates[group_code].rebateInterval * 1 == 0 ? 1 : global_rebates[group_code].rebateInterval * 1;
721          var minSeries = global_rebates[group_code].minSeries;
722          if (minSeries > maxSeries) {
723            minSeries = maxSeries;
724          }
725          var rebate_interval_item = maxSeries;
726
727          var slider_ops = [];
728
729          while (rebate_interval_item.toFixed(3) >
729= minSeries) {
730            slider_ops.push(rebate_interval_item);
731            rebate_interval_item = (rebate_interval_item * 10000 - rebate_interval * 10000) / 10000;
732          }
733          var _steps = slider_ops.toString();
734          var odd_quota = "";
735
736          if (_qt) {
737            if (!$.isEmptyObject(_qt.value)) {
738              if (_groups != 4) {
739                for (var qt in _qt.value) {
740                  if (_groups == qt) {
741                    odd_quota = tcg.ac.ui._createQouta_others(_qt.value[qt]);
742                  }
743                }
744              }
745            }
746          }
747          var color_code = _groups == 4 ? "#64C814" : "rgb(197, 197, 197)";
748          var rebateSeriesVal = _groups == 4 ? maxSeries : minSeries;
749          _html += ' <div class="hag_register_commun hac_link_mangslc hac_link_mangschw60">';
750          _html +=
751            ' <span class="hag_regcom_lt hag_reg_fc142 series_label" >' +
752            tcg.lib.prop("series_label_" + group_code) +
753            ":</span>";
754          _html +=
755            ' <div class="slider_range_container hag_regcom_nameinp  custom_dropdown  custom_dropdownelem all_custom_newrebate">';
756          _html +=
757            ' <span style="font-size: 12px;">' +
758            ((rebateSeriesVal + "").indexOf(".") > -1 ? rebateSeriesVal.toFixed(2) : rebateSeriesVal) +
759            tcg.ac.rebateTransformOther(maxSeries, group_code, minSeries) +
760            "</span> ";
761          _html +=
762            ' <div style="background:' +
763            color_code +
764            '"  class="range_slider_rebate" data-steps=' +
765            rebate_interval +
766            '  min="' +
767            minSeries +
768            '" max="' +
769            maxSeries +
770            '" data-type="' +
771            group_code +
772            '"  value="' +
773            ((rebateSeriesVal + "").indexOf(".") > -1 ? rebateSeriesVal.toFixed(2) : rebateSeriesVal) +
774            '"  data-value="' +
775            ((rebateSeriesVal + "").indexOf(".") > -1 ? rebateSeriesVal.toFixed(2) : rebateSeriesVal) +
776            '"  >';
777          _html +=
778            ' <input class="hide"  name="status" data-type="' +
779            group_code +
780            '"  value="' +
781            ((rebateSeriesVal + "").indexOf(".") > -1 ? rebateSeriesVal.toFixed(2) : rebateSeriesVal) +
782            '" >';
783          _html += " </div>";
784          _html += odd_quota;
785          _html += " </div>";
786          _html += " </div>";
787          if (_groups == 4) {
788            data_html._maxrateArr.push(maxSeries);
789            data_html._minrateArr.push(minSeries);
790            data_html.lott += _html;
791            data_html.minControlValue = data_html.minControlValue ? data_html.minControlValue : rebateSeriesVal;
792            data_html.minControlValue =
793              rebateSeriesVal > data_html.minControlValue ? rebateSeriesVal : data_html.minControlValue;
794            if (maxSeries != minSeries) {
795              data_html.disableMaxControl = true;
796            }
797          } else {
798            data_html.others += _html;
799          }
800        }
801      }
802    }
803
804    if (data_html.lott) {
805      var min_max_series = globalVar.globeRebate[4];
806      var _maxrate = data_html.disableMaxControl
807        ? Math.max.apply(Math, data_html._maxrateArr)
808        : data_html.minControlValue;
809      var _minrate = data_html.disableMaxControl ? Math.min.apply(Math, data_html._minrateArr) : _maxrate;
810      var _html_lott_main = "";
811      _html_lott_main += ' <div class="hag_register_commun hac_link_mangslc hac_link_mangschw60">';
812      _html_lott_main += ' <span class="hag_regcom_lt hag_reg_fc142 series_label" >返点设定:</span>';
813      _html_lott_main += ' <div class="slider_range_container hag_regcom_nameinp  custom_dropdown parentController">';
814      _html_lott_main += ' <span style="font-size: 12px;">' + _maxrate + "</span> ";
815      _html_lott_main +=
816        ' <div style="background:#64c814"  class="range_slider_rebate lotto_slider_controller" data-type="SSC_1" data-steps=' +
817        min_max_series[0].rebateInterval +
818        ' value="' +
819        _maxrate +
820        '"  min="' +
821        _minrate +
822        '" max="' +
823        _maxrate +
824        '"  data-value="' +
825        _maxrate +
826        '"  >';
827      _html_lott_main += ' <input class="hide"  name="status"  value="' + _maxrate + '" >';
828      _html_lott_main += " </div>";
829      _html_lott_main += " </div>";
830      _html_lott_main += " </div>";
831      _html_lott_main +=
832        ' <div id="show_lott_btn_container"><div id="show_lott_btn"><span>+</span> 开启彩票自定义 </div></div>';
833      data_html.lotto_main_slider = _html_lott_main;
834    }
835
836    var lotto_group_html = data_html.lott
837      ? "<div id='lottoGroupSlider' class='rebate_lott_group'><div class='lott_box_header'><div class='lott_box_title'>" +
838        tcg.lib.prop("lott_box_title") +
839        "</div>" +
840        "<div class='lott_min_max'><span data-mode='min' class='min_max'>" +
841        tcg.lib.prop("MIN") +
842        "</span><span data-mode='max' class='min_max'>" +
843        tcg.lib.prop("MAX") +
844        "</span>" +
845        lotto_qouta +
846        "</div>" +
847        data_html.lotto_main_slider +
848        "<div id='main_lotto_group_container' style='display:none;'>" +
849        "<div id='main_lotto_group_sub_container'>" +
850        data_html.lott +
851        "</div>" +
852        "</div>" +
853        "</div>" +
854        "</div>"
855      : "";
856
857    var other_group_html = data_html.others
858      ? "<div class='rebate_lott_group other_group'><div class='lott_box_header'><div><div class='lott_box_title'>" +
859        tcg.lib.prop("label_other") +
860        "</div><div class='lott_min_max'><span data-mode='min' class='min_max'>" +
861        tcg.lib.prop("MIN") +
862        "</span><span data-mode='max' class='min_max'>" +
863        tcg.lib.prop("MAX") +
864        "</span> </div>" +
865        data_html.others +
866        "</div></div>"
867      : "";
868
869    $(id).html(lotto_group_html + other_group_html);
870
871    //EVENT LISTENERS
872
873    $(document).on("click", ".lott_min_max .min_max", function () {
874      var min_max = $(this).attr("data-mode");
875      var lottoRangeSliders = $(this).parents(".rebate_lott_group").find(".range_slider_rebate");
876      $.each(lottoRangeSliders, function () {
877        $(this).slider("value", $(this).attr(min_max));
878        $(this).slider("enable");
879        tcg.ac.ui._changeSlideText(this, { value: $(this).slider("option", "value") });
880      });
881    });
882
883    $("#show_lott_btn").on("click", function () {
884      $("#main_lotto_group_container").toggle("slide", { direction: "up" }, 500);
885      if ($(this).find("span").html() == "+") {
886        $(this).html("<span>-</span> 关闭彩票自定义 ");
887      } else {
888        $(this).html("<span>+</span> 开启彩票自定义 ");
889      }
890    });
891
892    $(".rebate_lott_group").on("click", ".qouta_dropdown li", function () {
893      if (!$(this).attr("data-type")) {
894        if ($(this).parents(".rebate_lott_group").hasClass("other_group")) {
895          var lottoRangeSliders = $(this).parents(".slider_range_container").find(".range_slider_rebate");
896          $.each(lottoRangeSliders, function () {
897            $(this).slider("value", $(this).attr("min"));
898            $(this).slider("enable");
899            tcg.ac.ui._changeSlideText(this, { value: $(this).attr("min") });
900          });
901        } else {
902          $(this).parents(".rebate_lott_group").find(".lott_min_max .min_max[data-mode=max]").click();
903        }
904        return;
905      }
906
907      var data_rs = JSON.parse(sessionStorage.qt).value;
908      $(this).parents(".qouta_dropdown").find("input").attr("data-value", $(this).attr("value"));
909      var customerSeries = globalVar.series;
910      var eme = this;
911      var quotaConfig = data_rs[$(eme).attr("data-type")][$(eme).attr("data-num")];
912      //var thisParent = '#deleQutarebateEache' + _let + $(eme).attr("data-type");
913      for (var i = 0; i < quotaConfig.quotaRebateConfig.length; i++) {
914        var quotaModeType = quotaConfig.quotaRebateConfig[i].type;
915        for (var j = 0; j < customerSeries.length; j++) {
916          if (customerSeries[j].type == quotaModeType) {
917            var quotaModeValue =
918              customerSeries[j].rebateValue > quotaConfig.quotaRebateConfig[i].rebateValue
919                ? quotaConfig.quotaRebateConfig[i].rebateValue
920                : customerSeries[j].rebateValue;
921            var _elem = $("#deleAllQutaRebateList").find(".range_slider_rebate[data-type=" + quotaModeType + "]");
922            $(_elem).slider("value", quotaModeValue);
923            $(_elem).slider("disable");
924            tcg.ac.ui._changeSlideText(_elem, { value: quotaModeValue });
925            break;
926          }
927        }
928      }
929    });
930  };
931
932  tcg.ac.ui.loadDownlineRebateDropdown = function (id, downlineRebates, _qt, customerRebate) {
933    var slider_array = [];
934    var data_html = {
935      lott: "",
936      rng: "",
937      live: "",
938      pvp: "",
939      elotto: "",
940      sports: "",
941      fish: "",
942      others: "",
943    };
944
945    var lotto_qouta = "";
946
947    if (_qt) {
948      if (!$.isEmptyObject(_qt.value)) {
949        if (_qt.value["4"]) {
950          if (_qt.value["4"].length) {
951            lotto_qouta = tcg.ac.ui._createQouta_lotto(_qt.value["4"]); //qouta html for lotto
952          }
953        }
954      }
955    }
956
957    for (var _groups in globalVar.globeRebate) {
958      var data = globalVar.series;
959      var global_rebates = {};
960      var downline_rebates = {};
961      var gReb = globalVar.globeRebate[_groups].map(function (e) {
962        global_rebates[e.gameType] = e;
963      });
964
965      var downlineRebates = customerRebate.value.configs.map(function (e) {
966        var game_type = e.type;
967        if (e.prizeModeId * 1 > 0) {
968          game_type = e.type + "_" + e.prizeModeId;
969        }
970        downline_rebates[game_type] = e;
971      });
972
973      for (var i = 0; i < data.length; i++) {
974        var e = data[i];
975        var group_code = e.type;
976        var _html = "";
977
978        if (global_rebates[group_code]) {
979          var rebate_interval_item = minSeries;
980
981          var slider_ops = [];
982
983          while (rebate_interval_item <= maxSeries) {
984            slider_ops.push(rebate_interval_item);
985            rebate_interval_item += rebate_interval;
986          }
987          var _steps = slider_ops.toString();
988
989          var odd_quota = "";
990
991          if (_qt) {
992            if (!$.isEmptyObject(_qt.value)) {
993              if (_groups != 4) {
994                for (var qt in _qt.value) {
995                  if (_groups == qt) {
996                    odd_quota = tcg.ac.ui._createQouta_others(_qt.value[qt]);
997                  }
998                }
999              }
1000            }
1001          }
1002          var maxSeries =
1003            global_rebates[group_code].highestRebate < e.rebateValue
1004              ? global_rebates[group_code].highestRebate
1005              : e.rebateValue;
1006          maxSeries =
1007            maxSeries == global_rebates[group_code].minSeries
1008              ? maxSeries
1009              : maxSeries - global_rebates[group_code].rebateDifference;
1010          var rebate_interval =
1011            global_rebates[group_code].rebateInterval * 1 == 0 ? 1 : global_rebates[group_code].rebateInterval * 1;
1012
1013          var minSeries = global_rebates[group_code].minSeries;
1014
1015          if (minSeries > maxSeries) {
1016            minSeries = maxSeries;
1017          }
1018
1019          var current_dl_rebate = downline_rebates[group_code].rebateValue;
1020
1021          _html += ' <div class="hag_register_commun hac_link_mangslc hac_link_mangschw60">';
1022          _html +=
1023            ' <span class="hag_regcom_lt hag_reg_fc142" translate="series_label_' +
1024            group_code +
1025            '">' +
1026            tcg.lib.prop("series_label_" + group_code) +
1027            ":</span>";
1028
1029          _html +=
1030            ' <div class="slider_range_container hag_regcom_nameinp  custom_dropdown all_custom_newrebate custom_dropdownelem">';
1031          _html +=
1032            ' <span style="font-size: 12px;">' +
1033            ((current_dl_rebate + "").indexOf(".") > -1 ? current_dl_rebate.toFixed(2) : current_dl_rebate) +
1034            tcg.ac.rebateTransformOther(current_dl_rebate, group_code, current_dl_rebate) +
1035            "</span> ";
1036          _html +=
1037            ' <div style="background:rgb(197, 197, 197);" class="range_slider_rebate" data-steps=' +
1038            rebate_interval +
1039            '  min="' +
1040            current_dl_rebate +
1041            '" max="' +
1042            maxSeries +
1043            '" data-type="' +
1044            group_code +
1045            '"  value="' +
1046            ((current_dl_rebate + "").indexOf(".") > -1 ? current_dl_rebate.toFixed(2) : current_dl_rebate) +
1047            '"  >';
1048          _html +=
1049            ' <input class="slide_color_range hide"   name="status" data-type="' +
1050            group_code +
1051            '" value="' +
1052            ((current_dl_rebate + "").indexOf(".") > -1 ? current_dl_rebate.toFixed(2) : current_dl_rebate) +
1053            '">';
1054          _html += " </div>";
1055          _html += odd_quota;
1056          _html += " </div>";
1057          _html += " </div>";
1058
1059          if (_groups == 4) {
1060            data_html.lott += _html;
1061          } else {
1062            data_html.others += _html;
1063          }
1064        }
1065      }
1066    }
1067
1068    var lotto_group_html = data_html.lott
1069      ? "<div id='lottoGroupSlider' class='rebate_lott_group'><div class='lott_box_header'><div class='lott_box_title'>" +
1070        tcg.lib.prop("lott_box_title") +
1071        "</div>" +
1072        "<div class='lott_min_max'><span data-mode='min' class='min_max'>" +
1073        tcg.lib.prop("MIN") +
1074        "</span><span data-mode='max' class='min_max'>" +
1075        tcg.lib.prop("MAX") +
1076        "</span>" +
1077        lotto_qouta +
1078        "</div>" +
1079        data_html.lott +
1080        "</div></div>"
1081      : "";
1082
1083    var other_group_html = data_html.others
1084      ? "<div class='rebate_lott_group other_group'><div class='lott_box_header'><div><div class='lott_box_title'>" +
1085        tcg.lib.prop("label_other") +
1086        "</div><div class='lott_min_max'><span data-mode='min' class='min_max'>" +
1087        tcg.lib.prop("MIN") +
1088        "</span><span data-mode='max' class='min_max'>" +
1089        tcg.lib.prop("MAX") +
1090        "</span> </div>" +
1091        data_html.others +
1092        "</div></div>"
1093      : "";
1094    $(id).html(lotto_group_html + other_group_html);
1095
1096    //EVENT LISTENERS
1097
1098    $(document).on("click", ".lott_min_max .min_max", function () {
1099      var min_max = $(this).attr("data-mode");
1100      var lottoRangeSliders = $(this).parents(".rebate_lott_group").find(".range_slider_rebate");
1101      $.each(lottoRangeSliders, function () {
1102        $(this).slider("value", $(this).attr(min_max));
1103        $(this).slider("enable");
1104        tcg.ac.ui._changeSlideText(this, { value: $(this).slider("option", "value") });
1105      });
1106    });
1107
1108    $(".rebate_lott_group").on("click", ".qouta_dropdown li", function () {
1109      if (!$(this).attr("data-type")) {
1110        if ($(this).parents(".rebate_lott_group").hasClass("other_group")) {
1111          var lottoRangeSliders = $(this).parents(".slider_range_container").find(".range_slider_rebate");
1112          $.each(lottoRangeSliders, function () {
1113            $(this).slider("value", $(this).attr("min"));
1114            $(this).slider("enable");
1115            tcg.ac.ui._changeSlideText(this, { value: $(this).attr("min") });
1116          });
1117        } else {
1118          $(this).parents(".rebate_lott_group").find(".lott_min_max .min_max[data-mode=max]").click();
1119        }
1120        return;
1121      }
1122
1123      var data_rs = JSON.parse(sessionStorage.qt).value;
1124      $(this).parents(".qouta_dropdown").find("input").attr("data-value", $(this).attr("value"));
1125      var customerSeries = globalVar.series;
1126      var eme = this;
1127      var quotaConfig = data_rs[$(eme).attr("data-type")][$(eme).attr("data-num")];
1128      //var thisParent = '#deleQutarebateEache' + _let + $(eme).attr("data-type");
1129      for (var i = 0; i < quotaConfig.quotaRebateConfig.length; i++) {
1130        var quotaModeType = quotaConfig.quotaRebateConfig[i].type;
1131        for (var j = 0; j < customerSeries.length; j++) {
1132          if (customerSeries[j].type == quotaModeType) {
1133            var quotaModeValue =
1134              customerSeries[j].rebateValue > quotaConfig.quotaRebateConfig[i].rebateValue
1135                ? quotaConfig.quotaRebateConfig[i].rebateValue
1136                : customerSeries[j].rebateValue;
1137            var _elem = $("#member_rebates_dropdown").find(".range_slider_rebate[data-type=" + quotaModeType + "]");
1138            $(_
1138elem).slider("value", quotaModeValue);
1139            $(_elem).slider("disable");
1140            tcg.ac.ui._changeSlideText(_elem, { value: quotaModeValue });
1141            break;
1142          }
1143        }
1144      }
1145    });
1146  };
1147  tcg.ac.ui.zeroClipboardInit = function (elem) {
1148    //  Copy url
1149    // ZeroClipboard.config( { moviePath: window.location.origin + "http://apps.bdimg.com/libs/zeroclipboard/2.2.0/ZeroClipboard.swf" } );
1150    // var clip = new ZeroClipboard($(".zeroclipboard"));
1151    // clip.on('complete', function(client,args){
1152    //     tcg.lib.alert("success", (tcg.lib.prop("label_success_copy")));
1153    // });
1154    $("[data-clipboard], .zeroclipboard")
1155      .unbind("click")
1156      .bind("click", function () {
1157        //var link = $(this).find("span:last-child").html();// + "/register.html";
1158        var link = $(this).attr("data-clipboard-text");
1159        var input = document.createElement("INPUT");
1160        input.setAttribute("type", "text");
1161        input.setAttribute("name", "affiliateUrl");
1162        input.setAttribute("value", link);
1163        input.setAttribute("style", "position: absolute; z-index: -9999");
1164        $(this).append(input);
1165        $("[name='affiliateUrl']").select();
1166        try {
1167          var successful = document.execCommand("copy");
1168          var msg = successful ? "label_success_copy" : "linkManager_success_fail";
1169          tcg.lib.alert("success", tcg.lib.prop(msg), null, function () {
1170            $("[name='affiliateUrl']").remove();
1171          });
1172        } catch (err) {}
1173      });
1174  };
1175  tcg.ac.ui.copyClipboard = function (elem) {
1176    // var e = elem || $("[data-clipboard], .zeroclipboard");
1177    // ZeroClipboard.setDefaults({
1178    // 	moviePath: "http://apps.bdimg.com/libs/zeroclipboard/2.2.0/ZeroClipboard.swf"
1179    // });
1180    // var clip = new ZeroClipboard(e);
1181
1182    // return clip;
1183
1184    $("[data-clipboard], .zeroclipboard")
1185      .unbind("click")
1186      .bind("click", function () {
1187        var link = $(this).find("span:last-child").html(); // + "/register.html";
1188
1189        var input = document.createElement("INPUT");
1190        input.setAttribute("type", "text");
1191        input.setAttribute("name", "affiliateUrl");
1192        input.setAttribute("value", link);
1193        input.setAttribute("style", "position: absolute; z-index: -9999");
1194        $(this).append(input);
1195        $("[name='affiliateUrl']").select();
1196        try {
1197          var successful = document.execCommand("copy");
1198          var msg = successful ? "label_success_copy" : "linkManager_success_fail";
1199          tcg.lib.alert("success", tcg.lib.prop(msg), null, function () {
1200            $("[name='affiliateUrl']").remove();
1201          });
1202        } catch (err) {}
1203      });
1204  };
1205  tcg.ac.ui.cleanGameSeries = function (cleanGameSeries, _html) {
1206    _html += "<ul class='dira-regdline-gb-list'>";
1207    //gameSeries.forEach(function(entry,index) {
1208    $.each(cleanGameSeries, function (index, entry) {
1209      var gameCode = entry.gameGroupCode + entry.prizeModeId;
1210      _html += "<li class='dira-regdline-gb-listitem'>";
1211      _html +=
1212        "<input type='checkbox' class='mg-check' id='check" +
1213        index +
1214        "' name='lottery' value=" +
1215        entry.gameGroupCode +
1216        " data-gameCode='" +
1217        gameCode +
1218        "' checked />";
1219      _html += "<label for='check" + index + "'>" + tcg.lib.prop(entry.gameGroupCode + entry.prizeModeId) + ":</label>";
1220      _html += "<div class='quota' id='lottQuota" + index + "'></div>";
1221      _html += "<input type='text' class='quota-amount' gameCode='" + gameCode + "' placeholder='-----' />";
1222      _html += "<div class='minusBtn raeBtn'>";
1223      _html += "<input type='button' class='minus'/>";
1224      _html += "</div>";
1225      _html += "<div class='plusBtn raeBtn'>";
1226      _html += "<input type='button' class='plus'/>";
1227      _html += "</div>";
1228      _html += "</li>";
1229    });
1230    _html += "</ul>";
1231    return _html;
1232  };
1233  tcg.ac.ui.sscGamesSeriesSwitch = function () {
1234    $(".dira-regdline-gb-listitem input[data-gameCode='SSC1']").change(function () {
1235      var isChecked = $(this).is(":checked");
1236      if (!isChecked) {
1237        if ($(".dira-regdline-gb-listitem input[data-gameCode='SSC2']").is(":checked")) {
1238          $(".dira-regdline-gb-listitem input[data-gameCode='SSC2']").trigger("click");
1239          $(".dira-regdline-gb-listitem input[data-gameCode='SSC2']").attr("disabled", true);
1240        } else {
1241          $(".dira-regdline-gb-listitem input[data-gameCode='SSC2']").attr("disabled", true);
1242        }
1243      } else {
1244        if (!$(".dira-regdline-gb-listitem input[data-gameCode='SSC2']").is(":checked")) {
1245          $(".dira-regdline-gb-listitem input[data-gameCode='SSC2']").removeAttr("disabled");
1246          $(".dira-regdline-gb-listitem input[data-gameCode='SSC2']").trigger("click");
1247        }
1248      }
1249    });
1250  };
1251  tcg.ac.ui.clickQuotaTab = function (id) {
1252    $(document)
1253      .off("click", id + " [type='radio']")
1254      .on("click", id + " [type='radio']", function () {
1255        var quotaId = $(this).attr("quota-id");
1256        var rel = $(this).attr("data-rel");
1257        var radio_btn = this;
1258        var quotaRebateConfig = null;
1259
1260        $.each(globalVar.quotaObj, function (index, entry) {
1261          if (entry.quotaId == quotaId) {
1262            quotaRebateConfig = entry.quotaRebateConfig;
1263          }
1264        });
1265        $("#gameSeries input[type=text]").each(function () {
1266          for (var i = 0; i < quotaRebateConfig.length; i++) {
1267            var gameCode = quotaRebateConfig[i].type + quotaRebateConfig[i].prizeModeId;
1268            var inputCode = $(this).attr("gameCode");
1269            if (inputCode == gameCode) {
1270              $(this).val(quotaRebateConfig[i].rebateValue);
1271              var adj_cbox = $("input[value='" + quotaRebateConfig[i].type + "']", $(this).parent());
1272              if (!$(adj_cbox).is(":checked")) {
1273                if ($(adj_cbox).is(":disabled")) {
1274                  $(adj_cbox).removeAttr("disabled").trigger("click").attr("disabled", "disabled");
1275                } else {
1276                  $(adj_cbox).trigger("click");
1277                }
1278              }
1279
1280              $(".quota").slider({ value: quotaRebateConfig[i].rebateValue });
1281            }
1282          }
1283        });
1284        $(".quota-amount").each(function () {
1285          var maximum = $(this).val() * 1;
1286          var temp_gameCode = $(this).attr("gameCode");
1287          maximum =
1288            maximum < globalVar.customerSeries[temp_gameCode]["maxSeries"]
1289              ? maximum
1290              : globalVar.customerSeries[temp_gameCode]["maxSeries"];
1291          $(this).val(maximum);
1292          $(this).siblings(".quota").slider("option", {
1293            value: maximum,
1294            max: maximum,
1295          });
1296        });
1297        $("#rebateQuota input[type=radio]").each(function (index, elem) {
1298          $(radio_btn).attr("quota-id") != $(elem).attr("quota-id")
1299            ? $(elem).removeClass("mg-radio-btn")
1300            : $(radio_btn).addClass("mg-radio-btn");
1301        });
1302      });
1303  };
1304  tcg.ac.ui.rQuotaSwitch = function (form, tab, gameRebates) {
1305    var rQuotas = $(tab + " li input[type='radio'], " + tab + " li label"),
1306      rRebates = $(
1307        gameRebates +
1308          " li input[type='checkbox'], " +
1309          gameRebates +
1310          " li .quota-amount, " +
1311          gameRebates +
1312          " li div .minus, " +
1313          gameRebates +
1314          " li div .plus"
1315      );
1316    if ($(form + " #rQuotaSwitch").is(":checked")) {
1317      rQuotas.removeAttr("disabled");
1318      rQuotas.removeClass("disabled");
1319      rRebates.attr("disabled", "").closest("li").addClass("disable");
1320      $(".quota").slider("option", "disabled", true);
1321      $(form + " #rQuotaSwitch").addClass("mg-check");
1322      $("#gameSeries input[type='checkbox']").each(function () {
1323        $(this).addClass("mg-check").prop("checked", true);
1324      });
1325      $(".quota-amount[gameCode='SSC2']").removeAttr("disabled");
1326      $(".quota-amount[gameCode='SSC2']").siblings("input").removeAttr("disabled");
1327      $(".quota-amount[gameCode='SSC2']").siblings(".quota").slider("option", "disabled", false);
1328    } else {
1329      rQuotas.attr("disabled", "");
1330      rQuotas.addClass("disabled");
1331      rQuotas.removeAttr("checked");
1332      $(form + " .mg-radio-btn").removeClass("mg-radio-btn");
1333      rRebates.removeAttr("disabled").closest("li").removeClass("disable");
1334      $(".quota").slider("option", "disabled", false);
1335
1336      $("#gameSeries input[type=text]").each(function () {
1337        var minseries = $(this).attr("min") || 0;
1338        $(this).val(minseries);
1339        $(".quota").slider({ value: minseries });
1340      });
1341      $(form + " #rQuotaSwitch").removeClass("mg-check");
1342      $(".quota-amount").each(function () {
1343        $(this).val($(this).attr("min"));
1344        $(this)
1345          .siblings(".quota")
1346          .slider("option", {
1347            value: $(this).attr("min"),
1348            max: $(this).attr("max"),
1349          });
1350      });
1351    }
1352  };
1353  tcg.ac.ui.onGamesSeriesBoxClick = function (form, queryDown) {
1354    $(document)
1355      .off("click", form + " input[name='lottery']")
1356      .on("click", form + " input[name='lottery']", function () {
1357        if (queryDown) {
1358          return false;
1359        }
1360        if ($(this).prop("checked")) {
1361          var minSeries = $(this).siblings("input[type='text']").attr("min") || 0;
1362          $(this).siblings("input[type='text']").val(minSeries).attr("readonly", false);
1363          $(this).siblings(".quota").slider("value", minSeries);
1364          $(this).siblings(".quota").slider("enable");
1365          $(this).siblings(".quota-amount").removeAttr("disabled");
1366          $(this).siblings(".minusBtn").find(".minus").removeAttr("disabled");
1367          $(this).siblings(".plusBtn").find(".plus").removeAttr("disabled");
1368          $(this).addClass("mg-check");
1369        } else {
1370          var minSeries = $(this).siblings("input[type='text']").attr("min");
1371          $(this).siblings("input[type='text']").val(minSeries).attr("readonly", true);
1372          //$(this).siblings(".quota").slider("value",minSeries);
1373          $(this).siblings(".quota").slider("disable");
1374          $(this).siblings(".quota-amount").attr("disabled", "true");
1375          $(this).siblings(".minusBtn").find(".minus").attr("disabled", "true");
1376          $(this).siblings(".plusBtn").find(".plus").attr("disabled", "true");
1377          $(this).removeClass("mg-check");
1378        }
1379      });
1380  };
1381  tcg.ac.ui.sliderAmount = function (value, min, max, step, index, f, rand) {
1382    var form = $(f),
1383      lotteries = form.find("input[name='lottery']"),
1384      ranMin,
1385      last = 0;
1386    if (rand === true) {
1387      ranMin = Math.floor(Math.random() * (max - min + 1)) + min;
1388    } else {
1389      ranMin = min;
1390    }
1391
1392    var globeRebate_map = {};
1393    $(globalVar.globeRebate).map(function () {
1394      switch (this.gameType) {
1395        case "SSC_1":
1396          globeRebate_map["SSC1"] = this.highestRebate * 1;
1397          break;
1398        case "SSC_2":
1399          globeRebate_map["SSC2"] = this.highestRebate * 1;
1400          break;
1401        case "11X5_1":
1402          globeRebate_map["11X5"] = this.highestRebate * 1;
1403          break;
1404        case "LF_1":
1405          globeRebate_map["FC3D"] = this.highestRebate * 1;
1406          globeRebate_map["TCP3P5"] = this.highestRebate * 1;
1407          break;
1408        case "PK10_1":
1409          globeRebate_map["PK10"] = this.highestRebate * 1;
1410          break;
1411      }
1412    });
1413    lotteries.eq(index).siblings(".quota-amount").val(ranMin);
1414    lotteries.eq(index).siblings(".quota-amount").attr("max", max);
1415    lotteries.eq(index).siblings(".quota-amount").attr("min", min);
1416    lotteries.eq(index).siblings(".plusBtn").find(".plus").val(" ");
1417    lotteries.eq(index).siblings(".minusBtn").find(".minus").val(" ");
1418    lotteries
1419      .eq(index)
1420      .siblings(".quota")
1421      .slider({
1422        value: ranMin,
1423        orientation: "horizontal",
1424        range: "min",
1425        min: min,
1426        max: max,
1427        animate: true,
1428        step: step,
1429        slide: function (event, ui) {
1430          lotteries.eq(index).siblings(".quota").siblings("input.quota-amount").val(ui.value);
1431          var gameCode = lotteries.eq(index).siblings("input.quota-amount").attr("gameCode");
1432          if (ui.value >= max || ui.value >= globeRebate_map[gameCode]) {
1433            lotteries.eq(index).siblings(".quota").removeClass("sa-blue");
1434            lotteries.eq(index).siblings(".quota").addClass("sa-red");
1435          } else {
1436            lotteries.eq(index).siblings(".quota").removeClass("sa-red");
1437            lotteries.eq(index).siblings(".quota").addClass("sa-blue");
1438          }
1439        },
1440        change: function (event, ui) {
1441          var gameCode = lotteries.eq(index).siblings("input.quota-amount").attr("gameCode");
1442          if (ui.value >= max || ui.value >= globeRebate_map[gameCode]) {
1443            lotteries.eq(index).siblings(".quota").removeClass("sa-blue");
1444            lotteries.eq(index).siblings(".quota").addClass("sa-red");
1445          } else {
1446            lotteries.eq(index).siblings(".quota").removeClass("sa-red");
1447            lotteries.eq(index).siblings(".quota").addClass("sa-blue");
1448          }
1449        },
1450      });
1451
1452    lotteries
1453      .eq(index)
1454      .siblings(".quota-amount")
1455      .on("change", function () {
1456        var newValue = parseInt($(this).val());
1457
1458        if (newValue > max) {
1459          $(this).prevAll(".quota").slider({
1460            value: max,
1461          });
1462
1463          $(this).val(max);
1464        } else if (newValue < min) {
1465          $(this).prevAll(".quota").slider({
1466            value: min,
1467          });
1468          $(this).val(min);
1469        } else {
1470          $(this).prevAll(".quota").slider({
1471            value: newValue,
1472          });
1473
1474          $(this).val(newValue);
1475        }
1476        if (isNaN(newValue)) {
1477          $(this).val(min);
1478        }
1479      });
1480    //
1481    lotteries
1482      .eq(index)
1483      .siblings(".plusBtn")
1484      .children(".plus")
1485      .click(function () {
1486        var thisQuota = $(this).parent().prevAll(".quota"),
1487          value = thisQuota.slider("value"),
1488          max = thisQuota.slider("option", "max");
1489        nextAmount = parseInt($(this).parent().prevAll(".quota-amount").val());
1490        step = thisQuota.slider("option", "step");
1491
1492        thisQuota.slider("value", value + step);
1493
1494        if (nextAmount >= max) {
1495          $(this).parent().prevAll(".quota-amount").val(value);
1496        } else {
1497          $(this)
1498            .parent()
1499            .prevAll(".quota-amount")
1500            .val(value + step);
1501        }
1502      });
1503
1504    lotteries
1505      .eq(index)
1506      .siblings(".minusBtn")
1507      .children(".minus")
1508      .click(function () {
1509        var thisQuota = $(this).parent().prevAll(".quota"),
1510          value = thisQuota.slider("value"),
1511          min = thisQuota.slider("option", "min");
1512        nextAmount = parseInt($(this).parent().prevAll(".quota-amount").val());
1513        step = thisQuota.slider("option", "step");
1514
1515        thisQuota.slider("value", value - step);
1516
1517        if (nextAmount <= min) {
1518          $(this).parent().prevAll(".quota-amount").val(value);
1519        } else {
1520          $(this)
1521            .parent()
1522            .prevAll(".quota-amount")
1523            .val(value - step);
1524        }
1525      });
1526  };
1527
1528  tcg.ac.ui.agentRedRain = function (r, c) {
1529    var _html = "";
1530    $("#rpt_search_custmore").empty();
1531    $.each(r, function (k, v) {
1532      if (!c[k]) {
1533        _html +=
1534          '<div class="downline"><input type="checkbox" name="cb" id="' +
1535          v +
1536          '" data-value=' +
1537          v +
1538          ' data-name="' +
1539          k +
1540          '"><label for="' +
1541          v +
1542          '">' +
1543          k +
1544          "</label></div>";
1545      } else {
1546        _html +=
1547          '<div class="downline"><input type="checkbox" name="cb" checked id="' +
1548          v +
1549          '" data-value=' +
1550          v +
1551          ' data-name="' +
1552          k +
1553          '"><label for="' +
1554          v +
1555          '">' +
1556          k +
1557          "</label></div>";
1558      }
1559    });
1560    // _html = _html=="" ? '<div>暂无数据</div>':_html;
1561
1562    $("#rpt_search_custmore").html(_html);
1563    tcg.ac.agentRedRainClick();
1564  };
1565  tcg.ac.ui.agentRedRainSelect = function (r) {
1566    var _html = "";
1567    if (r.length > 0) {
1568      $.each(r, function (k, v) {
1569        if (k != "length") {
1570          _html +=
1571            '<div class="dynm-rpt rd" data-value=' +
1572            v +
1573            ' data-name="' +
1574            k +
1575            '">' +
1576            k +
1577            '<div class="close-rpf"></div></div>';
1578        }
1579      });
1580    } else {
1581      _html = '<div class="dynm-rpt">' + tcg.lib.prop("label_input_receiver") + "</div>";
1582    }
1583    $("#select_send_redrain").html(_html);
1584  };
1585
1586  tcg.ac.ui.registerDownlineQuota = function (msg, userType, username, password, lotteries, encodeValue) {
1587    // Declare
1588    var l = [];
1589    encodeValue["rebateSettingConfigs"] = [];
1590
1591    msg += "<div style='text-align:left; margin-left:40px; color:#fff;'>";
1592    msg +=
1593      tcg.lib.prop("ac_bet_content_1") +
1594      ":" +
1595      (userType == 1 ? tcg.lib.prop("label_agent") : tcg.lib.prop("label_member")) +
1596      "<br/>";
1597    msg += tcg.lib.prop("label_registration_account") + ":" + username + "<br/>";
1598    msg +=
1599      tcg.lib.prop("label_pwd_login") +
1600      ":" +
1601      (password != "" ? password : tcg.lib.prop("ac_default_password")) +
1602      "<br/>";
1603
1604    for (var i = 0; i < lotteries.length; i++) {
1605      var gameGroup = lotteries.eq(i).siblings("input.quota-amount").attr("gamecode");
1606      var groupCode = gameGroup.substr(gameGroup.length - 1);
1607      //encodeValue[i+4] = lotteries.eq(i).val() + ","+groupCode+"," + lotteries.eq(i).siblings("input.quota-amount").val();
1608      l[i] = {
1609        type: lotteries.eq(i).val() + "_" + groupCode,
1610        rebateValue: lotteries.eq(i).siblings("input.quota-amount").val(),
1611      };
1612      encodeValue["rebateSettingConfigs"].push(l[i]);
1613      msg +=
1614        lotteries.eq(i).siblings("label").text().replace(":", "") +
1615        tcg.lib.prop("ac_bonus_group") +
1616        ":" +
1617        lotteries.eq(i).siblings("input.quota-amount").val() +
1618        "<br/>";
1619    }
1620    msg += "</div>";
1621    return msg;
1622  };
1623
1624  tcg.ac.ui.chosePathType = function () {
1625    $(document)
1626      .off("change", "#generateAffiliateUrlForm select[name='pathType']")
1627      .on("change", "#generateAffiliateUrlForm select[name='pathType']", function () {
1628        var value = $(this).children("option:selected").val();
1629        if (value == 0 || value == 1) {
1630          $("#generateAffiliateUrlForm input[name='dira-genaffurl-promotionpath']").val(
1631            $(this).children("option:selected").text()
1632          );
1633          $("#generateAffiliateUrlForm input[name='dira-genaffurl-promotionpath']").attr("readonly", true);
1634        } else if (value == 2) {
1635          $("#generateAffiliateUrlForm input[name='dira-genaffurl-promotionpath']").val("");
1636          $("#generateAffiliateUrlForm input[name='dira-genaffurl-promotionpath']").attr("placeholder", "--");
1637          $("#generateAffiliateUrlForm input[name='dira-genaffurl-promotionpath']").attr("readonly", false);
1638        }
1639      });
1640
1641    $("#generateAffiliateUrlForm select[name='pathType']").trigger("change");
1642  };
1643  tcg.ac.ui.submitGenerateAffiliateUrl = function () {
1644    $(document)
1645      .off("click", "#generateAffiliateUrlForm .form-submit")
1646      .on("click", "#generateAffiliateUrlForm .form-submit", function () {
1647        tcg.ac.generateAffiliateUrl();
1648      });
1649  };
1650
1651  tcg.ac.ui.shortenPathName = function (channelName) {
1652    var cn = channelName;
1653    if (cn.length > 4) {
1654      cn = cn.substring(0, 4) + "...";
1655      cn += '<div class="pop-yel-2"><span>' + channelName + "</span></div>";
1656    }
1657    return cn;
1658  };
1659  tcg.ac.ui.beautifyAffiliateUrl = function (code, url_back) {
1660    var data = tcg.ac.ui.generateAffiliateUrl(code);
1661    var _text = data.hostname + url_back;
1662    var _template1 =
1663      "<div class='hover-tips'><span class='ellipsis'>{0}</span><div class='content-tips {2}' {4}>{1}{3}</div></div>";
1664    return _text && _text.byte() > 11 ? _template1.format(_text, _text) : _text;
1665  };
1666  tcg.ac.ui.loadAgentDownlines = function (result) {
1667    //  Declare
1668    var _html = "",
1669      registerAmount = 0;
1670    var TYPE = [tcg.lib.prop("label_member"), tcg.lib.prop("label_agent")],
1671      STATUS = [
1672        tcg.lib.prop("ac_link_manager_status_option_4"),
1673        tcg.lib.prop("ac_link_manager_status_option_2"),
1674        tcg.lib.prop("ac_link_manager_status_option_3"),
1675      ];
1676    //  Show result
1677
1678    var append_static_url = 0;
1679
1680    if (sessionStorage.AGECEN) {
1681      var AGCEN = JSON.parse(sessionStorage.AGECEN);
1682      for (var i = AGCEN.childrenNodes.length - 1; i >= 0; i--) {
1683        if (AGCEN.childrenNodes[i].modId == "REGCEN") {
1684          for (var j = AGCEN.childrenNodes[i].childrenNodes.length - 1; j >= 0; j--) {
1685            if (AGCEN.childrenNodes[i].childrenNodes[j].modId == "AFFURLEXT3") {
1686              append_static_url = AGCEN.childrenNodes[i].childrenNodes[j].enabled;
1687            }
1688          }
1689        }
1690      }
1691    }
1692
1693    if (result.List.length > 0) {
1694      for (var i = 0; i < result.List.length; i++) {
1695        var entry = result.List[i];
1696
1697        registerAmount += entry.affiliateCount;
1698        var merchantC = window.sessionStorage.getItem("merchantCode");
1699        var data = tcg.ac.ui.generateAffiliateUrl(entry.code),
1700          url_back = tcg.ac.mechantConfig(merchantC);
1701
1702        var append_register = append_static_url == "1" ? "/register.html" : "";
1703
1704        _html += "<div class='divTableRow border-bot clearfix'>";
1705        _html +=
1706          "<div class='divTableCell yel-con-2'>" +
1707          (!entry.path ? "系统生成" : entry.path == " " ? "系统生成" : entry.path) +
1708          "</div>";
1709        _html +=
1710          "<div class='divTableCell div-x tbl-link ico-file zeroclipboard' data-clipboard-text='" +
1711          data.url +
1712          url_back +
1713          append_register +
1714          "'><span class='icocss'></span><span class='icocss'></span>" +
1715          tcg.ac.ui.beautifyAffiliateUrl(entry.code, url_back + append_register) +
1716          "</div>";
1717        _html += "<div class='divTableCell div-z registerCount'>" + entry.affiliateCount + "</div>";
1718        /* Disable click event, removed classes (tbl-link registerCount) */
1719        _html += "<div class='divTableCell div-y'>" + TYPE[entry.type] + "</div>";
1720        _html += "<div class='divTableCell div-y'>" + STATUS[entry.status] + "</div>";
1721        _html += "<div class='divTableCell'>" + entry.startDate + "</div>";
1722        _html +=
1723          "<div class='divTableCell'>" +
1724          (entry.endDate != null ? entry.endDate : tcg.lib.prop("ac_link_register_deadline_option_1")) +
1725          "</div>";
1726        _html += "<div class='divTableCell div-y'>";
1727        _html += "<div class='tbl-gear game-icons'>";
1728        _html += "<ul class='dropdown-opts hide'>";
1729        _html += "<span class='arrow-up'></span>";
1730        _html += "<li class='affiliateUrlDetail'>" + tcg.lib.prop("label_details") + "</li>";
1731        _html += "<li class='affiliateUrlDelete'>" + tcg.lib.prop("ac_delete_btn") + "</li>";
1732        _html += "</ul>";
1733        _html += "</div>";
1734        _html += "</div>";
1735        _html += "<div style='display:none;' class='entry'>" + JSON.stringify(entry) + "</div>";
1736        _html += "</div>";
1737      }
1738    } else {
1739      _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
1740    }
1741
1742    $("#linkManagerList").html(_html);
1743    $("#totalEffectiveAmount").text(registerAmount);
1744
1745    //  Copy url
1746    tcg.ac.ui.zeroClipboardInit($(".zeroclipboard"));
1747  };
1748  tcg.ac.ui.generateAffiliateUrl = function (code) {
1749    var url = "";
1750    var hostname = "";
1751    var baseUrl = window.location.host.split(".");
1752
1753    hostname = code + "." + baseUrl[baseUrl.length - 2] + "." + baseUrl[baseUrl.length - 1];
1754    url += window.location.protocol + "//";
1755    url += hostname;
1756    //url += window.location.port == "80" ? "/" : ":" + window.location.port + "/";
1757    // url += "/register.html";
1758    return { hostname: hostname, url: url };
1759  };
1760
1761  tcg.ac.ui.appendBreadCrumbs = function (data) {
1762    var _html = "";
1763    for (var i = 0; data.length > i; i++) {
1764      _html +=
1765        "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
1766        data[i].customerName +
1767        "'>" +
1768        data[i].customerName +
1769        "</div>";
1770    }
1771    $("#breadcrumbs").html(_html);
1772  };
1773
1774  tcg.ac.ui.searchMemberManagement = function () {
1775    $(document)
1776      .off("click", "#memberManagementForm .form-submit")
1777      .on("click", "#memberManagementForm .form-submit", function () {
1778        $("#breadcrumbs .b-list.new-entry").remove();
1779        tcg.ac.getMemberManagement(true);
1780      });
1781  };
1782  tcg.ac.ui.searchMemberManagementV2 = function () {
1783    $(document)
1784      .off("click", "#memberManagementForm .form-submit")
1785      .on("click", "#memberManagementForm .form-submit", function (e) {
1786        if (e.originalEvent !== undefined) {
1787          $("#breadcrumbs .b-list.new-entry").remove();
1788          $("#memberManagementForm input[name='pageNo']").val(1);
1789          tcg.ac.getMemberManagementV2();
1790        } else {
1791          var len = $("#memberManagement #breadcrumbs .b-list").length - 1;
1792          var customerId = $($("#memberManagement #breadcrumbs .b-list")[len]).attr("data-customerid");
1793          if ($(".divTableCell.mm-th4.onel-th.div-x.sort").hasClass("asc")) {
1794            var type = $(".divTableCell.mm-th4.onel-th.div-x.sort").attr("data-type");
1795            tcg.ac.getMemberManagementV2(customerId, type, "asc");
1796          } else if ($(".divTableCell.mm-th4.onel-th.div-x.sort").hasClass("desc")) {
1797            var type = $(".divTableCell.mm-th4.onel-th.div-x.sort").attr("data-type");
1798            tcg.ac.getMemberManagementV2(customerId, type, "desc");
1799          } else {
1800            tcg.ac.getMemberManagementV2(customerId);
1801          }
1802        }
1803      });
1804  };
1805  tcg.ac.ui.clickMemberManagementBreadcrumbs = function () {
1806    $(document)
1807      .off("click", "#breadcrumbs .b-list")
1808      .on("click", "#breadcrumbs .b-list", function () {
1809        var user_customerId = `${tcg.ac.customerId}`;
1810        var customerId = $(this).attr("data-customerId"),
1811          removeFromList = false;
1812        $("#breadcrumbs .b-list").each(function () {
1813          if (removeFromList) $(this).remove();
1814          if ($(this).attr("data-customerId") == customerId) {
1815            removeFromList = true;
1816          }
1817        });
1818        if (user_customerId == customerId) {
1819          tcg.ac.getMemberManagement(true);
1820        } else {
1821          tcg.ac.getMemberManagement(true, customerId);
1822        }
1823      });
1824  };
1825  tcg.ac.ui.clickMemberManagementBreadcrumbsV2 = function () {
1826    $(document)
1827      .off("click", "#breadcrumbs .b-list")
1828      .on("click", "#breadcrumbs .b-list", function () {
1829        var username = window.sessionStorage.getItem("username");
1830        var customerId = $(this).attr("data-customerId"),
1831          removeFromList = false;
1832        $("#breadcrumbs .b-list").each(function () {
1833          if (removeFromList) $(this).remove();
1834          if ($(this).attr("data-customerId") == customerId) {
1835            removeFromList = true;
1836          }
1837        });
1838        $("#memberManagementForm input[name='pageNo']").val(1);
1839        $(".divTableCell.mm-th4.onel-th.div-x.sort").removeClass("asc");
1840        $(".divTableCell.mm-th4.onel-th.div-x.sort").removeClass("desc");
1841        tcg.ac.getMemberManagementV2(customerId);
1842      });
1843  };
1844  tcg.ac.ui.loadMemberManagement = function (result, isTransferEnabled) {
1845    var memberList = result;
1846    var list = "",
1847      decimal = 2;
1848    if (memberList != null) {
1849      for (var i = 0; i < memberList.length; i++) {
1850        // $.each(memberList, function(index, entry) {
1851        var lastLoginTime = memberList[i].last_login_time == null ? new Date() : memberList[i].last_login_time.time;
1852        var registerDate = memberList[i].reg_date == null ? new Date() : memberList[i].reg_date.time;
1853        var status =
1854          memberList[i].activeFlag == 0
1855            ? tcg.lib.prop("ac_active_flag")
1856            : memberList[i].activeFlag == 1
1857            ? tcg.lib.prop("ac_link_manager_status_option_2")
1858            : memberList[i].activeFlag == 2
1859            ? tcg.lib.prop("ac_active_flag")
1860            : memberList[i].activeFlag == 5
1861            ? tcg.lib.prop("ac_active_flag")
1862            : memberList[i].activeFlag == 6
1863            ? tcg.lib.prop("ac_active_flag")
1864            : memberList[i].activeFlag == 7
1865            ? tcg.lib.prop("ac_active_flag_7")
1866            : "N/A";
1867        var super6Rebate = memberList[i].super6Rebate == 0 ? "-" : memberList[i].super6_rebate;
1868        var sscRebate = memberList[i].sscRebate == 0 ? "-" : memberList[i].ssc_rebate;
1869        var accountBal = tcg.ac.customCurrencyFormat(memberList[i].avail_balance, decimal);
1870        if (i % 2 == 0) {
1871          list += '<div class="divTableRow border-bot clearfix">';
1872        } else {
1873          list += '<div class="divTableRow border-bot clearfix divTableRowothr">';
1874        }
1875        list +=
1876          '<div class="divTableCell div-x tbl-link showdetail" data-downline=' +
1877          memberList[i].customer_id +
1878          ">" +
1879          memberList[i].customer_name +
1880          "</div>";
1881        list +=
1882          '<div class="divTableCell ac_memberType">' +
1883          (memberList[i].type == 1 ? tcg.lib.prop("label_agent") : tcg.lib.prop("label_member")) +
1884          "</div>";
1885        list += '<div class="divTableCell ac_teamSize">' + memberList[i].team_size + "</div>";
1886        list +=
1887          '<div class="divTableCell div-z ac_registerDate">' +
1888          tcg.ac.formatDateFull(registerDate * 1, "yyyy-MM-dd hh:mm") +
1889          "</div>";
1890        list +=
1891          '<div class="divTableCell div-x ac_inactiveDays">' +
1892          tcg.ac.days_between(new Date(), new Date(lastLoginTime * 1)) +
1893          "</div>";
1894        list += '<div class="divTableCell ac_sscRebate">' + sscRebate + "</div>";
1895        list += '<div class="divTableCell ac_liveRebate">' + memberList[i].live_rebate + "</div>";
1896        list += '<div class="divTableCell ac_rngRebate">' + memberList[i].rng_rebate + "</div>";
1897        list += '<div class="divTableCell ac_pvpRebate">' + memberList[i].pvp_rebate_new + "</div>";
1898        // list += '<div class="divTableCell ac_super6Rebate">'+ super6Rebate +'</div>';
1899        // list += '<div class="divTableCell ">'+ status  +'</div>';
1900        list +=
1901          '<div class="divTableCell div-x ps-num ac_availableBalance" data-switchDecimal="' +
1902          decimal +
1903          '"  data-value="' +
1904          memberList[i].avail_balance.toFixed(2) +
1905          '">' +
1906          accountBal +
1907          "</div>";
1908        list +=
1909          '<div class="divTableCell div-y"><div class="tbl-gear game-icons">' +
1910          '<ul class="dropdown-opts hide"><span class="arrow-up"></span>';
1911        if ($("#breadcrumbs div").length == 1) {
1912          list +=
1913            '<li class="setRebate" data-customer_id="' +
1914            memberList[i].customer_id +
1915            '" data-customer_name="' +
1916            memberList[i].customer_name +
1917            '">' +
1918            tcg.lib.prop("ac_rebate_set") +
1919            "</li>";
1920        }
1921        if ($("#breadcrumbs div").length == 1 && memberList[i].type == 1) {
1922          list += '<li class="TransferQuota">' + tcg.lib.prop("ac_transfer_quota") + "</li>";
1923        }
1924        list +=
1925          '<li class="bettingHistoryLink" data-customer_name="' +
1926          memberList[i].customer_name +
1927          '">' +
1928          tcg.lib.prop("ac_game_record") +
1929          "</li>";
1930        if (isTransferEnabled == 1 && $("#breadcrumbs div").length == 1) {
1931          list +=
1932            '<li class="transferToDown" data-downline="' +
1933            memberList[i].customer_name +
1934            '">' +
1935            tcg.lib.prop("ac_transfer_to_downline") +
1936            "</li>";
1937        }
1938        if (memberList[i].type == 0 && $("#breadcrumbs div").length == 1) {
1939          list += '<li class="setAgent">' + tcg.lib.prop("ac_set_agent") + "</li>";
1940        }
1941        if (globalVar.cid == memberList[i].recommender_id) {
1942          list +=
1943            '<li class="sendMessage" data-customerName="' +
1944            memberList[i].customer_name +
1945            '" data-customerId="' +
1946            memberList[i].customer_id +
1947            '" >' +
1948            tcg.lib.prop("ac_sent_a_message") +
1949            "</li>";
1950        }
1951        list += "</ul></div></div>";
1952        list += '<div class="entry" style="display:none;">' + JSON.stringify(memberList[i]) + "</div>";
1953        list += "</div>";
1954        // });
1955      }
1956    }
1957    // list = '';
1958    $("#memberManagementList").html(list);
1959
1960    // switch(tcg.ac.getMerchant()){
1961    // 	case "500cai":
1962    // 		// TCG-6214
1963    // 		$(".mm-th7, .ac_super6Rebate").remove();
1964    // 	break;
1965    // 	default:
1966    // }
1967
1968    $("#totalTeamSize").html(sessionStorage.teamSize);
1969    $("#totalPlannedAmount").html(tcg.ac.customCurrencyFormat(sessionStorage.teamBalance, decimal)).attr({
1970      "data-SwitchDecimal": decimal,
1971      "data-value": sessionStorage.teamBalance,
1972    });
1973  };
1974  tcg.ac.ui.loadMemberManagementV2 = function (result, isTransferEnabled, footer) {
1975    var memberList = result;
1976    var list = "",
1977      decimal = 2,
1978      teamBalance = 0,
1979      teamSize = 0,
1980      downlineClass = "";
1981    if (memberList != null) {
1982      for (var i = 0; i < memberList.length; i++) {
1983        // $.each(memberList, function(index, entry) {
1984        var lastLoginTime =
1985          memberList[i].lastLoginTimeInTimestamp == null
1986            ? "--"
1987            : moment(memberList[i].lastLoginTimeInTimestamp).format("YYYY-MM-DD  HH:mm:ss");
1988        var registerDate =
1989          memberList[i].regDateInTimestamp == null
1990            ? moment().format("YYYY-MM-DD  HH:mm:ss")
1991            : moment(memberList[i].regDateInTimestamp).format("YYYY-MM-DD  HH:mm:ss");
1992        var status =
1993          memberList[i].activeFlag == 0
1994            ? tcg.lib.prop("ac_active_flag")
1995            : memberList[i].activeFlag == 1
1996            ? tcg.lib.prop("ac_link_manager_status_option_2")
1997            : memberList[i].activeFlag == 2
1998            ? tcg.lib.prop("ac_active_flag")
1999            : memberList[i].activeFlag == 5
2000            ? tcg.lib.prop("ac_active_flag")
2001            : memberList[i].activeFlag == 6
2002            ? tcg.lib.prop("ac_active_flag")
2003            : memberList[i].activeFlag == 7
2004            ? tcg.lib.prop("ac_active_flag_7")
2005            : "N/A";
2006        var rebates = {};
2007        for (var j = 0; j < memberList[i].rebates.length; j++) {
2008          rebates[memberList[i].rebates[j].rebateType] = memberList[i].rebates[j].rebateValue;
2009        }
2010        var accountBal = tcg.ac.customCurrencyFormat(memberList[i].availBalance, decimal);
2011        if (memberList[i].hasDirect) {
2012          downlineClass = "showdetail";
2013        }
2014        if (i % 2 == 0) {
2015          list += '<div class="divTableRow border-bot clearfix">';
2016        } else {
2017          list += '<div class="divTableRow border-bot clearfix divTableRowothr">';
2018        }
2019
2020        var _status;
2021        if (memberList[i].customerName == sessionStorage.username) {
2022          _status = "active";
2023        } else {
2024          _status = memberList[i].onlineStatus ? "active" : "inactive";
2025        }
2026        list += '<div class="divTableCell"> <span class="_dot  ' + _status + '"></span></div>';
2027        list +=
2028          '<div class="divTableCell div-x tbl-link ' +
2029          downlineClass +
2030          '" data-downline=' +
2031          memberList[i].customerId +
2032          " data-downlinename=" +
2033          memberList[i].customerName +
2034          ">" +
2035          memberList[i].customerName +
2036          "</div>";
2037        downlineClass = "";
2038        list +=
2039          '<div class="divTableCell ac_memberType">' +
2040          (memberList[i].isAgent ? tcg.lib.prop("label_agent") : tcg.lib.prop("label_member")) +
2041          "</div>";
2042        list += '<div class="divTableCell ac_teamSize">' + memberList[i].teamCount + "</div>";
2043
2044        var click_reb_text = rebates.SSC_1 ? rebates.SSC_1 : tcg.lib.prop("ac_clickable_rebate");
2045
2046        list +=
2047          '<div class="divTableCell rebateSlide _ac_status_rebates" data-recomender="' +
2048          memberList[i].recommenderId +
2049          '" data-rebates=' +
2050          JSON.stringify(rebates) +
2051          " data-downline=" +
2052          memberList[i].customerId +
2053          " data-downlinename=" +
2054          memberList[i].customerName +
2055          ">" +
2056          click_reb_text +
2057          "</div>";
2058        list += '<div class="divTableCell regDate div-z ac_registerDate">' + registerDate + "</div>";
2059        list += '<div class="divTableCell regDate div-z">' + lastLoginTime + "</div>";
2060        list +=
2061          '<div class="divTableCell" data-switchDecimal="' +
2062          decimal +
2063          '"  data-value="' +
2064          accountBal.replace(/[^0-9.]/g, "") +
2065          '">' +
2066          accountBal +
2067          "</div>";
2068
2069        var hide_gear = `${memberList[i].customerId}` === `${tcg.ac.customerId}` ? "hide" : "";
2070        if (sessionStorage.merchantCode == "hele8th") {
2071          hide_gear = "hide";
2072        }
2073        list +=
2074          '<div class="divTableCell div-y ' +
2075          hide_gear +
2076          '"><div class="tbl-gear game-icons">' +
2077          '<ul class="dropdown-opts hide"><span class="arrow-up"></span>';
2078        if (+memberList[i].recommenderId === tcg.ac.customerId) {
2079          list +=
2080            '<li class="setRebateDropdown" data-customer_id="' +
2081            memberList[i].customerId +
2082            '" data-customer_name="' +
2083            memberList[i].customerName +
2084            '">' +
2085            tcg.lib.prop("ac_rebate_set") +
2086            "</li>";
2087        }
2088        var _qt = JSON.parse(sessionStorage.qt);
2089
2090        if (
2091          +memberList[i].recommenderId === tcg.ac.customerId &&
2092          memberList[i].isAgent &&
2093          !$.isEmptyObject(_qt.value)
2094        ) {
2095          list += '<li class="TransferQuota">' + tcg.lib.prop("ac_transfer_quota") + "</li>";
2096        }
2097        list +=
2098          '<li class="bettingHistoryLink" data-customer_name="' +
2099          memberList[i].customerName +
2100          '">' +
2101          tcg.lib.prop("ac_game_record") +
2102          "</li>";
2103        // if (isTransferEnabled == 1 && $("#breadcrumbs div").length == 1) {
2104        //     list += '<li class="transferToDown" data-downline="' + memberList[i].customerName + '">' +tcg.lib.prop("ac_transfer_to_downline")+ '</li>';
2105        // }
2106        if (footer.toDownline == "1" && $("#breadcrumbs div").length >= 1) {
2107          if (footer.downlineReceiver == "DIRECT" && memberList[i].recommenderId == globalVar.cid) {
2108            list +=
2109              '<li class="transferToDown" data-downline="' +
2110              memberList[i].customerName +
2111              '">' +
2112              tcg.lib.prop("ac_transfer_to_downline") +
2113              "</li>";
2114          }
2115          if (footer.downlineReceiver == "TREE") {
2116            list +=
2117              '<li class="transferToDown" data-downline="' +
2118              memberList[i].customerName +
2119              '">' +
2120              tcg.lib.prop("ac_transfer_to_downline") +
2121              "</li>";
2122          }
2123        }
2124        if (!memberList[i].isAgent && +memberList[i].recommenderId === tcg.ac.customerId) {
2125          list += '<li class="setAgent">' + tcg.lib.prop("ac_set_agent") + "</li>";
2126        }
2127        if (+memberList[i].recommenderId === tcg.ac.customerId) {
2128          list +=
2129            '<li class="sendMessage" data-customerName="' +
2130            memberList[i].customerName +
2131            '" data-customerId="' +
2132            memberList[i].customer_id +
2133            '" >' +
2134            tcg.lib.prop("ac_sent_a_message") +
2135            "</li>";
2136        }
2137        list += "</ul></div></div>";
2138        list += '<div class="entry" style="display:none;">' + JSON.stringify(memberList[i]) + "</div>";
2139        list += "</div>";
2140        // });
2141        teamBalance += memberList[i].availBalance;
2142        teamSize += me
2142mberList[i].teamCount;
2143      }
2144    }
2145    // list = '';
2146    if (footer.subTeamList && footer.subTeamList.length) {
2147      tcg.ac.ui.appendBreadCrumbs(footer.subTeamList);
2148    }
2149
2150    $("#memberManagementList").html(list);
2151
2152    if ($.isEmptyObject(globalVar.globeRebate)) {
2153      $(".divTableCell.rebateSlide._ac_status_rebates").hide();
2154      $("#memberManagement .ac_rebate_head").hide();
2155    }
2156
2157    $("#memberManagementList")
2158      .off("click", ".rebateSlide")
2159      .on("click", ".rebateSlide", function () {
2160        $("#registerSubordinateFloater ._head span").html($(this).attr("data-downlinename"));
2161        var reb_lott = "";
2162        var reb_oothers = "";
2163        var rebates = JSON.parse($(this).attr("data-rebates"));
2164        var lott_html = "";
2165        var others_html = "";
2166
2167        for (var gr in globalVar.globeRebate) {
2168          for (var i = globalVar.globeRebate[gr].length - 1; i >= 0; i--) {
2169            for (var r in rebates) {
2170              if (r == globalVar.globeRebate[gr][i].gameType) {
2171                if (gr == 4) {
2172                  lott_html +=
2173                    "<div class='rebs'>" + tcg.lib.prop("series_label_" + r) + " : " + rebates[r] + " </div>";
2174                } else {
2175                  others_html +=
2176                    "<div class='rebs'>" + tcg.lib.prop("series_label_" + r) + " : " + rebates[r] + " </div>";
2177                }
2178              }
2179            }
2180          }
2181        }
2182
2183        $("#registerSubordinateFloater ._edit_btn.setRebate").attr({
2184          "data-customer_id": $(this).attr("data-downline"),
2185          "data-customer_name": $(this).attr("data-downlinename"),
2186        });
2187
2188        $("#registerSubordinateFloater ._lott ._content").html("");
2189        if (lott_html) {
2190          $("#registerSubordinateFloater ._lott ._content").html(lott_html);
2191          $("#registerSubordinateFloater ._lott").show();
2192        }
2193
2194        $("#registerSubordinateFloater ._others ._content").html("");
2195        if (others_html) {
2196          $("#registerSubordinateFloater ._others ._content").html(others_html);
2197          $("#registerSubordinateFloater ._others").show();
2198        }
2199
2200        if ($(this).attr("data-recomender") !== `${tcg.ac.customerId}`) {
2201          $("#registerSubordinateFloater ._edit_btn.setRebate").hide();
2202        } else {
2203          $("#registerSubordinateFloater ._edit_btn.setRebate").show();
2204        }
2205
2206        $("#registerSubordinateFloater").show("slide", { direction: "right" }, 300);
2207      });
2208
2209    $("#registerSubordinateFloater .clos_btn")
2210      .off("click")
2211      .on("click", function () {
2212        $("#registerSubordinateFloater").toggle("slide", { direction: "right" }, 300);
2213      });
2214
2215    // switch(tcg.ac.getMerchant()){
2216    //  case "500cai":
2217    //      // TCG-6214
2218    //      $(".mm-th7, .ac_super6Rebate").remove();
2219    //  break;
2220    //  default:
2221    // }
2222
2223    $("#totalTeamSize").html(teamSize);
2224    $("#totalPlannedAmount").html(tcg.ac.customCurrencyFormat(teamBalance, decimal)).attr({
2225      "data-SwitchDecimal": decimal,
2226      "data-value": teamBalance,
2227    });
2228  };
2229  tcg.ac.ui.valueCheck = function (value, replacement) {
2230    if (value === undefined || value === null) {
2231      return replacement;
2232    } else {
2233      return value;
2234    }
2235  };
2236  tcg.ac.ui.loadPagination = function (type, currentPage, pageTotal, id) {
2237    var offSetButtons = 3;
2238    var currentPage = currentPage * 1;
2239    var totalButtons = offSetButtons * 2;
2240    var currentPageClass = null,
2241      _html = [];
2242    _html.push(
2243      "<div class='pag-arr-left game-icons pag-bnt'><a href='javascript:void(0)' data-pageNav='prev'>&nbsp;</a></div>"
2244    );
2245    var startPage = currentPage <= pageTotal - totalButtons ? currentPage : pageTotal - totalButtons;
2246    for (var i = startPage <= 0 ? 1 : startPage * 1; i <= pageTotal; i++) {
2247      if (i < offSetButtons + currentPage || i > pageTotal - offSetButtons) {
2248        currentPageClass = currentPage == i ? "active" : "";
2249        _html.push(
2250          "<div class='pag-num game-icons pag-bnt " +
2251            currentPageClass +
2252            "'><a href='javascript:void(0);' data-pageNo='" +
2253            i +
2254            "'>" +
2255            i +
2256            "</a></div>"
2257        );
2258      } else if (i == offSetButtons + currentPage) {
2259        _html.push("<div class='pag-bnt'>...</div>");
2260      }
2261    }
2262    _html.push(
2263      "<div class='pag-arr-right game-icons pag-bnt'><a href='javascript:void(0);' data-pageNav='next'>&nbsp;</a></div>"
2264    );
2265
2266    _html.push("<div class='pag-search-con inline-block'>");
2267    _html.push("<input type='text' class='pag-search game-icons' name='inputPageNo'  />");
2268    _html.push(
2269      "<input class='game-icons switch-dete' type='button' name='goToPage' value='" +
2270        tcg.lib.prop("ac_datepicker_closeText") +
2271        "' />"
2272    );
2273    _html.push("</div>");
2274    var id = id || "#pagination";
2275    $(id).html(_html);
2276    tcg.ac.pageNav(type, currentPage, pageTotal, id);
2277    tcg.ac.clickPageNo(type, currentPage, pageTotal, id);
2278    tcg.ac.goToPageNo(type, currentPage, pageTotal, id);
2279  };
2280  tcg.ac.ui.loadPaginationNew = function (type, currentPage, pageTotal, id) {
2281    var offSetButtons = 3;
2282    var currentPage = currentPage * 1;
2283    var totalButtons = offSetButtons * 2;
2284    var currentPageClass = null,
2285      _html = [];
2286    _html.push('<a href="javascript:void(0)"  data-pageNav="prev" class="pageNum stepLeft"></a>');
2287    // _html.push("<div class='pag-arr-left game-icons pag-bnt'><a href='javascript:void(0)' data-pageNav='prev'>&nbsp;</a></div>");
2288    var startPage = currentPage <= pageTotal - totalButtons ? currentPage : pageTotal - totalButtons;
2289    for (var i = startPage <= 0 ? 1 : startPage * 1; i <= pageTotal; i++) {
2290      if (i < offSetButtons + currentPage || i > pageTotal - offSetButtons) {
2291        currentPageClass = currentPage == i ? "checkedPage" : "";
2292        // currentPageClass = currentPage == i ? "active" : "";
2293        _html.push(
2294          '<a href="javascript:void(0)" class="pageNum ' + currentPageClass + '" data-pageNo="' + i + '">' + i + "</a>"
2295        );
2296
2297        // _html.push("<div class='pag-num game-icons pag-bnt " + currentPageClass + "'><a href='javascript:void(0);' data-pageNo='" + i + "'>" + i + "</a></div>");
2298      } else if (i == offSetButtons + currentPage) {
2299        _html.push('<a  href="javascript:void(0)"  class="">...</a>');
2300        // _html.push("<div class='pag-bnt'>...</div>");
2301      }
2302    }
2303    _html.push('<a href="javascript:void(0)"  data-pageNav="next" class="pageNum stepRight"></a>');
2304    // _html.push("<div class='pag-arr-right game-icons pag-bnt'><a href='javascript:void(0);' data-pageNav='next'>&nbsp;</a></div>");
2305
2306    // _html.push("<div class='pag-search-con inline-block'>");
2307    // _html.push("<input type='text' class='pag-search game-icons' name='inputPageNo'  />");
2308    // _html.push("<input class='game-icons switch-dete' type='button' name='goToPage' value='" +tcg.lib.prop("ac_datepicker_closeText")+ "' />");
2309    // _html.push("</div>");
2310    var id = id || "#pagination";
2311    $(id).html(_html);
2312    tcg.ac.pageNav(type, currentPage, pageTotal, id);
2313    tcg.ac.clickPageNo(type, currentPage, pageTotal, id);
2314    tcg.ac.goToPageNo(type, currentPage, pageTotal, id);
2315  };
2316  tcg.ac.ui.loadBettingRecord = function (result) {
2317    var list = "",
2318      _total = "",
2319      decimal = 2;
2320    var bettingList = result.list;
2321    if (bettingList != null) {
2322      if (bettingList.length > 0) {
2323        //bettingList.forEach(function(entry) {
2324        $.each(bettingList, function (index, entry) {
2325          //var createTime = entry.create_time.substring(0,entry.create_time.indexOf("."));
2326          var createTime = entry.create_time.split(" ")[0];
2327          var status = "";
2328          switch (entry.status) {
2329            case "2":
2330              status = tcg.lib.prop("ac_order_status_2");
2331              break;
2332            case "4":
2333              status = tcg.lib.prop("ac_order_status_4");
2334              break;
2335            case "5":
2336              status = tcg.lib.prop("ac_order_status_5");
2337              break;
2338            case "6":
2339              status = tcg.lib.prop("ac_order_status_6");
2340              break;
2341            case "7":
2342              status = tcg.lib.prop("ac_order_status_7");
2343              break;
2344            case "8":
2345              status = tcg.lib.prop("ac_order_status_8");
2346              break;
2347            case "12":
2348              status = tcg.lib.prop("ac_order_status_12");
2349              break;
2350          }
2351          list += '<div class="divTableRow border-bot clearfix">';
2352          list +=
2353            '<div class="divTableCell onel-th-x openItem" data-orderid="' +
2354            entry.order_detail_id +
2355            '" data-chasing="' +
2356            entry.chase +
2357            '" data-ordermasterid="' +
2358            entry.order_master_id +
2359            '">' +
2360            tcg.ac.shortenText(entry.order_num) +
2361            "</div>";
2362          list += '<div class="divTableCell onel-th-x">' + entry.game_name.replace(/[A-Za-z]/g, "") + "</div>";
2363          list += '<div class="divTableCell onel-th-x">' + tcg.ac.formatDateFull(createTime, "yyyy-MM-dd") + "</div>";
2364          list +=
2365            '<div class="divTableCell onel-th-x rs-td-amt" data-switchDecimal="' +
2366            decimal +
2367            '" data-value="' +
2368            entry.actual_bet_amount +
2369            '" >' +
2370            tcg.ac.customCurrencyFormat(entry.actual_bet_amount, decimal) +
2371            "</span></div>";
2372          list +=
2373            '<div class="divTableCell onel-th-x rs-td-amt tbl-red" data-switchDecimal="' +
2374            decimal +
2375            '" data-value="' +
2376            entry.win_amount +
2377            '">' +
2378            tcg.ac.customCurrencyFormat(entry.win_amount, decimal) +
2379            "</span></div>";
2380          list += '<div class="divTableCell onel-th-x tbl-red">' + status + "</div>";
2381          list += "</div>";
2382        });
2383      } else {
2384        list += "<div class='tableContent-wrp'>";
2385        list += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
2386        list += "</div>";
2387      }
2388      var total = result.footer,
2389        totalBetAmount = bettingList.length == 0 ? 0 : total.total_actual_bet_amount,
2390        totalWinAmount = bettingList.length == 0 ? 0 : total.total_win_amount;
2391      $("#gameHistoryList").html(list);
2392
2393      _total += "<div class='tbl-total-con inline-block'>" + tcg.lib.prop("ac_bet_amount_total") + ":";
2394      _total +=
2395        "<span class='tbl-total-amt inline-block' data-SwitchDecimal='" +
2396        decimal +
2397        "' data-value='" +
2398        totalBetAmount +
2399        "'>" +
2400        tcg.ac.customCurrencyFormat(totalBetAmount, decimal) +
2401        "</span>";
2402      _total += "</div>";
2403      _total += "<div class='tbl-total-con inline-block'>" + tcg.lib.prop("ac_total_amount_prize") + ":";
2404      _total +=
2405        "<span class='tbl-total-amt inline-block' data-SwitchDecimal='" +
2406        decimal +
2407        "' data-value='" +
2408        totalWinAmount +
2409        "'>" +
2410        tcg.ac.customCurrencyFormat(totalWinAmount, decimal) +
2411        "</span>";
2412      _total += "</div>";
2413
2414      $("#agentGameHistoryTotal").html(_total);
2415
2416      $("#agentGameHistoryForm input[name='orderNum']").on("change", function () {
2417        $(this).val($(this).val().toUpperCase());
2418      });
2419    }
2420  };
2421  tcg.ac.ui.loadQueryConditionList = function (headers, callback) {
2422    tcg.ac.api.queryConditions(function (result) {
2423      var obj = {};
2424      var gamesArr = [];
2425      var orderStatus = "";
2426      var games = "<option value=''>" + tcg.lib.prop("ac_all") + "</option>";
2427      for (var x in result.games) {
2428        games += "<option value='" + x + "'>" + tcg.lib.prop("gameName_" + result.games[x]) + "</option>";
2429        gamesArr.push({ id: x, gameName: tcg.lib.prop("gameName_" + result.games[x]) });
2430      }
2431      obj.games = games;
2432      obj.gamesArr = gamesArr;
2433      for (var i in result.orderStatus) {
2434        orderStatus +=
2435          "<option value='" + i + "'>" + tcg.lib.prop("orderStatus_" + result.orderStatus[i]) + "</option>";
2436      }
2437      obj.orderStatus = orderStatus;
2438      callback(obj);
2439    });
2440  };
2441  tcg.ac.ui.searchAgentPvpGameHistory = function (downlineId) {
2442    $(document)
2443      .off("click", "#agentPvpGameHistoryForm .form-submit")
2444      .on("click", "#agentPvpGameHistoryForm .form-submit", function () {
2445        tcg.ac.getAgentPvpGameHistory(downlineId);
2446      });
2447  };
2448  tcg.ac.ui.loadAgentPvpGameHistory = function (result, gameType) {
2449    var _html = "",
2450      _total = "",
2451      decimal = 2,
2452      orders = result.list; //, total = result.footer;
2453    if (orders.length > 0) {
2454      for (var i = 0; i < orders.length; i++) {
2455        _html += "<div class='divTableRow border-bot clearfix'>";
2456        _html += "<div class='divTableCell onel-th-x'>" + orders[i].customer_name + "</div>";
2457        _html += "<div class='divTableCell onel-th-x'>" + orders[i].game_name + "</div>";
2458        _html +=
2459          "<div class='divTableCell onel-th-x rs-td-amt' data-switchDecimal='" +
2460          decimal +
2461          "' data-value='" +
2462          orders[i].game_loses +
2463          "'>" +
2464          tcg.ac.customCurrencyFormat(orders[i].game_loses, decimal) +
2465          "</span></div>";
2466        _html +=
2467          "<div class='divTableCell onel-th-x rs-td-amt' data-switchDecimal='" +
2468          decimal +
2469          "' data-value='" +
2470          orders[i].game_winnings +
2471          "'>" +
2472          tcg.ac.customCurrencyFormat(orders[i].game_winnings, decimal) +
2473          "</span></div>";
2474        _html +=
2475          "<div class='divTableCell onel-th-x' data-switchDecimal='" +
2476          decimal +
2477          "' data-value='" +
2478          orders[i].net_profit +
2479          "'>" +
2480          tcg.ac.customCurrencyFormat(orders[i].net_profit, decimal) +
2481          "</div>";
2482        _html += "</div>";
2483      }
2484    } else {
2485      _html += "<div class='tableContent-wrp'>";
2486      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
2487      _html += "</div>";
2488    }
2489
2490    $("#agentPvpGameHistoryTable .betLoss").text(
2491      gameType == "PVP" ? tcg.lib.prop("ac_net_money") : tcg.lib.prop("ac_bet_amount")
2492    );
2493    $("#agentPvpGameHistoryTable .prizeWon").text(
2494      gameType == "PVP" ? tcg.lib.prop("ac_net_amount_of_money") : tcg.lib.prop("ac_winning_amount")
2495    );
2496    $("#agentPvpGameHistoryList").html(_html);
2497  };
2498  tcg.ac.ui.loadGameRooms = function (targetId, gameType, type) {
2499    var rng = "",
2500      pvp = "";
2501
2502    rng += "<option value='game_ag_6'>
2502" + tcg.lib.prop("ac_game_fish") + "</option>";
2503    pvp += "<option value=''>" + tcg.lib.prop("ac_all") + "</option>";
2504    pvp += "<option value='bjl_room'>" + tcg.lib.prop("ac_game_baccarat") + "</option>";
2505    pvp += "<option value='gswz_room'>" + tcg.lib.prop("ac_game_5_in_hk") + "</option>";
2506    pvp += "<option value='thirteen_room'>" + tcg.lib.prop("ac_game_13_water") + "</option>";
2507    pvp += "<option value='tbnn_room'>" + tcg.lib.prop("ac_game_tiberius") + "</option>";
2508    pvp += "<option value='nn_room'>" + tcg.lib.prop("ac_game_taurus") + "</option>";
2509    pvp += "<option value='zjh_room'>" + tcg.lib.prop("ac_game_zhunjinhua") + "</option>";
2510    $(targetId).html(gameType == 0 || gameType == "PVP" ? pvp : rng);
2511
2512    var type = type || "set";
2513    if (type == "set") {
2514      tcg.ac.ui.customSelect(targetId);
2515    } else {
2516      $(targetId).trigger("chosen:updated");
2517    }
2518  };
2519  tcg.ac.ui.selectGameType = function (selector, targetId) {
2520    $(document)
2521      .off("change", selector)
2522      .on("change", selector, function () {
2523        var gameType = $(this).val();
2524        tcg.ac.ui.loadGameRooms(targetId, gameType, "update");
2525      });
2526  };
2527  tcg.ac.ui.loadTransferSumbit = function (downlineName) {
2528    $(document)
2529      .off("click", "#transferToDownlineForm .form-submit")
2530      .on("click", "#transferToDownlineForm .form-submit", function () {
2531        tcg.ac.submitTransferToDown(downlineName);
2532      });
2533    $(document)
2534      .off("keyup", "#transferToDownline [name='transferAmt']")
2535      .on("keyup", "#transferToDownline [name='transferAmt']", function () {
2536        $(".bl-data-hover").html($("[name='transferAmt']").val());
2537      });
2538  };
2539  tcg.ac.ui.validateTransferToDownlineInput = function () {
2540    $(document)
2541      .off("keyup", "#transferToDownlineForm .form-control")
2542      .on("keyup", "#transferToDownlineForm .form-control", function () {
2543        tcg.ac.ui.validateTransferToDownlineForm();
2544      });
2545  };
2546  tcg.ac.ui.validateTransferToDownlineForm = function () {
2547    $("#transferToDownlineForm .member_ContentCh .ch_mManagement .on-Mod").removeAttr("name");
2548    // $('#transferToDownlineForm')[0].childNodes[3].childNodes[5].childNodes[3].removeAttribute("name");
2549    var form = $("#transferToDownlineForm"),
2550      amount = form.find("[name='transferAmt']"),
2551      password = form.find("[name='paymentpwd']");
2552    if (password.val() == "" || amount.val() == "") {
2553      form.removeClass("enable");
2554    } else {
2555      if (tcg.ac.regExPattern("amount", amount.val())) {
2556        var amountVal = amount.val().split(".");
2557        if (amountVal[1] == undefined || amountVal[1].length <= 2) {
2558          form.addClass("enable");
2559        } else {
2560          form.removeClass("enable");
2561        }
2562      } else {
2563        form.removeClass("enable");
2564      }
2565    }
2566  };
2567  tcg.ac.ui.addNewContractRow = function (data) {
2568    var curr_inc = $("#add_new_contract_form .rec_increment").html() * 1;
2569    curr_inc++;
2570    var _html = "";
2571    _html += '<div  class="divident-content-wrp row_has_val " id="con_row_index_' + (curr_inc - 1) + '">';
2572    _html += '<div class="d-rnumber">' + (curr_inc - 1) + "</div>";
2573    _html += '<div class="betVolume">' + data.betVolume + "</div>";
2574    _html += '<div class="activeMember">' + data.activeMember + "</div>";
2575    _html += '<div class="requestedRate">' + data.requestedRate + "</div>";
2576    $(".delete_con_row").html("-").removeClass("action-btn");
2577    _html += '<div class="  delete_con_row"><span class="action-btn" id="delete_con_row">删除</span></div>';
2578    _html += "</div>";
2579    $("#add_new_contract_form .rec_increment").html(curr_inc);
2580    $("#add_new_contract_form").before(_html);
2581  };
2582  tcg.ac.ui.addNewContractRowCopy = function (data) {
2583    var curr_inc = $("#add_new_contract_form .rec_increment").html() * 1;
2584    curr_inc++;
2585    var _html = "";
2586    _html += '<div  class="divident-content-wrp row_has_val " id="con_row_index_' + (curr_inc - 1) + '">';
2587    _html += '<div class="d-rnumber">' + (curr_inc - 1) + "</div>";
2588    _html += '<div class="totalBet">' + data.totalBet + "</div>";
2589    _html += '<div class="betVolume">' + data.betVolume + "</div>";
2590    _html += '<div class="activeMember">' + data.activeMember + "</div>";
2591    _html += '<div class="requestedRate">' + data.requestedRate + "</div>";
2592    $(".delete_con_row").html("-").removeClass("action-btn");
2593    _html += '<div class="delete_con_row"><span class="action-btn" id="delete_con_row">删除</span></div>';
2594    _html += "</div>";
2595    $("#add_new_contract_form .rec_increment").html(curr_inc);
2596    $("#add_new_contract_form").before(_html);
2597  };
2598  tcg.ac.ui.editAddNewContractRow = function (data, isAutomated) {
2599    var curr_inc = $("#edit_contract_form .rec_increment").html() * 1;
2600    curr_inc++;
2601    var _html = "";
2602    var requestid_senderid = data.requestId ? data.requestId : "";
2603    _html +=
2604      '<div  class="divident-content-wrp row_has_no_val " id="con_row_index_' +
2605      (curr_inc - 1) +
2606      '" data-senderid = ' +
2607      requestid_senderid +
2608      ">";
2609    _html += '<div class="d-rnumber">' + (curr_inc - 1) + "</div>";
2610    _html += '<div class="betVolume">' + data.betVolume + "</div>";
2611    _html += '<div class="activeMember">' + data.activeMember + "</div>";
2612    _html += '<div class="requestedRate">' + parseInt(data.requestedRate) + "</div>";
2613    $(".delete_con_row").html("-").removeClass("action-btn");
2614    _html +=
2615      '<div class=" delete_con_row"><span class="action-btn" id=delete_con_row>' +
2616      tcg.lib.prop("ac_delete_btn") +
2617      "</span></div>";
2618    _html += "</div>";
2619    $("#edit_contract_form .rec_increment").html(curr_inc);
2620    $("#edit_contract_form").before(_html);
2621  };
2622  tcg.ac.ui.editAddNewContractRowCopy = function (data, isAutomated) {
2623    var curr_inc = $("#edit_contract_form .rec_increment").html() * 1;
2624    curr_inc++;
2625    var _html = "";
2626    var requestid_senderid = data.requestId ? data.requestId : "";
2627    _html +=
2628      '<div  class="divident-content-wrp row_has_no_val " id="con_row_index_' +
2629      (curr_inc - 1) +
2630      '" data-senderid = ' +
2631      requestid_senderid +
2632      ">";
2633    _html += '<div class="d-rnumber">' + (curr_inc - 1) + "</div>";
2634    _html += '<div class="totalBet">' + data.totalBet + "</div>";
2635    _html += '<div class="betVolume">' + data.betVolume + "</div>";
2636    _html += '<div class="activeMember">' + data.activeMember + "</div>";
2637    _html += '<div class="requestedRate">' + parseInt(data.requestedRate) + "</div>";
2638    $(".delete_con_row").html("-").removeClass("action-btn");
2639    _html +=
2640      '<div class=" delete_con_row"><span class="action-btn" id=delete_con_row>' +
2641      tcg.lib.prop("ac_delete_btn") +
2642      "</span></div>";
2643    _html += "</div>";
2644    $("#edit_contract_form .rec_increment").html(curr_inc);
2645    $("#edit_contract_form").before(_html);
2646  };
2647  tcg.ac.ui.loadBonusDownlines = function (result, downlineContracts) {
2648    //  Declare
2649    var _html = "",
2650      registerAmount = 0;
2651    var status = {
2652      P: { status: tcg.lib.prop("ac_status_P") },
2653      A: { status: tcg.lib.prop("ac_status_A") },
2654      E: { status: tcg.lib.prop("ac_status_E") },
2655      C: { status: tcg.lib.prop("ac_status_C") },
2656      V: { status: tcg.lib.prop("ac_status_V") },
2657      R: { status: tcg.lib.prop("ac_status_R") },
2658      DEF: { status: tcg.lib.prop("ac_status_DEF") },
2659    };
2660
2661    //  Show result
2662    var downline_contracts = {};
2663    if (downlineContracts.value.downline) {
2664      var downlineContracts = downlineContracts.value.downline;
2665      $(downlineContracts).map(function () {
2666        downline_contracts[this.receiverId] = this;
2667      });
2668    }
2669    try {
2670      if (result.length) {
2671        var status_mem = "DEF";
2672        for (var i = 0; i < result.length; i++) {
2673          var entry = result[i];
2674          var registerDate = entry.reg_date == null ? new Date() : entry.reg_date.time;
2675          var processed_date = "-",
2676            createdDate_date = "-";
2677          var log_action = "<div class='d-histLog'>-</div>";
2678          var add_contract_btn = "";
2679          add_contract_btn += '<div class="add_contract action-btn" data-targetCustomer="' + entry.customer_name + '">';
2680          add_contract_btn += tcg.lib.prop("ac_initiate_contract");
2681          add_contract_btn += "</div>";
2682          var dividend_info = '<div class="d-contact">-</div>';
2683          if (downline_contracts[entry.customer_id]) {
2684            status_mem = downline_contracts[entry.customer_id].status;
2685            if (downline_contracts[entry.customer_id].processedDate) {
2686              processed_date = tcg.ac.formatDateFull(
2687                downline_contracts[entry.customer_id].processedDate * 1,
2688                "yyyy-MM-dd hh:mm"
2689              );
2690              createdDate_date = tcg.ac.formatDateFull(
2691                downline_contracts[entry.customer_id].createdDate * 1,
2692                "yyyy-MM-dd hh:mm"
2693              );
2694            }
2695            log_action =
2696              "<div class='dividend_log d-histLog action-btn' data-customer_id='" +
2697              entry.customer_id +
2698              "'>" +
2699              tcg.lib.prop("ac_signing_history") +
2700              "</div>";
2701            dividend_info =
2702              '<div class="d-contact action-btn viewContractDetails" data-targetCustomer="' +
2703              entry.customer_name +
2704              '"data-status="' +
2705              downline_contracts[entry.customer_id].status +
2706              '" data-requestedRate="' +
2707              downline_contracts[entry.customer_id].contractRate +
2708              '" >' +
2709              tcg.lib.prop("label_details") +
2710              "</div>";
2711            if (downline_contracts[entry.customer_id].status == "A") {
2712              add_contract_btn = "";
2713              add_contract_btn += '<div class="action-btn">';
2714              add_contract_btn +=
2715                '<span class="pointer void_contract" data-targetCustomer="' +
2716                entry.customer_name +
2717                '" >' +
2718                tcg.lib.prop("ac_termination") +
2719                "</span> | ";
2720              add_contract_btn +=
2721                '<span class="pointer edit_contract" data-targetCustomer="' +
2722                entry.customer_name +
2723                '" data-status="' +
2724                downline_contracts[entry.customer_id].status +
2725                '" >' +
2726                tcg.lib.prop("ac_modify") +
2727                "</span>";
2728              add_contract_btn += "</div>";
2729            } else if (
2730              downline_contracts[entry.customer_id].status == "P" ||
2731              downline_contracts[entry.customer_id].status == "V"
2732            ) {
2733              add_contract_btn = "";
2734              add_contract_btn += '<div class="">';
2735              add_contract_btn += tcg.lib.prop("ac_waiting_to_determined");
2736              add_contract_btn += "</div>";
2737            } else if (downline_contracts[entry.customer_id].status == "E") {
2738              add_contract_btn = "";
2739              add_contract_btn += '<div class="">';
2740              add_contract_btn += tcg.lib.prop("ac_waiting_to_determined");
2741              add_contract_btn += "</div>";
2742            }
2743          }
2744          _html += '<div class="d-cont-wrp">';
2745          _html += '<div class="d-name">' + entry.customer_name + "</div>";
2746          _html += dividend_info;
2747          _html += '<div class="d-time">' + createdDate_date + "</div>";
2748          _html += '<div class="d-apTime">' + processed_date + "</div>";
2749          if (downline_contracts[entry.customer_id]) {
2750            _html += '<div class="d-status ">' + status[status_mem].status + "</div>";
2751          } else {
2752            _html += '<div class="d-status">' + tcg.lib.prop("ac_status_DEF") + "</div>";
2753          }
2754          _html += log_action;
2755          _html += add_contract_btn;
2756          _html += "</div>";
2757        }
2758      } else {
2759        _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
2760      }
2761    } catch (e) {
2762      _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
2763    }
2764
2765    $("#downlineList").html(_html);
2766    $("#totalEffectiveAmount").text(registerAmount);
2767  };
2768  tcg.ac.ui.loadBonusDownlinesCopy = function (result, downlineContracts) {
2769    //  Declare
2770    var _html = "",
2771      registerAmount = 0;
2772    var status = {
2773      P: { status: tcg.lib.prop("ac_status_P") },
2774      A: { status: tcg.lib.prop("ac_status_A") },
2775      E: { status: tcg.lib.prop("ac_status_E") },
2776      C: { status: tcg.lib.prop("ac_status_C") },
2777      V: { status: tcg.lib.prop("ac_status_V") },
2778      R: { status: tcg.lib.prop("ac_status_R") },
2779      DEF: { status: tcg.lib.prop("ac_status_DEF") },
2780    };
2781
2782    //  Show result
2783    var downline_contracts = {};
2784    if (downlineContracts.value.downline) {
2785      var downlineContracts = downlineContracts.value.downline;
2786      $(downlineContracts).map(function () {
2787        downline_contracts[this.receiverId] = this;
2788      });
2789    }
2790    try {
2791      if (result.length) {
2792        var status_mem = "DEF";
2793        for (var i = 0; i < result.length; i++) {
2794          var entry = result[i];
2795          var registerDate = entry.reg_date == null ? new Date() : entry.reg_date.time;
2796          var processed_date = "-",
2797            createdDate_date = "-";
2798          var log_action = "<div class='d-histLog'>-</div>";
2799          var add_contract_btn = "";
2800          add_contract_btn += '<div class="add_contract action-btn" data-targetCustomer="' + entry.customer_name + '">';
2801          add_contract_btn += tcg.lib.prop("ac_initiate_contract");
2802          add_contract_btn += "</div>";
2803          var dividend_info = '<div class="d-contact">-</div>';
2804          if (downline_contracts[entry.customer_id]) {
2805            status_mem = downline_contracts[entry.customer_id].status;
2806            if (downline_contracts[entry.customer_id].processedDate) {
2807              processed_date = tcg.ac.formatDateFull(
2808                downline_contracts[entry.customer_id].processedDate * 1,
2809                "yyyy-MM-dd hh:mm"
2810              );
2811              createdDate_date = tcg.ac.formatDateFull(
2812                downline_contracts[entry.customer_id].createdDate * 1,
2813                "yyyy-MM-dd hh:mm"
2814              );
2815            }
2816            log_action =
2817              "<div class='dividend_log d-histLog action-btn' data-customer_id='" +
2818              entry.customer_id +
2819              "'>" +
2820              tcg.lib.prop("ac_signing_history") +
2821              "</div>";
2822            dividend_info =
2823              '<div class="d-contact action-btn viewContractDetails" data-targetCustomer="' +
2824              entry.customer_name +
2825              '"data-status="' +
2826              downline_contracts[entry.customer_id].status +
2827              '"data-requestedRate="' +
2828              downline_contracts[entry.customer_id].contractRate +
2829              '" >' +
2830              tcg.lib.prop("label_details") +
2831              "</div>";
2832            if (downline_contracts[entry.customer_id].status == "A") {
2833              add_contract_btn = "";
2834              add_contract_btn += '<div class="action-btn">';
2835              add_contract_btn +=
2836                '<span class="pointer void_contract" data-targetCustomer="' +
2837                entry.customer_name +
2838                '" >' +
2839                tcg.lib.prop("ac_termination") +
2840                "</span> | ";
2841              add_contract_btn +=
2842                '<span class="pointer edit_contract" data-targetCustomer="' +
2843                entry.customer_name +
2844                '" data-status="' +
2845                downline_contracts[entry.customer_id].status +
2846                '">' +
2847                tcg.lib.prop("ac_modify") +
2848                "</span>";
2849              add_contract_btn += "</div>";
2850            } else if (
2851              downline_contracts[entry.customer_id].status == "P" ||
2852              downline_contracts[entry.customer_id].status == "V"
2853            ) {
2854              add_contract_btn = "";
2855              add_contract_btn += '<div class="">';
2856              add_contract_btn += tcg.lib.prop("ac_waiting_to_determined");
2857              add_contract_btn += "</div>";
2858            } else if (downline_contracts[entry.customer_id].status == "E") {
2859              add_contract_btn = "";
2860              add_contract_btn += '<div class="">';
2861              add_contract_btn += tcg.lib.prop("ac_waiting_to_determined");
2862              add_contract_btn += "</div>";
2863            }
2864          }
2865          _html += '<div class="d-cont-wrp">';
2866          _html += '<div class="d-name">' + entry.customer_name + "</div>";
2867          _html += dividend_info;
2868          _html += '<div class="d-time">' + createdDate_date + "</div>";
2869          _html += '<div class="d-apTime">' + processed_date + "</div>";
2870          if (downline_contracts[entry.customer_id]) {
2871            _html += '<div class="d-status ">' + status[status_mem].status + "</div>";
2872          } else {
2873            _html += '<div class="d-status">' + tcg.lib.prop("ac_status_DEF") + "</div>";
2874          }
2875          _html += log_action;
2876          _html += add_contract_btn;
2877          _html += "</div>";
2878        }
2879      } else {
2880        _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
2881      }
2882    } catch (e) {
2883      _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
2884    }
2885
2886    $("#downlineList").html(_html);
2887    $("#totalEffectiveAmount").text(registerAmount);
2888  };
2889  tcg.ac.ui.loadContractHistoryLog = function (result) {
2890    var _html = "";
2891    for (var i = 0; i < result.value.length; i++) {
2892      var elem = result.value[i];
2893      var placeholder = "";
2894      switch (elem.action) {
2895        case "N":
2896          placeholder = tcg.lib.prop("ac_initiate_contract");
2897          break;
2898        case "E":
2899          placeholder = tcg.lib.prop("ac_modify_contract");
2900          break;
2901        case "C":
2902          placeholder = tcg.lib.prop("ac_termination_success");
2903          break;
2904        case "A":
2905          placeholder = tcg.lib.prop("ac_signed_success");
2906          break;
2907        case "R":
2908          placeholder = tcg.lib.prop("ac_termination");
2909          break;
2910        case "V":
2911          placeholder = tcg.lib.prop("ac_initiate_termination");
2912          break;
2913      }
2914      _html += '<div  class="divident-content-wrp ">';
2915      _html += '<div class="">' + tcg.ac.timeToDateFormat(elem.activityDate, "dateTime") + "</div>";
2916      _html += '<div class="">' + placeholder + "</div>";
2917      _html += "</div>";
2918    }
2919    $("#dividendLogList").html(_html);
2920  };
2921  tcg.ac.ui.appendContractDivInfo = function (data) {
2922    $("#agentContract").append(
2923      '<div class="dvdentRport-content" data-minimumBet="' +
2924        data.netLoss +
2925        '" data-activeMember="' +
2926        data.activeMember +
2927        '" data-contractRate="' +
2928        Math.round(data.contractRate * 100) +
2929        '"><div class="po-middle team-betting">' +
2930        tcg.lib.prop("ac_half_month") +
2931        "≥" +
2932        data.netLoss +
2933        tcg.lib.prop("ac_yuan") +
2934        '</div> <div class="po-middle team-active">' +
2935        data.activeMember +
2936        tcg.lib.prop("label_unit_people") +
2937        '</div> <div class="po-middle dvdent-rate">' +
2938        Math.round(data.contractRate * 100) +
2939        "%</div></div>"
2940    );
2941  };
2942  tcg.ac.ui.appendContractDivInfoCopy = function (data) {
2943    $("#agentContract").append(
2944      '<div class="dvdentRport-content" data-totalBet="' +
2945        data.minimumBet +
2946        '" data-minimumBet="' +
2947        data.netLoss +
2948        '" data-activeMember="' +
2949        data.activeMember +
2950        '" data-contractRate="' +
2951        Math.round(data.contractRate * 100) +
2952        '"><div class="po-middle team-betting">' +
2953        data.minimumBet +
2954        tcg.lib.prop("ac_yuan") +
2955        '</div><div class="po-middle team-minimumBet">
2955' +
2956        data.netLoss +
2957        tcg.lib.prop("ac_yuan") +
2958        '</div> <div class="po-middle team-active">' +
2959        data.activeMember +
2960        tcg.lib.prop("label_unit_people") +
2961        '</div> <div class="po-middle dvdent-rate">' +
2962        Math.round(data.contractRate * 100) +
2963        "%</div></div>"
2964    );
2965  };
2966  tcg.ac.ui.loadTeamOverview = function (result, agInfo) {
2967    var newGetList = result.value.list;
2968    var agInfo = agInfo.value;
2969
2970    $("#hagDirectlyUnder > span").text(
2971      agInfo.currentDirectSubordinateCount > 0 ? agInfo.currentDirectSubordinateCount : " - "
2972    );
2973
2974    $("#allTeamMember >span").text(agInfo.currentTeamMemberCount > 0 ? agInfo.currentTeamMemberCount : " - ");
2975
2976    $("#findLottBlances > span").html(agInfo.currentBalance > 0 ? agInfo.currentBalance : " - ");
2977  };
2978
2979  tcg.ac.ui.fillGraphTab = function () {
2980    var newGetList = JSON.parse(sessionStorage.chartData).value.list;
2981    var game = $(".overviewGames_input").attr("data-value");
2982    var deposit = 0,
2983      withdraw = 0,
2984      lott_game_betting = 0,
2985      lott_game_winning = 0,
2986      lott_agent_commission = 0;
2987
2988    data = newGetList[0][game].footer;
2989    deposit = data.totalDeposit;
2990    withdraw = data.totalWithdrawal;
2991    lott_game_betting = data.totalBet;
2992    lott_game_winning = data.totalWin;
2993    lott_agent_commission = data.totalRebate;
2994
2995    $("#hag_directly_ctdvalue").html(
2996      '<div class="hag_directly_ctdm">' +
2997        '<p><span class="hag_directly_ctdsbg1">' +
2998        tcg.lib.prop("overview_label22") +
2999        "</span></p>" +
3000        "<p>" +
3001        tcg.ac.customCurrencyFormat(deposit /* + agent_transfer_in*/, 2) +
3002        "</p>" +
3003        "</div>" +
3004        '<div class="hag_directly_ctdm">' +
3005        '<p><span class="hag_directly_ctdsbg2">' +
3006        tcg.lib.prop("overview_label23") +
3007        "</span></p>" +
3008        "<p>" +
3009        tcg.ac.customCurrencyFormat(withdraw /*+ agent_transfer_out*/, 2) +
3010        "</p>" +
3011        "</div>" +
3012        '<div class="hag_directly_ctdm">' +
3013        '<p><span class="hag_directly_ctdsbg3">' +
3014        tcg.lib.prop("overview_label24") +
3015        "</span></p>" +
3016        "<p>" +
3017        tcg.ac.customCurrencyFormat(lott_game_betting, 2) +
3018        "</p>" +
3019        "</div>" +
3020        '<div class="hag_directly_ctdm">' +
3021        '<p><span class="hag_directly_ctdsbg4">' +
3022        tcg.lib.prop("overview_label25") +
3023        "</span></p>" +
3024        "<p>" +
3025        tcg.ac.customCurrencyFormat(lott_game_winning, 2) +
3026        "</p>" +
3027        "</div>" +
3028        '<div class="hag_directly_ctdm">' +
3029        '<p><span class="hag_directly_ctdsbg5">' +
3030        tcg.lib.prop("overview_label26") +
3031        "</span></p>" +
3032        "<p>" +
3033        tcg.ac.customCurrencyFormat(lott_agent_commission, 2) +
3034        "</p>" +
3035        "</div>"
3036    );
3037  };
3038
3039  tcg.ac.ui.loadContractDetails = function (result) {
3040    var _html = "",
3041      _addNum = 1,
3042      new_result = [];
3043    new_result = tcg.ac.dividendChangeListVlue(result.value.downline);
3044    if (new_result.length > 0) {
3045      for (var i = 0; i < new_result.length; i++) {
3046        var item = new_result[i];
3047        //if(item.status == "A"){
3048        _html += '<div  class="divident-content-wrp row_has_val ">';
3049        _html += '<div class="">' + _addNum + "</div>";
3050        _html += '<div class="">' + item.netLoss * 1 + "</div>";
3051        _html += '<div class="">' + item.activeMember * 1 + "</div>";
3052        _html += '<div class="">' + parseInt(item.contractRate * 100) + "%</div>";
3053        _html += '<div class="">-</div>';
3054        _html += "</div>";
3055        _addNum++;
3056        //}
3057      }
3058    }
3059
3060    $("#downlineContractDetailsList").html(_html);
3061  };
3062  tcg.ac.ui.loadContractDetailsCopy = function (result) {
3063    var _html = "",
3064      _addNum = 1,
3065      new_result = [];
3066    new_result = tcg.ac.dividendChangeListVlue(result.value.downline);
3067    if (new_result.length > 0) {
3068      for (var i = 0; i < new_result.length; i++) {
3069        var item = new_result[i];
3070        //if(item.status == "A"){
3071        _html += '<div  class="divident-content-wrp row_has_val ">';
3072        _html += '<div class="">' + _addNum + "</div>";
3073        _html += '<div class="">' + item.minimumBet * 1 + "</div>";
3074        _html += '<div class="">' + item.netLoss * 1 + "</div>";
3075        _html += '<div class="">' + item.activeMember * 1 + "</div>";
3076        _html += '<div class="">' + parseInt(item.contractRate * 100) + "%</div>";
3077        _html += '<div class="">-</div>';
3078        _html += "</div>";
3079        _addNum++;
3080        //}
3081      }
3082    }
3083
3084    $("#downlineContractDetailsList").html(_html);
3085  };
3086  tcg.ac.ui.loadCommissionReport = function (result) {
3087    var data = result.value.list[0];
3088    if (data) {
3089      $("#plan").attr("data-current", "").attr("data-prev", Math.round(data.dividend_income_plan, 2));
3090      $("#betting")
3091        .attr("data-current", Math.round(data.curr_game_betting, 2))
3092        .attr("data-prev", Math.round(data.team_betting, 2));
3093      $("#profit")
3094        .attr("data-current", Math.round(data.curr_net_profit, 2))
3095        .attr("data-prev", Math.round(data.prev_net_profit, 2));
3096      $("#active").attr("data-current", data.curr_active_member_count).attr("data-prev", data.active_member_count);
3097      $("#rate").attr("data-current", data.curr_dividend_rate).attr("data-prev", data.prev_dividend_rate);
3098      $("#income")
3099        .attr("data-current", Math.round(data.curr_dividend_income, 2))
3100        .attr("data-prev", Math.round(data.prev_dividend_income, 2));
3101    }
3102  };
3103  tcg.ac.ui.loadCommissionReportCopy = function (result, rs) {
3104    var current = result ? result.value : false;
3105    var prev = rs ? rs.value : false;
3106    if (current) {
3107      $("#cont1").attr("data-current", current.teamBetting);
3108      $("#cont2").attr("data-current", current.teamWinning);
3109      $("#cont3").attr("data-current", current.dailyIncome);
3110      $("#cont4").attr("data-current", current.teamAgentCommission);
3111      $("#cont5").attr("data-current", current.teamPromotion);
3112      $("#cont6").attr("data-current", current.teamRebate);
3113      $("#cont7").attr("data-current", current.teamProfitSharing);
3114      $("#cont8").attr("data-current", current.teamBankCharges);
3115      $("#cont9").attr("data-current", current.teamNetProfit);
3116      $("#cont10").attr("data-current", current.activeMember);
3117      $("#cont11").attr("data-current", current.rate);
3118      $("#cont12").attr("data-current", current.dividendAmount);
3119      $("#cont13").attr("data-current", current.teamProductCharge);
3120      $("#cont8").attr("data-currentStart", current.startDate).attr("data-currentEnd", current.endDate);
3121      $("#cont13").attr("data-currentStart", current.startDate).attr("data-currentEnd", current.endDate);
3122    }
3123    if (prev) {
3124      $("#cont1").attr("data-prev", prev.teamBetting);
3125      $("#cont2").attr("data-prev", prev.teamWinning);
3126      $("#cont3").attr("data-prev", prev.dailyIncome);
3127      $("#cont4").attr("data-prev", prev.teamAgentCommission);
3128      $("#cont5").attr("data-prev", prev.teamPromotion);
3129      $("#cont6").attr("data-prev", prev.teamRebate);
3130      $("#cont7").attr("data-prev", prev.teamProfitSharing);
3131      $("#cont8").attr("data-prev", prev.teamBankCharges);
3132      $("#cont9").attr("data-prev", prev.teamNetProfit);
3133      $("#cont10").attr("data-prev", prev.activeMember);
3134      $("#cont11").attr("data-prev", prev.rate);
3135      $("#cont12").attr("data-prev", prev.dividendAmount);
3136      $("#cont13").attr("data-prev", prev.teamProductCharge);
3137      $("#cont8").attr("data-prevStart", prev.startDate).attr("data-prevEnd", prev.endDate);
3138      $("#cont13").attr("data-prevStart", prev.startDate).attr("data-prevEnd", prev.endDate);
3139    }
3140  };
3141  tcg.ac.ui.loadBankCharges = function (result) {
3142    var items = [
3143      "pgBankCharges",
3144      "mtBankCharges",
3145      "unqrBankCharges",
3146      "unBankCharges",
3147      "alipayBankCharges",
3148      "maqrBankCharges",
3149      "atBankCharges",
3150      "aliwapBankCharges",
3151      "wechatBankCharges",
3152      "wtBankCharges",
3153      "wcwapBankCharges",
3154      "jdBankCharges",
3155      "qqBankCharges",
3156      "qqwapBankCharges",
3157      "wrsBankCharges",
3158      "jdwapBankCharges",
3159      "mwqrBankCharges",
3160      "muqrBankCharges",
3161      "eptBankCharges",
3162      "label_other",
3163    ];
3164    var data = result.footer;
3165    var _html = "";
3166    if (data) {
3167      for (var i = 0; i < items.length; i++) {
3168        _html += "<li><h4>" + tcg.lib.prop(items[i]) + "</h4>";
3169        _html += "<div><p>" + tcg.ac.currencyFormat(data[items[i]], 2) + "</p></div></li>";
3170      }
3171    }
3172    return _html;
3173  };
3174  tcg.ac.ui.showTooltip = function (elem, err_msg, customClass, callback) {
3175    var className = customClass || "form-tooltip";
3176    var _html = "<div class='err-msg tcg-tooltip " + className + "' style='display: block'>";
3177    _html += "<div class='err-cont' style='width:auto !important;'>";
3178    _html += "<span class='rs-tri'></span>";
3179    _html += "<span class='the-err-msg'>" + tcg.lib.prop(err_msg) + "</span>";
3180    _html += "</div></div>";
3181    elem.parents(".form-group").addClass("in-rel");
3182    elem.parents("form").find(".tcg-tooltip").remove();
3183    elem.after(_html);
3184    if (callback) {
3185      callback();
3186    } else {
3187      $(document)
3188        .off("click.tooltip", "html")
3189        .on("click.tooltip", "html", function (e) {
3190          if (!$(e.target).hasClass("form-submit")) {
3191            $("." + className).remove();
3192            $(document).off("click.tooltip");
3193          }
3194        });
3195    }
3196  };
3197
3198  tcg.ac.ui.loadWalletList = function (id, walletList, callback) {
3199    var list = ""; // "<option value=''>请选择</option>";
3200    for (var i = 0; i < walletList.length; i++) {
3201      // if( tcg.lib.prop(walletList[i].accountName) != "[" +walletList[i].accountName+ "]" ){
3202      var walletName = tcg.lib.prop(walletList[i].accountName),
3203        selected = walletName == "主钱包" ? "selected=''" : "";
3204      list += "<option value='" + walletList[i].accountTypeId + "' " + selected + ">" + walletName + "</option>";
3205
3206      // switch(tcg.ac.getMerchant()){
3207      // 	// TCG-6059
3208      // 	case "500cai":
3209      // 		if(walletList[i].accountTypeId == 1 || walletList[i].accountTypeId == 301){
3210      // 			walletList[i].accountTypeId = "DISABLED";
3211      // 		}
3212      // 	break;
3213      // 	default:
3214      // }
3215
3216      // switch(walletList[i].accountTypeId) {
3217      //     case 1:
3218      //         var wallet_1 = "<option value='" +walletList[i].accountTypeId+ "' " +selected+ ">" +walletName+ "</option>";
3219      //         break;
3220      //     case 2:
3221      //         var wallet_2 = "<option value='" +walletList[i].accountTypeId+ "' " +selected+ ">" +walletName+ "</option>";
3222      //         break;
3223      //     case 301:
3224      //         var wallet_3 = "<option value='" +walletList[i].accountTypeId+ "' " +selected+ ">" +walletName+ "</option>";
3225      //         break;
3226      //     case 4:
3227      //         var wallet_4 = "<option value='" +walletList[i].accountTypeId+ "' " +selected+ ">" +walletName+ "</option>";
3228      //         break;
3229      // }
3230      // }
3231    }
3232
3233    // list += wallet_2 || "";
3234    // list += wallet_4 || "";
3235    // list += wallet_1 || "";
3236    // list += wallet_3 || "";
3237
3238    $(id).html(list);
3239    tcg.ac.ui.customSelect(id);
3240    callback();
3241  };
3242  tcg.ac.ui.searchDownlineTransactionDetails = function () {
3243    $("#downlineTransactionDetailsForm .form-submit")
3244      .unbind("click")
3245      .bind("click", function () {
3246        tcg.ac.getDownlineTransactionDetails();
3247      });
3248  };
3249  tcg.ac.ui.loadDownlineTransactionDetails = function (result, accountType) {
3250    var decimal = 2,
3251      list = "";
3252    if (result.list.length > 0) {
3253      for (var i = 0; i < result.list.length; i++) {
3254        if ([8122, 8222].indexOf(result.list[i].tx_type_id) < 0) {
3255          var dateTime = result.list[i].tx_time,
3256            date = dateTime.slice(0, dateTime.indexOf(" ")),
3257            time = dateTime.substr(dateTime.indexOf(" ") + 1),
3258            remark = result.list[i].remark,
3259            currentAvailBalance = result.list[i].current_avail_balance;
3260
3261          if (result.list[i].amount < 0) {
3262            var amountColor = "tbl-green";
3263            var balPayment = tcg.lib.prop("ac_expenditure");
3264            var amount = result.list[i].amount;
3265          } else {
3266            // Filter Transaction Type '6201' and '2004'; To fix the issue of wrong response data of Transaction Type-'6201' and '2004' of MCS or ACS in Ticket, TCG-1323.
3267            var transType = result.list[i].tx_type_id;
3268            if (transType == "6201" || transType == "2004") {
3269              var amountColor = "tbl-green";
3270              var balPayment = tcg.lib.prop("ac_expenditure");
3271              var amount = "-" + result.list[i].amount;
3272            } else {
3273              var amountColor = "tbl-red";
3274              var balPayment = tcg.lib.prop("ac_income");
3275              var amount = result.list[i].amount;
3276            }
3277          }
3278
3279          if (remark.indexOf("Lott_User_drawback") > 0) {
3280            remark = remark.substr(0, remark.indexOf("_Lott_User_drawback")) + ":Lott_User_drawback";
3281          }
3282
3283          if (remark.indexOf(" LOTT") > 0) {
3284            remark = remark.split(" ");
3285            remark = remark[1];
3286          }
3287
3288          if (remark.indexOf("game type : null") > 0) {
3289            remark = "gameName_NOGAME";
3290          }
3291
3292          if (remark.indexOf(":") > 0) {
3293            var temp_remark = remark;
3294            temp_remark = temp_remark.split(":");
3295            if (temp_remark[1] == "Rebate") {
3296              remark = tcg.lib.prop("gameName_" + remark.split(":")[0]) + " : " + tcg.lib.prop("Lott_Rebate");
3297            } else if (temp_remark[1] == "Lott_User_drawback") {
3298              remark =
3299                tcg.lib.prop("gameName_" + remark.substr(0, remark.indexOf(":"))) +
3300                " : " +
3301                tcg.lib.prop("Lott_User_drawback");
3302            } else if (temp_remark[1] == "Lott_User_Cancel_Order") {
3303              remark =
3304                tcg.lib.prop("gameName_" + remark.substr(0, remark.indexOf(":"))) +
3305                " : " +
3306                tcg.lib.prop("Lott_User_Cancel_Order");
3307            } else {
3308              remark =
3309                tcg.lib.prop("gameName_" + remark.substr(0, remark.indexOf(":"))) +
3310                " : " +
3311                tcg.lib.prop(remark.substr(remark.indexOf(":") + 1));
3312            }
3313          }
3314          remark = tcg.lib.prop(remark);
3315          remark = remark.replace(/[\[\]&]+/g, "");
3316          var account = result.list[i].customer_name.split("@");
3317          if (
3318            $("[name='type'] :selected").val() == "4301" &&
3319            $("[name='type'] :selected").parent().attr("label") == tcg.lib.prop("ac_income")
3320          ) {
3321            if (amount < 0) {
3322              continue;
3323            }
3324          } else if (
3325            $("[name='type'] :selected").val() == "4301" &&
3326            $("[name='type'] :selected").parent().attr("label") == tcg.lib.prop("ac_expenditure")
3327          ) {
3328            if (amount > 0) {
3329              continue;
3330            }
3331          }
3332          list += "<div class='divTableRow border-bot clearfix'>";
3333          list += "<div class='divTableCell pp-pads dv-w-150'>" + account[1] + "</div>";
3334          list += "<div class='divTableCell pp-pads dv-w-100'>" + tcg.lib.prop(result.list[i].tx_type_id) + "</div>";
3335          list += "<div class='divTableCell pp-pads dv-w-50'>" + balPayment + "</div>";
3336          list +=
3337            "<div class='divTableCell pp-pads dv-w-150'>" + date + " <span class='tblDec'>" + time + "</span></div>";
3338          list +=
3339            "<div class='divTableCell pp-pads dv-w-140 " +
3340            amountColor +
3341            "' data-switchDecimal='" +
3342            decimal +
3343            "' data-value='" +
3344            amount +
3345            "'>" +
3346            tcg.ac.customCurrencyFormat(amount, decimal) +
3347            "</div>";
3348          list +=
3349            "<div class='divTableCell pp-pads dv-w-140' data-switchDecimal='" +
3350            decimal +
3351            "' data-value='" +
3352            currentAvailBalance +
3353            "'>" +
3354            tcg.ac.customCurrencyFormat(currentAvailBalance, decimal) +
3355            "</div>";
3356          list += "<div class='divTableCell pp-pads dv-w-210'>" + remark + "</div>";
3357          list += "</div>";
3358        }
3359      }
3360    } else {
3361      list += "<div class='tableContent-wrp'>";
3362      list += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
3363      list += "</div>";
3364    }
3365    $("#downlineTransactionDetailsList").html(list);
3366  };
3367  tcg.ac.ui.loadDownlineTransactionDetailsCopy = function (result, accountType) {
3368    var list = "";
3369    if (result.list.length > 0) {
3370      for (var i = 0; i < result.list.length; i++) {
3371        list += "<div class='divTableRow border-bot clearfix'>";
3372        list += "<div class='divTableCell pp-pads dv-w-100'>" + result.list[i].customerName + "</div>";
3373        list += "<div class='divTableCell pp-pads dv-w-100'>" + result.list[i].nameCn + "</div>";
3374        list += "<div class='divTableCell pp-pads dv-w-150'>" + result.list[i].txTime + "</div>";
3375        list += "<div class='divTableCell pp-pads dv-w-140'>" + result.list[i].amount + "</div>";
3376        list += "<div class='divTableCell pp-pads dv-w-140'>" + result.list[i].currentAvailBalance + "</div>";
3377        var orderNo = result.list[i].orderNo;
3378        if (orderNo == null || orderNo == undefined) {
3379          orderNo = "-";
3380        }
3381        list += "<div class='divTableCell pp-pads dv-w-100'>" + orderNo + "</div>";
3382        list += "</div>";
3383      }
3384    } else {
3385      list += "<div class='tableContent-wrp'>";
3386      list += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
3387      list += "</div>";
3388    }
3389    $("#totalAmount").html(tcg.ac.customCurrencyFormat(result.footer.amount, 2));
3390    $("#downlineTransactionDetailsList").html(list);
3391  };
3392  tcg.ac.ui.onChangeSelect = function (formId) {
3393    $(document)
3394      .off("change", formId + " [name='account']")
3395      .on("change", formId + " [name='account']", function () {
3396        tcg.ac.ui.changeOptions(formId + " [name='account']", formId + " [name='type']");
3397      });
3398  };
3399  tcg.ac.ui.changeOptions = function (account, type) {
3400    var select = $(account),
3401      type = $(type),
3402      selected = select.find("option:selected").val();
3403
3404    type.remove("options");
3405
3406    var prop = {
3407      width: "100%",
3408      disable_search: true,
3409    };
3410    $(account, type)
3411      .chosen(prop)
3412      .on("chosen:showing_dropdown", function () {
3413        $(account, type).parents("div").addClass("red-up");
3414      })
3415      .on("chosen:hiding_dropdown", function () {
3416        $(account, type).parents("div").removeClass("red-up");
3417      });
3418
3419    switch (selected) {
3420      // PVP
3421      case "1":
3422        var options = "";
3423        options += '<option value="" class="entire" selected>' + tcg.lib.prop("ac_all") + "</option>";
3424        options += '<optgroup label="' + tcg.lib.prop("ac_income") + '">';
3425        options += '<option value="5100">' + tcg.lib.prop("ac_income_option_1") + "</option>";
3426        //	options += '<option value="5112">活动</option>';
3427        options += '<option value="8102">' + tcg.lib.prop("ac_income_option_2") + "</option>";
3428        options += "</optgroup>";
3429
3430        options += '<optgroup label="' + tcg.lib.prop("ac_expenditure") + '">';
3431        options += '<option value="5200">' + tcg.lib.prop("ac_income_option_1") + "</option>";
3432        options += '<option value="8202">' + tcg.lib.prop("ac_income_option_2") + "</option>";
3433        options += "</optgroup>";
3434
3435        $(type).html(options);
3436        break;
3437
3438      // Main
3439      case "2":
3440        var options = "";
3441        options += '<option value="" class="entire" selected>' + tcg.lib.prop("ac_all") + "</option>";
3442        options += '<optgroup label="' + tcg.lib.prop("ac_income") + '">';
3443        options += '<option value="6101">' + tcg.lib.prop("ac_income_option_3") + "</option>";
3444        if (globalVar.enableDividentTransacationRecord) {
3445          options += '<option value="6116,6112">' + tcg.lib.prop("ac_income_option_4") + "</option>";
3446        }
3447        options += '<option value="6131,5112,3102,4104">' + tcg.lib.prop("ac_income_option_5") + "</option>";
3448        options += '<option value="4401">' + tcg.lib.prop("ac_revenue_report_column_4") + "</option>";
3449        if (globalVar.enableSalaryTransactionRecord) {
3450          options += '<option value="4301">' + tcg.lib.prop("ac_revenue_report_column_3") + "</option>";
3451        }
3452        options += '<option value="8102">' + tcg.lib.prop("ac_income_option_2") + "</option>";
3453        options += '<option value="6110">
3453' + tcg.lib.prop("ac_income_option_6") + "</option>";
3454        options += '<option value="6104">' + tcg.lib.prop("ac_income_option_7") + "</option>";
3455        options += '<option value="6111,6109,6113">' + tcg.lib.prop("ac_income_option_8") + "</option>";
3456        options += "</optgroup>";
3457
3458        options += '<optgroup label="' + tcg.lib.prop("ac_expenditure") + '">';
3459        options += '<option value="6201">' + tcg.lib.prop("ac_income_option_9") + "</option>";
3460        options += '<option value="8202">' + tcg.lib.prop("ac_income_option_2") + "</option>";
3461        options += '<option value="6208">' + tcg.lib.prop("ac_income_option_10") + "</option>";
3462        options += '<option value="6207">' + tcg.lib.prop("ac_income_option_7") + "</option>";
3463        if (globalVar.enableSalaryTransactionRecord) {
3464          options += '<option value="4301">' + tcg.lib.prop("ac_revenue_report_column_3") + "</option>";
3465        }
3466        options += "</optgroup>";
3467
3468        $(type).html(options);
3469        break;
3470
3471      // AG
3472      case "301":
3473        var options = "";
3474        options += '<option value="" class="entire" selected>' + tcg.lib.prop("ac_all") + "</option>";
3475        options += '<optgroup label="' + tcg.lib.prop("ac_income") + '">';
3476        options += '<option value="3116">' + tcg.lib.prop("ac_income_option_11") + "</option>";
3477        //options += '<option value="3102">活动</option>';
3478        options += '<option value="3101">' + tcg.lib.prop("ac_income_option_2") + "</option>";
3479        options += "</optgroup>";
3480
3481        options += '<optgroup label="' + tcg.lib.prop("ac_expenditure") + '">';
3482        options +=
3483          '<option value="3216">' + tcg.lib.prop("ac_subordinate_management_pvp_history_column_3") + "</option>";
3484        options += '<option value="3201">' + tcg.lib.prop("ac_income_option_2") + "</option>";
3485        options += "</optgroup>";
3486
3487        $(type).html(options);
3488
3489        break;
3490
3491      // Lotto
3492      case "4":
3493        var options = "";
3494        options += '<option value="" class="entire" selected>' + tcg.lib.prop("ac_all") + "</option>";
3495        options += '<optgroup label="' + tcg.lib.prop("ac_income") + '">';
3496        options += '<option value="4100">' + tcg.lib.prop("ac_income_option_11") + "</option>";
3497        options += '<option value="4106,4107,4108,4109,4110,4111">' + tcg.lib.prop("ac_income_option_12") + "</option>";
3498        if (parseInt(sessionStorage.isAgent) > 0) {
3499          options += '<option value="6114">' + tcg.lib.prop("ac_income_option_13") + "</option>";
3500        }
3501        options += '<option value="4280">' + tcg.lib.prop("ac_income_option_14") + "</option>";
3502        options += '<option value="4105">' + tcg.lib.prop("ac_income_option_15") + "</option>";
3503        //options += '<option value="4104">活动</option>';
3504        options += '<option value="4101">' + tcg.lib.prop("ac_income_option_2") + "</option>";
3505        options += "</optgroup>";
3506
3507        options += '<optgroup label="' + tcg.lib.prop("ac_expenditure") + '">';
3508        options +=
3509          '<option value="4200">' + tcg.lib.prop("ac_subordinate_management_pvp_history_column_3") + "</option>";
3510        options += '<option value="4201">' + tcg.lib.prop("ac_income_option_2") + "</option>";
3511        options += '<option value="4208">' + tcg.lib.prop("ac_income_option_16") + "</option>";
3512        options += "</optgroup>";
3513
3514        $(type).html(options);
3515        break;
3516      default:
3517    }
3518
3519    $(type).trigger("chosen:updated");
3520  };
3521
3522  // PNL Agent Report
3523  tcg.ac.ui.switchAgentPnl = function () {
3524    $(document)
3525      .off("click", "#switchAgentPnl li")
3526      .on("click", "#switchAgentPnl li", function () {
3527        var rel = $(this).attr("data-rel");
3528        if (!$(this).hasClass("active")) {
3529          if (rel == "lotto_rel") {
3530            $("#lottoAgentPnlContainer").removeClass("hide");
3531            $("#pvpAgentPnlContainer,#rngAgentPnlContainer,#fishAgentPnlContainer,#sportsAgentPnlContainer").addClass(
3532              "hide"
3533            );
3534            $("#lottoAgentPnlForm .form-submit").click();
3535          } else if (rel == "pvp_rel") {
3536            $("#pvpAgentPnlContainer").removeClass("hide");
3537            $("#lottoAgentPnlContainer,#rngAgentPnlContainer,#fishAgentPnlContainer,#sportsAgentPnlContainer").addClass(
3538              "hide"
3539            );
3540            $("#pvpAgentPnlForm .form-submit").click();
3541          } else if (rel == "rng_rel") {
3542            $("#rngAgentPnlContainer").removeClass("hide");
3543            $("#lottoAgentPnlContainer,#pvpAgentPnlContainer,#fishAgentPnlContainer,#sportsAgentPnlContainer").addClass(
3544              "hide"
3545            );
3546            $("#rngAgentPnlForm .form-submit").click();
3547          } else if (rel == "fish_rel") {
3548            $("#fishAgentPnlContainer").removeClass("hide");
3549            $("#lottoAgentPnlContainer,#pvpAgentPnlContainer,#rngAgentPnlContainer,#sportsAgentPnlContainer").addClass(
3550              "hide"
3551            );
3552            $("#fishAgentPnlForm .form-submit").click();
3553          } else if (rel == "sports_rel") {
3554            $("#sportsAgentPnlContainer").removeClass("hide");
3555            $("#lottoAgentPnlContainer,#pvpAgentPnlContainer,#rngAgentPnlContainer,#fishAgentPnlContainer").addClass(
3556              "hide"
3557            );
3558            $("#sportsAgentPnlForm .form-submit").click();
3559          }
3560          $("#switchAgentPnl li.active").removeClass("active");
3561          $(this).addClass("active");
3562        }
3563      });
3564  };
3565  tcg.ac.ui.switchAgentPnlCopy = function () {
3566    $(document)
3567      .off("click", "#switchAgentPnl li")
3568      .on("click", "#switchAgentPnl li", function () {
3569        var rel = $(this).attr("data-rel");
3570        if (!$(this).hasClass("active")) {
3571          $("div.palTab").addClass("hide");
3572          if (rel == "cons_rel") {
3573            $("#consAgentPnlContainer").removeClass("hide");
3574            $("#consAgentPnlForm .form-submit").click();
3575          } else if (rel == "lott_rel") {
3576            $("#lottoAgentPnlContainer").removeClass("hide");
3577            $("#lottoAgentPnlForm .form-submit").click();
3578          } else if (rel == "pvp_rel") {
3579            $("#pvpAgentPnlContainer").removeClass("hide");
3580            $("#pvpAgentPnlForm .form-submit").click();
3581          } else if (rel == "rng_rel") {
3582            $("#rngAgentPnlContainer").removeClass("hide");
3583            $("#rngAgentPnlForm .form-submit").click();
3584          } else if (rel == "live_rel") {
3585            $("#liveAgentPnlContainer").removeClass("hide");
3586            $("#liveAgentPnlForm .form-submit").click();
3587          } else if (rel == "fish_rel") {
3588            $("#fishAgentPnlContainer").removeClass("hide");
3589            $("#fishAgentPnlForm .form-submit").click();
3590          } else if (rel == "sports_rel") {
3591            $("#sportsAgentPnlContainer").removeClass("hide");
3592            $("#sportsAgentPnlForm .form-submit").click();
3593          } else if (rel == "elott_rel") {
3594            $("#elottAgentPnlContainer").removeClass("hide");
3595            $("#elottAgentPnlForm .form-submit").click();
3596          }
3597          $("#switchAgentPnl li.active").removeClass("active");
3598          $(this).addClass("active");
3599        }
3600      });
3601  };
3602  // Cons PNLCopy Functions
3603  tcg.ac.ui.searchConsAgentPnl = function () {
3604    $(document)
3605      .off("click", "#consAgentPnlForm .form-submit")
3606      .on("click", "#consAgentPnlForm .form-submit", function (event) {
3607        $(".switchDecimal").removeClass("on").removeClass("off");
3608        if (event.originalEvent === undefined) {
3609          var len = $("#consAgentPnlForm .b-list").length - 1;
3610          var customerId = $($("#consAgentPnlForm .b-list")[len]).attr("data-customerid");
3611          if ($("#consAgentPnlTable .divTableCell.sort").hasClass("asc")) {
3612            var type = $("#consAgentPnlTable .divTableCell.sort.asc").attr("data-type");
3613            tcg.ac.getConsAgentPnl(customerId, type, "asc");
3614          } else if ($("#consAgentPnlTable .divTableCell.sort").hasClass("desc")) {
3615            var type = $("#consAgentPnlTable .divTableCell.sort.desc").attr("data-type");
3616            tcg.ac.getConsAgentPnl(customerId, type, "desc");
3617          } else {
3618            tcg.ac.getConsAgentPnl(customerId);
3619          }
3620        } else {
3621          $("#consAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
3622          tcg.ac.getConsAgentPnl();
3623        }
3624      });
3625  };
3626  tcg.ac.ui.loadConsAgentPnl = function (result, summaryType, sortType, sortDir) {
3627    var _column = "";
3628    var currentUser = {};
3629    for (var i = 0; i < result.list.length; i++) {
3630      if (tcg.ac.customerId === +result.list[i].customerId) {
3631        currentUser = result.list[i];
3632        break;
3633      }
3634    }
3635    if (summaryType == 0) {
3636      _column += "<div class='divTableCell '>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_1") + "</div>";
3637      _column +=
3638        "<div class='divTableCell tbl-link sort' data-sort='' data-type='deposit'>" +
3639        tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_2") +
3640        "</div>";
3641      _column +=
3642        "<div class='divTableCell tbl-link sort' data-sort='' data-type='withdraw'>" +
3643        tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_3") +
3644        "</div>";
3645      _column +=
3646        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
3647        tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_4") +
3648        "</div>";
3649      _column +=
3650        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
3651        tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_6") +
3652        "</div>";
3653      _column += "<div class='divTableCell '>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_5") + "</div>";
3654      if (sessionStorage.enableSalary == "true") {
3655        _column += "<div class='divTableCell '>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_9") + "</div>";
3656      }
3657      _column += "<div class='divTableCell '>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_7") + "</div>";
3658      if (currentUser.bankCharges != undefined && currentUser.bankCharges != 0) {
3659        _column +=
3660          "<div class='divTableCell tbl-link' data-sort='' data-type='bankCharges'>" +
3661          tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_10") +
3662          "</div>";
3663      }
3664      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
3665        _column +=
3666          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
3667          tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_11") +
3668          "</div>";
3669      }
3670      _column +=
3671        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>
3671" +
3672        tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_8") +
3673        "</div>";
3674    } else {
3675      _column += "<div class='divTableCell '>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_1") + "</div>";
3676      _column +=
3677        "<div class='divTableCell tbl-link sort' data-sort='' data-type='deposit'>" +
3678        tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_2") +
3679        "</div>";
3680      _column +=
3681        "<div class='divTableCell tbl-link sort' data-sort='' data-type='withdraw'>" +
3682        tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_3") +
3683        "</div>";
3684      _column +=
3685        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
3686        tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_4") +
3687        "</div>";
3688      _column +=
3689        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
3690        tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_6") +
3691        "</div>";
3692      _column += "<div class='divTableCell '>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_5") + "</div>";
3693      if (sessionStorage.enableSalary == "true") {
3694        _column += "<div class='divTableCell '>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_9") + "</div>";
3695      }
3696      _column += "<div class='divTableCell '>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_7") + "</div>";
3697      if (currentUser.bankCharges != undefined && currentUser.bankCharges != 0) {
3698        _column +=
3699          "<div class='divTableCell tbl-link' data-sort='' data-type='bankCharges'>" +
3700          tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_10") +
3701          "</div>";
3702      }
3703      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
3704        _column +=
3705          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
3706          tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_11") +
3707          "</div>";
3708      }
3709      _column +=
3710        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>" +
3711        tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_8") +
3712        "</div>";
3713    }
3714    $("#consAgentPnlColumn").html(_column);
3715    var decimal = 2,
3716      list = result.list,
3717      _html = "";
3718    for (var i = 0; i < list.length; i++) {
3719      _html += "<div class='divTableRow'>";
3720      var account = list[i].customerName;
3721      _html += "<div class='divTableCell tbl-link' data-customerId='" + account + "'>" + account + "</div>";
3722      var depositAndTransferIn = list[i].deposit;
3723      _html +=
3724        "<div class='divTableCell' data-switchDecimal='" +
3725        decimal +
3726        "' data-value='" +
3727        list[i].deposit +
3728        "'>" +
3729        tcg.ac.customCurrencyFormat(depositAndTransferIn, decimal) +
3730        "</div>";
3731      var withdrawAndTransferOut = list[i].withdraw;
3732      _html +=
3733        "<div class='divTableCell' data-switchDecimal='" +
3734        decimal +
3735        "' data-value='" +
3736        list[i].withdraw +
3737        "'>" +
3738        tcg.ac.customCurrencyFormat(withdrawAndTransferOut, decimal) +
3739        "</div>";
3740      _html +=
3741        "<div class='divTableCell' data-switchDecimal='" +
3742        decimal +
3743        "' data-value='" +
3744        list[i].betAmount +
3745        "'>" +
3746        tcg.ac.customCurrencyFormat(list[i].betAmount, decimal) +
3747        "</div>";
3748      _html +=
3749        "<div class='divTableCell' data-switchDecimal='" +
3750        decimal +
3751        "' data-value='" +
3752        list[i].winAmount +
3753        "'>" +
3754        tcg.ac.customCurrencyFormat(list[i].winAmount, decimal) +
3755        "</div>";
3756      var consGameRebate = list[i].agentCommission + list[i].rebate;
3757      var lottGameRebateColor = consGameRebate;
3758      _html +=
3759        "<div class='divTableCell " +
3760        lottGameRebateColor +
3761        "'  data-switchDecimal='" +
3762        decimal +
3763        "' data-value='" +
3764        consGameRebate +
3765        "'>" +
3766        tcg.ac.customCurrencyFormat(consGameRebate, decimal) +
3767        "</div>";
3768      if (sessionStorage.enableSalary == "true") {
3769        _html +=
3770          "<div class='divTableCell' data-switchDecimal='" +
3771          decimal +
3772          "' data-value='" +
3773          list[i].dailyIncome +
3774          "'>" +
3775          tcg.ac.customCurrencyFormat(list[i].dailyIncome, decimal) +
3776          "</div>";
3777      }
3778      var promobrokeincome = list[i].profitSharing + list[i].promotion;
3779      _html +=
3780        "<div class='divTableCell' data-switchDecimal='" +
3781        decimal +
3782        "' data-value='" +
3783        promobrokeincome +
3784        "'>" +
3785        tcg.ac.customCurrencyFormat(promobrokeincome, decimal) +
3786        "</div>";
3787      if (currentUser.bankCharges != undefined && currentUser.bankCharges != 0) {
3788        _html +=
3789          "<div class='divTableCell' data-switchDecimal='" +
3790          decimal +
3791          "' data-value='" +
3792          list[i].bankCharges +
3793          "'>" +
3794          tcg.ac.customCurrencyFormat(list[i].bankCharges, decimal) +
3795          "</div>";
3796      }
3797      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
3798        _html +=
3799          "<div class='divTableCell' data-switchDecimal='" +
3800          decimal +
3801          "' data-value='" +
3802          list[i].merchantCharge +
3803          "'>" +
3804          tcg.ac.customCurrencyFormat(list[i].merchantCharge, decimal) +
3805          "</div>";
3806      }
3807      var profitLossColor = list[i].profitAndLoss >= 0 ? "tbl-red" : "tbl-green";
3808      _html +=
3809        "<div class='divTableCell " +
3810        profitLossColor +
3811        "' data-switchDecimal='" +
3812        decimal +
3813        "' data-value='" +
3814        list[i].profitAndLoss +
3815        "'>" +
3816        tcg.ac.customCurrencyFormat(list[i].profitAndLoss, decimal) +
3817        "</div>";
3818      _html += "</div>";
3819    }
3820    $("#consAgentPnlList").html(_html);
3821    if (sortType && sortDir) {
3822      $("#consAgentPnlTable .divTableCell.tbl-link.sort[data-type='" + sortType + "']")
3823        .attr("data-sort", sortDir)
3824        .addClass(sortDir);
3825    }
3826  };
3827  tcg.ac.ui.switchConsAgentPnlSummaryType = function () {
3828    $(document)
3829      .off("click", "#consAgentPnlForm .summaryTypeList li")
3830      .on("click", "#consAgentPnlForm .summaryTypeList li", function () {
3831        if (!$(this).hasClass("active") && !$("#consAgentPnlForm .form-submit").hasClass("processing")) {
3832          var rel = $(this).attr("data-rel");
3833          $("#consAgentPnlForm .summaryTypeList li").removeClass("active");
3834          $(this).addClass("active");
3835          $("#consAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
3836          $("#consAgentPnlForm [name='pageNo']").val(1);
3837          $("#consAgentPnlForm [name='summaryType']").val(rel);
3838          $("#consAgentPnlForm .form-submit").click();
3839        }
3840      });
3841  };
3842  tcg.ac.ui.selectConsAgentDownlinePnl = function () {
3843    $(document)
3844      .off("click", "#consAgentPnlList .tbl-link")
3845      .on("click", "#consAgentPnlList .tbl-link", function () {
3846        if (!$(this).hasClass("loading")) {
3847          var customerName = $(this).text(),
3848            customerId = $(this).attr("data-customerId"),
3849            isOpen = false;
3850          $("#consAgentPnlForm .breadcrumbs .b-list").each(function () {
3851            if ($(this).attr("data-customerId") == customerId) {
3852              isOpen = true;
3853            }
3854          });
3855          if (!isOpen) {
3856            $("#consAgentPnlForm .breadcrumbs .b-list").addClass("loading");
3857            $("#consAgentPnlForm .summaryTypeList li").addClass("loading");
3858            _html =
3859              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
3860              customerId +
3861              "'>" +
3862              customerName +
3863              "</div>";
3864            $("#consAgentPnlForm .breadcrumbs").append(_html);
3865          }
3866          $("#consAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
3867          $("#consAgentPnlForm [name='pageNo']").val(1);
3868          tcg.ac.getConsAgentPnl(customerId);
3869        }
3870      });
3871  };
3872  tcg.ac.ui.clickConsAgentPnlBreadcrumbs = function () {
3873    $(document)
3874      .off("click", "#consAgentPnlForm .breadcrumbs .b-list")
3875      .on("click", "#consAgentPnlForm .breadcrumbs .b-list", function () {
3876        if (!$(this).hasClass("loading")) {
3877          var customerId = $(this).attr("data-customerId"),
3878            customerName = $(this).text(),
3879            removeFromList = false;
3880          $("#consAgentPnlForm .breadcrumbs .b-list").each(function () {
3881            if (removeFromList) $(this).remove();
3882            if ($(this).attr("data-customerId") == customerId) {
3883              removeFromList = true;
3884            }
3885          });
3886          $("#consAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
3887          $("#consAgentPnlForm [name='pageNo']").val(1);
3888          $("#consAgentPnlForm .breadcrumbs .b-list").addClass("loading");
3889          $("#consAgentPnlForm .summaryTypeList li").addClass("loading");
3890          tcg.ac.getConsAgentPnl(customerId);
3891        }
3892      });
3893  };
3894  tcg.ac.ui.sortConsAgentPnl = function () {
3895    $(document)
3896      .off("click", "#consAgentPnlTable .divTableCell.sort")
3897      .on("click", "#consAgentPnlTable .divTableCell.sort", function (event) {
3898        var type = $(this).attr("data-type");
3899        var sort = $(this).attr("data-sort");
3900        $("#consAgentPnlTable .divTableCell.sort").addClass("loading");
3901        $("#consAgentPnlTable .divTableCell.sort").removeClass("asc").removeClass("desc");
3902        $("#consAgentPnlTable .divTableCell.sort").attr("data-sort", "");
3903        if (sort === "") {
3904          $(this).attr("data-sort", "desc");
3905          sort = "desc";
3906        } else {
3907          if (sort == "desc") {
3908            $(this).attr("data-sort", "asc");
3909            sort = "asc";
3910          } else {
3911            $(this).attr("data-sort", "desc");
3912            sort = "desc";
3913          }
3914        }
3915        $(this).addClass(sort);
3916        console.log(type, sort);
3917        $("#consAgentPnlForm input[name='pageNo']").val(1);
3918        var len = $("#consAgentPnlForm .b-list").length - 1;
3919        var customerId = $($("#consAgentPnlForm .b-list")[len]).attr("data-customerid");
3920        tcg.ac.getConsAgentPnl(customerId, type, sort);
3921      });
3922  };
3923  // LottoCopy PNL Functions
3924  tcg.ac.ui.searchLottoCopyAgentPnl = function () {
3925    $(document)
3926      .off("click", "#lottoAgentPnlForm .form-submit")
3927      .on("click", "#lottoAgentPnlForm .form-submit", function (event) {
3928        $(".switchDecimal").removeClass("on").removeClass("off");
3929        if (event.originalEvent === undefined) {
3930          var len = $("#lottoAgentPnlForm .b-list").length - 1;
3931          var customerId = $($("#lottoAgentPnlForm .b-list")[len]).attr("data-customerid");
3932          if ($("#lottoAgentPnlTable .divTableCell.sort").hasClass("asc")) {
3933            var type = $("#lottoAgentPnlTable .divTableCell.sort.asc").attr("data-type");
3934            tcg.ac.getLottoCopyAgentPnl(customerId, type, "asc");
3935          } else if ($("#lottoAgentPnlTable .divTableCell.sort").hasClass("desc")) {
3936            var type = $("#lottoAgentPnlTable .divTableCell.sort.desc").attr("data-type");
3937            tcg.ac.getLottoCopyAgentPnl(customerId, type, "desc");
3938          } else {
3939            tcg.ac.getLottoCopyAgentPnl(customerId);
3940          }
3941        } else {
3942          $("#lottoAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
3943          tcg.ac.getLottoCopyAgentPnl();
3944        }
3945      });
3946  };
3947  tcg.ac.ui.loadLottoCopyAgentPnl = function (result, summaryType, sortType, sortDir) {
3948    var _column = "";
3949    var currentUser = {};
3950    for (var i = 0; i < result.list.length; i++) {
3951      if (tcg.ac.customerId === +result.list[i].customerId) {
3952        currentUser = result.list[i];
3953        break;
3954      }
3955    }
3956    if (summaryType == 0) {
3957      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_1") + "</div>";
3958      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_2")+ "</div>";
3959      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_3")+ "</div>";
3960      _column +=
3961        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
3962        tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_4") +
3963        "</div>";
3964      _column +=
3965        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
3966        tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_6") +
3967        "</div>";
3968      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_5") + "</div>";
3969      if (sessionStorage.enableSalary == "true") {
3970        _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_9") + "</div>";
3971      }
3972      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_7") + "</div>";
3973      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
3974        _column +=
3975          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
3976          tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_11") +
3977          "</div>";
3978      }
3979      _column +=
3980        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>
3980" +
3981        tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_8") +
3982        "</div>";
3983    } else {
3984      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_1") + "</div>";
3985      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_2")+ "</div>";
3986      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_3")+ "</div>";
3987      _column +=
3988        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
3989        tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_4") +
3990        "</div>";
3991      _column +=
3992        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
3993        tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_6") +
3994        "</div>";
3995      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_5") + "</div>";
3996      if (sessionStorage.enableSalary == "true") {
3997        _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_9") + "</div>";
3998      }
3999      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_7") + "</div>";
4000      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4001        _column +=
4002          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
4003          tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_11") +
4004          "</div>";
4005      }
4006      _column +=
4007        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>" +
4008        tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_8") +
4009        "</div>";
4010    }
4011    $("#lottoAgentPnlColumn").html(_column);
4012
4013    var decimal = 2,
4014      list = result.list,
4015      _html = "";
4016    for (var i = 0; i < list.length; i++) {
4017      _html += "<div class='divTableRow'>";
4018      var account = list[i].customerName;
4019      _html += "<div class='divTableCell tbl-link' data-customerId='" + account + "'>" + account + "</div>";
4020      // var depositAndTransferIn = list[i].deposit + list[i].agent_transfer_in;
4021      // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + list[i].deposit + "'>" + tcg.ac.customCurrencyFormat(depositAndTransferIn, decimal) + "</div>";
4022      // var withdrawAndTransferOut = list[i].withdraw + list[i].agent_transfer_out;
4023      // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + list[i].withdraw + "'>" + tcg.ac.customCurrencyFormat(withdrawAndTransferOut, decimal) + "</div>";
4024      _html +=
4025        "<div class='divTableCell' data-switchDecimal='" +
4026        decimal +
4027        "' data-value='" +
4028        list[i].betAmount +
4029        "'>" +
4030        tcg.ac.customCurrencyFormat(list[i].betAmount, decimal) +
4031        "</div>";
4032      _html +=
4033        "<div class='divTableCell' data-switchDecimal='" +
4034        decimal +
4035        "' data-value='" +
4036        list[i].winAmount +
4037        "'>" +
4038        tcg.ac.customCurrencyFormat(list[i].winAmount, decimal) +
4039        "</div>";
4040      var lottoGameRebate = list[i].agentCommission + list[i].rebate;
4041      var lottGameRebateColor = lottoGameRebate;
4042      _html +=
4043        "<div class='divTableCell " +
4044        lottGameRebateColor +
4045        "'  data-switchDecimal='" +
4046        decimal +
4047        "' data-value='" +
4048        lottoGameRebate +
4049        "'>" +
4050        tcg.ac.customCurrencyFormat(lottoGameRebate, decimal) +
4051        "</div>";
4052
4053      if (sessionStorage.enableSalary == "true") {
4054        _html +=
4055          "<div class='divTableCell' data-switchDecimal='" +
4056          decimal +
4057          "' data-value='" +
4058          list[i].dailyIncome +
4059          "'>" +
4060          tcg.ac.customCurrencyFormat(list[i].dailyIncome, decimal) +
4061          "</div>";
4062      }
4063      var promobrokeincome = list[i].promotion;
4064      //var promobrokeincome = list[i].dailyIncome + list[i].promotion;
4065      _html +=
4066        "<div class='divTableCell' data-switchDecimal='" +
4067        decimal +
4068        "' data-value='" +
4069        promobrokeincome +
4070        "'>" +
4071        tcg.ac.customCurrencyFormat(promobrokeincome, decimal) +
4072        "</div>";
4073      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4074        _html +=
4075          "<div class='divTableCell' data-switchDecimal='" +
4076          decimal +
4077          "' data-value='" +
4078          list[i].merchantCharge +
4079          "'>" +
4080          tcg.ac.customCurrencyFormat(list[i].merchantCharge, decimal) +
4081          "</div>";
4082      }
4083      var profitLossColor = list[i].profitAndLoss >= 0 ? "tbl-red" : "tbl-green";
4084      _html +=
4085        "<div class='divTableCell " +
4086        profitLossColor +
4087        "' data-switchDecimal='" +
4088        decimal +
4089        "' data-value='" +
4090        list[i].profitAndLoss +
4091        "'>" +
4092        tcg.ac.customCurrencyFormat(list[i].profitAndLoss, decimal) +
4093        "</div>";
4094      _html += "</div>";
4095    }
4096    $("#lottoAgentPnlList").html(_html);
4097    if (sortType && sortDir) {
4098      $("#lottoAgentPnlTable .divTableCell.tbl-link.sort[data-type='" + sortType + "']")
4099        .attr("data-sort", sortDir)
4100        .addClass(sortDir);
4101    }
4102  };
4103  tcg.ac.ui.switchLottoCopyAgentPnlSummaryType = function () {
4104    $(document)
4105      .off("click", "#lottoAgentPnlForm .summaryTypeList li")
4106      .on("click", "#lottoAgentPnlForm .summaryTypeList li", function () {
4107        if (!$(this).hasClass("active") && !$("#lottoAgentPnlForm .form-submit").hasClass("processing")) {
4108          var rel = $(this).attr("data-rel");
4109          $("#lottoAgentPnlForm .summaryTypeList li").removeClass("active");
4110          $(this).addClass("active");
4111          $("#lottoAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4112          $("#lottoAgentPnlForm [name='pageNo']").val(1);
4113          $("#lottoAgentPnlForm [name='summaryType']").val(rel);
4114          $("#lottoAgentPnlForm .form-submit").click();
4115        }
4116      });
4117  };
4118  tcg.ac.ui.selectLottoCopyAgentDownlinePnl = function () {
4119    $(document)
4120      .off("click", "#lottoAgentPnlList .tbl-link")
4121      .on("click", "#lottoAgentPnlList .tbl-link", function () {
4122        if (!$(this).hasClass("loading")) {
4123          var customerName = $(this).text(),
4124            customerId = $(this).attr("data-customerId"),
4125            isOpen = false;
4126          $("#lottoAgentPnlForm .breadcrumbs .b-list").each(function () {
4127            if ($(this).attr("data-customerId") == customerId) {
4128              isOpen = true;
4129            }
4130          });
4131          if (!isOpen) {
4132            $("#lottoAgentPnlForm .breadcrumbs .b-list").addClass("loading");
4133            $("#lottoAgentPnlForm .summaryTypeList li").addClass("loading");
4134            _html =
4135              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
4136              customerId +
4137              "'>" +
4138              customerName +
4139              "</div>";
4140            $("#lottoAgentPnlForm .breadcrumbs").append(_html);
4141          }
4142          $("#lottoAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4143          $("#lottoAgentPnlForm [name='pageNo']").val(1);
4144          tcg.ac.getLottoCopyAgentPnl(customerId);
4145        }
4146      });
4147  };
4148  tcg.ac.ui.clickLottoCopyAgentPnlBreadcrumbs = function () {
4149    $(document)
4150      .off("click", "#lottoAgentPnlForm .breadcrumbs .b-list")
4151      .on("click", "#lottoAgentPnlForm .breadcrumbs .b-list", function () {
4152        if (!$(this).hasClass("loading")) {
4153          var customerId = $(this).attr("data-customerId"),
4154            customerName = $(this).text(),
4155            removeFromList = false;
4156          $("#lottoAgentPnlForm .breadcrumbs .b-list").each(function () {
4157            if (removeFromList) $(this).remove();
4158            if ($(this).attr("data-customerId") == customerId) {
4159              removeFromList = true;
4160            }
4161          });
4162          $("#lottoAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4163          $("#lottoAgentPnlForm [name='pageNo']").val(1);
4164          $("#lottoAgentPnlForm .breadcrumbs .b-list").addClass("loading");
4165          $("#lottoAgentPnlForm .summaryTypeList li").addClass("loading");
4166          tcg.ac.getLottoCopyAgentPnl(customerId);
4167        }
4168      });
4169  };
4170  tcg.ac.ui.sortLottoCopyAgentPnl = function () {
4171    $(document)
4172      .off("click", "#lottoAgentPnlTable .divTableCell.sort")
4173      .on("click", "#lottoAgentPnlTable .divTableCell.sort", function (event) {
4174        var type = $(this).attr("data-type");
4175        var sort = $(this).attr("data-sort");
4176        $("#lottoAgentPnlTable .divTableCell.sort").addClass("loading");
4177        $("#lottoAgentPnlTable .divTableCell.sort").removeClass("asc").removeClass("desc");
4178        $("#lottoAgentPnlTable .divTableCell.sort").attr("data-sort", "");
4179        if (sort === "") {
4180          $(this).attr("data-sort", "desc");
4181          sort = "desc";
4182        } else {
4183          if (sort == "desc") {
4184            $(this).attr("data-sort", "asc");
4185            sort = "asc";
4186          } else {
4187            $(this).attr("data-sort", "desc");
4188            sort = "desc";
4189          }
4190        }
4191        $(this).addClass(sort);
4192        console.log(type, sort);
4193        $("#lottoAgentPnlForm input[name='pageNo']").val(1);
4194        var len = $("#lottoAgentPnlForm .b-list").length - 1;
4195        var customerId = $($("#lottoAgentPnlForm .b-list")[len]).attr("data-customerid");
4196        tcg.ac.getLottoCopyAgentPnl(customerId, type, sort);
4197      });
4198  };
4199  tcg.ac.ui.searchPvpCopyAgentPnl = function () {
4200    $(document)
4201      .off("click", "#pvpAgentPnlForm .form-submit")
4202      .on("click", "#pvpAgentPnlForm .form-submit", function (event) {
4203        $(".switchDecimal").removeClass("on").removeClass("off");
4204        if (event.originalEvent === undefined) {
4205          var len = $("#pvpAgentPnlForm .b-list").length;
4206          var customerId = $($("#pvpAgentPnlForm .b-list")[len]).attr("data-customerid");
4207          if ($("#pvpAgentPnlTable .divTableCell.sort").hasClass("asc")) {
4208            var type = $("#pvpAgentPnlTable .divTableCell.sort.asc").attr("data-type");
4209            tcg.ac.getPvpCopyAgentPnl(customerId, type, "asc");
4210          } else if ($("#pvpAgentPnlTable .divTableCell.sort").hasClass("desc")) {
4211            var type = $("#pvpAgentPnlTable .divTableCell.sort.desc").attr("data-type");
4212            tcg.ac.getPvpCopyAgentPnl(customerId, type, "desc");
4213          } else {
4214            tcg.ac.getPvpCopyAgentPnl(customerId);
4215          }
4216        } else {
4217          $("#pvpAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
4218          tcg.ac.getPvpCopyAgentPnl();
4219        }
4220      });
4221  };
4222  tcg.ac.ui.loadPvpCopyAgentPnl = function (result, summaryType, sortType, sortDir) {
4223    var _column = "";
4224    var currentUser = {};
4225    for (var i = 0; i < result.list.length; i++) {
4226      if (tcg.ac.customerId === +result.list[i].customerId) {
4227        currentUser = result.list[i];
4228        break;
4229      }
4230    }
4231    if (summaryType == 0) {
4232      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_1") + "</div>";
4233      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_2")+ "</div>";
4234      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_3")+ "</div>";
4235      _column +=
4236        "<div class='divTableCell tbl-link sort' data-sort='' data-type='loseAmount'>" +
4237        tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_4") +
4238        "</div>";
4239      _column +=
4240        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
4241        tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_5") +
4242        "</div>";
4243      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_6") + "</div>";
4244      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_7") + "</div>";
4245      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4246        _column +=
4247          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
4248          tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_11") +
4249          "</div>";
4250      }
4251      _column +=
4252        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>
4252" +
4253        tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_8") +
4254        "</div>";
4255    } else {
4256      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_1") + "</div>";
4257      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_2")+ "</div>";
4258      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_3")+ "</div>";
4259      _column +=
4260        "<div class='divTableCell tbl-link sort' data-sort='' data-type='loseAmount'>" +
4261        tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_4") +
4262        "</div>";
4263      _column +=
4264        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
4265        tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_5") +
4266        "</div>";
4267      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_6") + "</div>";
4268      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_7") + "</div>";
4269      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4270        _column +=
4271          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
4272          tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_11") +
4273          "</div>";
4274      }
4275      _column +=
4276        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>" +
4277        tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_8") +
4278        "</div>";
4279    }
4280    $("#pvpAgentPnlColumn").html(_column);
4281
4282    var decimal = 2,
4283      list = result.list,
4284      _html = "";
4285    if (list.length > 0) {
4286      for (var i = 0; i < list.length; i++) {
4287        _html += "<div class='divTableRow'>";
4288        var account = list[i].customerName;
4289        _html += "<div class='divTableCell tbl-link' data-customerId='" + account + "'>" + account + "</div>";
4290        // var total_deposit = list[i].deposit;
4291        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_deposit + "'>" + tcg.ac.customCurrencyFormat(total_deposit, decimal) + "</div>";
4292        // var total_withdraw = list[i].withdraw;
4293        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_withdraw + "'>" + tcg.ac.customCurrencyFormat(total_withdraw, decimal) + "</div>";
4294        var total_betting_loss = list[i].loseAmount;
4295        _html +=
4296          "<div class='divTableCell' data-switchDecimal='" +
4297          decimal +
4298          "' data-value='" +
4299          total_betting_loss +
4300          "'>" +
4301          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
4302          "</div>";
4303        var total_game_winnings = list[i].winAmount;
4304        var gameWinningColor = total_game_winnings;
4305        _html +=
4306          "<div class='divTableCell " +
4307          gameWinningColor +
4308          "'  data-switchDecimal='" +
4309          decimal +
4310          "' data-value='" +
4311          total_game_winnings +
4312          "'>" +
4313          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
4314          "</div>";
4315        var total_game_rebate = list[i].agentCommission + list[i].rebate;
4316        _html +=
4317          "<div class='divTableCell' data-switchDecimal='" +
4318          decimal +
4319          "' data-value='" +
4320          total_game_rebate +
4321          "'>" +
4322          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
4323          "</div>";
4324        var total_promotion = list[i].promotion;
4325        _html +=
4326          "<div class='divTableCell' data-switchDecimal='" +
4327          decimal +
4328          "' data-value='" +
4329          total_promotion +
4330          "'>" +
4331          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
4332          "</div>";
4333        if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4334          _html +=
4335            "<div class='divTableCell' data-switchDecimal='" +
4336            decimal +
4337            "' data-value='" +
4338            list[i].merchantCharge +
4339            "'>" +
4340            tcg.ac.customCurrencyFormat(list[i].merchantCharge, decimal) +
4341            "</div>";
4342        }
4343        var total_pnl = list[i].profitAndLoss;
4344        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
4345        _html +=
4346          "<div class='divTableCell " +
4347          profitLossColor +
4348          "' data-switchDecimal='" +
4349          decimal +
4350          "' data-value='" +
4351          total_pnl +
4352          "'>" +
4353          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
4354          "</div>";
4355        _html += "</div>";
4356      }
4357    } else {
4358      _html += "<div class='tableContent-wrp'>";
4359      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
4360      _html += "</div>";
4361    }
4362    $("#pvpAgentPnlList").html(_html);
4363    if (sortType && sortDir) {
4364      $("#pvpAgentPnlTable .divTableCell.tbl-link.sort[data-type='" + sortType + "']")
4365        .attr("data-sort", sortDir)
4366        .addClass(sortDir);
4367    }
4368  };
4369  tcg.ac.ui.switchPvpCopyAgentPnlSummaryType = function () {
4370    $(document)
4371      .off("click", "#pvpAgentPnlForm .summaryTypeList li")
4372      .on("click", "#pvpAgentPnlForm .summaryTypeList li", function () {
4373        if (!$(this).hasClass("active") && !$("#pvpAgentPnlForm .form-submit").hasClass("processing")) {
4374          var rel = $(this).attr("data-rel");
4375          $("#pvpAgentPnlForm .summaryTypeList li").removeClass("active");
4376          $(this).addClass("active");
4377          $("#pvpAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4378          $("#pvpAgentPnlForm [name='pageNo']").val(1);
4379          $("#pvpAgentPnlForm [name='summaryType']").val(rel);
4380          $("#pvpAgentPnlForm .form-submit").click();
4381        }
4382      });
4383  };
4384  tcg.ac.ui.selectPvpCopyAgentDownlinePnl = function () {
4385    $(document)
4386      .off("click", "#pvpAgentPnlList .tbl-link")
4387      .on("click", "#pvpAgentPnlList .tbl-link", function () {
4388        if (!$(this).hasClass("loading")) {
4389          var customerName = $(this).text(),
4390            customerId = $(this).attr("data-customerId"),
4391            isOpen = false;
4392          $("#pvpAgentPnlForm .breadcrumbs .b-list").each(function () {
4393            if ($(this).attr("data-customerId") == customerId) {
4394              isOpen = true;
4395            }
4396          });
4397          if (!isOpen) {
4398            $("#pvpAgentPnlForm .breadcrumbs .b-list").addClass("loading");
4399            $("#pvpAgentPnlList .tbl-link").addClass("loading");
4400            var _html =
4401              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
4402              customerId +
4403              "'>" +
4404              customerName +
4405              "</div>";
4406            $("#pvpAgentPnlForm .breadcrumbs").append(_html);
4407          }
4408          $("#pvpAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4409          $("#pvpAgentPnlForm [name='pageNo']").val(1);
4410          tcg.ac.getPvpCopyAgentPnl(customerId);
4411        }
4412      });
4413  };
4414  tcg.ac.ui.clickPvpCopyAgentPnlBreadcrumbs = function () {
4415    $(document)
4416      .off("click", "#pvpAgentPnlForm .breadcrumbs .b-list")
4417      .on("click", "#pvpAgentPnlForm .breadcrumbs .b-list", function () {
4418        if (!$(this).hasClass("loading")) {
4419          var customerId = $(this).attr("data-customerId"),
4420            customerName = $(this).text(),
4421            removeFromList = false;
4422          $("#pvpAgentPnlForm .breadcrumbs .b-list").each(function () {
4423            if (removeFromList) $(this).remove();
4424            if ($(this).attr("data-customerId") == customerId) {
4425              removeFromList = true;
4426            }
4427          });
4428          $("#pvpAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4429          $("#pvpAgentPnlForm [name='pageNo']").val(1);
4430          $("#pvpAgentPnlForm .breadcrumbs .b-list").addClass("loading");
4431          $("#pvpAgentPnlList .tbl-link").addClass("loading");
4432          tcg.ac.getPvpCopyAgentPnl(customerId);
4433        }
4434      });
4435  };
4436  tcg.ac.ui.sortPvpCopyAgentPnl = function () {
4437    $(document)
4438      .off("click", "#pvpAgentPnlTable .divTableCell.sort")
4439      .on("click", "#pvpAgentPnlTable .divTableCell.sort", function (event) {
4440        var type = $(this).attr("data-type");
4441        var sort = $(this).attr("data-sort");
4442        $("#pvpAgentPnlTable .divTableCell.sort").addClass("loading");
4443        $("#pvpAgentPnlTable .divTableCell.sort").removeClass("asc").removeClass("desc");
4444        $("#pvpAgentPnlTable .divTableCell.sort").attr("data-sort", "");
4445        if (sort === "") {
4446          $(this).attr("data-sort", "desc");
4447          sort = "desc";
4448        } else {
4449          if (sort == "desc") {
4450            $(this).attr("data-sort", "asc");
4451            sort = "asc";
4452          } else {
4453            $(this).attr("data-sort", "desc");
4454            sort = "desc";
4455          }
4456        }
4457        $(this).addClass(sort);
4458        console.log(type, sort);
4459        $("#pvpAgentPnlForm input[name='pageNo']").val(1);
4460        var len = $("#pvpAgentPnlForm .b-list").length - 1;
4461        var customerId = $($("#pvpAgentPnlForm .b-list")[len]).attr("data-customerid");
4462        tcg.ac.getPvpCopyAgentPnl(customerId, type, sort);
4463      });
4464  };
4465  tcg.ac.ui.searchRNGCopyAgentPnl = function () {
4466    $(document)
4467      .off("click", "#rngAgentPnlForm .form-submit")
4468      .on("click", "#rngAgentPnlForm .form-submit", function (event) {
4469        $(".switchDecimal").removeClass("on").removeClass("off");
4470        if (event.originalEvent === undefined) {
4471          var len = $("#rngAgentPnlForm .b-list").length - 1;
4472          var customerId = $($("#rngAgentPnlForm .b-list")[len]).attr("data-customerid");
4473          if ($("#rngAgentPnlTable .divTableCell.sort").hasClass("asc")) {
4474            var type = $("#rngAgentPnlTable .divTableCell.sort.asc").attr("data-type");
4475            tcg.ac.getRNGCopyAgentPnl(customerId, type, "asc");
4476          } else if ($("#rngAgentPnlTable .divTableCell.sort").hasClass("desc")) {
4477            var type = $("#rngAgentPnlTable .divTableCell.sort.desc").attr("data-type");
4478            tcg.ac.getRNGCopyAgentPnl(customerId, type, "desc");
4479          } else {
4480            tcg.ac.getRNGCopyAgentPnl(customerId);
4481          }
4482        } else {
4483          $("#rngAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
4484          tcg.ac.getRNGCopyAgentPnl();
4485        }
4486      });
4487  };
4488  tcg.ac.ui.loadRNGCopyAgentPnl = function (result, summaryType, sortType, sortDir) {
4489    var _column = "";
4490    var currentUser = {};
4491    for (var i = 0; i < result.list.length; i++) {
4492      if (tcg.ac.customerId === +result.list[i].customerId) {
4493        currentUser = result.list[i];
4494        break;
4495      }
4496    }
4497    if (summaryType == 0) {
4498      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_1") + "</div>";
4499      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_0_column_2")+ "</div>";
4500      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_0_column_3")+ "</div>";
4501      _column +=
4502        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
4503        tcg.lib.prop("ac_rng_pnl_summaryType_0_column_4") +
4504        "</div>";
4505      _column +=
4506        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
4507        tcg.lib.prop("ac_rng_pnl_summaryType_0_column_5") +
4508        "</div>";
4509      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_6") + "</div>";
4510      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_7") + "</div>";
4511      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4512        _column +=
4513          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
4514          tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_11") +
4515          "</div>";
4516      }
4517      _column +=
4518        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>
4518" +
4519        tcg.lib.prop("ac_rng_pnl_summaryType_0_column_8") +
4520        "</div>";
4521    } else {
4522      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_1") + "</div>";
4523      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_1_column_2")+ "</div>";
4524      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_1_column_3")+ "</div>";
4525      _column +=
4526        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
4527        tcg.lib.prop("ac_rng_pnl_summaryType_1_column_4") +
4528        "</div>";
4529      _column +=
4530        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
4531        tcg.lib.prop("ac_rng_pnl_summaryType_1_column_5") +
4532        "</div>";
4533      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_6") + "</div>";
4534      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_7") + "</div>";
4535      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4536        _column +=
4537          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
4538          tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_11") +
4539          "</div>";
4540      }
4541      _column +=
4542        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>" +
4543        tcg.lib.prop("ac_rng_pnl_summaryType_1_column_8") +
4544        "</div>";
4545    }
4546    $("#rngAgentPnlColumn").html(_column);
4547
4548    var decimal = 2,
4549      list = result.list,
4550      _html = "";
4551    if (list.length > 0 || list.length != null) {
4552      for (var i = 0; i < list.length; i++) {
4553        _html += "<div class='divTableRow'>";
4554        var account = list[i].customerName;
4555        _html +=
4556          "<div class='divTableCell tbl-link ps-strings' data-customerId='" + account + "'>" + account + "</div>";
4557        // var total_deposit = list[i].deposit;
4558        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_deposit + "'>" + tcg.ac.customCurrencyFormat(total_deposit, decimal) + "</div>";
4559        // var total_withdraw = list[i].withdraw;
4560        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_withdraw + "'>" + tcg.ac.customCurrencyFormat(total_withdraw, decimal) + "</div>";
4561        var total_betting_loss = list[i].betAmount;
4562        _html +=
4563          "<div class='divTableCell' data-switchDecimal='" +
4564          decimal +
4565          "' data-value='" +
4566          total_betting_loss +
4567          "'>" +
4568          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
4569          "</div>";
4570        var total_game_winnings = list[i].winAmount;
4571        var gameWinningColor = total_game_winnings;
4572        _html +=
4573          "<div class='divTableCell " +
4574          gameWinningColor +
4575          "'  data-switchDecimal='" +
4576          decimal +
4577          "' data-value='" +
4578          total_game_winnings +
4579          "'>" +
4580          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
4581          "</div>";
4582        var total_game_rebate = list[i].rebate + list[i].agentCommission;
4583        _html +=
4584          "<div class='divTableCell' data-switchDecimal='" +
4585          decimal +
4586          "' data-value='" +
4587          total_game_rebate +
4588          "'>" +
4589          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
4590          "</div>";
4591        var total_promotion = list[i].promotion;
4592        _html +=
4593          "<div class='divTableCell' data-switchDecimal='" +
4594          decimal +
4595          "' data-value='" +
4596          total_promotion +
4597          "'>" +
4598          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
4599          "</div>";
4600        if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4601          _html +=
4602            "<div class='divTableCell' data-switchDecimal='" +
4603            decimal +
4604            "' data-value='" +
4605            list[i].merchantCharge +
4606            "'>" +
4607            tcg.ac.customCurrencyFormat(list[i].merchantCharge, decimal) +
4608            "</div>";
4609        }
4610        var total_pnl = list[i].profitAndLoss;
4611        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
4612        _html +=
4613          "<div class='divTableCell " +
4614          profitLossColor +
4615          "' data-switchDecimal='" +
4616          decimal +
4617          "' data-value='" +
4618          total_pnl +
4619          "'>" +
4620          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
4621          "</div>";
4622        _html += "</div>";
4623      }
4624    } else {
4625      _html += "<div class='tableContent-wrp'>";
4626      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
4627      _html += "</div>";
4628    }
4629    $("#rngAgentPnlList").html(_html);
4630    if (sortType && sortDir) {
4631      $("#rngAgentPnlTable .divTableCell.tbl-link.sort[data-type='" + sortType + "']")
4632        .attr("data-sort", sortDir)
4633        .addClass(sortDir);
4634    }
4635  };
4636  tcg.ac.ui.switchRNGCopyAgentPnlSummaryType = function () {
4637    $(document)
4638      .off("click", "#rngAgentPnlForm .summaryTypeList li")
4639      .on("click", "#rngAgentPnlForm .summaryTypeList li", function () {
4640        if (!$(this).hasClass("active") && !$("#rngAgentPnlForm .form-submit").hasClass("processing")) {
4641          var rel = $(this).attr("data-rel");
4642          $("#rngAgentPnlForm .summaryTypeList li").removeClass("active");
4643          $(this).addClass("active");
4644          $("#rngAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4645          $("#rngAgentPnlForm [name='pageNo']").val(1);
4646          $("#rngAgentPnlForm [name='summaryType']").val(rel);
4647          $("#rngAgentPnlForm [name='customerName']").val("");
4648          $("#rngAgentPnlForm .form-submit").click();
4649        }
4650      });
4651  };
4652  tcg.ac.ui.selectRNGCopyAgentDownlinePnl = function () {
4653    $(document)
4654      .off("click", "#rngAgentPnlList .tbl-link")
4655      .on("click", "#rngAgentPnlList .tbl-link", function () {
4656        if (!$(this).hasClass("loading")) {
4657          var customerName = $(this).text(),
4658            customerId = $(this).attr("data-customerId"),
4659            isOpen = false;
4660          $("#rngAgentPnlForm .breadcrumbs .b-list").each(function () {
4661            if ($(this).attr("data-customerId") == customerId) {
4662              isOpen = true;
4663            }
4664          });
4665          if (!isOpen) {
4666            $("#rngAgentPnlForm .breadcrumbs .b-list").addClass("loading");
4667            $("#rngAgentPnlForm .tbl-link").addClass("loading");
4668            var _html =
4669              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
4670              customerId +
4671              "'>" +
4672              customerName +
4673              "</div>";
4674            $("#rngAgentPnlForm .breadcrumbs").append(_html);
4675          }
4676          $("#rngAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4677          $("#rngAgentPnlForm [name='pageNo']").val(1);
4678          //$("#rngAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
4679          tcg.ac.getRNGCopyAgentPnl(customerId);
4680        }
4681      });
4682  };
4683  tcg.ac.ui.clickRNGCopyAgentPnlBreadcrumbs = function () {
4684    $(document)
4685      .off("click", "#rngAgentPnlForm .breadcrumbs .b-list")
4686      .on("click", "#rngAgentPnlForm .breadcrumbs .b-list", function () {
4687        if (!$(this).hasClass("loading")) {
4688          var customerId = $(this).attr("data-customerId"),
4689            customerName = $(this).text(),
4690            removeFromList = false;
4691          $("#rngAgentPnlForm .breadcrumbs .b-list").each(function () {
4692            if (removeFromList) $(this).remove();
4693            if ($(this).attr("data-customerId") == customerId) {
4694              removeFromList = true;
4695            }
4696          });
4697          $("#rngAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4698          $("#rngAgentPnlForm [name='pageNo']").val(1);
4699          $("#rngAgentPnlForm .breadcrumbs .b-list").addClass("loading");
4700          $("#rngAgentPnlList .tbl-link").addClass("loading");
4701          //$("#rngAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
4702          tcg.ac.getRNGCopyAgentPnl(customerId);
4703        }
4704      });
4705  };
4706  tcg.ac.ui.sortRNGCopyAgentPnl = function () {
4707    $(document)
4708      .off("click", "#rngAgentPnlTable .divTableCell.sort")
4709      .on("click", "#rngAgentPnlTable .divTableCell.sort", function (event) {
4710        var type = $(this).attr("data-type");
4711        var sort = $(this).attr("data-sort");
4712        $("#rngAgentPnlTable .divTableCell.sort").addClass("loading");
4713        $("#rngAgentPnlTable .divTableCell.sort").removeClass("asc").removeClass("desc");
4714        $("#rngAgentPnlTable .divTableCell.sort").attr("data-sort", "");
4715        if (sort === "") {
4716          $(this).attr("data-sort", "desc");
4717          sort = "desc";
4718        } else {
4719          if (sort == "desc") {
4720            $(this).attr("data-sort", "asc");
4721            sort = "asc";
4722          } else {
4723            $(this).attr("data-sort", "desc");
4724            sort = "desc";
4725          }
4726        }
4727        $(this).addClass(sort);
4728        console.log(type, sort);
4729        $("#rngAgentPnlForm input[name='pageNo']").val(1);
4730        var len = $("#rngAgentPnlForm .b-list").length - 1;
4731        var customerId = $($("#rngAgentPnlForm .b-list")[len]).attr("data-customerid");
4732        tcg.ac.getRNGCopyAgentPnl(customerId, type, sort);
4733      });
4734  };
4735  tcg.ac.ui.searchLIVECopyAgentPnl = function () {
4736    $(document)
4737      .off("click", "#liveAgentPnlForm .form-submit")
4738      .on("click", "#liveAgentPnlForm .form-submit", function (event) {
4739        $(".switchDecimal").removeClass("on").removeClass("off");
4740        if (event.originalEvent === undefined) {
4741          var len = $("#liveAgentPnlForm .b-list").length - 1;
4742          var customerId = $($("#liveAgentPnlForm .b-list")[len]).attr("data-customerid");
4743          if ($("#liveAgentPnlTable .divTableCell.sort").hasClass("asc")) {
4744            var type = $("#liveAgentPnlTable .divTableCell.sort.asc").attr("data-type");
4745            tcg.ac.getLIVECopyAgentPnl(customerId, type, "asc");
4746          } else if ($("#liveAgentPnlTable .divTableCell.sort").hasClass("desc")) {
4747            var type = $("#liveAgentPnlTable .divTableCell.sort.desc").attr("data-type");
4748            tcg.ac.getLIVECopyAgentPnl(customerId, type, "desc");
4749          } else {
4750            tcg.ac.getLIVECopyAgentPnl(customerId);
4751          }
4752        } else {
4753          $("#liveAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
4754          tcg.ac.getLIVECopyAgentPnl();
4755        }
4756      });
4757  };
4758  tcg.ac.ui.loadLIVECopyAgentPnl = function (result, summaryType, sortType, sortDir) {
4759    var _column = "";
4760    var currentUser = {};
4761    for (var i = 0; i < result.list.length; i++) {
4762      if (tcg.ac.customerId === +result.list[i].customerId) {
4763        currentUser = result.list[i];
4764        break;
4765      }
4766    }
4767    if (summaryType == 0) {
4768      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_1") + "</div>";
4769      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_0_column_2")+ "</div>";
4770      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_0_column_3")+ "</div>";
4771      _column +=
4772        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
4773        tcg.lib.prop("ac_rng_pnl_summaryType_0_column_4") +
4774        "</div>";
4775      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_9") + "</div>";
4776      _column +=
4777        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
4778        tcg.lib.prop("ac_rng_pnl_summaryType_0_column_5") +
4779        "</div>";
4780      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_6") + "</div>";
4781      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_7") + "</div>";
4782      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4783        _column +=
4784          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
4785          tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_11") +
4786          "</div>";
4787      }
4788      _column +=
4789        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>
4789" +
4790        tcg.lib.prop("ac_rng_pnl_summaryType_0_column_8") +
4791        "</div>";
4792    } else {
4793      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_1") + "</div>";
4794      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_1_column_2")+ "</div>";
4795      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_1_column_3")+ "</div>";
4796      _column +=
4797        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
4798        tcg.lib.prop("ac_rng_pnl_summaryType_1_column_4") +
4799        "</div>";
4800      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_9") + "</div>";
4801      _column +=
4802        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
4803        tcg.lib.prop("ac_rng_pnl_summaryType_1_column_5") +
4804        "</div>";
4805      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_6") + "</div>";
4806      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_7") + "</div>";
4807      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4808        _column +=
4809          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
4810          tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_11") +
4811          "</div>";
4812      }
4813      _column +=
4814        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>" +
4815        tcg.lib.prop("ac_rng_pnl_summaryType_1_column_8") +
4816        "</div>";
4817    }
4818    $("#liveAgentPnlColumn").html(_column);
4819
4820    var decimal = 2,
4821      list = result.list,
4822      _html = "";
4823    if (list.length > 0 || list.length != null) {
4824      for (var i = 0; i < list.length; i++) {
4825        _html += "<div class='divTableRow'>";
4826        var account = list[i].customerName;
4827        _html +=
4828          "<div class='divTableCell tbl-link ps-strings' data-customerId='" + account + "'>" + account + "</div>";
4829        // var total_deposit = list[i].deposit;
4830        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_deposit + "'>" + tcg.ac.customCurrencyFormat(total_deposit, decimal) + "</div>";
4831        // var total_withdraw = list[i].withdraw;
4832        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_withdraw + "'>" + tcg.ac.customCurrencyFormat(total_withdraw, decimal) + "</div>";
4833        var total_betting_loss = list[i].betAmount;
4834        _html +=
4835          "<div class='divTableCell' data-switchDecimal='" +
4836          decimal +
4837          "' data-value='" +
4838          total_betting_loss +
4839          "'>" +
4840          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
4841          "</div>";
4842        var total_game_winnings = list[i].winAmount;
4843        var gameWinningColor = total_game_winnings;
4844        var validBetAmount = list[i].validBetAmount;
4845        _html +=
4846          "<div class='divTableCell  data-switchDecimal='" +
4847          decimal +
4848          "' data-value='" +
4849          validBetAmount +
4850          "'>" +
4851          tcg.ac.customCurrencyFormat(validBetAmount, decimal) +
4852          "</div>";
4853        _html +=
4854          "<div class='divTableCell " +
4855          gameWinningColor +
4856          "'  data-switchDecimal='" +
4857          decimal +
4858          "' data-value='" +
4859          total_game_winnings +
4860          "'>" +
4861          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
4862          "</div>";
4863        var total_game_rebate = list[i].rebate + list[i].agentCommission;
4864        _html +=
4865          "<div class='divTableCell' data-switchDecimal='" +
4866          decimal +
4867          "' data-value='" +
4868          total_game_rebate +
4869          "'>" +
4870          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
4871          "</div>";
4872        var total_promotion = list[i].promotion;
4873        _html +=
4874          "<div class='divTableCell' data-switchDecimal='" +
4875          decimal +
4876          "' data-value='" +
4877          total_promotion +
4878          "'>" +
4879          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
4880          "</div>";
4881        if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
4882          _html +=
4883            "<div class='divTableCell' data-switchDecimal='" +
4884            decimal +
4885            "' data-value='" +
4886            list[i].merchantCharge +
4887            "'>" +
4888            tcg.ac.customCurrencyFormat(list[i].merchantCharge, decimal) +
4889            "</div>";
4890        }
4891        var total_pnl = list[i].profitAndLoss;
4892        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
4893        _html +=
4894          "<div class='divTableCell " +
4895          profitLossColor +
4896          "' data-switchDecimal='" +
4897          decimal +
4898          "' data-value='" +
4899          total_pnl +
4900          "'>" +
4901          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
4902          "</div>";
4903        _html += "</div>";
4904      }
4905    } else {
4906      _html += "<div class='tableContent-wrp'>";
4907      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
4908      _html += "</div>";
4909    }
4910    $("#liveAgentPnlList").html(_html);
4911    if (sortType && sortDir) {
4912      $("#liveAgentPnlTable .divTableCell.tbl-link.sort[data-type='" + sortType + "']")
4913        .attr("data-sort", sortDir)
4914        .addClass(sortDir);
4915    }
4916  };
4917  tcg.ac.ui.switchLIVECopyAgentPnlSummaryType = function () {
4918    $(document)
4919      .off("click", "#liveAgentPnlForm .summaryTypeList li")
4920      .on("click", "#liveAgentPnlForm .summaryTypeList li", function () {
4921        if (!$(this).hasClass("active") && !$("#liveAgentPnlForm .form-submit").hasClass("processing")) {
4922          var rel = $(this).attr("data-rel");
4923          $("#liveAgentPnlForm .summaryTypeList li").removeClass("active");
4924          $(this).addClass("active");
4925          $("#liveAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4926          $("#liveAgentPnlForm [name='pageNo']").val(1);
4927          $("#liveAgentPnlForm [name='summaryType']").val(rel);
4928          $("#liveAgentPnlForm [name='customerName']").val("");
4929          $("#liveAgentPnlForm .form-submit").click();
4930        }
4931      });
4932  };
4933  tcg.ac.ui.selectLIVECopyAgentDownlinePnl = function () {
4934    $(document)
4935      .off("click", "#liveAgentPnlList .tbl-link")
4936      .on("click", "#liveAgentPnlList .tbl-link", function () {
4937        if (!$(this).hasClass("loading")) {
4938          var customerName = $(this).text(),
4939            customerId = $(this).attr("data-customerId"),
4940            isOpen = false;
4941          $("#liveAgentPnlForm .breadcrumbs .b-list").each(function () {
4942            if ($(this).attr("data-customerId") == customerId) {
4943              isOpen = true;
4944            }
4945          });
4946          if (!isOpen) {
4947            $("#liveAgentPnlForm .breadcrumbs .b-list").addClass("loading");
4948            $("#liveAgentPnlForm .tbl-link").addClass("loading");
4949            var _html =
4950              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
4951              customerId +
4952              "'>" +
4953              customerName +
4954              "</div>";
4955            $("#liveAgentPnlForm .breadcrumbs").append(_html);
4956          }
4957          $("#liveAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4958          $("#liveAgentPnlForm [name='pageNo']").val(1);
4959          //$("#rngAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
4960          tcg.ac.getLIVECopyAgentPnl(customerId);
4961        }
4962      });
4963  };
4964  tcg.ac.ui.clickLIVECopyAgentPnlBreadcrumbs = function () {
4965    $(document)
4966      .off("click", "#liveAgentPnlForm .breadcrumbs .b-list")
4967      .on("click", "#liveAgentPnlForm .breadcrumbs .b-list", function () {
4968        if (!$(this).hasClass("loading")) {
4969          var customerId = $(this).attr("data-customerId"),
4970            customerName = $(this).text(),
4971            removeFromList = false;
4972          $("#liveAgentPnlForm .breadcrumbs .b-list").each(function () {
4973            if (removeFromList) $(this).remove();
4974            if ($(this).attr("data-customerId") == customerId) {
4975              removeFromList = true;
4976            }
4977          });
4978          $("#liveAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
4979          $("#liveAgentPnlForm [name='pageNo']").val(1);
4980          $("#liveAgentPnlForm .breadcrumbs .b-list").addClass("loading");
4981          $("#liveAgentPnlList .tbl-link").addClass("loading");
4982          //$("#rngAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
4983          tcg.ac.getLIVECopyAgentPnl(customerId);
4984        }
4985      });
4986  };
4987  tcg.ac.ui.sortLIVECopyAgentPnl = function () {
4988    $(document)
4989      .off("click", "#liveAgentPnlTable .divTableCell.sort")
4990      .on("click", "#liveAgentPnlTable .divTableCell.sort", function (event) {
4991        var type = $(this).attr("data-type");
4992        var sort = $(this).attr("data-sort");
4993        $("#liveAgentPnlTable .divTableCell.sort").addClass("loading");
4994        $("#liveAgentPnlTable .divTableCell.sort").removeClass("asc").removeClass("desc");
4995        $("#liveAgentPnlTable .divTableCell.sort").attr("data-sort", "");
4996        if (sort === "") {
4997          $(this).attr("data-sort", "desc");
4998          sort = "desc";
4999        } else {
5000          if (sort == "desc") {
5001            $(this).attr("data-sort", "asc");
5002            sort = "asc";
5003          } else {
5004            $(this).attr("data-sort", "desc");
5005            sort = "desc";
5006          }
5007        }
5008        $(this).addClass(sort);
5009        console.log(type, sort);
5010        $("#liveAgentPnlForm input[name='pageNo']").val(1);
5011        var len = $("#liveAgentPnlForm .b-list").length - 1;
5012        var customerId = $($("#liveAgentPnlForm .b-list")[len]).attr("data-customerid");
5013        tcg.ac.getLIVECopyAgentPnl(customerId, type, sort);
5014      });
5015  };
5016  tcg.ac.ui.searchFishCopyAgentPnl = function () {
5017    $(document)
5018      .off("click", "#fishAgentPnlForm .form-submit")
5019      .on("click", "#fishAgentPnlForm .form-submit", function (event) {
5020        $(".switchDecimal").removeClass("on").removeClass("off");
5021        if (event.originalEvent === undefined) {
5022          var len = $("#fishAgentPnlForm .b-list").length - 1;
5023          var customerId = $($("#fishAgentPnlForm .b-list")[len]).attr("data-customerid");
5024          if ($("#fishAgentPnlTable .divTableCell.sort").hasClass("asc")) {
5025            var type = $("#fishAgentPnlTable .divTableCell.sort.asc").attr("data-type");
5026            tcg.ac.getFishCopyAgentPnl(customerId, type, "asc");
5027          } else if ($("#fishAgentPnlTable .divTableCell.sort").hasClass("desc")) {
5028            var type = $("#fishAgentPnlTable .divTableCell.sort.desc").attr("data-type");
5029            tcg.ac.getFishCopyAgentPnl(customerId, type, "desc");
5030          } else {
5031            tcg.ac.getFishCopyAgentPnl(customerId);
5032          }
5033        } else {
5034          $("#fishAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
5035          tcg.ac.getFishCopyAgentPnl();
5036        }
5037      });
5038  };
5039  tcg.ac.ui.loadFishCopyAgentPnl = function (result, summaryType, sortType, sortDir) {
5040    var _column = "";
5041    var currentUser = {};
5042    for (var i = 0; i < result.list.length; i++) {
5043      if (tcg.ac.customerId === +result.list[i].customerId) {
5044        currentUser = result.list[i];
5045        break;
5046      }
5047    }
5048    if (summaryType == 0) {
5049      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_1") + "</div>";
5050      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_fish_pnl_summaryType_0_column_2")+ "</div>";
5051      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_fish_pnl_summaryType_0_column_3")+ "</div>";
5052      _column +=
5053        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
5054        tcg.lib.prop("ac_fish_pnl_summaryType_0_column_4") +
5055        "</div>";
5056      _column +=
5057        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
5058        tcg.lib.prop("ac_fish_pnl_summaryType_0_column_5") +
5059        "</div>";
5060      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_6") + "</div>";
5061      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_7") + "</div>";
5062      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
5063        _column +=
5064          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
5065          tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_11") +
5066          "</div>";
5067      }
5068      _column +=
5069        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>
5069" +
5070        tcg.lib.prop("ac_fish_pnl_summaryType_0_column_8") +
5071        "</div>";
5072    } else {
5073      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_1") + "</div>";
5074      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_fish_pnl_summaryType_1_column_2")+ "</div>";
5075      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_fish_pnl_summaryType_1_column_3")+ "</div>";
5076      _column +=
5077        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
5078        tcg.lib.prop("ac_fish_pnl_summaryType_1_column_4") +
5079        "</div>";
5080      _column +=
5081        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
5082        tcg.lib.prop("ac_fish_pnl_summaryType_1_column_5") +
5083        "</div>";
5084      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_6") + "</div>";
5085      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
5086        _column +=
5087          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
5088          tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_11") +
5089          "</div>";
5090      }
5091      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_7") + "</div>";
5092      _column +=
5093        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>" +
5094        tcg.lib.prop("ac_fish_pnl_summaryType_1_column_8") +
5095        "</div>";
5096    }
5097    $("#fishAgentPnlColumn").html(_column);
5098
5099    var decimal = 2,
5100      list = result.list,
5101      _html = "";
5102    if (list.length > 0 || list.length != null) {
5103      for (var i = 0; i < list.length; i++) {
5104        _html += "<div class='divTableRow'>";
5105        var account = list[i].customerName;
5106        _html +=
5107          "<div class='divTableCell tbl-link ps-strings' data-customerId='" + account + "'>" + account + "</div>";
5108        // var total_deposit = list[i].deposit;
5109        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_deposit + "'>" + tcg.ac.customCurrencyFormat(total_deposit, decimal) + "</div>";
5110        // var total_withdraw = list[i].withdraw;
5111        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_withdraw + "'>" + tcg.ac.customCurrencyFormat(total_withdraw, decimal) + "</div>";
5112        var total_betting_loss = list[i].betAmount;
5113        _html +=
5114          "<div class='divTableCell' data-switchDecimal='" +
5115          decimal +
5116          "' data-value='" +
5117          total_betting_loss +
5118          "'>" +
5119          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
5120          "</div>";
5121        var total_game_winnings = list[i].winAmount;
5122        var gameWinningColor = total_game_winnings;
5123        _html +=
5124          "<div class='divTableCell " +
5125          gameWinningColor +
5126          "'  data-switchDecimal='" +
5127          decimal +
5128          "' data-value='" +
5129          total_game_winnings +
5130          "'>" +
5131          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
5132          "</div>";
5133        var total_game_rebate = list[i].rebate + list[i].agentCommission;
5134        _html +=
5135          "<div class='divTableCell' data-switchDecimal='" +
5136          decimal +
5137          "' data-value='" +
5138          total_game_rebate +
5139          "'>" +
5140          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
5141          "</div>";
5142        var total_promotion = list[i].promotion;
5143        _html +=
5144          "<div class='divTableCell' data-switchDecimal='" +
5145          decimal +
5146          "' data-value='" +
5147          total_promotion +
5148          "'>" +
5149          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
5150          "</div>";
5151        if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
5152          _html +=
5153            "<div class='divTableCell' data-switchDecimal='" +
5154            decimal +
5155            "' data-value='" +
5156            list[i].merchantCharge +
5157            "'>" +
5158            tcg.ac.customCurrencyFormat(list[i].merchantCharge, decimal) +
5159            "</div>";
5160        }
5161        var total_pnl = list[i].profitAndLoss;
5162        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
5163        _html +=
5164          "<div class='divTableCell " +
5165          profitLossColor +
5166          "' data-switchDecimal='" +
5167          decimal +
5168          "' data-value='" +
5169          total_pnl +
5170          "'>" +
5171          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
5172          "</div>";
5173        _html += "</div>";
5174      }
5175    } else {
5176      _html += "<div class='tableContent-wrp'>";
5177      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
5178      _html += "</div>";
5179    }
5180    $("#fishAgentPnlList").html(_html);
5181    if (sortType && sortDir) {
5182      $("#fishAgentPnlTable .divTableCell.tbl-link.sort[data-type='" + sortType + "']")
5183        .attr("data-sort", sortDir)
5184        .addClass(sortDir);
5185    }
5186  };
5187  tcg.ac.ui.switchFishCopyAgentPnlSummaryType = function () {
5188    $(document)
5189      .off("click", "#fishAgentPnlForm .summaryTypeList li")
5190      .on("click", "#fishAgentPnlForm .summaryTypeList li", function () {
5191        if (!$(this).hasClass("active") && !$("#rngAgentPnlForm .form-submit").hasClass("processing")) {
5192          var rel = $(this).attr("data-rel");
5193          $("#fishAgentPnlForm .summaryTypeList li").removeClass("active");
5194          $(this).addClass("active");
5195          $("#fishAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
5196          $("#fishAgentPnlForm [name='pageNo']").val(1);
5197          $("#fishAgentPnlForm [name='summaryType']").val(rel);
5198          $("#fishAgentPnlForm [name='customerName']").val("");
5199          $("#fishAgentPnlForm .form-submit").click();
5200        }
5201      });
5202  };
5203  tcg.ac.ui.selectFishCopyAgentDownlinePnl = function () {
5204    $(document)
5205      .off("click", "#fishAgentPnlList .tbl-link")
5206      .on("click", "#fishAgentPnlList .tbl-link", function () {
5207        if (!$(this).hasClass("loading")) {
5208          var customerName = $(this).text(),
5209            customerId = $(this).attr("data-customerId"),
5210            isOpen = false;
5211          $("#fishAgentPnlForm .breadcrumbs .b-list").each(function () {
5212            if ($(this).attr("data-customerId") == customerId) {
5213              isOpen = true;
5214            }
5215          });
5216          if (!isOpen) {
5217            $("#fishAgentPnlForm .breadcrumbs .b-list").addClass("loading");
5218            $("#fishAgentPnlForm .tbl-link").addClass("loading");
5219            var _html =
5220              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
5221              customerId +
5222              "'>" +
5223              customerName +
5224              "</div>";
5225            $("#fishAgentPnlForm .breadcrumbs").append(_html);
5226          }
5227          $("#fishAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
5228          $("#fishAgentPnlForm [name='pageNo']").val(1);
5229          // $("#fishAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
5230          tcg.ac.getFishCopyAgentPnl(customerId);
5231        }
5232      });
5233  };
5234  tcg.ac.ui.clickFishCopyAgentPnlBreadcrumbs = function () {
5235    $(document)
5236      .off("click", "#fishAgentPnlForm .breadcrumbs .b-list")
5237      .on("click", "#fishAgentPnlForm .breadcrumbs .b-list", function () {
5238        if (!$(this).hasClass("loading")) {
5239          var customerId = $(this).attr("data-customerId"),
5240            customerName = $(this).text(),
5241            removeFromList = false;
5242          $("#fishAgentPnlForm .breadcrumbs .b-list").each(function () {
5243            if (removeFromList) $(this).remove();
5244            if ($(this).attr("data-customerId") == customerId) {
5245              removeFromList = true;
5246            }
5247          });
5248          $("#fishAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
5249          $("#fishAgentPnlForm [name='pageNo']").val(1);
5250          $("#fishAgentPnlForm .breadcrumbs .b-list").addClass("loading");
5251          $("#fishAgentPnlForm .tbl-link").addClass("loading");
5252          $("#fishAgentPnlForm [name='customerName']").val(
5253            customerName == window.sessionStorage.getItem("username") ? "" : customerName
5254          );
5255          tcg.ac.getFishCopyAgentPnl(customerId);
5256        }
5257      });
5258  };
5259  tcg.ac.ui.sortFishCopyAgentPnl = function () {
5260    $(document)
5261      .off("click", "#fishAgentPnlTable .divTableCell.sort")
5262      .on("click", "#fishAgentPnlTable .divTableCell.sort", function (event) {
5263        var type = $(this).attr("data-type");
5264        var sort = $(this).attr("data-sort");
5265        $("#fishAgentPnlTable .divTableCell.sort").addClass("loading");
5266        $("#fishAgentPnlTable .divTableCell.sort").removeClass("asc").removeClass("desc");
5267        $("#fishAgentPnlTable .divTableCell.sort").attr("data-sort", "");
5268        if (sort === "") {
5269          $(this).attr("data-sort", "desc");
5270          sort = "desc";
5271        } else {
5272          if (sort == "desc") {
5273            $(this).attr("data-sort", "asc");
5274            sort = "asc";
5275          } else {
5276            $(this).attr("data-sort", "desc");
5277            sort = "desc";
5278          }
5279        }
5280        $(this).addClass(sort);
5281        console.log(type, sort);
5282        $("#fishAgentPnlForm input[name='pageNo']").val(1);
5283        var len = $("#fishAgentPnlForm .b-list").length - 1;
5284        var customerId = $($("#fishAgentPnlForm .b-list")[len]).attr("data-customerid");
5285        tcg.ac.getFishCopyAgentPnl(customerId, type, sort);
5286      });
5287  };
5288  tcg.ac.ui.searchSportsCopyAgentPnl = function () {
5289    $(document)
5290      .off("click", "#sportsAgentPnlForm .form-submit")
5291      .on("click", "#sportsAgentPnlForm .form-submit", function (event) {
5292        $(".switchDecimal").removeClass("on").removeClass("off");
5293        if (event.originalEvent === undefined) {
5294          var len = $("#sportsAgentPnlForm .b-list").length - 1;
5295          var customerId = $($("#sportsAgentPnlForm .b-list")[len]).attr("data-customerid");
5296          if ($("#sportsAgentPnlTable .divTableCell.sort").hasClass("asc")) {
5297            var type = $("#sportsAgentPnlTable .divTableCell.sort.asc").attr("data-type");
5298            tcg.ac.getSportsCopyAgentPnl(customerId, type, "asc");
5299          } else if ($("#sportsAgentPnlTable .divTableCell.sort").hasClass("desc")) {
5300            var type = $("#sportsAgentPnlTable .divTableCell.sort.desc").attr("data-type");
5301            tcg.ac.getSportsCopyAgentPnl(customerId, type, "desc");
5302          } else {
5303            tcg.ac.getSportsCopyAgentPnl(customerId);
5304          }
5305        } else {
5306          $("#sportsAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
5307          tcg.ac.getSportsCopyAgentPnl();
5308        }
5309      });
5310  };
5311  tcg.ac.ui.loadSportsCopyAgentPnl = function (result, summaryType, sortType, sortDir) {
5312    var _column = "";
5313    var currentUser = {};
5314    for (var i = 0; i < result.list.length; i++) {
5315      if (tcg.ac.customerId === +result.list[i].customerId) {
5316        currentUser = result.list[i];
5317        break;
5318      }
5319    }
5320    if (summaryType == 0) {
5321      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_1") + "</div>";
5322      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_sports_pnl_summaryType_0_column_2")+ "</div>";
5323      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_sports_pnl_summaryType_0_column_3")+ "</div>";
5324      _column +=
5325        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
5326        tcg.lib.prop("ac_sports_pnl_summaryType_0_column_4") +
5327        "</div>";
5328      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_9") + "</div>";
5329      _column +=
5330        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
5331        tcg.lib.prop("ac_sports_pnl_summaryType_0_column_5") +
5332        "</div>";
5333      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_6") + "</div>";
5334      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_7") + "</div>";
5335      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
5336        _column +=
5337          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
5338          tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_11") +
5339          "</div>";
5340      }
5341      _column +=
5342        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>
5342" +
5343        tcg.lib.prop("ac_sports_pnl_summaryType_0_column_8") +
5344        "</div>";
5345    } else {
5346      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_1") + "</div>";
5347      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_sports_pnl_summaryType_1_column_2")+ "</div>";
5348      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_sports_pnl_summaryType_1_column_3")+ "</div>";
5349      _column +=
5350        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
5351        tcg.lib.prop("ac_sports_pnl_summaryType_1_column_4") +
5352        "</div>";
5353      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_9") + "</div>";
5354      _column +=
5355        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
5356        tcg.lib.prop("ac_sports_pnl_summaryType_1_column_5") +
5357        "</div>";
5358      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_6") + "</div>";
5359      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_7") + "</div>";
5360      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
5361        _column +=
5362          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
5363          tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_11") +
5364          "</div>";
5365      }
5366      _column +=
5367        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>" +
5368        tcg.lib.prop("ac_sports_pnl_summaryType_1_column_8") +
5369        "</div>";
5370    }
5371    $("#sportsAgentPnlColumn").html(_column);
5372
5373    var decimal = 2,
5374      list = result.list,
5375      _html = "";
5376    if (list.length > 0 || list.length != null) {
5377      for (var i = 0; i < list.length; i++) {
5378        _html += "<div class='divTableRow'>";
5379        var account = list[i].customerName;
5380        _html +=
5381          "<div class='divTableCell tbl-link ps-strings' data-customerId='" + account + "'>" + account + "</div>";
5382        // var total_deposit = list[i].deposit;
5383        // _html += "<div class='divTableCell' data-switchDecimal='" + decimal + "' data-value='" + total_deposit + "'>" + tcg.ac.customCurrencyFormat(total_deposit, decimal) + "</div>";
5384        // var total_withdraw = list[i].withdraw;
5385        // _html += "<div class='divTableCell' data-switchDecimal='" + decimal + "' data-value='" + total_withdraw + "'>" + tcg.ac.customCurrencyFormat(total_withdraw, decimal) + "</div>";
5386        var total_betting_loss = list[i].betAmount;
5387        _html +=
5388          "<div class='divTableCell' data-switchDecimal='" +
5389          decimal +
5390          "' data-value='" +
5391          total_betting_loss +
5392          "'>" +
5393          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
5394          "</div>";
5395        var total_game_winnings = list[i].winAmount;
5396        var gameWinningColor = total_game_winnings;
5397        var validBetAmount = list[i].validBetAmount;
5398        _html +=
5399          "<div class='divTableCell  data-switchDecimal='" +
5400          decimal +
5401          "' data-value='" +
5402          validBetAmount +
5403          "'>" +
5404          tcg.ac.customCurrencyFormat(validBetAmount, decimal) +
5405          "</div>";
5406        _html +=
5407          "<div class='divTableCell " +
5408          gameWinningColor +
5409          "'  data-switchDecimal='" +
5410          decimal +
5411          "' data-value='" +
5412          total_game_winnings +
5413          "'>" +
5414          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
5415          "</div>";
5416        var total_game_rebate = list[i].agentCommission + list[i].rebate;
5417        _html +=
5418          "<div class='divTableCell' data-switchDecimal='" +
5419          decimal +
5420          "' data-value='" +
5421          total_game_rebate +
5422          "'>" +
5423          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
5424          "</div>";
5425        var total_promotion = list[i].promotion;
5426        _html +=
5427          "<div class='divTableCell' data-switchDecimal='" +
5428          decimal +
5429          "' data-value='" +
5430          total_promotion +
5431          "'>" +
5432          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
5433          "</div>";
5434        if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
5435          _html +=
5436            "<div class='divTableCell' data-switchDecimal='" +
5437            decimal +
5438            "' data-value='" +
5439            list[i].merchantCharge +
5440            "'>" +
5441            tcg.ac.customCurrencyFormat(list[i].merchantCharge, decimal) +
5442            "</div>";
5443        }
5444        var total_pnl = list[i].profitAndLoss;
5445        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
5446        _html +=
5447          "<div class='divTableCell " +
5448          profitLossColor +
5449          "' data-switchDecimal='" +
5450          decimal +
5451          "' data-value='" +
5452          total_pnl +
5453          "'>" +
5454          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
5455          "</div>";
5456        _html += "</div>";
5457      }
5458    } else {
5459      _html += "<div class='tableContent-wrp'>";
5460      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
5461      _html += "</div>";
5462    }
5463    $("#sportsAgentPnlList").html(_html);
5464    if (sortType && sortDir) {
5465      $("#sportsAgentPnlTable .divTableCell.tbl-link.sort[data-type='" + sortType + "']")
5466        .attr("data-sort", sortDir)
5467        .addClass(sortDir);
5468    }
5469  };
5470  tcg.ac.ui.switchSportsCopyAgentPnlSummaryType = function () {
5471    $(document)
5472      .off("click", "#sportsAgentPnlForm .summaryTypeList li")
5473      .on("click", "#sportsAgentPnlForm .summaryTypeList li", function () {
5474        if (!$(this).hasClass("active") && !$("#rngAgentPnlForm .form-submit").hasClass("processing")) {
5475          var rel = $(this).attr("data-rel");
5476          $("#sportsAgentPnlForm .summaryTypeList li").removeClass("active");
5477          $(this).addClass("active");
5478          $("#sportsAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
5479          $("#sportsAgentPnlForm [name='pageNo']").val(1);
5480          $("#sportsAgentPnlForm [name='summaryType']").val(rel);
5481          $("#sportsAgentPnlForm [name='customerName']").val("");
5482          $("#sportsAgentPnlForm .form-submit").click();
5483        }
5484      });
5485  };
5486  tcg.ac.ui.selectSportsCopyAgentDownlinePnl = function () {
5487    $(document)
5488      .off("click", "#sportsAgentPnlList .tbl-link")
5489      .on("click", "#sportsAgentPnlList .tbl-link", function () {
5490        if (!$(this).hasClass("loading")) {
5491          var customerName = $(this).text(),
5492            customerId = $(this).attr("data-customerId"),
5493            isOpen = false;
5494          $("#sportsAgentPnlForm .breadcrumbs .b-list").each(function () {
5495            if ($(this).attr("data-customerId") == customerId) {
5496              isOpen = true;
5497            }
5498          });
5499          if (!isOpen) {
5500            $("#sportsAgentPnlForm .breadcrumbs .b-list").addClass("loading");
5501            $("#sportsAgentPnlForm .tbl-link").addClass("loading");
5502            var _html =
5503              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
5504              customerId +
5505              "'>" +
5506              customerName +
5507              "</div>";
5508            $("#sportsAgentPnlForm .breadcrumbs").append(_html);
5509          }
5510          $("#sportsAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
5511          $("#sportsAgentPnlForm [name='pageNo']").val(1);
5512          // $("#sportsAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
5513          tcg.ac.getSportsCopyAgentPnl(customerId);
5514        }
5515      });
5516  };
5517  tcg.ac.ui.clickSportsCopyAgentPnlBreadcrumbs = function () {
5518    $(document)
5519      .off("click", "#sportsAgentPnlForm .breadcrumbs .b-list")
5520      .on("click", "#sportsAgentPnlForm .breadcrumbs .b-list", function () {
5521        if (!$(this).hasClass("loading")) {
5522          var customerId = $(this).attr("data-customerId"),
5523            customerName = $(this).text(),
5524            removeFromList = false;
5525          $("#sportsAgentPnlForm .breadcrumbs .b-list").each(function () {
5526            if (removeFromList) $(this).remove();
5527            if ($(this).attr("data-customerId") == customerId) {
5528              removeFromList = true;
5529            }
5530          });
5531          $("#sportsAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
5532          $("#sportsAgentPnlForm [name='pageNo']").val(1);
5533          $("#sportsAgentPnlForm .breadcrumbs .b-list").addClass("loading");
5534          $("#sportsAgentPnlForm .tbl-link").addClass("loading");
5535          $("#sportsAgentPnlForm [name='customerName']").val(
5536            customerName == window.sessionStorage.getItem("username") ? "" : customerName
5537          );
5538          tcg.ac.getSportsCopyAgentPnl(customerId);
5539        }
5540      });
5541  };
5542  tcg.ac.ui.sortSportsCopyAgentPnl = function () {
5543    $(document)
5544      .off("click", "#sportsAgentPnlTable .divTableCell.sort")
5545      .on("click", "#sportsAgentPnlTable .divTableCell.sort", function (event) {
5546        var type = $(this).attr("data-type");
5547        var sort = $(this).attr("data-sort");
5548        $("#sportsAgentPnlTable .divTableCell.sort").addClass("loading");
5549        $("#sportsAgentPnlTable .divTableCell.sort").removeClass("asc").removeClass("desc");
5550        $("#sportsAgentPnlTable .divTableCell.sort").attr("data-sort", "");
5551        if (sort === "") {
5552          $(this).attr("data-sort", "desc");
5553          sort = "desc";
5554        } else {
5555          if (sort == "desc") {
5556            $(this).attr("data-sort", "asc");
5557            sort = "asc";
5558          } else {
5559            $(this).attr("data-sort", "desc");
5560            sort = "desc";
5561          }
5562        }
5563        $(this).addClass(sort);
5564        console.log(type, sort);
5565        $("#sportsAgentPnlForm input[name='pageNo']").val(1);
5566        var len = $("#sportsAgentPnlForm .b-list").length - 1;
5567        var customerId = $($("#sportsAgentPnlForm .b-list")[len]).attr("data-customerid");
5568        tcg.ac.getSportsCopyAgentPnl(customerId, type, sort);
5569      });
5570  };
5571  tcg.ac.ui.searchElottCopyAgentPnl = function () {
5572    $(document)
5573      .off("click", "#elottAgentPnlForm .form-submit")
5574      .on("click", "#elottAgentPnlForm .form-submit", function (event) {
5575        $(".switchDecimal").removeClass("on").removeClass("off");
5576        if (event.originalEvent === undefined) {
5577          var len = $("#elottAgentPnlForm .b-list").length - 1;
5578          var customerId = $($("#elottAgentPnlForm .b-list")[len]).attr("data-customerid");
5579          if ($("#elottAgentPnlTable .divTableCell.sort").hasClass("asc")) {
5580            var type = $("#elottAgentPnlTable .divTableCell.sort.asc").attr("data-type");
5581            tcg.ac.getElottCopyAgentPnl(customerId, type, "asc");
5582          } else if ($("#elottAgentPnlTable .divTableCell.sort").hasClass("desc")) {
5583            var type = $("#elottAgentPnlTable .divTableCell.sort.desc").attr("data-type");
5584            tcg.ac.getElottCopyAgentPnl(customerId, type, "desc");
5585          } else {
5586            tcg.ac.getElottCopyAgentPnl(customerId);
5587          }
5588        } else {
5589          $("#elottAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
5590          tcg.ac.getElottCopyAgentPnl();
5591        }
5592      });
5593  };
5594  tcg.ac.ui.loadElottCopyAgentPnl = function (result, summaryType, sortType, sortDir) {
5595    var _column = "";
5596    var currentUser = {};
5597    for (var i = 0; i < result.list.length; i++) {
5598      if (tcg.ac.customerId === +result.list[i].customerId) {
5599        currentUser = result.list[i];
5600        break;
5601      }
5602    }
5603    if (summaryType == 0) {
5604      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_1") + "</div>";
5605      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_0_column_2")+ "</div>";
5606      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_0_column_3")+ "</div>";
5607      _column +=
5608        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
5609        tcg.lib.prop("ac_rng_pnl_summaryType_0_column_4") +
5610        "</div>";
5611      _column +=
5612        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
5613        tcg.lib.prop("ac_rng_pnl_summaryType_0_column_5") +
5614        "</div>";
5615      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_6") + "</div>";
5616      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_7") + "</div>";
5617      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
5618        _column +=
5619          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
5620          tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_11") +
5621          "</div>";
5622      }
5623      _column +=
5624        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>
5624" +
5625        tcg.lib.prop("ac_rng_pnl_summaryType_0_column_8") +
5626        "</div>";
5627    } else {
5628      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_1") + "</div>";
5629      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_1_column_2")+ "</div>";
5630      // _column += "<div class='divTableCell'>" +tcg.lib.prop("ac_rng_pnl_summaryType_1_column_3")+ "</div>";
5631      _column +=
5632        "<div class='divTableCell tbl-link sort' data-sort='' data-type='betAmount'>" +
5633        tcg.lib.prop("ac_rng_pnl_summaryType_1_column_4") +
5634        "</div>";
5635      _column +=
5636        "<div class='divTableCell tbl-link sort' data-sort='' data-type='winAmount'>" +
5637        tcg.lib.prop("ac_rng_pnl_summaryType_1_column_5") +
5638        "</div>";
5639      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_6") + "</div>";
5640      _column += "<div class='divTableCell'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_7") + "</div>";
5641      if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
5642        _column +=
5643          "<div class='divTableCell tbl-link' data-sort='' data-type='merchantCharge'>" +
5644          tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_11") +
5645          "</div>";
5646      }
5647      _column +=
5648        "<div class='divTableCell tbl-link sort' data-sort='' data-type='profitAndLoss'>" +
5649        tcg.lib.prop("ac_rng_pnl_summaryType_1_column_8") +
5650        "</div>";
5651    }
5652    $("#elottAgentPnlColumn").html(_column);
5653
5654    var decimal = 2,
5655      list = result.list,
5656      _html = "";
5657    if (list.length > 0 || list.length != null) {
5658      for (var i = 0; i < list.length; i++) {
5659        _html += "<div class='divTableRow'>";
5660        var account = list[i].customerName;
5661        _html +=
5662          "<div class='divTableCell tbl-link ps-strings' data-customerId='" + account + "'>" + account + "</div>";
5663        // var total_deposit = list[i].deposit;
5664        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_deposit + "'>" + tcg.ac.customCurrencyFormat(total_deposit, decimal) + "</div>";
5665        // var total_withdraw = list[i].withdraw;
5666        // _html += "<div class='divTableCell ps-num' data-switchDecimal='" + decimal + "' data-value='" + total_withdraw + "'>" + tcg.ac.customCurrencyFormat(total_withdraw, decimal) + "</div>";
5667        var total_betting_loss = list[i].betAmount;
5668        _html +=
5669          "<div class='divTableCell' data-switchDecimal='" +
5670          decimal +
5671          "' data-value='" +
5672          total_betting_loss +
5673          "'>" +
5674          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
5675          "</div>";
5676        var total_game_winnings = list[i].winAmount;
5677        var gameWinningColor = total_game_winnings;
5678        _html +=
5679          "<div class='divTableCell " +
5680          gameWinningColor +
5681          "'  data-switchDecimal='" +
5682          decimal +
5683          "' data-value='" +
5684          total_game_winnings +
5685          "'>" +
5686          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
5687          "</div>";
5688        var total_game_rebate = list[i].rebate + list[i].agentCommission;
5689        _html +=
5690          "<div class='divTableCell' data-switchDecimal='" +
5691          decimal +
5692          "' data-value='" +
5693          total_game_rebate +
5694          "'>" +
5695          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
5696          "</div>";
5697        var total_promotion = list[i].promotion;
5698        _html +=
5699          "<div class='divTableCell' data-switchDecimal='" +
5700          decimal +
5701          "' data-value='" +
5702          total_promotion +
5703          "'>" +
5704          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
5705          "</div>";
5706        if (currentUser.merchantCharge != undefined && currentUser.merchantCharge != 0) {
5707          _html +=
5708            "<div class='divTableCell' data-switchDecimal='" +
5709            decimal +
5710            "' data-value='" +
5711            list[i].merchantCharge +
5712            "'>" +
5713            tcg.ac.customCurrencyFormat(list[i].merchantCharge, decimal) +
5714            "</div>";
5715        }
5716        var total_pnl = list[i].profitAndLoss;
5717        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
5718        _html +=
5719          "<div class='divTableCell " +
5720          profitLossColor +
5721          "' data-switchDecimal='" +
5722          decimal +
5723          "' data-value='" +
5724          total_pnl +
5725          "'>" +
5726          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
5727          "</div>";
5728        _html += "</div>";
5729      }
5730    } else {
5731      _html += "<div class='tableContent-wrp'>";
5732      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
5733      _html += "</div>";
5734    }
5735    $("#elottAgentPnlList").html(_html);
5736    if (sortType && sortDir) {
5737      $("#elottAgentPnlTable .divTableCell.tbl-link.sort[data-type='" + sortType + "']")
5738        .attr("data-sort", sortDir)
5739        .addClass(sortDir);
5740    }
5741  };
5742  tcg.ac.ui.switchElottCopyAgentPnlSummaryType = function () {
5743    $(document)
5744      .off("click", "#elottAgentPnlForm .summaryTypeList li")
5745      .on("click", "#elottAgentPnlForm .summaryTypeList li", function () {
5746        if (!$(this).hasClass("active") && !$("#elottAgentPnlForm .form-submit").hasClass("processing")) {
5747          var rel = $(this).attr("data-rel");
5748          $("#elottAgentPnlForm .summaryTypeList li").removeClass("active");
5749          $(this).addClass("active");
5750          $("#elottAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
5751          $("#elottAgentPnlForm [name='pageNo']").val(1);
5752          $("#elottAgentPnlForm [name='summaryType']").val(rel);
5753          $("#elottAgentPnlForm [name='customerName']").val("");
5754          $("#elottAgentPnlForm .form-submit").click();
5755        }
5756      });
5757  };
5758  tcg.ac.ui.selectElottCopyAgentDownlinePnl = function () {
5759    $(document)
5760      .off("click", "#elottAgentPnlList .tbl-link")
5761      .on("click", "#elottAgentPnlList .tbl-link", function () {
5762        if (!$(this).hasClass("loading")) {
5763          var customerName = $(this).text(),
5764            customerId = $(this).attr("data-customerId"),
5765            isOpen = false;
5766          $("#elottAgentPnlForm .breadcrumbs .b-list").each(function () {
5767            if ($(this).attr("data-customerId") == customerId) {
5768              isOpen = true;
5769            }
5770          });
5771          if (!isOpen) {
5772            $("#elottAgentPnlForm .breadcrumbs .b-list").addClass("loading");
5773            $("#elottAgentPnlForm .tbl-link").addClass("loading");
5774            var _html =
5775              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
5776              customerId +
5777              "'>" +
5778              customerName +
5779              "</div>";
5780            $("#elottAgentPnlForm .breadcrumbs").append(_html);
5781          }
5782          $("#elottAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
5783          $("#elottAgentPnlForm [name='pageNo']").val(1);
5784          //$("#elottAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
5785          tcg.ac.getElottCopyAgentPnl(customerId);
5786        }
5787      });
5788  };
5789  tcg.ac.ui.clickElottCopyAgentPnlBreadcrumbs = function () {
5790    $(document)
5791      .off("click", "#elottAgentPnlForm .breadcrumbs .b-list")
5792      .on("click", "#elottAgentPnlForm .breadcrumbs .b-list", function () {
5793        if (!$(this).hasClass("loading")) {
5794          var customerId = $(this).attr("data-customerId"),
5795            customerName = $(this).text(),
5796            removeFromList = false;
5797          $("#elottAgentPnlForm .breadcrumbs .b-list").each(function () {
5798            if (removeFromList) $(this).remove();
5799            if ($(this).attr("data-customerId") == customerId) {
5800              removeFromList = true;
5801            }
5802          });
5803          $("#elottAgentPnlTable .divTableCell.sort").attr("data-sort", "").removeClass("asc").removeClass("desc");
5804          $("#elottAgentPnlForm [name='pageNo']").val(1);
5805          $("#elottAgentPnlForm .breadcrumbs .b-list").addClass("loading");
5806          $("#elottAgentPnlList .tbl-link").addClass("loading");
5807          //$("#elottAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
5808          tcg.ac.getElottCopyAgentPnl(customerId);
5809        }
5810      });
5811  };
5812  tcg.ac.ui.sortElottCopyAgentPnl = function () {
5813    $(document)
5814      .off("click", "#elottAgentPnlTable .divTableCell.sort")
5815      .on("click", "#elottAgentPnlTable .divTableCell.sort", function (event) {
5816        var type = $(this).attr("data-type");
5817        var sort = $(this).attr("data-sort");
5818        $("#elottAgentPnlTable .divTableCell.sort").addClass("loading");
5819        $("#elottAgentPnlTable .divTableCell.sort").removeClass("asc").removeClass("desc");
5820        $("#elottAgentPnlTable .divTableCell.sort").attr("data-sort", "");
5821        if (sort === "") {
5822          $(this).attr("data-sort", "desc");
5823          sort = "desc";
5824        } else {
5825          if (sort == "desc") {
5826            $(this).attr("data-sort", "asc");
5827            sort = "asc";
5828          } else {
5829            $(this).attr("data-sort", "desc");
5830            sort = "desc";
5831          }
5832        }
5833        $(this).addClass(sort);
5834        $("#elottAgentPnlForm input[name='pageNo']").val(1);
5835        var len = $("#elottAgentPnlForm .b-list").length - 1;
5836        var customerId = $($("#elottAgentPnlForm .b-list")[len]).attr("data-customerid");
5837        tcg.ac.getElottCopyAgentPnl(customerId, type, sort);
5838      });
5839  };
5840
5841  tcg.ac.ui.appendBreadCrumbsPalStatements = function (data) {
5842    if (data) {
5843      var _html = "";
5844      for (var i = 0; data.length > i; i++) {
5845        var agent_new_entry = i == 0 ? "agentName" : "new-entry";
5846        _html +=
5847          "<div class='arrow-small-con mem-icon2 inline-block b-list " +
5848          agent_new_entry +
5849          " ' data-customerId='" +
5850          data[i].customerName +
5851          "'>" +
5852          data[i].customerName +
5853          "</div>";
5854      }
5855      $(".palStatements .breadcrumbs").html(_html);
5856    }
5857  };
5858
5859  // Lotto PNL Functions
5860  tcg.ac.ui.searchLottoAgentPnl = function () {
5861    $(document)
5862      .off("click", "#lottoAgentPnlForm .form-submit")
5863      .on("click", "#lottoAgentPnlForm .form-submit", function (event) {
5864        if (event.originalEvent === undefined) {
5865          var len = $("#lottoAgentPnlForm .b-list").length - 1;
5866          var customerId = $($(".b-list")[len]).attr("data-customerid");
5867          tcg.ac.getLottoAgentPnl(customerId);
5868        } else {
5869          $("#lottoAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
5870          tcg.ac.getLottoAgentPnl();
5871        }
5872      });
5873  };
5874  tcg.ac.ui.loadLottoAgentPnl = function (result, summaryType) {
5875    var _column = "";
5876    if (summaryType == 0) {
5877      _column +=
5878        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_1") + "</div>";
5879      _column +=
5880        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_2") + "</div>";
5881      _column +=
5882        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_3") + "</div>";
5883      _column +=
5884        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_4") + "</div>";
5885      _column +=
5886        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_5") + "</div>";
5887      _column +=
5888        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_6") + "</div>";
5889      _column +=
5890        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_7") + "</div>";
5891      _column +=
5892        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_0_column_8") + "</div>";
5893    } else {
5894      _column +=
5895        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_1") + "</div>";
5896      _column +=
5897        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_2") + "</div>";
5898      _column +=
5899        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_3") + "</div>";
5900      _column +=
5901        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_4") + "</div>";
5902      _column +=
5903        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_5") + "</div>";
5904      _column +=
5905        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_6") + "</div>";
5906      _column +=
5907        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_7") + "</div>";
5908      _column +=
5909        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_8") + "</div>";
5910    }
5911    $("#lottoAgentPnlColumn").html(_column);
5912
5913    var decimal = 2,
5914      list = result.list,
5915      _html = "";
5916    for (var i = 0; i < list.length; i++) {
5917      _html += "<div class='divTableRow'>";
5918      var account = list[i].customer_name.split("@");
5919      _html +=
5920        "<div class='divTableCell tbl-link ps-strings' data-customerId='" +
5921        list[i].customer_id +
5922        "'>" +
5923        account[1] +
5924        "</div>";
5925      var depositAndTransferIn = list[i].deposit + list[i].agent_transfer_in;
5926      _html +=
5927        "<div class='divTableCell ps-num' data-switchDecimal='" +
5928        decimal +
5929        "' data-value='" +
5930        list[i].deposit +
5931        "'>" +
5932        tcg.ac.customCurrencyFormat(depositAndTransferIn, decimal) +
5933        "</div>";
5934      var withdrawAndTransferOut = list[i].withdraw + list[i].agent_transfer_out;
5935      _html +=
5936        "<div class='divTableCell ps-num' data-switchDecimal='" +
5937        decimal +
5938        "' data-value='" +
5939        list[i].withdraw +
5940        "'>" +
5941        tcg.ac.customCurrencyFormat(withdrawAndTransferOut, decimal) +
5942        "</div>";
5943      _html +=
5944        "<div class='divTableCell ps-num' data-switchDecimal='" +
5945        decimal +
5946        "' data-value='" +
5947        list[i].lott_game_betting +
5948        "'>" +
5949        tcg.ac.customCurrencyFormat(list[i].lott_game_betting, decimal) +
5950        "</div>";
5951      var lottoGameRebate = list[i].lott_game_rebate + list[i].lott_agent_c
5951ommission;
5952      var lottGameRebateColor = lottoGameRebate;
5953      _html +=
5954        "<div class='divTableCell ps-num " +
5955        lottGameRebateColor +
5956        "'  data-switchDecimal='" +
5957        decimal +
5958        "' data-value='" +
5959        lottoGameRebate +
5960        "'>" +
5961        tcg.ac.customCurrencyFormat(lottoGameRebate, decimal) +
5962        "</div>";
5963      _html +=
5964        "<div class='divTableCell ps-num' data-switchDecimal='" +
5965        decimal +
5966        "' data-value='" +
5967        list[i].lott_game_winning +
5968        "'>" +
5969        tcg.ac.customCurrencyFormat(list[i].lott_game_winning, decimal) +
5970        "</div>";
5971      var promobrokeincome = list[i].lott_promotion + list[i].lott_daily_income + list[i].lott_brokerage;
5972      _html +=
5973        "<div class='divTableCell ps-num' data-switchDecimal='" +
5974        decimal +
5975        "' data-value='" +
5976        promobrokeincome +
5977        "'>" +
5978        tcg.ac.customCurrencyFormat(promobrokeincome, decimal) +
5979        "</div>";
5980      var profitLossColor = list[i].lott_game_pnl >= 0 ? "tbl-red" : "tbl-green";
5981      _html +=
5982        "<div class='divTableCell ps-num " +
5983        profitLossColor +
5984        "' data-switchDecimal='" +
5985        decimal +
5986        "' data-value='" +
5987        list[i].lott_game_pnl +
5988        "'>" +
5989        tcg.ac.customCurrencyFormat(list[i].lott_game_pnl, decimal) +
5990        "</div>";
5991      _html += "</div>";
5992    }
5993    $("#lottoAgentPnlList").html(_html);
5994  };
5995  tcg.ac.ui.switchLottoAgentPnlSummaryType = function () {
5996    $(document)
5997      .off("click", "#lottoAgentPnlForm .summaryTypeList li")
5998      .on("click", "#lottoAgentPnlForm .summaryTypeList li", function () {
5999        if (!$(this).hasClass("active") && !$("#lottoAgentPnlForm .form-submit").hasClass("processing")) {
6000          var rel = $(this).attr("data-rel");
6001          $("#lottoAgentPnlForm .summaryTypeList li").removeClass("active");
6002          $(this).addClass("active");
6003          $("#lottoAgentPnlForm [name='pageNo']").val(1);
6004          $("#lottoAgentPnlForm [name='summaryType']").val(rel);
6005          $("#lottoAgentPnlForm .form-submit").click();
6006        }
6007      });
6008  };
6009  tcg.ac.ui.selectLottoAgentDownlinePnl = function () {
6010    $(document)
6011      .off("click", "#lottoAgentPnlList .tbl-link")
6012      .on("click", "#lottoAgentPnlList .tbl-link", function () {
6013        if (!$(this).hasClass("loading")) {
6014          var customerName = $(this).text(),
6015            customerId = $(this).attr("data-customerId"),
6016            isOpen = false;
6017          $("#lottoAgentPnlForm .breadcrumbs .b-list").each(function () {
6018            if ($(this).attr("data-customerId") == customerId) {
6019              isOpen = true;
6020            }
6021          });
6022          if (!isOpen) {
6023            $("#lottoAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6024            $("#lottoAgentPnlForm .summaryTypeList li").addClass("loading");
6025            _html =
6026              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
6027              customerId +
6028              "'>" +
6029              customerName +
6030              "</div>";
6031            $("#lottoAgentPnlForm .breadcrumbs").append(_html);
6032          }
6033          $("#lottoAgentPnlForm [name='pageNo']").val(1);
6034          tcg.ac.getLottoAgentPnl(customerId);
6035        }
6036      });
6037  };
6038  tcg.ac.ui.clickLottoAgentPnlBreadcrumbs = function () {
6039    $(document)
6040      .off("click", "#lottoAgentPnlForm .breadcrumbs .b-list")
6041      .on("click", "#lottoAgentPnlForm .breadcrumbs .b-list", function () {
6042        if (!$(this).hasClass("loading")) {
6043          var customerId = $(this).attr("data-customerId"),
6044            customerName = $(this).text(),
6045            removeFromList = false;
6046          $("#lottoAgentPnlForm .breadcrumbs .b-list").each(function () {
6047            if (removeFromList) $(this).remove();
6048            if ($(this).attr("data-customerId") == customerId) {
6049              removeFromList = true;
6050            }
6051          });
6052          $("#lottoAgentPnlForm [name='pageNo']").val(1);
6053          $("#lottoAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6054          $("#lottoAgentPnlForm .summaryTypeList li").addClass("loading");
6055          tcg.ac.getLottoAgentPnl(customerId);
6056        }
6057      });
6058  };
6059  //
6060  tcg.ac.ui.searchFishAgentPnl = function () {
6061    $(document)
6062      .off("click", "#fishAgentPnlForm .form-submit")
6063      .on("click", "#fishAgentPnlForm .form-submit", function () {
6064        $("#fishAgentPnlForm .breadcrumbs .b-list.new--entry").remove();
6065        tcg.ac.getFishAgentPnl();
6066      });
6067  };
6068  tcg.ac.ui.searchSportsAgentPnl = function () {
6069    $(document)
6070      .off("click", "#sportsAgentPnlForm .form-submit")
6071      .on("click", "#sportsAgentPnlForm .form-submit", function () {
6072        $("#sportsAgentPnlForm .breadcrumbs .b-list.new--entry").remove();
6073        tcg.ac.getSportsAgentPnl();
6074      });
6075  };
6076  tcg.ac.ui.searchPvpAgentPnl = function () {
6077    $(document)
6078      .off("click", "#pvpAgentPnlForm .form-submit")
6079      .on("click", "#pvpAgentPnlForm .form-submit", function (event) {
6080        //$("#pvpAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
6081        //tcg.ac.getPvpAgentPnl();
6082
6083        if (event.originalEvent === undefined) {
6084          var len = $("#pvpAgentPnlForm .b-list").length;
6085          var customerId = $($(".b-list")[len]).attr("data-customerid");
6086          tcg.ac.getPvpAgentPnl(customerId);
6087        } else {
6088          $("#pvpAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
6089          tcg.ac.getPvpAgentPnl();
6090        }
6091      });
6092  };
6093  tcg.ac.ui.searchRNGAgentPnl = function () {
6094    $(document)
6095      .off("click", "#rngAgentPnlForm .form-submit")
6096      .on("click", "#rngAgentPnlForm .form-submit", function (event) {
6097        if (event.originalEvent === undefined) {
6098          var len = $("#rngAgentPnlForm .b-list").length - 1;
6099          var customerId = $($("#rngAgentPnlForm .breadcrumbs .b-list")[len]).attr("data-customerid");
6100          tcg.ac.getRNGAgentPnl(customerId);
6101        } else {
6102          $("#rngAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
6103          tcg.ac.getRNGAgentPnl();
6104        }
6105      });
6106  };
6107  tcg.ac.ui.loadPvpAgentPnl = function (result, summaryType) {
6108    var _column = "";
6109    if (summaryType == 0) {
6110      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_1") + "</div>";
6111      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_2") + "</div>";
6112      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_3") + "</div>";
6113      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_4") + "</div>";
6114      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_5") + "</div>";
6115      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_6") + "</div>";
6116      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_7") + "</div>";
6117      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_0_column_8") + "</div>";
6118    } else {
6119      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_1") + "</div>";
6120      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_2") + "</div>";
6121      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_3") + "</div>";
6122      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_4") + "</div>";
6123      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_5") + "</div>";
6124      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_6") + "</div>";
6125      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_7") + "</div>";
6126      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_pvp_pnl_summaryType_1_column_8") + "</div>";
6127    }
6128    $("#pvpAgentPnlColumn").html(_column);
6129
6130    var decimal = 2,
6131      list = result.list,
6132      _html = "";
6133    if (list.length > 0) {
6134      for (var i = 0; i < list.length; i++) {
6135        _html += "<div class='divTableRow'>";
6136        var account = list[i].customer_name.split("@");
6137        _html +=
6138          "<div class='divTableCell tbl-link ps-strings' data-customerId='" +
6139          list[i].customer_id +
6140          "'>" +
6141          account[1] +
6142          "</div>";
6143        var total_deposit = list[i].deposit;
6144        _html +=
6145          "<div class='divTableCell ps-num' data-switchDecimal='" +
6146          decimal +
6147          "' data-value='" +
6148          total_deposit +
6149          "'>" +
6150          tcg.ac.customCurrencyFormat(total_deposit, decimal) +
6151          "</div>";
6152        var total_withdraw = list[i].withdraw;
6153        _html +=
6154          "<div class='divTableCell ps-num' data-switchDecimal='" +
6155          decimal +
6156          "' data-value='" +
6157          total_withdraw +
6158          "'>" +
6159          tcg.ac.customCurrencyFormat(total_withdraw, decimal) +
6160          "</div>";
6161        var total_betting_loss = list[i].pvp_game_loses;
6162        _html +=
6163          "<div class='divTableCell ps-num' data-switchDecimal='" +
6164          decimal +
6165          "' data-value='" +
6166          total_betting_loss +
6167          "'>" +
6168          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
6169          "</div>";
6170        var total_game_winnings = list[i].pvp_game_winnings;
6171        var gameWinningColor = total_game_winnings;
6172        _html +=
6173          "<div class='divTableCell ps-num " +
6174          gameWinningColor +
6175          "'  data-switchDecimal='" +
6176          decimal +
6177          "' data-value='" +
6178          total_game_winnings +
6179          "'>" +
6180          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
6181          "</div>";
6182        var total_game_rebate = list[i].pvp_game_rebate;
6183        _html +=
6184          "<div class='divTableCell ps-num' data-switchDecimal='" +
6185          decimal +
6186          "' data-value='" +
6187          total_game_rebate +
6188          "'>" +
6189          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
6190          "</div>";
6191        var total_promotion = list[i].pvp_promotion;
6192        _html +=
6193          "<div class='divTableCell ps-num' data-switchDecimal='" +
6194          decimal +
6195          "' data-value='" +
6196          total_promotion +
6197          "'>" +
6198          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
6199          "</div>";
6200        var total_pnl = list[i].pvp_game_pnl;
6201        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
6202        _html +=
6203          "<div class='divTableCell ps-num " +
6204          profitLossColor +
6205          "' data-switchDecimal='" +
6206          decimal +
6207          "' data-value='" +
6208          total_pnl +
6209          "'>" +
6210          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
6211          "</div>";
6212        _html += "</div>";
6213      }
6214    } else {
6215      _html += "<div class='tableContent-wrp'>";
6216      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
6217      _html += "</div>";
6218    }
6219    $("#pvpAgentPnlList").html(_html);
6220  };
6221  tcg.ac.ui.loadRNGAgentPnl = function (result, summaryType) {
6222    var _column = "";
6223    if (summaryType == 0) {
6224      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_1") + "</div>";
6225      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_2") + "</div>";
6226      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_3") + "</div>";
6227      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_4") + "</div>";
6228      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_5") + "</div>";
6229      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_6") + "</div>";
6230      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_7") + "</div>";
6231      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_0_column_8") + "</div>";
6232    } else {
6233      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_1") + "</div>";
6234      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_2") + "</div>";
6235      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_3") + "</div>";
6236      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_4") + "</div>";
6237      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_5") + "</div>";
6238      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_6") + "</div>";
6239      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_7") + "</div>";
6240      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_rng_pnl_summaryType_1_column_8") + "</div>";
6241    }
6242    $("#rngAgentPnlColumn").html(_column);
6243
6244    var decimal = 2,
6245      list = result.list,
6246      _html = "";
6247    if (list.length > 0 || list.length != null) {
6248      for (var i = 0; i < list.length; i++) {
6249        _html += "<div class='divTableRow'>";
6250        var account = list[i].customer_name.split("@");
6251        _html +=
6252          "<div class='divTableCell tbl-link ps-strings' data-customerId='" +
6253          list[i].customer_id +
6254          "'>" +
6255          account[1] +
6256          "</div>";
6257        var total_deposit = list[i].deposit;
6258        _html +=
6259          "<div class='divTableCell ps-num' data-switchDecimal='" +
6260          decimal +
6261          "' data-value='" +
6262          total_deposit +
6263          "'>" +
6264          tcg.ac.customCurrencyFormat(total_deposit, decimal) +
6265          "</div>";
6266        var total_withdraw = list[i].withdraw;
6267        _html +=
6268          "<div class='divTableCell ps-num' data-switchDecimal='" +
6269          decimal +
6270          "' data-value='" +
6271          total_withdraw +
6272          "'>" +
6273          tcg.ac.customCurrencyFormat(total_withdraw, decimal) +
6274          "</div>";
6275        var total_betting_loss = list[i].rng_game_betting + list[i].live_game_betting;
6276        _html +=
6277          "<div class='divTableCell ps-num' data-switchDecimal='" +
6278          decimal +
6279          "' data-value='" +
6280          total_betting_loss +
6281          "'>" +
6282          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
6283          "</div>";
6284        var total_game_winnings = list[i].rng_game_winning + list[i].live_game_winning;
6285        var gameWinningColor = total_game_winnings;
6286        _html +=
6287          "<div class='divTableCell ps-num " +
6288          gameWinningColor +
6289          "'  data-switchDecimal='" +
6290          decimal +
6291          "' data-value='" +
6292          total_game_winnings +
6293          "'>" +
6294          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
6295          "</div>";
6296        var total_game_rebate = list[i].rng_game_rebate + list[i].live_game_rebate;
6297        _html +=
6298          "<div class='divTableCell ps-num' data-switchDecimal='" +
6299          decimal +
6300          "' data-value='" +
6301          total_game_rebate +
6302          "'>" +
6303          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
6304          "</div>";
6305        var total_promotion = list[i].rng_promotion;
6306        _html +=
6307          "<div class='divTableCell ps-num' data-switchDecimal='" +
6308          decimal +
6309          "' data-value='" +
6310          total_promotion +
6311          "'>" +
6312          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
6313          "</div>";
6314        var total_pnl = list[i].rng_game_pnl + list[i].live_game_pnl;
6315        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
6316        _html +=
6317          "<div class='divTableCell ps-num " +
6318          profitLossColor +
6319          "' data-switchDecimal='" +
6320          decimal +
6321          "' data-value='" +
6322          total_pnl +
6323          "'>" +
6324          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
6325          "</div>";
6326        _html += "</div>";
6327      }
6328    } else {
6329      _html += "<div class='tableContent-wrp'>";
6330      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
6331      _html += "</div>";
6332    }
6333    $("#rngAgentPnlList").html(_html);
6334  };
6335  tcg.ac.ui.loadFishAgentPnl = function (result, summaryType) {
6336    var _column = "";
6337    if (summaryType == 0) {
6338      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_1") + "</div>";
6339      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_2") + "</div>";
6340      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_3") + "</div>";
6341      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_4") + "</div>";
6342      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_5") + "</div>";
6343      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_6") + "</div>";
6344      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_7") + "</div>";
6345      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_0_column_8") + "</div>";
6346    } else {
6347      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_1") + "</div>";
6348      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_2") + "</div>";
6349      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_3") + "</div>";
6350      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_4") + "</div>";
6351      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_5") + "</div>";
6352      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_6") + "</div>";
6353      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_7") + "</div>";
6354      _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_fish_pnl_summaryType_1_column_8") + "</div>";
6355    }
6356    $("#fishAgentPnlColumn").html(_column);
6357
6358    var decimal = 2,
6359      list = result.list,
6360      _html = "";
6361    if (list.length > 0 || list.length != null) {
6362      for (var i = 0; i < list.length; i++) {
6363        _html += "<div class='divTableRow'>";
6364        var account = list[i].customer_name.split("@");
6365        _html +=
6366          "<div class='divTableCell tbl-link ps-strings' data-customerId='" +
6367          list[i].customer_id +
6368          "'>" +
6369          account[1] +
6370          "</div>";
6371        var total_deposit = list[i].deposit;
6372        _html +=
6373          "<div class='divTableCell ps-num' data-switchDecimal='" +
6374          decimal +
6375          "' data-value='" +
6376          total_deposit +
6377          "'>" +
6378          tcg.ac.customCurrencyFormat(total_deposit, decimal) +
6379          "</div>";
6380        var total_withdraw = list[i].withdraw;
6381        _html +=
6382          "<div class='divTableCell ps-num' data-switchDecimal='" +
6383          decimal +
6384          "' data-value='" +
6385          total_withdraw +
6386          "'>" +
6387          tcg.ac.customCurrencyFormat(total_withdraw, decimal) +
6388          "</div>";
6389        var total_betting_loss = list[i].fish_game_betting;
6390        _html +=
6391          "<div class='divTableCell ps-num' data-switchDecimal='" +
6392          decimal +
6393          "' data-value='" +
6394          total_betting_loss +
6395          "'>" +
6396          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
6397          "</div>";
6398        var total_game_winnings = list[i].fish_game_winning;
6399        var gameWinningColor = total_game_winnings;
6400        _html +=
6401          "<div class='divTableCell ps-num " +
6402          gameWinningColor +
6403          "'  data-switchDecimal='" +
6404          decimal +
6405          "' data-value='" +
6406          total_game_winnings +
6407          "'>" +
6408          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
6409          "</div>";
6410        var total_game_rebate = list[i].fish_game_rebate;
6411        _html +=
6412          "<div class='divTableCell ps-num' data-switchDecimal='" +
6413          decimal +
6414          "' data-value='" +
6415          total_game_rebate +
6416          "'>" +
6417          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
6418          "</div>";
6419        var total_promotion = 0; //fish无活动,默认为0
6420        _html +=
6421          "<div class='divTableCell ps-num' data-switchDecimal='" +
6422          decimal +
6423          "' data-value='" +
6424          total_promotion +
6425          "'>" +
6426          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
6427          "</div>";
6428        var total_pnl = list[i].fish_game_pnl;
6429        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
6430        _html +=
6431          "<div class='divTableCell ps-num " +
6432          profitLossColor +
6433          "' data-switchDecimal='" +
6434          decimal +
6435          "' data-value='" +
6436          total_pnl +
6437          "'>" +
6438          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
6439          "</div>";
6440        _html += "</div>";
6441      }
6442    } else {
6443      _html += "<div class='tableContent-wrp'>";
6444      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
6445      _html += "</div>";
6446    }
6447    $("#fishAgentPnlList").html(_html);
6448  };
6449  tcg.ac.ui.loadSportsAgentPnl = function (result, summaryType) {
6450    var _column = "";
6451    if (summaryType == 0) {
6452      _column +=
6453        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_1") + "</div>";
6454      _column +=
6455        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_2") + "</div>";
6456      _column +=
6457        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_3") + "</div>";
6458      _column +=
6459        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_4") + "</div>";
6460      _column +=
6461        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_5") + "</div>";
6462      _column +=
6463        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_6") + "</div>";
6464      _column +=
6465        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_7") + "</div>";
6466      _column +=
6467        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_0_column_8") + "</div>";
6468    } else {
6469      _column +=
6470        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_1") + "</div>";
6471      _column +=
6472        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_2") + "</div>";
6473      _column +=
6474        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_3") + "</div>";
6475      _column +=
6476        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_4") + "</div>";
6477      _column +=
6478        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_5") + "</div>";
6479      _column +=
6480        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_6") + "</div>";
6481      _column +=
6482        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_7") + "</div>";
6483      _column +=
6484        "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_sports_pnl_summaryType_1_column_8") + "</div>";
6485    }
6486    $("#sportsAgentPnlColumn").html(_column);
6487
6488    var decimal = 2,
6489      list = result.list,
6490      _html = "";
6491    if (list.length > 0 || list.length != null) {
6492      for (var i = 0; i < list.length; i++) {
6493        _html += "<div class='divTableRow'>";
6494        var account = list[i].customer_name.split("@");
6495        _html +=
6496          "<div class='divTableCell tbl-link ps-strings' data-customerId='" +
6497          list[i].customer_id +
6498          "'>" +
6499          account[1] +
6500          "</div>";
6501        var total_deposit = list[i].deposit;
6502        _html +=
6503          "<div class='divTableCell ps-num' data-switchDecimal='" +
6504          decimal +
6505          "' data-value='" +
6506          total_deposit +
6507          "'>" +
6508          tcg.ac.customCurrencyFormat(total_deposit, decimal) +
6509          "</div>";
6510        var total_withdraw = list[i].withdraw;
6511        _html +=
6512          "<div class='divTableCell ps-num' data-switchDecimal='" +
6513          decimal +
6514          "' data-value='" +
6515          total_withdraw +
6516          "'>" +
6517          tcg.ac.customCurrencyFormat(total_withdraw, decimal) +
6518          "</div>";
6519        var total_betting_loss = list[i].sports_game_betting;
6520        _html +=
6521          "<div class='divTableCell ps-num' data-switchDecimal='" +
6522          decimal +
6523          "' data-value='" +
6524          total_betting_loss +
6525          "'>" +
6526          tcg.ac.customCurrencyFormat(total_betting_loss, decimal) +
6527          "</div>";
6528        var total_game_winnings = list[i].sports_game_winning;
6529        var gameWinningColor = total_game_winnings;
6530        _html +=
6531          "<div class='divTableCell ps-num " +
6532          gameWinningColor +
6533          "'  data-switchDecimal='" +
6534          decimal +
6535          "' data-value='" +
6536          total_game_winnings +
6537          "'>" +
6538          tcg.ac.customCurrencyFormat(total_game_winnings, decimal) +
6539          "</div>";
6540        var total_game_rebate = list[i].sports_agent_commission + list[i].sports_game_rebate;
6541        _html +=
6542          "<div class='divTableCell ps-num' data-switchDecimal='" +
6543          decimal +
6544          "' data-value='" +
6545          total_game_rebate +
6546          "'>" +
6547          tcg.ac.customCurrencyFormat(total_game_rebate, decimal) +
6548          "</div>";
6549        var total_promotion = 0; //sports无活动,默认为0
6550        _html +=
6551          "<div class='divTableCell ps-num' data-switchDecimal='" +
6552          decimal +
6553          "' data-value='" +
6554          total_promotion +
6555          "'>" +
6556          tcg.ac.customCurrencyFormat(total_promotion, decimal) +
6557          "</div>";
6558        var total_pnl = list[i].sports_game_pnl;
6559        var profitLossColor = total_pnl >= 0 ? "tbl-red" : "tbl-green";
6560        _html +=
6561          "<div class='divTableCell ps-num " +
6562          profitLossColor +
6563          "' data-switchDecimal='" +
6564          decimal +
6565          "' data-value='" +
6566          total_pnl +
6567          "'>" +
6568          tcg.ac.customCurrencyFormat(total_pnl, decimal) +
6569          "</div>";
6570        _html += "</div>";
6571      }
6572    } else {
6573      _html += "<div class='tableContent-wrp'>";
6574      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
6575      _html += "</div>";
6576    }
6577    $("#sportsAgentPnlList").html(_html);
6578  };
6579  tcg.ac.ui.switchPvpAgentPnlSummaryType = function () {
6580    $(document)
6581      .off("click", "#pvpAgentPnlForm .summaryTypeList li")
6582      .on("click", "#pvpAgentPnlForm .summaryTypeList li", function () {
6583        if (!$(this).hasClass("active") && !$("#pvpAgentPnlForm .form-submit").hasClass("processing")) {
6584          var rel = $(this).attr("data-rel");
6585          $("#pvpAgentPnlForm .summaryTypeList li").removeClass("active");
6586          $(this).addClass("active");
6587          $("#pvpAgentPnlForm [name='pageNo']").val(1);
6588          $("#pvpAgentPnlForm [name='summaryType']").val(rel);
6589          // $("#pvpAgentPnlForm .form-submit").click();
6590          tcg.ac.getPvpAgentPnl();
6591        }
6592      });
6593  };
6594  tcg.ac.ui.switchRNGAgentPnlSummaryType = function () {
6595    $(document)
6596      .off("click", "#rngAgentPnlForm .summaryTypeList li")
6597      .on("click", "#rngAgentPnlForm .summaryTypeList li", function () {
6598        if (!$(this).hasClass("active") && !$("#rngAgentPnlForm .form-submit").hasClass("processing")) {
6599          var rel = $(this).attr("data-rel");
6600          $("#rngAgentPnlForm .summaryTypeList li").removeClass("active");
6601          $(this).addClass("active");
6602          $("#rngAgentPnlForm [name='pageNo']").val(1);
6603          $("#rngAgentPnlForm [name='summaryType']").val(rel);
6604          $("#rngAgentPnlForm [name='customerName']").val("");
6605          // $("#rngAgentPnlForm .form-submit").click();
6606          tcg.ac.getRNGAgentPnl();
6607        }
6608      });
6609  };
6610  tcg.ac.ui.switchFishAgentPnlSummaryType = function () {
6611    $(document)
6612      .off("click", "#fishAgentPnlForm .summaryTypeList li")
6613      .on("click", "#fishAgentPnlForm .summaryTypeList li", function () {
6614        if (!$(this).hasClass("active") && !$("#rngAgentPnlForm .form-submit").hasClass("processing")) {
6615          var rel = $(this).attr("data-rel");
6616          $("#fishAgentPnlForm .summaryTypeList li").removeClass("active");
6617          $(this).addClass("active");
6618          $("#fishAgentPnlForm [name='pageNo']").val(1);
6619          $("#fishAgentPnlForm [name='summaryType']").val(rel);
6620          $("#fishAgentPnlForm [name='customerName']").val("");
6621          // $("#rngAgentPnlForm .form-submit").click();
6622          tcg.ac.getFishAgentPnl();
6623        }
6624      });
6625  };
6626  tcg.ac.ui.switchSportsAgentPnlSummaryType = function () {
6627    $(document)
6628      .off("click", "#sportsAgentPnlForm .summaryTypeList li")
6629      .on("click", "#sportsAgentPnlForm .summaryTypeList li", function () {
6630        if (!$(this).hasClass("active") && !$("#rngAgentPnlForm .form-submit").hasClass("processing")) {
6631          var rel = $(this).attr("data-rel");
6632          $("#sportsAgentPnlForm .summaryTypeList li").removeClass("active");
6633          $(this).addClass("active");
6634          $("#sportsAgentPnlForm [name='pageNo']").val(1);
6635          $("#sportsAgentPnlForm [name='summaryType']").val(rel);
6636          $("#sportsAgentPnlForm [name='customerName']").val("");
6637          // $("#rngAgentPnlForm .form-submit").click();
6638          tcg.ac.getSportsAgentPnl();
6639        }
6640      });
6641  };
6642  tcg.ac.ui.selectPvpAgentDownlinePnl = function () {
6643    $(document)
6644      .off("click", "#pvpAgentPnlList .tbl-link")
6645      .on("click", "#pvpAgentPnlList .tbl-link", function () {
6646        if (!$(this).hasClass("loading")) {
6647          var customerName = $(this).text(),
6648            customerId = $(this).attr("data-customerId"),
6649            isOpen = false;
6650          $("#pvpAgentPnlForm .breadcrumbs .b-list").each(function () {
6651            if ($(this).attr("data-customerId") == customerId) {
6652              isOpen = true;
6653            }
6654          });
6655          if (!isOpen) {
6656            $("#pvpAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6657            $("#pvpAgentPnlList .tbl-link").addClass("loading");
6658            var _html =
6659              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
6660              customerId +
6661              "'>" +
6662              customerName +
6663              "</div>";
6664            $("#pvpAgentPnlForm .breadcrumbs").append(_html);
6665          }
6666          $("#pvpAgentPnlForm [name='pageNo']").val(1);
6667          tcg.ac.getPvpAgentPnl(customerId);
6668        }
6669      });
6670  };
6671  tcg.ac.ui.selectRNGAgentDownlinePnl = function () {
6672    $(document)
6673      .off("click", "#rngAgentPnlList .tbl-link")
6674      .on("click", "#rngAgentPnlList .tbl-link", function () {
6675        if (!$(this).hasClass("loading")) {
6676          var customerName = $(this).text(),
6677            customerId = $(this).attr("data-customerId"),
6678            isOpen = false;
6679          $("#rngAgentPnlForm .breadcrumbs .b-list").each(function () {
6680            if ($(this).attr("data-customerId") == customerId) {
6681              isOpen = true;
6682            }
6683          });
6684          if (!isOpen) {
6685            $("#rngAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6686            $("#rngAgentPnlForm .tbl-link").addClass("loading");
6687            var _html =
6688              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
6689              customerId +
6690              "'>" +
6691              customerName +
6692              "</div>";
6693            $("#rngAgentPnlForm .breadcrumbs").append(_html);
6694          }
6695          $("#rngAgentPnlForm [name='pageNo']").val(1);
6696          //$("#rngAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
6697          tcg.ac.getRNGAgentPnl(customerId);
6698        }
6699      });
6700  };
6701  tcg.ac.ui.selectFishAgentDownlinePnl = function () {
6702    $(document)
6703      .off("click", "#fishAgentPnlList .tbl-link")
6704      .on("click", "#fishAgentPnlList .tbl-link", function () {
6705        if (!$(this).hasClass("loading")) {
6706          var customerName = $(this).text(),
6707            customerId = $(this).attr("data-customerId"),
6708            isOpen = false;
6709          $("#fishAgentPnlForm .breadcrumbs .b-list").each(function () {
6710            if ($(this).attr("data-customerId") == customerId) {
6711              isOpen = true;
6712            }
6713          });
6714          if (!isOpen) {
6715            $("#fishAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6716            $("#fishAgentPnlForm .tbl-link").addClass("loading");
6717            var _html =
6718              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
6719              customerId +
6720              "'>" +
6721              customerName +
6722              "</div>";
6723            $("#fishAgentPnlForm .breadcrumbs").append(_html);
6724          }
6725          $("#fishAgentPnlForm [name='pageNo']").val(1);
6726          $("#fishAgentPnlForm [name='customerName']").val(
6727            customerName == window.sessionStorage.getItem("username") ? "" : customerName
6728          );
6729          tcg.ac.getFishAgentPnl();
6730        }
6731      });
6732  };
6733  tcg.ac.ui.selectSportsAgentDownlinePnl = function () {
6734    $(document)
6735      .off("click", "#sportsAgentPnlList .tbl-link")
6736      .on("click", "#sportsAgentPnlList .tbl-link", function () {
6737        if (!$(this).hasClass("loading")) {
6738          var customerName = $(this).text(),
6739            customerId = $(this).attr("data-customerId"),
6740            isOpen = false;
6741          $("#sportsAgentPnlForm .breadcrumbs .b-list").each(function () {
6742            if ($(this).attr("data-customerId") == customerId) {
6743              isOpen = true;
6744            }
6745          });
6746          if (!isOpen) {
6747            $("#sportsAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6748            $("#sportsAgentPnlForm .tbl-link").addClass("loading");
6749            var _html =
6750              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
6751              customerId +
6752              "'>" +
6753              customerName +
6754              "</div>";
6755            $("#sportsAgentPnlForm .breadcrumbs").append(_html);
6756          }
6757          $("#sportsAgentPnlForm [name='pageNo']").val(1);
6758          $("#sportsAgentPnlForm [name='customerName']").val(
6759            customerName == window.sessionStorage.getItem("username") ? "" : customerName
6760          );
6761          tcg.ac.getSportsAgentPnl();
6762        }
6763      });
6764  };
6765  tcg.ac.ui.clickPvpAgentPnlBreadcrumbs = function () {
6766    $(document)
6767      .off("click", "#pvpAgentPnlForm .breadcrumbs .b-list")
6768      .on("click", "#pvpAgentPnlForm .breadcrumbs .b-list", function () {
6769        if (!$(this).hasClass("loading")) {
6770          var customerId = $(this).attr("data-customerId"),
6771            customerName = $(this).text(),
6772            removeFromList = false;
6773          $("#pvpAgentPnlForm .breadcrumbs .b-list").each(function () {
6774            if (removeFromList) $(this).remove();
6775            if ($(this).attr("data-customerId") == customerId) {
6776              removeFromList = true;
6777            }
6778          });
6779          $("#pvpAgentPnlForm [name='pageNo']").val(1);
6780          $("#pvpAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6781          $("#pvpAgentPnlList .tbl-link").addClass("loading");
6782          tcg.ac.getPvpAgentPnl(customerId);
6783        }
6784      });
6785  };
6786  tcg.ac.ui.clickRNGAgentPnlBreadcrumbs = function () {
6787    $(document)
6788      .off("click", "#rngAgentPnlForm .breadcrumbs .b-list")
6789      .on("click", "#rngAgentPnlForm .breadcrumbs .b-list", function () {
6790        if (!$(this).hasClass("loading")) {
6791          var customerId = $(this).attr("data-customerId"),
6792            customerName = $(this).text(),
6793            removeFromList = false;
6794          $("#rngAgentPnlForm .breadcrumbs .b-list").each(function () {
6795            if (removeFromList) $(this).remove();
6796            if ($(this).attr("data-customerId") == customerId) {
6797              removeFromList = true;
6798            }
6799          });
6800          $("#rngAgentPnlForm [name='pageNo']").val(1);
6801          $("#rngAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6802          $("#rngAgentPnlList .tbl-link").addClass("loading");
6803          //$("#rngAgentPnlForm [name='customerName']").val( customerName == window.sessionStorage.getItem("username") ? "" : customerName );
6804          tcg.ac.getRNGAgentPnl(customerId);
6805        }
6806      });
6807  };
6808  tcg.ac.ui.clickFishAgentPnlBreadcrumbs = function () {
6809    $(document)
6810      .off("click", "#fishAgentPnlForm .breadcrumbs .b-list")
6811      .on("click", "#fishAgentPnlForm .breadcrumbs .b-list", function () {
6812        if (!$(this).hasClass("loading")) {
6813          var customerId = $(this).attr("data-customerId"),
6814            customerName = $(this).text(),
6815            removeFromList = false;
6816          $("#fishAgentPnlForm .breadcrumbs .b-list").each(function () {
6817            if (removeFromList) $(this).remove();
6818            if ($(this).attr("data-customerId") == customerId) {
6819              removeFromList = true;
6820            }
6821          });
6822          $("#fishAgentPnlForm [name='pageNo']").val(1);
6823          $("#fishAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6824          $("#fishAgentPnlForm .tbl-link").addClass("loading");
6825          $("#fishAgentPnlForm [name='customerName']").val(
6826            customerName == window.sessionStorage.getItem("username") ? "" : customerName
6827          );
6828          tcg.ac.getFishAgentPnl();
6829        }
6830      });
6831  };
6832  tcg.ac.ui.clickSportsAgentPnlBreadcrumbs = function () {
6833    $(document)
6834      .off("click", "#sportsAgentPnlForm .breadcrumbs .b-list")
6835      .on("click", "#sportsAgentPnlForm .breadcrumbs .b-list", function () {
6836        if (!$(this).hasClass("loading")) {
6837          var customerId = $(this).attr("data-customerId"),
6838            customerName = $(this).text(),
6839            removeFromList = false;
6840          $("#sportsAgentPnlForm .breadcrumbs .b-list").each(function () {
6841            if (removeFromList) $(this).remove();
6842            if ($(this).attr("data-customerId") == customerId) {
6843              removeFromList = true;
6844            }
6845          });
6846          $("#sportsAgentPnlForm [name='pageNo']").val(1);
6847          $("#sportsAgentPnlForm .breadcrumbs .b-list").addClass("loading");
6848          $("#sportsAgentPnlForm .tbl-link").addClass("loading");
6849          $("#sportsAgentPnlForm [name='customerName']").val(
6850            customerName == window.sessionStorage.getItem("username") ? "" : customerName
6851          );
6852          tcg.ac.getSportsAgentPnl();
6853        }
6854      });
6855  };
6856
6857  // Agent Team Betting
6858  tcg.ac.ui.loadTeamBetting = function (result) {
6859    var decimal = 2,
6860      _html = "",
6861      _total = "",
6862      list = result.list,
6863      total = result.footer;
6864    if (list.length > 0) {
6865      for (var i = 0; i < list.length; i++) {
6866        var dateTime = list[i].create_time.split(" ");
6867        var prop = tcg.lib.prop(tcg.ac.getMerchant() + "_" + list[i].game_name);
6868        var gameName = prop == tcg.ac.getMerchant() + "_" + list[i].game_name ? list[i].game_name : prop;
6869        _html += "<div class='divTableRow' style='position: relative'>";
6870        _html += "<div class='divTableCell onel-th-x'>" + gameName + "</div>";
6871        _html +=
6872          "<div class='divTableCell onel-th-x mylink tbl-l'><span class='openItem' data-orderId='" +
6873          list[i].order_detail_id +
6874          "' data-chasing='" +
6875          list[i].chase +
6876          "' data-orderMasterId='" +
6877          list[i].order_master_id +
6878          "'>" +
6879          tcg.ac.shortenText(list[i].order_num) +
6880          "</span></div>"; //  yel-pop
6881        _html += "<div class='divTableCell onel-th-x'>" + list[i].customer_name + "</div>"; // yel-pop
6882        _html +=
6883          "<div class='divTableCell onel-th-x div-long'>" +
6884          dateTime[0] +
6885          " <span class='tclDec'>" +
6886          dateTime[1] +
6887          "</span></div>";
6888        _html += "<div class='divTableCell onel-th-x div-long2'>" + list[i].numero + "</div>";
6889        /*_html += "<div class='divTableCell onel-th-x div-y'>" +tcg.lib.prop("bettingMode_"+list[i].bet_mode)+ "</div>";*/
6890        _html += "<div class='divTableCell onel-th-x div-y'>" + list[i].chase_remark + "</div>";
6891        _html +=
6892          "<div class='divTableCell onel-th-x ps-num2' data-switchDecimal='" +
6893          decimal +
6894          "' data-value='" +
6895          list[i].plan_bet_amount +
6896          "'>" +
6897          tcg.ac.customCurrencyFormat(list[i].plan_bet_amount, decimal) +
6898          "</div>";
6899        _html +=
6900          "<div class='divTableCell onel-th-x ps-num2' data-switchDecimal='" +
6901          decimal +
6902          "' data-value='" +
6903          list[i].actual_bet_amount +
6904          "'>" +
6905          tcg.ac.customCurrencyFormat(list[i].actual_bet_amount, decimal) +
6906          "</div>";
6907        var color = list[i].status == 4 ? "tbl-red" : "";
6908        _html +=
6909          "<div class='divTableCell onel-th-x ps-num2 " +
6910          color +
6911          "' data-switchDecimal='" +
6912          decimal +
6913          "' data-value='" +
6914          list[i].win_amount +
6915          "'>" +
6916          tcg.ac.customCurrencyFormat(list[i].win_amount, decimal) +
6917          "</div>";
6918        _html +=
6919          "<div class='divTableCell onel-th-x div-z'>" + tcg.lib.prop("orderStatus_" + list[i].status) + "</div>";
6920        _html += "</div>";
6921      }
6922    } else {
6923      _html += "<div class='tableContent-wrp'>";
6924      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
6925      _html += "</div>";
6926    }
6927
6928    $("#teamBettingList").html(_html);
6929    var totalBetAmt = result.list.length == 0 ? 0 : total.total_plan_bet_amount;
6930    var totalActualBetAmt = result.list.length == 0 ? 0 : total.total_actual_bet_amount;
6931    var totalWinAmt = result.list.length == 0 ? 0 : total.total_win_amount;
6932    _total += "<div class='tbl-total-con inline-block'>" + tcg.lib.prop("ac_planned_bet_amount_total") + "</div>";
6933    _total +=
6934      "<div class='tbl-total-amt inline-block' data-switchDecimal='" +
6935      decimal +
6936      "' data-value='" +
6937      totalBetAmt +
6938      "'>" +
6939      tcg.ac.customCurrencyFormat(totalBetAmt, decimal) +
6940      "</div>";
6941    _total += "<div class='tbl-total-con inline-block'>" + tcg.lib.prop("ac_total_valid_betting_amount") + "</div>";
6942    _total +=
6943      "<div class='tbl-total-amt inline-block' data-switchDecimal='" +
6944      decimal +
6945      "' data-value='" +
6946      totalActualBetAmt +
6947      "'>" +
6948      tcg.ac.customCurrencyFormat(totalActualBetAmt, decimal) +
6949      "</div>";
6950    _total += "<div class='tbl-total-con inline-block'>" + tcg.lib.prop("ac_total_amount_prize_money") + "</div>";
6951    _total +=
6952      "<div class='tbl-total-amt inline-block' data-switchDecimal='" +
6953      decimal +
6954      "' data-value='" +
6955      totalWinAmt +
6956      "'>" +
6957      tcg.ac.customCurrencyFormat(totalWinAmt, decimal) +
6958      "</div>";
6959    $("#totalTeamBetting").html(_total);
6960
6961    $("#lottoTeamBetting input[name='order']").on("change", function () {
6962      $(this).val($(this).val().toUpperCase());
6963    });
6964  };
6965  // tcg.ac.ui.loadLottoGameHistoryItem = function (result, orderMasterId, chasing) {
6966  //     var decimal = 2;
6967  //     globalVar.orderMasterId = orderMasterId;
6968  //     globalVar.orderMultiple = result.multiple;
6969  //     $("#itemWrapper .prsnl-game-name").html("<span id='rm_" + result.gameC
6969ode + "'>&nbsp;</span>");
6970  //     var orderNumber = tcg.ac.shortenText(result.orderNumber);
6971  //     if (!$("#chasing").hasClass("hide")) {
6972  //         $("#chasing").addClass("hide");
6973  //     }
6974  //     ;
6975  //     if (chasing == true || chasing == "true") {
6976  //         var chasingOrder = result.chasingOrder;
6977  //         orderNumber = orderNumber + "-" + tcg.ac.ui.strPad(chasingOrder, 3);
6978  //         $("#chasing").removeClass("hide");
6979  //     }
6980  //     $("#itemWrapper #lotteryNum").removeClass("double");
6981  //     $("#itemWrapper .orderNo").text(orderNumber);
6982  //     $("#itemWrapper .seriesModel").text(result.series + "/" + tcg.lib.prop("bettingMode_" + result.bettingModeCode));
6983  //     $("#itemWrapper .prizeMoney").html(result.winningAmount == null ? "-" : result.winningAmount.toFixed(4));
6984  //     $("#itemWrapper .bettingNoteCount").text(result.stakes);
6985  //     $("#itemWrapper .bettingMultiples").html(tcg.ac.currencyFormat(result.multiple));
6986  //     $("#itemWrapper .bettingTime").text(tcg.ac.timeToDateFormat(result.bettingTime, "dateTime"));
6987  //     $("#itemWrapper .orderStatus").text(tcg.lib.prop("orderStatus_" + result.orderStatus));
6988  //     $("#itemWrapper .bettingOnNumber").text(result.numero);
6989  //     var lotteryNumbers = result.winningNumber == null ? "-" : result.winningNumber;
6990  //     var splitChar = lotteryNumbers.indexOf(",") < 0 ? "" : ",";
6991  //     $("#itemWrapper #lotteryNum").html("<span>" + lotteryNumbers.split(splitChar).join("</span><span>") + "</span>");
6992  //     if (result.winningNumber != null) {
6993  //         $("#itemWrapper #lotteryNum").addClass("lotteryNumbers")
6994  //     }
6995  //     ;
6996  //     if (splitChar == ",") {
6997  //         $("#itemWrapper #lotteryNum").addClass("double")
6998  //     }
6999  //     ;
7000  //     var _html = "", pageNo = $("#itemWrapper [name='pageNo']");
7001  //     var data = {
7002  //         page: (pageNo.val() * 1) - 1,
7003  //         size: 100
7004  //     }
7005  //     tcg.ac.api.orderInfos(data, function (orderInfo, textStatus, jqXHR) {
7006  //         var orderInfos = orderInfo.content;
7007  //         for (var i = 0; i < orderInfos.length; i++) {
7008  //             var betRow = tcg.ac.betMap(orderInfos[i]);
7009  //             _html += "<div class='divTableRow'>";
7010  //             _html += "<div class='divTableCell onel-cl-y ps-cen yel-pop'>" + lottTranslator.translatePlayName(orderInfos[i].playId,orderInfos[i].playCode,orderInfos[i].bettingContent);
7011  //             _html += "<div class='pop-yellow' style='left:0'>" + lottTranslator.translatePlayName(orderInfos[i].playId,orderInfos[i].playCode,orderInfos[i].bettingContent) + "</div>";
7012  //             _html += "</div>"
7013  //             _html += "<div class='divTableCell onel-cl-y ps-cen yel-pop xdaLs'>" + lottTranslator.translateBallContentText(orderInfos[i].playId,orderInfos[i].bettingContent) + "<div class='pop-yellow'>";
7014  //             _html += lottTranslator.translateBallContentText(orderInfos[i].playId,orderInfos[i].bettingContent);
7015  //             _html += "</div></div>";
7016  //             _html += "<div class='divTableCell onel-cl-y ps-cen xd2-xda'>" + orderInfos[i].stakes + "</div>";
7017  //             var multiple = (orderInfos[i].multiple * 1) * (globalVar.orderMultiple * 1);
7018  //             _html += "<div class='divTableCell onel-cl-y ps-cen xd3-xda'>" + orderInfos[i].series + "/" + tcg.lib.prop("bettingMode_" + orderInfos[i].bettingMode) + "/" + multiple + "</div>";
7019  //             var total_bet_amt = (orderInfos[i].bettingAmount * 1) * (globalVar.orderMultiple * 1);
7020  //             _html += "<div class='divTableCell onel-cl-y ps-cen xg-xlass' data-switchDecimal='" + decimal + "' data-value='" + total_bet_amt + "'>" + tcg.ac.customCurrencyFormat(total_bet_amt, decimal) + "</div>";
7021  //             _html += "</div>";
7022  //         }
7023
7024  //         if (result.orderStatus == 2) {
7025  //             $("#cancelGameHistoryDetail").parent().show();
7026  //         } else {
7027  //             $("#cancelGameHistoryDetail").parent().hide();
7028  //         }
7029  //         $("#itemList").html(_html);
7030  //         $(".moreText").on("click", function () {
7031  //             tcg.ac.showLongText($(this).attr("data-text"));
7032  //         });
7033  //         tcg.ac.ui.loadPagination("itemWrapper", pageNo.val(), orderInfo.totalPages, "#orderDetailPagination");
7034  //     });
7035  //     tcg.ac.switchDecimal("#switchDecimal");
7036  //     $("#chasing").on("click", function () {
7037  //         sessionStorage.setItem("orderMasterId", orderMasterId);
7038  //         sessionStorage.setItem("chasingOrder", result.chasingOrder);
7039  //         sessionStorage.setItem("chasing", chasing);
7040  //         $('.model_child_menus li[data-submenu="norecordChase"]').trigger('click');
7041  //     })
7042  //     tcg.ac.ui.goBackToGameHistory();
7043  //     tcg.ac.ui.addCopySelection('js-copybtn');
7044  // };
7045  tcg.ac.ui.loadOrderDetail = function (result, icon) {
7046    globalVar.orderMasterId = result.orderMasterId;
7047    globalVar.orderMultiple = result.multiple;
7048
7049    $("#gameHistoryDetail .prsnl-game-name").html(
7050      "<span id='rm_" +
7051        result.gameCode +
7052        "' style='background-image: url(" +
7053        icon[result.gameCode] +
7054        ");background-size: 100%;background-repeat: no-repeat;background-position: center;'>&nbsp;</span>"
7055    );
7056
7057    var orderNumber = tcg.ac.shortenText(result.orderNumber);
7058    if (!$("#chasing").hasClass("hide")) {
7059      $("#chasing").addClass("hide");
7060    }
7061    var chasing = result.chasingOrder;
7062    if (chasing == true || chasing == "true") {
7063      var chasingOrder = result.chasingOrder;
7064      orderNumber = orderNumber + "-" + tcg.ac.ui.strPad(chasingOrder, 3);
7065      $("#chasing").removeClass("hide");
7066    }
7067    $("#gameHistoryDetail #lotteryNum").removeClass("double");
7068    $("#gameHistoryDetail .orderNo").text(orderNumber);
7069    $("#gameHistoryDetail .bettingTime").text(tcg.ac.timeToDateFormat(result.bettingTime, "dateTime"));
7070    $("#gameHistoryDetail .prizeMoney").html(result.winningAmount == null ? "-" : result.winningAmount.toFixed(4));
7071    $("#gameHistoryDetail .bettingNoteCount").text(result.stakes);
7072    $("#gameHistoryDetail .orderStatus").text(tcg.lib.prop("orderStatus_" + result.orderStatus));
7073    var lotteryNumbers = result.winningNumber == null ? "-" : result.winningNumber;
7074    var splitChar = lotteryNumbers.indexOf(",") < 0 ? "" : ",";
7075    $("#gameHistoryDetail #lotteryNum").html(
7076      "<span>" + lotteryNumbers.split(splitChar).join("</span><span>") + "</span>"
7077    );
7078    $("#gameHistoryDetail .bettingOnNumber").text(result.numero);
7079  };
7080  tcg.ac.ui.loadOrderInfo = function (result) {
7081    var decimal = 2;
7082    var html = "";
7083    var content = result.content;
7084    $("#member_management #gameHistoryDetail #itemList").html("");
7085    for (var i = 0; i < content.length; i++) {
7086      html += '<div class="divTableRow">';
7087      html +=
7088        '<div class="divTableCell onel-cl-y ps-cen yel-npop yel-pop">' +
7089        lottTranslator.translatePlayName(content[i].playId, content[i].playCode, content[i].bettingContent) +
7090        '<div class="pop-yellow" style="left:0">' +
7091        lottTranslator.translatePlayName(content[i].playId, content[i].playCode, content[i].bettingContent) +
7092        "</div></div>";
7093      html +=
7094        '<div class="divTableCell onel-cl-y ps-cen yel-pop xdaLs"><span class="divTableCellnspan">' +
7095        lottTranslator.translateBallContentText(content[i].playId, content[i].bettingContent) +
7096        '</span><div class="pop-yellow">' +
7097        lottTranslator.translateBallContentText(content[i].playId, content[i].bettingContent) +
7098        "</div></div>";
7099      html += '<div class="divTableCell onel-cl-y ps-cen xg-xlass">' + content[i].stakes + "</div>";
7100      html +=
7101        '<div class="divTableCell onel-cl-y ps-cen xd3-xda">' +
7102        content[i].series +
7103        "/元/" +
7104        content[i].multiple +
7105        "</div>";
7106      var multiple = content[i].multiple * 1 * (globalVar.orderMultiple * 1);
7107      var total_bet_amt = content[i].bettingAmount * 1 * (globalVar.orderMultiple * 1);
7108      html +=
7109        "<div class='divTableCell onel-cl-y ps-cen xg-xlass' data-switchDecimal='" +
7110        decimal +
7111        "' data-value='" +
7112        total_bet_amt +
7113        "'>" +
7114        tcg.ac.customCurrencyFormat(total_bet_amt, decimal) +
7115        "</div>";
7116      html += "</div>";
7117    }
7118    return html;
7119  };
7120  tcg.ac.ui.goBackToGameHistory = function () {
7121    $(document)
7122      .off("click", "#backToGameHistory")
7123      .on("click", "#backToGameHistory", function () {
7124        var lastPage = sessionStorage.getItem("lastPage"),
7125          childMenu = sessionStorage.getItem("childMenu");
7126        switch (lastPage) {
7127          case "teamBetting":
7128            $("#itemWrapper").addClass("hide");
7129            $("#teamBetting").removeClass("hide");
7130            tcg.ac.searchTeamBetting();
7131            break;
7132          default:
7133        }
7134        sessionStorage.removeItem("lastPage");
7135      });
7136  };
7137  /*when click copy the text*/
7138  tcg.ac.ui.addCopySelection = function (selectionId) {
7139    // remove style
7140    document.getElementById(selectionId).removeAttribute("style", true);
7141
7142    $(document)
7143      .off("click", "#" + selectionId)
7144      .on("click", "#" + selectionId, function () {
7145        var text = $(this).html();
7146        try {
7147          // set background highlight
7148          $(this).css({
7149            "background-color": "#004A88",
7150            color: "#fff",
7151          });
7152
7153          // for IE
7154          if (window.clipboardData && window.clipboardData.setData) {
7155            window.clipboardData.setData("Text", text);
7156          } else {
7157            document.execCommand("copy");
7158            document.execCommand("copy", false, text);
7159          }
7160        } catch (err) {
7161          alert("Oops, unable to copy");
7162        }
7163      });
7164  };
7165  tcg.ac.ui.switchAgentTeamBetting = function () {
7166    $(document)
7167      .off("click", "#switchAgentTeamBetting li")
7168      .on("click", "#switchAgentTeamBetting li", function () {
7169        if ($(this).attr("data-rel") == "lotto") {
7170          $("#pvpTeamBetting").addClass("hide");
7171          $("#lottoTeamBetting").removeClass("hide");
7172          $("#lottoTeamBettingForm .form-submit").click();
7173        } else {
7174          $("#lottoTeamBetting").addClass("hide");
7175          $("#pvpTeamBetting").removeClass("hide");
7176          $("#pvpTeamBettingForm .form-submit").click();
7177        }
7178        $("#switchAgentTeamBetting li.active").removeClass("active");
7179        $(this).addClass("active");
7180      });
7181  };
7182  tcg.ac.ui.loadGroupGames = function (_html) {
7183    $("#customGameList").html(_html);
7184    $("#lottoTeamBettingForm .form-submit").click();
7185    tcg.ac.ui.customSelectGame("#lottoTeamBettingForm [name='game']");
7186  };
7187  tcg.ac.ui.customSelectGame = function (id) {
7188    var id = id;
7189    $(document)
7190      .off("click", id)
7191      .on("click", id, function () {
7192        var parentDiv = $(this).parents(".selectGame");
7193        var input = parentDiv.find("[name='game']");
7194        parentDiv.addClass("show-data");
7195        parentDiv
7196          .find(".gameList .game")
7197          .unbind("click")
7198          .bind("click", function (e) {
7199            var selected = $(this),
7200              gameCode = selected.attr("data-gameCode");
7201            if (gameCode == "") {
7202              input.val(selected.text()).attr({ "data-gameCode": selected.attr("data-gameCode") });
7203              parentDiv.find(".gameList .game").removeClass("selected");
7204              parentDiv.find(".gameList .game-all").addClass("selected");
7205            } else {
7206              parentDiv.find(".gameList .game-all").removeClass("selected");
7207              var arrVal = input.attr("data-gameCode") == "" ? [] : input.val().split(","),
7208                arrCode = input.attr("data-gameCode") == "" ? [] : input.attr("data-gameCode").split(",");
7209              if ($(this).hasClass("selected")) {
7210                var index = arrVal.indexOf(selected.text());
7211                if (index >= 0) {
7212                  arrVal.splice(index, 1);
7213                }
7214                var index = arrCode.indexOf(gameCode);
7215                if (index >= 0) {
7216                  arrCode.splice(index, 1);
7217                }
7218                selected.removeClass("selected");
7219              } else {
7220                if (arrCode.indexOf(gameCode) < 0) {
7221                  arrVal.push(selected.text());
7222                  arrCode.push(gameCode);
7223                  selected.addClass("selected");
7224                }
7225              }
7226              if (arrVal.length > 0) {
7227                input.val(arrVal.join(","));
7228                input.attr({ "data-gameCode": arrCode.join(",") });
7229              } else {
7230                input.val("全部");
7231                input.attr({ "data-gameCode": "" });
7232                parentDiv.find(".gameList .game").removeClass("selected");
7233                parentDiv.find(".gameList .game-all").addClass("selected");
7234              }
7235            }
7236            // $(document).off("click","html");
7237            // parentDiv.removeClass("show-data");
7238          });
7239        $(document)
7240          .off("click", "html")
7241          .on("click", "html", function (e) {
7242            if (e.target.id == "customGameList" || $(e.target).parents("#customGameList")[0]) {
7243            } else {
7244              $(document).off("click", "html");
7245              parentDiv.removeClass("show-data");
7246            }
7247          });
7248      });
7249  };
7250  tcg.ac.ui.loadGameRooms = function (targetId, gameType, type) {
7251    var rng = "",
7252      pvp = "";
7253
7254    rng += "<option value='game_ag_6'>" + tcg.lib.prop("ac_subordinate_management_betting_history_tab_4") + "</option>";
7255    pvp += "<option value=''>" + tcg.lib.prop("ac_all") + "</option>";
7256    pvp += "<option value='bjl_room'>" + tcg.lib.prop("ac_game_baccarat") + "</option>";
7257    pvp += "<option value='gswz_room'>" + tcg.lib.prop("ac_game_5_in_hk") + "</option>";
7258    pvp += "<option value='thirteen_room'>" + tcg.lib.prop("ac_game_13_water") + "</option>";
7259    pvp += "<option value='tbnn_room'>" + tcg.lib.prop("ac_game_tiberius") + "</option>";
7260    pvp += "<option value='nn_room'>" + tcg.lib.prop("ac_game_taurus") + "</option>";
7261    pvp += "<option value='zjh_room'>" + tcg.lib.prop("ac_game_zhunjinhua") + "</option>";
7262    $(targetId).html(gameType == 0 || gameType == "PVP" ? pvp : rng);
7263
7264    var type = type || "set";
7265    if (type == "set") {
7266      tcg.ac.ui.customSelect(targetId);
7267    } else {
7268      $(targetId).trigger("chosen:updated");
7269    }
7270  };
7271  tcg.ac.ui.showMorePvpFilter = function () {
7272    $(document)
7273      .off("click", "#pvpTeamBettingForm .tabBtn")
7274      .on("click", "#pvpTeamBettingForm .tabBtn", function () {
7275        var form = $("#pvpTeamBettingForm"),
7276          otherFilter = form.find(".otherFilter"),
7277          table = $("#tableContainer");
7278        if (otherFilter.hasClass("hide")) {
7279          $(this).addClass("active");
7280          otherFilter.removeClass("hide");
7281          table.addClass("mini");
7282          $("#lottoGameHistoryList").addClass("y-overflow");
7283          tcg.ac.ui.customSelect("#lottoGameHistoryForm [name='chaseStatus']");
7284        } else {
7285          $(this).removeClass("active");
7286          otherFilter.addClass("hide");
7287          table.removeClass("mini");
7288          $("#lottoGameHistoryList").removeClass("y-overflow");
7289        }
7290      });
7291  };
7292  tcg.ac.ui.searchPvpTeamBetting = function () {
7293    $(document)
7294      .off("click", "#pvpTeamBettingForm .form-submit")
7295      .on("click", "#pvpTeamBettingForm .form-submit", function () {
7296        tcg.ac.getPvpTeamBetting();
7297      });
7298  };
7299  tcg.ac.ui.loadPvpTeamBetting = function (result, gameType) {
7300    var decimal = 2,
7301      _html = "",
7302      _total = "",
7303      total = result.footer,
7304      list = result.list;
7305
7306    if (list.length > 0) {
7307      for (var i = 0; i < list.length; i++) {
7308        _html += "<div class='divTableRow'>";
7309        var gameType =
7310          list[i].game_category == "PVP"
7311            ? tcg.lib.prop("ac_subordinate_management_betting_history_tab_6")
7312            : tcg.lib.prop("ac_subordinate_management_betting_history_tab_4");
7313        _html += "<div class='divTableCell'>" + gameType + "</div>";
7314        _html += "<div class='divTableCell'>" + list[i].game_name + "</div>";
7315        _html += "<div class='divTableCell'>" + list[i].customer_name + "</div>";
7316        _html +=
7317          "<div class='divTableCell' data-switchDecimal='" +
7318          decimal +
7319          "' data-value='" +
7320          list[i].game_loses +
7321          "'>" +
7322          tcg.ac.customCurrencyFormat(list[i].game_loses, decimal) +
7323          "</div>";
7324        _html +=
7325          "<div class='divTableCell' data-switchDecimal='" +
7326          decimal +
7327          "' data-value='" +
7328          list[i].game_winnings +
7329          "'>" +
7330          tcg.ac.customCurrencyFormat(list[i].game_winnings, decimal) +
7331          "</div>";
7332        var netProfitColor = list[i].net_profit >= 0 ? "tbl-red" : "tbl-green";
7333        _html +=
7334          "<div class='divTableCell " +
7335          netProfitColor +
7336          "' data-switchDecimal='" +
7337          decimal +
7338          "' data-value='" +
7339          list[i].net_profit +
7340          "'>" +
7341          tcg.ac.customCurrencyFormat(list[i].net_profit, decimal) +
7342          "</div>";
7343        _html += "</div>";
7344      }
7345    } else {
7346      _html += "<div class='tableContent-wrp'>";
7347      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
7348      _html += "</div>";
7349    }
7350
7351    $("#pvpTeamBettingTable .betLost").text(
7352      gameType == "PVP" ? tcg.lib.prop("ac_net_money") : tcg.lib.prop("ac_bet_amount")
7353    );
7354    $("#pvpTeamBettingTable .prizeWon").text(
7355      gameType == "PVP" ? tcg.lib.prop("ac_net_amount_of_money") : tcg.lib.prop("ac_winning_amount")
7356    );
7357
7358    $("#pvpTeamBettingList").html(_html);
7359    var _total = "",
7360      total = result.footer,
7361      label_betLoss = gameType == "PVP" ? tcg.lib.prop("ac_net_amount_money") : tcg.lib.prop("ac_bet_amount_total"),
7362      label_betWin =
7363        gameType == "PVP" ? tcg.lib.prop("ac_total_amount_net_win") : tcg.lib.prop("ac_total_amount_prize"),
7364      label_pnl =
7365        gameType == "PVP"
7366          ? tcg.lib.prop("ac_game_profit_and_loss_total")
7367          : tcg.lib.prop("ac_game_profit_and_loss_total"),
7368      totalGameLoses = list.length == 0 ? 0 : total.game_loses,
7369      totalGameWinnings = list.length == 0 ? 0 : total.game_winnings,
7370      totalNetProfit = list.length == 0 ? 0 : total.net_profit;
7371    _total += "<div class='tbl-total-con inline-block'>" + label_betLoss + ":</div>";
7372    _total +=
7373      "<div class='tbl-total-amt inline-block' data-switchdecimal='" +
7374      decimal +
7375      "' data-value='" +
7376      totalGameLoses +
7377      "'>" +
7378      tcg.ac.customCurrencyFormat(totalGameLoses, decimal) +
7379      "</div>";
7380    _total += "<div class='tbl-total-con inline-block'>" + label_betWin + ":</div>";
7381    _total +=
7382      "<div class='tbl-total-amt inline-block' data-switchdecimal='" +
7383      decimal +
7384      "' data-value='" +
7385      totalGameWinnings +
7386      "'>" +
7387      tcg.ac.customCurrencyFormat(totalGameWinnings, decimal) +
7388      "</div>";
7389    _total += "<div class='tbl-total-con inline-block'>" + label_pnl + ":</div>";
7390    _total +=
7391      "<div class='tbl-total-amt inline-block' data-switchdecimal='" +
7392      decimal +
7393      "' data-value='" +
7394      totalNetProfit +
7395      "'>" +
7396      tcg.ac.customCurrencyFormat(totalNetProfit, decimal) +
7397      "</div>";
7398    $("#pvpTeamBettingTotal").html(_total);
7399  };
7400
7401  // Personal History
7402  tcg.ac.ui.loadRngReportsWalletCopy = function (vendors) {
7403    var _html = "",
7404      _num = 0;
7405    for (var i = 0; i < vendors.length; i++) {
7406      if (vendors[i] == "SAFE_BOX" || vendors[i] == "LOTT") continue;
7407      var cn = _num == 0 ? "default" : "";
7408      _html += "<li data-value='" + vendors[i] + "' class='" + cn + "'>" + vendors[i] + "</li>";
7409      _num++;
7410    }
7411    if (_num == 0) {
7412      return false;
7413    }
7414    return _html;
7415  };
7416  tcg.ac.ui.loadRngReportsCopy = function (data) {
7417    var _html = "",
7418      decimal = 2;
7419    var subTotalBetAmt = 0;
7420    var subTotalWinAmt = 0;
7421    var list = data.list;
7422    var footer = data.footer;
7423    if (list.length > 0) {
7424      for (var i = 0; i < list.length; i++) {
7425        var color = i % 2 == 1 ? "tbl-tr-even" : "tbl-tr-odd";
7426        _html += '<div class="divTableRow ' + color + '">';
7427        _html += '<div class="divTableCell">' + list[i].customerName + "</div>";
7428        _html += '<div class="divTableCell long">' + moment(list[i].betTime).format("YYYY-MM-DD HH:mm:ss") + "</div>";
7429        _html +=
7430          '<div class="divTableCell" data-switchDecimal="' +
7431          decimal +
7432          '" data-value="' +
7433          list[i].betAmount +
7434          '">' +
7435          tcg.ac.currencyFormat(list[i].betAmount, decimal) +
7436          "</div>";
7437        _html +=
7438          '<div class="divTableCell" data-switchDecimal="' +
7439          decimal +
7440          '" data-value="' +
7441          list[i].validBetAmount +
7442          '">' +
7443          tcg.ac.currencyFormat(list[i].validBetAmount, decimal) +
7444          "</div>";
7445        _html +=
7446          '<div class="divTableCell" data-switchDecimal="' +
7447          decimal +
7448          '" data-value="' +
7449          list[i].winAmount +
7450          '">' +
7451          tcg.ac.currencyFormat(list[i].winAmount, decimal) +
7452          "</div>";
7453        _html +=
7454          '<div class="divTableCell" data-switchDecimal="' +
7455          decimal +
7456          '" data-value="' +
7457          list[i].profitAndLoss +
7458          '">' +
7459          tcg.ac.currencyFormat(list[i].profitAndLoss, decimal) +
7460          "</div>";
7461        _html += '<div class="divTableCell" data-value="' + list[i].gameNameCN + '">' + list[i].gameNameCN + "</div>";
7462        _html += '<div class="divTableCell">' + list[i].orderNo + "</div>";
7463        _html += "</div>";
7464      }
7465      // SubTotal
7466      $("#betHistoryTotal .betAmount").text(tcg.ac.currencyFormat(footer.betAmount, decimal)).attr({
7467        "data-switchDecimal": decimal,
7468        "data-value": footer.betAmount,
7469      });
7470      $("#betHistoryTotal .subTotalBetAmt").text(tcg.ac.currencyFormat(footer.validBetAmount, decimal)).attr({
7471        "data-switchDecimal": decimal,
7472        "data-value": footer.validBetAmount,
7473      });
7474      $("#betHistoryTotal .subTotalWinAmt").text(tcg.ac.currencyFormat(footer.winAmount, decimal)).attr({
7475        "data-switchDecimal": decimal,
7476        "data-value": footer.winAmount,
7477      });
7478      $("#betHistoryTotal .subTotalPnl").text(tcg.ac.currencyFormat(footer.profitAndLoss, decimal)).attr({
7479        "data-switchDecimal": decimal,
7480        "data-value": footer.profitAndLoss,
7481      });
7482    } else {
7483      _html += "<div class='divTableRow dtr_noRecord'>";
7484      _html += "<div class='divTableCell ps-strings'>" + tcg.lib.prop("ac_reports_no_data") + "</div>";
7485      _html += "</div>";
7486    }
7487    return _html;
7488  };
7489  tcg.ac.ui.loadPvpReportsCopy = function (data) {
7490    var _html = "",
7491      decimal = 2;
7492    var subTotalBetAmt = 0;
7493    var subTotalWinAmt = 0;
7494    var list = data.list;
7495    var footer = data.footer;
7496    if (list.length > 0) {
7497      for (var i = 0; i < list.length; i++) {
7498        var color = i % 2 == 1 ? "tbl-tr-even" : "tbl-tr-odd";
7499        _html += '<div class="divTableRow ' + color + '">';
7500        _html += '<div class="divTableCell ps-strings">' + list[i].customerName + "</div>";
7501        _html +=
7502          '<div class="divTableCell ps-strings">' + moment(list[i].betTime).format("YYYY-MM-DD HH:mm:ss") + "</div>";
7503        _html +=
7504          '<div class="divTableCell ps-strings" data-switchDecimal="' +
7505          decimal +
7506          '" data-value="' +
7507          list[i].startMoney +
7508          '">' +
7509          tcg.ac.currencyFormat(list[i].startMoney, decimal) +
7510          "</div>";
7511        _html +=
7512          '<div class="divTableCell ps-strings" data-switchDecimal="' +
7513          decimal +
7514          '" data-value="' +
7515          list[i].endMoney +
7516          '">' +
7517          tcg.ac.currencyFormat(list[i].endMoney, decimal) +
7518          "</div>";
7519        _html +=
7520          '<div class="divTableCell ps-strings" data-switchDecimal="' +
7521          decimal +
7522          '" data-value="' +
7523          list[i].profitAndLoss +
7524          '">' +
7525          tcg.ac.currencyFormat(list[i].profitAndLoss, decimal) +
7526          "</div>";
7527        _html +=
7528          '<div class="divTableCell ps-strings" data-value="' +
7529          list[i].gameNameCN +
7530          '">' +
7531          list[i].gameNameCN +
7532          "</div>";
7533        _html += '<div class="divTableCell ps-strings">' + list[i].orderNo + "</div>";
7534        _html += "</div>";
7535      }
7536      // SubTotal
7537      // $("#betHistoryTotal .subTotalBetAmt").text( tcg.ac.currencyFormat(footer.validBetAmount, decimal) ).attr({"data-switchDecimal": decimal, "data-value": footer.validBetAmount });
7538      // $("#betHistoryTotal .subTotalWinAmt").text( tcg.ac.currencyFormat(footer.winAmount, decimal) ).attr({"data-switchDecimal": decimal, "data-value": footer.winAmount });
7539      $("#betHistoryTotal .subTotalPnl").text(tcg.ac.currencyFormat(footer.profitAndLoss, decimal)).attr({
7540        "data-switchDecimal": decimal,
7541        "data-value": footer.profitAndLoss,
7542      });
7543    } else {
7544      _html += "<div class='divTableRow dtr_noRecord'>";
7545      _html += "<div class='divTableCell ps-strings'>" + tcg.lib.prop("ac_reports_no_data") + "</div>";
7546      _html += "</div>";
7547    }
7548    return _html;
7549  };
7550  tcg.ac.ui.loadSportsReportsCopy = function (api, data) {
7551    var _html = "",
7552      decimal = 2;
7553    var subTotalBetAmt = 0;
7554    var subTotalWinAmt = 0;
7555    var list = data.list;
7556    var footer = data.footer;
7557    if (list.length > 0) {
7558      for (var i = 0; i < list.length; i++) {
7559        var color = i % 2 == 1 ? "tbl-tr-even" : "tbl-tr-odd";
7560        _html += '<div class="divTableRow ' + color + '">';
7561        _html += '<div class="divTableCell ps-strings">' + list[i].customerName + "</div>";
7562        _html +=
7563          '    <div class="divTableCell ps-strings dateCell">' +
7564          moment(orders[i].betTime).format("YYYY-MM-DD HH:mm:ss") +
7565          "</div>";
7566        _html +=
7567          '    <div class="divTableCell ps-strings dateCell">' +
7568          moment(orders[i].transTime).format("YYYY-MM-DD HH:mm:ss") +
7569          "</div>";
7570        _html +=
7571          '    <div class="divTableCell ps-strings ac_tooltipster_hover longName" data-value="' +
7572          list[i].selection +
7573          '"><span class="ac_elipser">' +
7574          tcg.ac.strSub(list[i].selection, 15) +
7575          '</span><span class="ac_tooltipster hide">' +
7576          list[i].selection +
7577          "</span></div>";
7578        _html +=
7579          '    <div class="divTableCell ps-strings" data-switchDecimal="' +
7580          decimal +
7581          '" data-value="' +
7582          list[i].odds +
7583          '">' +
7584          tcg.ac.currencyFormat(list[i].odds, decimal) +
7585          "</div>";
7586        _html +=
7587          '    <div class="divTableCell ps-strings" data-switchDecimal="' +
7588          decimal +
7589          '" data-value="' +
7590          list[i].betAmount +
7591          '">' +
7592          tcg.ac.currencyFormat(list[i].betAmount, decimal) +
7593          "</div>";
7594        var winAmt = list[i].winAmount ? list[i].winAmount : 0;
7595        var rowStatus = list[i].status ? tcg.lib.prop("status_order_" + list[i].status) : "-";
7596        _html +=
7597          '    <div class="divTableCell ps-strings" data-switchDecimal="' +
7598          decimal +
7599          '" data-value="' +
7600          list[i].winAmt +
7601          '">' +
7602          tcg.ac.currencyFormat(winAmt, decimal) +
7603          "</div>";
7604        _html +=
7605          '    <div class="divTableCell ps-strings betStatus"  data-value="' + rowStatus + '" >' + rowStatus + "</div>";
7606        _html +=
7607          '    <div class="divTableCell ps-strings ac_tooltipster_hover longName" data-value="' +
7608          list[i].eventName +
7609          '"><span class="ac_elipser">' +
7610          tcg.ac.strSub(list[i].eventName, 15) +
7611          '</span><span class="ac_tooltipster hide">' +
7612          list[i].eventName +
7613          "</span></div>";
7614        _html += "</div>";
7615      }
7616      // SubTotal
7617      if (api == "set") {
7618        $("#betHistoryTotal .subTotalPnl").text(tcg.ac.currencyFormat(footer.profitAndLoss, decimal)).attr({
7619          "data-switchDecimal": decimal,
7620          "data-value": footer.profitAndLoss,
7621        });
7622        $("#betHistoryTotal .subTotalBetAmt").text(tcg.ac.currencyFormat(footer.validBetAmount, decimal)).attr({
7623          "data-switchDecimal": decimal,
7624          "data-value": footer.validBetAmount,
7625        });
7626        $("#betHistoryTotal .subTotalWinAmt").text(tcg.ac.currencyFormat(footer.winAmount, decimal)).attr({
7627          "data-switchDecimal": decimal,
7628          "data-value": footer.winAmount,
7629        });
7630      } else {
7631        $("#betHistoryTotal .subTotalPnl").text(tcg.ac.currencyFormat(footer.profitAndLoss, decimal)).attr({
7632          "data-switchDecimal": decimal,
7633          "data-value": footer.profitAndLoss,
7634        });
7635        footer.winAmount = footer.winAmount ? tcg.mc.currencyFormat(footer.winAmount, decimal) : 0;
7636        $("#betHistoryTotal .subTotalBetAmt").text(tcg.ac.currencyFormat(footer.betAmount, decimal)).attr({
7637          "data-switchDecimal": decimal,
7638          "data-value": footer.betAmount,
7639        });
7640        $("#betHistoryTotal .subTotalWinAmt").text(tcg.ac.currencyFormat(footer.winAmount, decimal)).attr({
7641          "data-switchDecimal": decimal,
7642          "data-value": footer.winAmount,
7643        });
7644      }
7645    } else {
7646      _html += "<div class='divTableRow dtr_noRecord'>";
7647      _html += "<div class='divTableCell ps-strings'>" + tcg.lib.prop("ac_reports_no_data") + "</div>";
7648      _html += "</div>";
7649    }
7650    return _html;
7651  };
7652  tcg.ac.ui.loadElottReportsCopy = function (api, data) {
7653    var _html = "",
7654      decimal = 2;
7655    var subTotalBetAmt = 0;
7656    var subTotalWinAmt = 0;
7657    var list = data.list;
7658    var footer = data.footer;
7659    if (list.length > 0) {
7660      for (var i = 0; i < list.length; i++) {
7661        var color = i % 2 == 1 ? "tbl-tr-even" : "tbl-tr-odd";
7662        _html += '<div class="divTableRow ' + color + '">';
7663        _html += '<div class="divTableCell ps-strings">' + list[i].customerName + "</div>";
7664        _html += '    <div class="divTableCell ps-strings">' + list[i].gameNameCN + "</div>";
7665        _html +=
7666          '    <div class="divTableCell ps-strings">' +
7667          moment(list[i].betTime).format("YYYY-MM-DD HH:mm:ss") +
7668          "</div>";
7669        _html +=
7670          '    <div class="divTableCell ps-strings" data-switchDecimal="' +
7671          decimal +
7672          '" data-value="' +
7673          list[i].betAmount +
7674          '">' +
7675          tcg.ac.currencyFormat(list[i].betAmount, decimal) +
7676          "</div>";
7677        var validBetAmount = list[i].validBetAmount ? list[i].validBetAmount : 0;
7678        _html +=
7679          '    <div class="divTableCell ps-strings" data-switchDecimal="' +
7680          decimal +
7681          '" data-value="' +
7682          validBetAmount +
7683          '">' +
7684          tcg.ac.currencyFormat(validBetAmount, decimal) +
7685          "</div>";
7686        var winAmt = api == "sett" ? list[i].winAmount : 0;
7687        var rowStatus = api == "sett" ? tcg.lib.prop("status_order_" + list[i].status) : "-";
7688        _html +=
7689          '    <div class="divTableCell ps-strings" data-switchDecimal="' +
7690          decimal +
7691          '" data-value="' +
7692          winAmt +
7693          '">' +
7694          tcg.ac.currencyFormat(winAmt, decimal) +
7695          "</div>";
7696        _html += '    <div class="divTableCell ps-strings" data-value="' + rowStatus + '">' + rowStatus + "</div>";
7697        _html += '    <div class="divTableCell ps-strings">' + list[i].orderNo + "</div>";
7698        _html += "</div>";
7699      }
7700      // SubTotal
7701      if (api == "sett") {
7702        $("#betHistoryTotal .subTotalBetAmt").text(tcg.ac.currencyFormat(footer.betAmount, decimal)).attr({
7703          "data-switchDecimal": decimal,
7704          "data-value": footer.betAmount,
7705        });
7706        $("#betHistoryTotal .subTotalWinAmt").text(tcg.ac.currencyFormat(footer.validBetAmount, decimal)).attr({
7707          "data-switchDecimal": decimal,
7708          "data-value": footer.validBetAmount,
7709        });
7710        $("#betHistoryTotal .subTotalPnl").text(tcg.ac.currencyFormat(footer.winAmount, decimal)).attr({
7711          "data-switchDecimal": decimal,
7712          "data-value": footer.winAmount,
7713        });
7714      } else {
7715        footer.validBetAmount = 0;
7716        footer.winAmount = 0;
7717        $("#betHistoryTotal .subTotalBetAmt").text(tcg.ac.currencyFormat(footer.betAmount, decimal)).attr({
7718          "data-switchDecimal": decimal,
7719          "data-value": footer.betAmount,
7720        });
7721        $("#betHistoryTotal .subTotalWinAmt").text(tcg.ac.currencyFormat(footer.validBetAmount, decimal)).attr({
7722          "data-switchDecimal": decimal,
7723          "data-value": footer.validBetAmount,
7724        });
7725        $("#betHistoryTotal .subTotalPnl").text(tcg.ac.currencyFormat(footer.winAmount, decimal)).attr({
7726          "data-switchDecimal": decimal,
7727          "data-value": footer.winAmount,
7728        });
7729      }
7730    } else {
7731      _html += "<div class='divTableRow dtr_noRecord'>";
7732      _html += "<div class='divTableCell ps-strings'>" + tcg.lib.prop("ac_reports_no_data") + "</div>";
7733      _html += "</div>";
7734    }
7735    return _html;
7736  };
7737  tcg.ac.ui.loadLottoGameHistory = function (result) {
7738    var _html = "",
7739      decimal = 2,
7740      orders = result.value.list;
7741    if (orders.length > 0) {
7742      for (var i = 0; i < orders.length; i++) {
7743        _html += "<div class='divTableRow clearfix' >";
7744        _html += "<div class='divTableCell ps-strings'>" + orders[i].gameNameCN + "</div>";
7745        _html +=
7746          "<div class='divTableCell ps-strings openItem' data-orderId='" +
7747          orders[i].orderId +
7748          "' data-chasing='" +
7749          orders[i].chase +
7750          "' data-orderMasterId=''>" +
7751          orders[i].abbrOrderNo +
7752          "</div>";
7753        _html += "<div class='divTableCell ps-strings'>" + orders[i].customerName + "</div>";
7754        var betTime = moment(orders[i].betTime)
7755          .format("YYYY-MM-DD HH:mm:ss")
7756          .replace(new Date().getFullYear().toString() + "-", "");
7757        _html += "<div class='divTableCell ps-strings'>" + betTime + "</div>";
7758        _html += "<div class='divTableCell ps-strings'>" + orders[i].numero + "</div>";
7759        var chase = orders[i].chase === false ? "-" : "是";
7760        // _html += "<div class='divTableCell ps-strings'>" + chase + "</div>";
7761        //_html += '<div class="divTableCell ps-strings yel-pop betContent">'+orders[i].bettingContent.substr(0,8)+'<div class="pop-yellow">'+tcg.ac.hoverLongText(orders[i].bettingContent, 10)+'</div></div>';
7762        _html +=
7763          "<div class='divTableCell ps-strings' data-switchDecimal='" +
7764          decimal +
7765          "' data-value='" +
7766          orders[i].betAmount +
7767          "'>" +
7768          tcg.ac.customCurrencyFormat(orders[i].betAmount, decimal) +
7769          "</div>";
7770        _html +=
7771          "<div class='divTableCell ps-strings' data-switchDecimal='" +
7772          decimal +
7773          "' data-value='" +
7774          orders[i].validBetAmount +
7775          "'>" +
7776          tcg.ac.customCurrencyFormat(orders[i].validBetAmount, decimal) +
7777          "</div>";
7778        if (orders[i].status == 5 || orders[i].status == 16) {
7779          _html +=
7780            "<div class='divTableCell ps-strings' data-switchDecimal='" +
7781            decimal +
7782            "' data-value='" +
7783            orders[i].winAmount +
7784            "'>" +
7785            tcg.ac.customCurrencyFormat(0, decimal) +
7786            "</div>";
7787        } else if (orders[i].status == 4) {
7788          _html +=
7789            "<div class='divTableCell ps-strings' data-switchDecimal='" +
7790            decimal +
7791            "' data-value='" +
7792            orders[i].winAmount +
7793            "'>" +
7794            tcg.ac.customCurrencyFormat(orders[i].winAmount, decimal) +
7795            "</div>";
7796        } else {
7797          _html += "<div class='divTableCell ps-strings' data-switchDecimal='" + decimal + "' data-value='-'>-</div>";
7798        }
7799        // _html += "<div class='divTableCell ps-strings' data-switchDecimal='" + decimal + "' data-value='" + orders[i].winAmount + "'>" + tcg.ac.customCurrencyFormat(orders[i].winAmount, decimal) + "</div>";
7800        _html +=
7801          "<div class='divTableCell ps-strings orderStatus'>" +
7802          tcg.lib.prop("orderStatus_" + orders[i].status) +
7803          "</div>";
7804        // var orderNumber = tcg.ac.shortenText(orders[i].orderNo);
7805        // if (orders[i].chase == true || orders[i].chase == "true") {
7806        //     orderNumber = orderNumber + "-" + tcg.ac.ui.strPad(orders[i].chasingOrder, 3);
7807        // }
7808        // _html += "<div class='divTableCell onel-cl-y ps-cen ps-strings yel-pop tbl-link'><span class='openItem' data-orderId='" + orders[i].orderDetailId + "' data-chasing='" + orders[i].chasing + "' data-orderMasterId='" + orders[i].orderMasterId + "'>" + orderNumber + "</span></div>";
7809        // _html += "<div class='divTableCell onel-cl-y ps-cen width-adjustment-128'>" + tcg.ac.timeToDateFormat(orders[i].bettingTime, "MonthDateTime") + "</div>";
7810        // _html += "<div class='divTableCell onel-cl-y ps-cen width-adjustment-128'>" + orders[i].numero + "</div>";
7811        // var chasingPhase;
7812        // if (orders[i].chasing == true) {
7813        //     if (orders[i].chasingOrder == 1) {
7814        //         chasingPhase = orders[i].chasingPhase + tcg.lib.prop("mc_lott_game_history_chase_suffix");
7815        //     } else {
7816        //         chasingPhase = tcg.lib.prop("mc_lott_game_history_n
7816o_chase");
7817        //     }
7818        // } else {
7819        //     chasingPhase = "-";
7820        // }
7821        // _html += "<div class='divTableCell onel-cl-y ps-cen div-y'>" + chasingPhase + "</div>";
7822        // _html += "<div class='divTableCell onel-cl-y' data-switchDecimal='" + decimal + "' data-value='" + orders[i].planBettingAmount + "'>" + tcg.ac.customCurrencyFormat(orders[i].planBettingAmount, decimal) + "</div>";
7823        // _html += "<div class='divTableCell onel-cl-y width-adjustment-80' data-switchDecimal='" + decimal + "' data-value='" + orders[i].actualBettingAmount + "'>" + tcg.ac.customCurrencyFormat(orders[i].actualBettingAmount, decimal) + "</div>";
7824        // if (orders[i].winningAmount == null) {
7825        //     // if (orders[i].orderStatus == 5 || orders[i].orderStatus == 2) {
7826        //         _html += "<div class='divTableCell onel-cl-y tbl-red width-adjustment-75 text-right ch-riht-rl'>-</div>";
7827        //     // }
7828        // } else {
7829        //     _html += "<div class='divTableCell onel-cl-y tbl-red width-adjustment-75 text-right ch-riht-rl' data-switchDecimal='" + decimal + "' data-value='" + orders[i].winningAmount + "'>" + tcg.ac.customCurrencyFormat(orders[i].winningAmount, decimal) + "</div>";
7830        // }
7831        // _html += "<div class='divTableCell onel-cl-y ps-cen div-z'>" + tcg.lib.prop("orderStatus_" + orders[i].orderStatus) + "</div>";
7832        _html += "</div>";
7833      }
7834    } else {
7835      _html += "<div class='tableContent-wrp'>";
7836      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
7837      _html += "</div>";
7838    }
7839
7840    if (orders.length > 0) {
7841      var total = result.value.footer,
7842        _total = "";
7843      _total +=
7844        "<div class='tbl-total-con inline-block'>" + tcg.lib.prop("ac_lott_game_history_total_plan_bet_amt") + "</div>";
7845      _total +=
7846        "<div class='tbl-total-amt inline-block' data-switchDecimal='" +
7847        decimal +
7848        "' data-value='" +
7849        total.betAmount +
7850        "'>" +
7851        tcg.ac.customCurrencyFormat(total.betAmount, decimal) +
7852        "</div>";
7853      _total +=
7854        "<div class='tbl-total-con inline-block'>" +
7855        tcg.lib.prop("ac_lott_game_history_total_actual_bet_amt") +
7856        "</div>";
7857      _total +=
7858        "<div class='tbl-total-amt inline-block' data-switchDecimal='" +
7859        decimal +
7860        "' data-value='" +
7861        total.validBetAmount +
7862        "'>" +
7863        tcg.ac.customCurrencyFormat(total.validBetAmount, decimal) +
7864        "</div>";
7865      _total +=
7866        "<div class='tbl-total-con inline-block'>" + tcg.lib.prop("ac_lott_game_history_total_win_amt") + "</div>";
7867      _total +=
7868        "<div class='tbl-total-amt inline-block' data-switchDecimal='" +
7869        decimal +
7870        "' data-value='" +
7871        total.winAmount +
7872        "'>" +
7873        tcg.ac.customCurrencyFormat(total.winAmount, decimal) +
7874        "</div>";
7875      $("#lottoGameHistoryTotal").html(_total);
7876    }
7877    // $("#listWrapper input[name='order']").on("change", function () {
7878    //     $(this).val($(this).val().toUpperCase());
7879    // });
7880
7881    return _html;
7882  };
7883  tcg.ac.ui.loadLottoGameHistoryItem = function (result, orderMasterId, chasing, orderInfo, icon) {
7884    var decimal = 4;
7885    globalVar.orderMasterId = orderMasterId;
7886    globalVar.orderMultiple = result.multiple;
7887    $("#itemWrapper .prsnl-game-name").html(
7888      "<span id='rm_" +
7889        result.gameCode +
7890        "' style='background-image: url(" +
7891        icon[result.gameCode] +
7892        ");background-size: 100%;background-repeat: no-repeat;background-position: center;'>&nbsp;</span>"
7893    );
7894    var orderNumber = tcg.ac.shortenText(result.orderNumber);
7895    if (!$("#chasing").hasClass("hide")) {
7896      $("#chasing").addClass("hide");
7897    }
7898    if (chasing == true || chasing == "true") {
7899      var chasingOrder = result.chasingOrder;
7900      orderNumber = orderNumber + "-" + tcg.ac.ui.strPad(chasingOrder, 3);
7901      $("#chasing").removeClass("hide");
7902    }
7903    $(".pkModeNote").addClass("hide");
7904    if (result.pkMode) {
7905      var pkModeWinProbability = result.pkModeWinProbability * 100 + "%";
7906      $(".pkModeNote").removeClass("hide");
7907      if (result.pkModeCalculationMode === "SPECIFY") {
7908        $("#pkModeWinProbability").text(pkModeWinProbability);
7909        $("#pkModeCalculationValue").text(result.pkModeCalculationValue.toFixed(2));
7910      }
7911      if (result.pkModeCalculationMode === "PERCENTAGE") {
7912        $("#pkModeWinProbability").text(pkModeWinProbability);
7913        $("#pkModeCalculationValue").text(result.pkModeCalculationValue + "%");
7914      }
7915    }
7916    $(".pkMode").show();
7917    $("#gh_orderNo").val(orderNumber);
7918    $("#itemWrapper #lotteryNum").removeClass("double");
7919    $("#itemWrapper .orderNo").text(orderNumber);
7920    $("#itemWrapper .seriesModel").text(result.series + "/" + tcg.lib.prop("bettingMode_" + result.bettingModeCode));
7921    if (result.orderStatus == 5 || result.orderStatus == 16) {
7922      $("#itemWrapper .prizeMoney").html(tcg.ac.customCurrencyFormat(0, 4));
7923    } else if (result.orderStatus == 4) {
7924      $("#itemWrapper .prizeMoney").html(tcg.ac.customCurrencyFormat(result.winningAmou
7924nt, 4));
7925    } else {
7926      $("#itemWrapper .prizeMoney").html("-");
7927    }
7928    $("#itemWrapper .bettingNoteCount").text(result.stakes);
7929    $("#itemWrapper .bettingMultiples").html(tcg.ac.customCurrencyFormat(result.multiple));
7930    $("#itemWrapper .bettingTime").text(tcg.ac.timeToDateFormat(result.bettingTime, "dateTime"));
7931    $("#itemWrapper .orderStatus").text(tcg.lib.prop("orderStatus_" + result.orderStatus));
7932    $("#itemWrapper .bettingOnNumber").text(result.numero);
7933    var lotteryNumbers = result.winningNumber == null ? "-" : result.winningNumber;
7934    var splitChar = lotteryNumbers.indexOf(",") < 0 ? "" : ",";
7935    $("#itemWrapper #lotteryNum").html("<span>" + lotteryNumbers.split(splitChar).join("</span><span>") + "</span>");
7936    if (result.winningNumber != null) {
7937      $("#itemWrapper #lotteryNum").addClass("lotteryNumbers");
7938    }
7939    if (splitChar == ",") {
7940      $("#itemWrapper #lotteryNum").addClass("double");
7941    }
7942
7943    var _html = "",
7944      pageNo = $("#itemWrapper [name='pageNo']");
7945
7946    var orderInfos = orderInfo.content;
7947    for (var i = 0; i < orderInfos.length; i++) {
7948      _html += "<div class='divTableRow'>";
7949      _html +=
7950        "<div class='divTableCell onel-cl-y ps-cen yel-npop yel-pop playName'>" +
7951        lottTranslator.translatePlayName(orderInfos[i].playId, orderInfos[i].playCode, orderInfos[i].bettingContent);
7952      _html +=
7953        "<div class='pop-yellow' style='left:0'>" +
7954        lottTranslator.translatePlayName(orderInfos[i].playId, orderInfos[i].playCode, orderInfos[i].bettingContent) +
7955        "</div>";
7956      _html += "</div>";
7957      _html +=
7958        "<div class='divTableCell onel-cl-y ps-cen yel-pop  betContent'><span class='divTableCellnspan'>" +
7959        lottTranslator.translateBallContentText(orderInfos[i].playId, orderInfos[i].bettingContent) +
7960        "</span><div class='pop-yellow'>";
7961      _html += tcg.ac.hoverLongText(
7962        lottTranslator.translateBallContentText(orderInfos[i].playId, orderInfos[i].bettingContent),
7963        30
7964      );
7965      _html += "</div></div>";
7966      _html += "<div class='divTableCell onel-cl-y ps-cen '>" + orderInfos[i].stakes + "</div>"; // .xd2-xda
7967      var multiple = orderInfos[i].multiple * 1 * (globalVar.orderMultiple * 1);
7968      _html +=
7969        "<div class='divTableCell onel-cl-y ps-cen '>" +
7970        orderInfos[i].series +
7971        "/" +
7972        tcg.lib.prop("bettingMode_" + orderInfos[i].bettingMode) +
7973        "/" +
7974        multiple +
7975        "</div>";
7976      var total_bet_amt = orderInfos[i].bettingAmount * 1 * (globalVar.orderMultiple * 1);
7977      _html +=
7978        "<div class='divTableCell onel-cl-y ps-cen xg-xlass' data-switchDecimal='" +
7979        decimal +
7980        "' data-value='" +
7981        total_bet_amt +
7982        "'>" +
7983        tcg.ac.customCurrencyFormat(total_bet_amt, decimal) +
7984        "</div>";
7985      var winAmount;
7986      if (result.orderStatus == 5 || result.orderStatus == 16 || result.orderStatus == 4) {
7987        winAmount = 0;
7988        if (
7989          result.orderStatus == 4 &&
7990          (orderInfos[i].winAmount != null || orderInfos[i].winAmount != undefined || isNaN(orderInfos[i].winAmount))
7991        ) {
7992          winAmount = orderInfos[i].winAmount;
7993        }
7994      } else {
7995        winAmount = "-";
7996      }
7997      _html +=
7998        "<div class='divTableCell onel-cl-y ps-cen xg-xlass' data-switchDecimal='" +
7999        decimal +
8000        "' data-value='" +
8001        winAmount +
8002        "'>" +
8003        tcg.ac.currencyFormat(winAmount, decimal) +
8004        "</div>";
8005      var pkMode = result.pkMode ? "是" : "否";
8006      if (
8007        result.pkModeCalculationMode !== null ||
8008        result.pkModeCalculationValue !== null ||
8009        result.pkModeWinProbability !== null
8010      ) {
8011        _html += "<div class='divTableCell onel-cl-y ps-cen pkMode'>" + pkMode + "</div>";
8012      }
8013      _html += "</div>";
8014    }
8015    if (
8016      result.pkModeCalculationMode === null ||
8017      result.pkModeCalculationValue === null ||
8018      result.pkModeWinProbability === null
8019    ) {
8020      $(".pkMode").hide();
8021    }
8022    if (result.orderStatus == 2) {
8023      $("#cancelGameHistoryDetail").parent().removeClass("hide");
8024      $("#cancelGameHistoryDetail").parent().show();
8025    } else {
8026      $("#cancelGameHistoryDetail").parent().hide();
8027    }
8028    return _html;
8029  };
8030  tcg.ac.ui.loadChaseRecords = function (result) {
8031    var decimal = 2,
8032      orders = result.orders.content,
8033      _html = "";
8034    if (orders.length > 0) {
8035      for (var i = 0; i < orders.length; i++) {
8036        var orderNumber = tcg.ac.shortenText(orders[i].orderNumber);
8037        if (orders[i].chasing == true || orders[i].chasing == "true") {
8038          orderNumber = orderNumber + "-" + tcg.ac.ui.strPad(orders[i].chasingOrder, 3);
8039        }
8040        _html += "<div class='divTableRow'>";
8041        _html +=
8042          "<div class='divTableCell onel-cl-y ps-cen openItem ps-strings tbl-link' data-chasingOrder='" +
8043          orders[i].chasingOrder +
8044          "' data-orderMasterId='" +
8045          orders[i].orderMasterId +
8046          "'>" +
8047          orderNumber +
8048          "</div>";
8049        _html +=
8050          "<div class='divTableCell onel-cl-y ps-cen'>" + tcg.lib.prop("gameName_" + orders[i].gameCode) + "</div>";
8051        _html += "<div class='divTableCell onel-cl-y ps-cen'>" + orders[i].numero + "</div>";
8052        _html += "<div class='divTableCell onel-cl-y ps-cen'>" + orders[i].chaseEndNumero + "</div>";
8053        _html += "<div class='divTableCell onel-cl-y ps-cen div-y'>" + orders[i].chasingPhase + "</div>";
8054        _html += "<div class='divTableCell onel-cl-y ps-cen div-y'>" + orders[i].actualChasingPhase + "</div>";
8055        _html +=
8056          "<div class='divTableCell onel-cl-y ps-num' data-switchDecimal='" +
8057          decimal +
8058          "' data-value='" +
8059          orders[i].planBettingAmount +
8060          "'>" +
8061          tcg.ac.customCurrencyFormat(orders[i].planBettingAmount, decimal) +
8062          "</div>";
8063        var winningAmount = orders[i].winningAmount == null ? 0 : orders[i].winningAmount,
8064          winningAmountColor = orders[i].orderStatus == 4 ? "tbl-red" : "";
8065        _html +=
8066          "<div class='divTableCell onel-cl-y ps-num " +
8067          winningAmountColor +
8068          "' data-switchDecimal='" +
8069          decimal +
8070          "' data-value='" +
8071          winningAmount +
8072          "'>" +
8073          tcg.ac.customCurrencyFormat(winningAmount, decimal) +
8074          "</div>";
8075        _html +=
8076          "<div class='divTableCell onel-cl-y ps-cen div-x " +
8077          winningAmountColor +
8078          "'>" +
8079          tcg.lib.prop("orderStatus_" + orders[i].orderStatus) +
8080          "</div>";
8081        _html += "</div>";
8082      }
8083    } else {
8084      _html += "<div class='tableContent-wrp'>";
8085      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
8086      _html += "</div>";
8087    }
8088    var totalPlanBettingAmt = result.orderSumTO.sumPlanBettingAmt;
8089    var totalActualBetAmount = result.orderSumTO.sumActualBettingAmt;
8090    var totalWinningAmount = result.orderSumTO.sumWinningAmt;
8091    $("#totalPlanBettingAmt").html(tcg.ac.customCurrencyFormat(totalPlanBettingAmt, decimal)).attr({
8092      "data-switchDecimal": decimal,
8093      "data-value": totalPlanBettingAmt,
8094    });
8095    $("#totalActualBettingAmt").html(tcg.ac.customCurrencyFormat(totalActualBetAmount, decimal)).attr({
8096      "data-switchDecimal": decimal,
8097      "data-value": totalActualBetAmount,
8098    });
8099    $("#totalWinningAmt").html(tcg.ac.customCurrencyFormat(totalWinningAmount, decimal)).attr({
8100      "data-switchDecimal": decimal,
8101      "data-value": totalWinningAmount,
8102    });
8103
8104    return _html;
8105  };
8106  tcg.ac.ui.loadChaseRecordItem = function (result, chasingOrder, orderInfo, icon) {
8107    var decimal = 4;
8108
8109    $("#chase_itemWrapper .prsnl-game-name").html(
8110      "<span id='rm_" +
8111        result.gameCode +
8112        "' style='background-image: url(" +
8113        icon[result.gameCode] +
8114        ");background-size: 100%;background-repeat: no-repeat;background-position: center;'>&nbsp;</span>"
8115    );
8116
8117    var orderNumber = tcg.ac.shortenText(result.orderNumber);
8118    if (result.chase == true || result.chase == "true") {
8119      orderNumber = orderNumber + "-" + tcg.ac.ui.strPad(chasingOrder, 3);
8120    }
8121
8122    $("#ch_orderNo").val(orderNumber);
8123    $("#chase_itemWrapper .orderNo").text(orderNumber);
8124    $("#chase_itemWrapper .seriesModel").text(result.series + "/" + tcg.lib.prop("bettingMode_" + result.mode)); //TCG.Prop("bettingMode_"+result.bettingModeCode)
8125
8126    var winningAmount = 0;
8127    $.each(result.orderDetailOrders, function (index, value) {
8128      if (value.winningAmount != undefined) {
8129        winningAmount += value.winningAmount;
8130      }
8131    });
8132
8133    $("#chase_itemWrapper .prizeMoney").html(tcg.ac.customCurrencyFormat(winningAmount, decimal));
8134    $("#chase_itemWrapper .bettingNoteCount").text(result.orderDetailOrders[0].stakes); //
8135    var multiples = result.orderDetailOrders[0].multiple;
8136    $("#chase_itemWrapper .bettingTime").text(tcg.ac.timeToDateFormat(result.bettingTime, "dateTime"));
8137    $("#chase_itemWrapper .orderStatus").text(tcg.lib.prop("orderStatus_" + result.orderStatus));
8138    $("#chase_itemWrapper .bettingOnNumber").text(result.numero);
8139    $("#chase_itemWrapper .lotteryNumbers").text(result.winningNumber == null ? "-" : result.winningNumber);
8140    var winningStop = result.winningStop == true ? tcg.lib.prop("mc_cno_item_yes") : tcg.lib.prop("mc_cno_item_no");
8141    $("#chase_itemWrapper .winningstop").text(winningStop);
8142    $("#chase_itemWrapper .plan_bet_amount").html(tcg.ac.customCurrencyFormat(result.totalBetAmount, decimal));
8143    var abandoning = result.abandoning == true ? tcg.lib.prop("mc_cno_item_yes") : tcg.lib.prop("mc_cno_item_no");
8144    $("#chase_itemWrapper .abonding").text(abandoning);
8145    $("#chase_itemWrapper .actual_bet_amount").html(tcg.ac.customCurrencyFormat(result.totalActualBetAmount, decimal));
8146    var completed = result.completed == true ? tcg.lib.prop("mc_cno_item_yes") : tcg.lib.prop("mc_cno_item_no");
8147    $("#chase_itemWrapper .chasephase").text(result.totalChasePhases);
8148    $("#chase_itemWrapper .isCompleted").text(completed);
8149
8150    var tab1_html = "",
8151      orderDetails = result.orderDetailOrders,
8152      tab2_html = "";
8153    globalVar.orderMasterId = result.orderMasterId;
8154    var pageNo = $("#chase_itemWrapper [name='pageNo']");
8155
8156    var orderInfos = orderInfo.content;
8157    for (var i = 0; i < orderInfos.length; i++) {
8158      var decimal = 2;
8159      tab1_html += "<div class='divTableRow'>";
8160      tab1_html +=
8161        "<div class='divTableCell onel-cl-y ps-cen yel-pop'>" +
8162        lottTranslator.translatePlayName(orderInfos[i].playId, orderInfos[i].playCode, orderInfos[i].bettingContent);
8163      tab1_html +=
8164        "<div class='pop-yellow' style='left:30px'>" +
8165        lottTranslator.translatePlayName(orderInfos[i].playId, orderInfos[i].playCode, orderInfos[i].bettingContent) +
8166        "</div>";
8167      tab1_html += "</div>";
8168      tab1_html +=
8169        "<div class='divTableCell onel-cl-y ps-cen yel-pop ps-strings'>" +
8170        tcg.ac.strSub(lottTranslator.translateBallContentText(orderInfos[i].playId, orderInfos[i].bettingContent), 10) +
8171        "<div class='pop-yellow txbx1'>";
8172      tab1_html += tcg.ac.hoverLongText(
8173        lottTranslator.translateBallContentText(orderInfos[i].playId, orderInfos[i].bettingContent),
8174        10
8175      );
8176      tab1_html += "</div></div>";
8177      tab1_html += "<div class='divTableCell onel-cl-y ps-cen'>" + orderInfos[i].stakes + "</div>";
8178      var multiple = orderInfos[i].multiple * 1 * (result.orderDetailOrders[0].multiple * 1);
8179      tab1_html +=
8180        "<div class='divTableCell onel-cl-y ps-cen2'>" +
8181        orderInfos[i].series +
8182        "/" +
8183        tcg.lib.prop("bettingMode_" + orderInfos[i].bettingMode) +
8184        "/" +
8185        multiple +
8186        "</div>";
8187      var total_bet_amt = orderInfos[i].bettingAmount * 1 * (result.orderDetailOrders[0].multiple * 1);
8188      tab1_html +=
8189        "<div class='divTableCell onel-cl-y ps-num' data-switchDecimal='" +
8190        decimal +
8191        "' data-value='" +
8192        total_bet_amt +
8193        "'>" +
8194        tcg.ac.customCurrencyFormat(total_bet_amt, decimal) +
8195        "</div>";
8196      tab1_html += "</div>";
8197    }
8198    $("#orderInfos").html(tab1_html);
8199
8200    tcg.ac.ui.loadPagination("chaseRecordItem", pageNo.val(), orderInfo.totalPages, "#ncoDetailPagination");
8201
8202    var orderDet = [];
8203    for (var i = 0; i < orderDetails.length; i++) {
8204      for (var n = 0; n < orderDetails.length; n++) {
8205        if (orderDetails[n].chasingOrder * 1 == i + 1) {
8206          orderDet[i] = orderDetails[n];
8207          break;
8208        }
8209      }
8210    }
8211    for (var i = 0; i < orderDetails.length; i++) {
8212      tab2_html += "<div class='divTableRow orderDetailsItem'>";
8213      tab2_html += "<div class='divTableCell onel-cl-y ps-cen div-x col-checkbox'>"; //ps-chkd
8214      if (orderDetails[i].orderStatus == 2) {
8215        tab2_html +=
8216          "<input type='checkbox' id='check" +
8217          i +
8218          "' name='orderDetail' value='" +
8219          orderDetails[i].orderDetailId +
8220          "' />";
8221        tab2_html += "<label for='check" + i + "'></label>";
8222      }
8223      tab2_html += "</div>";
8224      tab2_html += "<div class='divTableCell onel-cl-y ps-cen'>" + orderDetails[i].numero + "</div>";
8225      var winningNumber = orderDetails[i].winningNumber == null ? "-" : orderDetails[i].winningNumber;
8226      tab2_html +=
8227        "<div class='divTableCell onel-cl-y ps-cen yel-pop ps-strings'>" +
8228        tcg.ac.strSub(winningNumber, 10) +
8229        "<div class='pop-yellow txbx1 chUn123'>";
8230      tab2_html += tcg.ac.hoverLongText(winningNumber, 10);
8231      tab2_html += "</div></div>";
8232      tab2_html +=
8233        "<div class='divTableCell onel-cl-y ps-cen div-x col-orderStatus'>" +
8234        tcg.lib.prop("orderStatus_" + orderDetails[i].orderStatus) +
8235        "</div>";
8236      var bettingSumAmount = orderDetails[i].bettingSumAmount == null ? 0 : orderDetails[i].bettingSumAmount * 1;
8237      tab2_html +=
8238        "<div class='divTableCell onel-cl-y ps-num' data-switchDecimal='" +
8239        decimal +
8240        "' data-value='" +
8241        bettingSumAmount +
8242        "'>" +
8243        tcg.ac.customCurrencyFormat(bettingSumAmount, decimal) +
8244        "</div>";
8245      var winningAmount = orderDetails[i].winningAmount == null ? 0 : orderDetails[i].winningAmount * 1,
8246        winningAmountClass = orderDetails[i].orderStatus == 4 ? "tbl-red" : "";
8247      tab2_html +=
8248        "<div class='divTableCell onel-cl-y ps-num " +
8249        winningAmountClass +
8250        "' data-switchDecimal='" +
8251        decimal +
8252        "' data-value='" +
8253        winningAmount +
8254        "'>" +
8255        tcg.ac.customCurrencyFormat(winningAmount, decimal) +
8256        "</div>";
8257      tab2_html +=
8258        "<div class='divTableCell onel-cl-y ps-cen div-x blue openGameHistoryItem' id='openGameHistoryItem' data-orderId='" +
8259        orderDetails[i].orderDetailId +
8260        "' data-chasing='true'>" +
8261        tcg.lib.prop("mc_cno_open_item_btn") +
8262        "</div>";
8263      tab2_html += "</div>";
8264    }
8265    $("#orderDetailOrders").html(tab2_html);
8266  };
8267
8268  tcg.ac.ui.myIncome3 = function (gameCategory, result) {
8269    var datalist = [];
8270    var enabledDividend = JSON.parse(sessionStorage.consolidated).value.divtypeinfo
8271      ? Object.keys(JSON.parse(sessionStorage.consolidated).value.divtypeinfo)
8272      : [];
8273    var enabledSalary = JSON.parse(sessionStorage.consolidated).value.dailysalinfo
8274      ? Object.keys(JSON.parse(sessionStorage.consolidated).value.dailysalinfo)
8275      : [];
8276    if ("ALL".indexOf(gameCategory) > -1) {
8277      tcg.apis.getGameMakers(tcg.ac.getMerchant(), sessionStorage.token, function (result) {
8278        var available = Object.keys(result.value.content);
8279
8280        datalist = ["balanceDate", "lottIncome", "rngIncome", "liveIncome", "sportsIncome", "fishIncome", "pvpIncome"];
8281
8282        if (available.indexOf("LOTT") == -1) {
8283          datalist.splice(1, 1);
8284        }
8285        if (available.indexOf("PVP") == -1) {
8286          datalist.splice(6, 1);
8287        }
8288        if (available.indexOf("RNG") == -1) {
8289          datalist.splice(2, 1);
8290        }
8291        if (available.indexOf("LIVE") == -1) {
8292          datalist.splice(3, 1);
8293        }
8294        if (available.indexOf("FISH") == -1) {
8295          datalist.splice(5, 1);
8296        }
8297        if (available.indexOf("SPORTS") == -1) {
8298          datalist.splice(4, 1);
8299        }
8300        // if(available.indexOf("ELOTT") == -1 ) {
8301        //      datalist.splice(1,1);
8302        // }
8303      });
8304
8305      //datalist =  ["balanceDate" , "lottIncome" , "rngIncome" , "liveIncome" , "sportsIncome"  ,"totalIncome"];
8306    } else if ("LOTT".indexOf(gameCategory) > -1) {
8307      datalist = ["balanceDate", "totalAgentRebate"];
8308      if (sessionStorage.enableSalary == "true") {
8309        datalist.push("totalDailySalary");
8310        $("tr[data-obj='lott'] .mac-table-head.salary").removeClass("hide");
8311      } else {
8312        $("tr[data-obj='lott'] .mac-table-head.salary").addClass("hide");
8313      }
8314      if (sessionStorage.enableContract == "true" && enabledDividend.indexOf(gameCategory) > -1) {
8315        datalist.push("totalDividend");
8316        $("tr[data-obj='lott'] .mac-table-head.contract").removeClass("hide");
8317      } else {
8318        $("tr[data-obj='lott'] .mac-table-head.contract").addClass("hide");
8319      }
8320    } else if ("RNG||LIVE||SPORTS||FISH".indexOf(gameCategory) > -1) {
8321      datalist = ["balanceDate", "totalAgentRebate"];
8322      if (sessionStorage.enableContract == "true" && enabledDividend.indexOf(gameCategory) > -1) {
8323        datalist.push("totalDividend");
8324        $("tr[data-obj='rng||live||sports||fish'] .mac-table-head.contract").removeClass("hide");
8325      } else {
8326        $("tr[data-obj='rng||live||sports||fish'] .mac-table-head.contract").addClass("hide");
8327      }
8328    } else if ("PVP".indexOf(gameCategory) > -1) {
8329      datalist = ["balanceDate", "totalAgentRebate"];
8330    }
8331    datalist.push("totalIncome");
8332    var _html = "",
8333      _obj = {};
8334    if (result.value) {
8335      _obj = result.value.list;
8336      $.each(_obj, function (index, value) {
8337        _html += '<tr class="mac-table-row">';
8338        for (var k in datalist) {
8339          _html += '<td class="mac-table-cell">' + value[datalist[k]] + "</td>";
8340        }
8341        _html += "</tr>";
8342      });
8343    } else {
8344      _html = '<div class="tableContent-wrp"><div class="noResult-data">没有查到符合条件的数据</div></div>';
8345      console.error("ODS is currently down or slow due to number of requests.");
8346    }
8347
8348    return _html;
8349  };
8350  tcg.ac.ui.myIncome3_footer = function (gameCategory, result) {
8351    if ("ALL".indexOf(gameCategory) > -1) {
8352      datalist = ["lottIncome", "rngIncome", "liveIncome", "sportsIncome", "fishIncome", "pvpIncome"];
8353
8354      //datalist =  ["balanceDate" , "lottIncome" , "rngIncome" , "liveIncome" , "sportsIncome"  ,"totalIncome"];
8355    } else if ("LOTT".indexOf(gameCategory) > -1) {
8356      datalist = ["totalAgentRebate"];
8357      if (sessionStorage.enableSalary == "true") {
8358        datalist.push("totalDailySalary");
8359        $(".mac-table-head.salary").removeClass("hide");
8360      } else {
8361        $(".mac-table-head.salary").addClass("hide");
8362      }
8363      if (sessionStorage.enableContract == "true") {
8364        datalist.push("totalDividend");
8365        $(".mac-table-head.contract").removeClass("hide");
8366      } else {
8367        $(".mac-table-head.contract").addClass("hide");
8368      }
8369    }
8369 else if ("RNG||LIVE||SPORTS||FISH".indexOf(gameCategory) > -1) {
8370      datalist = ["totalAgentRebate"];
8371      if (sessionStorage.enableContract == "true") {
8372        datalist.push("totalDividend");
8373      }
8374    } else if ("PVP".indexOf(gameCategory) > -1) {
8375      datalist = ["totalAgentRebate"];
8376    }
8377    datalist.push("totalIncome");
8378    var _html = "",
8379      _obj = {},
8380      consolidatedData = {};
8381    if (result.value) {
8382      if (result.value.footer) {
8383        _obj = result.value.footer;
8384        $(".mac-table-row").each(function (index, value) {
8385          if (!$(value).hasClass("hide") && $(value).attr("data-obj")) {
8386            $(value)
8387              .find("th")
8388              .each(function (indexOfHeader, valueOfHeader) {
8389                if (indexOfHeader != 0 && !$(valueOfHeader).hasClass("hide")) {
8390                  consolidatedData[$(valueOfHeader).html()] = 0.0;
8391                  consolidatedData[$(valueOfHeader).html()] += parseFloat(_obj[datalist[indexOfHeader - 1]]);
8392                }
8393              });
8394          }
8395        });
8396      }
8397
8398      console.log(consolidatedData);
8399      if (!("ALL".indexOf(gameCategory) > -1)) {
8400        _html = '<div class="mac-foot-field title"><label>总汇:</label><span></span> </div>';
8401      }
8402
8403      $.each(consolidatedData, function (key, value) {
8404        _html +=
8405          '<div class="mac-foot-field"><label>' +
8406          key +
8407          ":</label><span>" +
8408          tcg.ac.customCurrencyFormat(value, 2) +
8409          "</span></div>";
8410      });
8411      return _html;
8412    } else {
8413    }
8414  };
8415  // Team Income Report
8416  tcg.ac.ui.searchAgentTeamIncome = function () {
8417    $(document)
8418      .off("click", "#agentTeamIncome .form-submit")
8419      .on("click", "#agentTeamIncome .form-submit", function (event) {
8420        //$("#agentTeamIncome .breadcrumbs .b-list.new-entry").remove();
8421        //tcg.ac.getAgentTeamIncome();
8422        if (event.originalEvent === undefined) {
8423          var len = $("#agentTeamIncome .b-list").length - 1;
8424          var customerId = $($("#agentTeamIncome .breadcrumbs .b-list")[len]).attr("data-customerid");
8425          tcg.ac.getAgentTeamIncome(customerId);
8426        } else {
8427          $("#rngAgentPnlForm .breadcrumbs .b-list.new-entry").remove();
8428          tcg.ac.getAgentTeamIncome();
8429        }
8430      });
8431  };
8432  tcg.ac.ui.loadAgentTeamIncome = function (result) {
8433    var _column = "";
8434    _column +=
8435      "<div class='divTableCell onel-th-x'>" +
8436      tcg.lib.prop("ac_subordinate_management_member_management_username_label") +
8437      "</div>";
8438    _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_revenue_report_column_2") + "</div>";
8439    _column +=
8440      "<div class='divTableCell onel-th-x dailySalary'>" + tcg.lib.prop("ac_revenue_report_column_3") + "</div>";
8441    _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_revenue_report_column_4") + "</div>";
8442    _column += "<div class='divTableCell onel-th-x'>" + tcg.lib.prop("ac_revenue_report_column_5") + "</div>";
8443    $("#agentTeamIncomeColumn").html(_column);
8444
8445    var decimal = 2,
8446      list = result.list,
8447      _html = "";
8448    for (var i = 0; i < list.length; i++) {
8449      if (i % 2 == 0) {
8450        _html += "<div class='divTableRow'>";
8451      } else {
8452        _html += "<div class='divTableRow divTableRowothr'>";
8453      }
8454      var account = list[i].customer_name.split("@");
8455      _html +=
8456        "<div class='divTableCell tbl-link ps-strings' data-customerId='" +
8457        list[i].customer_id +
8458        "'>" +
8459        account[1] +
8460        "</div>";
8461      var agent_commission =
8462        list[i].live_agent_commission +
8463        list[i].lott_agent_commission +
8464        list[i].pvp_commission +
8465        list[i].rng_agent_commission;
8466      _html +=
8467        "<div class='divTableCell ps-num' data-switchDecimal='" +
8468        decimal +
8469        "' data-value='" +
8470        agent_commission +
8471        "'>" +
8472        tcg.ac.customCurrencyFormat(agent_commission, decimal) +
8473        "</div>";
8474      var lott_daily_income = list[i].lott_daily_income;
8475      _html +=
8476        "<div class='divTableCell ps-num dailySalary' data-switchDecimal='" +
8477        decimal +
8478        "' data-value='" +
8479        lott_daily_income +
8480        "'>" +
8481        tcg.ac.customCurrencyFormat(lott_daily_income, decimal) +
8482        "</div>";
8483      var lott_brokerage = list[i].lott_brokerage;
8484      _html +=
8485        "<div class='divTableCell ps-num' data-switchDecimal='" +
8486        decimal +
8487        "' data-value='" +
8488        lott_brokerage +
8489        "'>" +
8490        tcg.ac.customCurrencyFormat(lott_brokerage, decimal) +
8491        "</div>";
8492      var agentIncomeTotal = agent_commission + lott_daily_income + lott_brokerage;
8493      _html +=
8494        "<div class='divTableCell ps-num ' data-switchDecimal='" +
8495        decimal +
8496        "' data-total='" +
8497        decimal +
8498        "' data-value='" +
8499        agentIncomeTotal +
8500        "'>" +
8501        tcg.ac.customCurrencyFormat(agentIncomeTotal, decimal) +
8502        "</div>";
8503      _html += "</div>";
8504    }
8505    $("#agentTeamIncomeList").html(_html);
8506  };
8507  tcg.ac.ui.switchAgentTeamIncome = function () {
8508    $(document)
8509      .off("click", "#agentTeamIncome .summaryTypeList li")
8510      .on("click", "#agentTeamIncome .summaryTypeList li", function () {
8511        if (!$(this).hasClass("active") && !$("#lottoAgentPnlForm .form-submit").hasClass("processing")) {
8512          var rel = $(this).attr("data-rel");
8513          $("#agentTeamIncome .summaryTypeList li").removeClass("active");
8514          $(this).addClass("active");
8515          $("#agentTeamIncome [name='summaryType']").val(rel);
8516          $("#agentTeamIncome .form-submit").click();
8517        }
8518      });
8519  };
8520  tcg.ac.ui.selectAgentTeamIncome = function () {
8521    $(document)
8522      .off("click", "#agentTeamIncomeList .tbl-link")
8523      .on("click", "#agentTeamIncomeList .tbl-link", function () {
8524        if (!$(this).hasClass("loading")) {
8525          var customerName = $(this).text(),
8526            customerId = $(this).attr("data-customerId"),
8527            isOpen = false;
8528          $("#agentTeamIncome .breadcrumbs .b-list").each(function () {
8529            if ($(this).attr("data-customerId") == customerId) {
8530              isOpen = true;
8531            }
8532          });
8533          if (!isOpen) {
8534            $("#agentTeamIncome .breadcrumbs .b-list").addClass("loading");
8535            $("#agentTeamIncome .summaryTypeList li").addClass("loading");
8536            _html =
8537              "<div class='arrow-small-con mem-icon2 inline-block b-list new-entry' data-customerId='" +
8538              customerId +
8539              "'>" +
8540              customerName +
8541              "</div>";
8542            $("#agentTeamIncome .breadcrumbs").append(_html);
8543          }
8544          $("#agentTeamIncome [name='pageNo']").val(1);
8545          tcg.ac.getAgentTeamIncome(customerId);
8546        }
8547      });
8548  };
8549  tcg.ac.ui.clickAgentTeamIncome = function () {
8550    $(document)
8551      .off("click", "#agentTeamIncome .breadcrumbs .b-list")
8552      .on("click", "#agentTeamIncome .breadcrumbs .b-list", function () {
8553        if (!$(this).hasClass("loading")) {
8554          var customerId = $(this).attr("data-customerId"),
8555            customerName = $(this).text(),
8556            removeFromList = false;
8557          $("#agentTeamIncome .breadcrumbs .b-list").each(function () {
8558            if (removeFromList) $(this).remove();
8559            if ($(this).attr("data-customerId") == customerId) {
8560              removeFromList = true;
8561            }
8562          });
8563          $("#agentTeamIncome .breadcrumbs .b-list").addClass("loading");
8564          $("#agentTeamIncome .summaryTypeList li").addClass("loading");
8565          tcg.ac.getAgentTeamIncome(customerId);
8566        }
8567      });
8568  };
8569
8570  // Agent Revenue Report
8571  tcg.ac.ui.searchRevenueReport = function () {
8572    $(document)
8573      .off("click", "#revenueReportForm .form-submit")
8574      .on("click", "#revenueReportForm .form-submit", function () {
8575        tcg.ac.getRevenueReport();
8576      });
8577  };
8578  tcg.ac.ui.loadRevenueReport = function (result) {
8579    console.log(result);
8580    var list = result.list,
8581      total = result.footer,
8582      decimal = 2,
8583      _html = "",
8584      _total = "";
8585    for (var i = 0; i < list.length; i++) {
8586      var dateTime = list[i].balance_date.split(" "),
8587        elott_agent_commission = list[i].elott_agent_commission == "" ? 0 : list[i].elott_agent_commission,
8588        fish_agent_commission = list[i].fish_agent_commission == "" ? 0 : list[i].fish_agent_commission,
8589        live_agent_commission = list[i].live_agent_commission == "" ? 0 : list[i].live_agent_commission,
8590        lott_agent_commission = list[i].lott_agent_commission == "" ? 0 : list[i].lott_agent_commission,
8591        pvp_commission = list[i].pvp_commission == "" ? 0 : list[i].pvp_commission,
8592        rng_agent_commission = list[i].rng_agent_commission == "" ? 0 : list[i].rng_agent_commission,
8593        sports_agent_commission = list[i].sports_agent_commission == "" ? 0 : list[i].sports_agent_commission,
8594        agent_commission =
8595          elott_agent_commission +
8596          fish_agent_commission +
8597          live_agent_commission +
8598          lott_agent_commission +
8599          pvp_commission +
8600          rng_agent_commission +
8601          sports_agent_commission,
8602        dailySalary = list[i].lott_daily_income == "" ? 0 : list[i].lott_daily_income,
8603        brokerage = list[i].lott_brokerage == "" ? 0 : list[i].lott_brokerage,
8604        totalIncome = list[i].agent_income == "" ? 0 : list[i].agent_income;
8605      var keys = Object.keys(list[i]),
8606        totalBrokerage;
8607      for (var j = 0; j < keys.length; j++) {
8608        if (keys[j].indexOf("profit_sharing") > -1) {
8609          totalBrokerage += list[i][keys[j]];
8610        }
8611      }
8612      totalBrokerage += brokerage;
8613      _html += "<div class='arr-tr clearfix'>";
8614      _html += "<div class='arr-td'>" + dateTime[0] + "</div>";
8615      _html +=
8616        "<div class='arr-td amount-fixCh' data-switchDecimal='" +
8617        decimal +
8618        "' data-value='" +
8619        agent_commission +
8620        "'>" +
8621        tcg.ac.customCurrencyFormat(agent_commission, decimal) +
8622        "</div>";
8623      _html +=
8624        "<div class='arr-td amount-fixCh' data-switchDecimal='" +
8625        decimal +
8626        "' data-value='" +
8627        dailySalary +
8628        "'>" +
8629        tcg.ac.customCurrencyFormat(dailySalary, decimal) +
8630        "</div>";
8631      _html +=
8632        "<div class='arr-td amount-fixCh' data-switchDecimal='" +
8633        decimal +
8634        "' data-value='" +
8635        totalBrokerage +
8636        "'>" +
8637        tcg.ac.customCurrencyFormat(totalBrokerage, decimal) +
8638        "</div>";
8639      _html +=
8640        "<div class='arr-td amount-fixCh' data-switchDecimal='" +
8641        decimal +
8642        "' data-value='" +
8643        totalIncome +
8644        "'>" +
8645        tcg.ac.customCurrencyFormat(totalIncome, decimal) +
8646        "</div>";
8647      _html += "</div>";
8648    }
8649    $("#revenueReportList").html(_html);
8650
8651    var total_elott_agent_commission =
8652        list.length == 0 || total.elott_agent_commission == "" ? 0 : total.elott_agent_commission,
8653      total_fish_agent_commission =
8654        list.length == 0 || total.fish_agent_commission == "" ? 0 : total.fish_agent_commission,
8655      total_live_agent_commission =
8656        list.length == 0 || total.live_agent_commission == "" ? 0 : total.live_agent_commission,
8657      total_lott_agent_commission =
8658        list.length == 0 || total.lott_agent_commission == "" ? 0 : total.lott_agent_commission,
8659      total_agent_commission =
8660        total_elott_agent_commission +
8661        total_fish_agent_commission +
8662        total_live_agent_commission +
8663        total_lott_agent_commission,
8664      total_dailySalary = list.length == 0 || total.lott_daily_income == "" ? 0 : total.lott_daily_income,
8665      total_brokerage = list.length == 0 || total.lott_brokerage == "" ? 0 : total.lott_brokerage,
8666      total_income = list.length == 0 || total.agent_income == "" ? 0 : total.agent_income;
8667    _total +=
8668      "<span class='sdt'>" +
8669      tcg.lib.prop("ac_rebate_total") +
8670      ":</span><span class='sdd' data-switchDecimal='" +
8671      decimal +
8672      "' data-value='" +
8673      total_agent_commission +
8674      "'>" +
8675      tcg.ac.customCurrencyFormat(total_agent_commission, decimal) +
8676      "</span>";
8677    _total +=
8678      "<span class='sdt'>" +
8679      tcg.lib.prop("ac_daily_salary") +
8680      ":</span><span class='sdd' data-switchDecimal='" +
8681      decimal +
8682      "' data-value='" +
8683      total_dailySalary +
8684      "'>" +
8685      tcg.ac.customCurrencyFormat(total_dailySalary, decimal) +
8686      "</span>";
8687    _total +=
8688      "<span class='sdt'>" +
8689      tcg.lib.prop("ac_total_commission") +
8690      ":</span><span class='sdd' data-switchDecimal='" +
8691      decimal +
8692      "' data-value='" +
8693      total_brokerage +
8694      "'>" +
8695      tcg.ac.customCurrencyFormat(total_brokerage, decimal) +
8696      "</span>";
8697    _total +=
8698      "<span class='sdt'>" +
8699      tcg.lib.prop("ac_total_amount_income") +
8700      ":</span><span class='sdd' data-switchDecimal='" +
8701      decimal +
8702      "' data-value='" +
8703      total_income +
8704      "'>" +
8705      tcg.ac.customCurrencyFormat(total_income, decimal) +
8706      "</span>";
8707    $("#revenueReportTotal").html(_total);
8708  };
8709
8710  // Agent Dividend
8711  tcg.ac.ui.loadAgentDividendRecord = function (result) {
8712    if (result.list.length == 0) return;
8713    var prev_commission_period =
8714      tcg.ac.timeToDateFormat(result.list[0].prev_start_date.time, "date") +
8715      "~" +
8716      tcg.ac.timeToDateFormat(result.list[0].prev_end_date.time, "date");
8717    $(".prev_commission_period").text(prev_commission_period);
8718    var prev_pnl = result.list[0].prev_net_profit * 1;
8719    var prev_pnlColor = prev_pnl >= 0 ? "tbl-red" : "tbl-green";
8720    $(".prev_pnl").text(prev_pnl).addClass(prev_pnlColor);
8721    var prev_commission = result.list[0].prev_dividend_income;
8722    $(".prev_commission").text(prev_commission);
8723    var current_commission_period =
8724      tcg.ac.timeToDateFormat(result.list[0].curr_start_date.time, "date") +
8725      "~" +
8726      tcg.ac.timeToDateFormat(result.list[0].curr_end_date.time, "date");
8727    $(".current_commission_period").text(current_commission_period);
8728    var current_pnl = result.list[0].curr_net_profit * 1;
8729    var current_pnlColor = current_pnl >= 0 ? "tbl-red" : "tbl-green";
8730    $(".current_pnl").text(current_pnl).addClass(current_pnlColor);
8731    var current_commission = result.list[0].curr_dividend_income;
8732    $(".current_commission").text(current_commission);
8733    var commission_rate = result.list[0].prev_dividend_rate + "%";
8734    $(".commission_rate").text(commission_rate);
8735    var count_of_commission_computed = result.list[0].commission_distributed_count;
8736    $(".count_of_commission_computed").text(count_of_commission_computed);
8737    var count_of_commission_disbursed = result.list[0].commission_received_count;
8738    $(".count_of_commission_disbursed").text(count_of_commission_disbursed);
8739  };
8740  tcg.ac.ui.switchAgentDividendTab = function () {
8741    $("#switchAgentDividend li")
8742      .unbind("click")
8743      .bind("click", function () {
8744        var targetId = $(this).attr("data-rel");
8745        $("#switchAgentDividend li.active").removeClass("active");
8746        $(this).addClass("active");
8747        $(".contentTab").addClass("hide");
8748        $("#" + targetId).removeClass("hide");
8749
8750        switch (targetId) {
8751          case "contractManagementContent":
8752            $("#editContract").addClass("hide");
8753            $("#contractManagement").removeClass("hide");
8754            tcg.ac.getReceiverScreen();
8755            break;
8756          case "disbursementContent":
8757            $("#disbursementContent").removeClass("hide");
8758            $("#disbursementContent .form-submit").click();
8759            break;
8760        }
8761      });
8762  };
8763  tcg.ac.ui.loadDisbursementRecords = function (result) {
8764    var _html = "";
8765    if (result.value.list) {
8766      result = result.value.list;
8767      if (result.length > 0) {
8768        for (var i = 0; i < result.length; i++) {
8769          var elem = result[i];
8770          var action = "";
8771          if (elem.status === "0" && elem.amount > 0) {
8772            action =
8773              '<div class="hag_link_mangdetl tbl-link action-btn disburse" id="' +
8774              elem.id +
8775              '" data-beneficiaryId="' +
8776              elem.beneficiary_id +
8777              '">派发</div>';
8778          } else {
8779            action = '<div class="" id="' + elem.id + '" data-beneficiaryId="' + elem.beneficiary_id + '">-</div>';
8780          }
8781          _html += '   <div class="distbursement-content">';
8782          _html += '   <div class="d-name">' + elem.beneficiary_name + "</div>";
8783          _html += '   <div class="d-date">' + tcg.ac.formatDateFull(elem.create_date, "yyyy-MM-dd") + "</div>";
8784          _html += '   <div class="d-Tbeating">' + elem.team_bet + "</div>";
8785          _html += '   <div class="d-TPNL">' + elem.team_profit + "</div>";
8786          _html += '   <div class="d-active-member">' + elem.active_member + "</div>";
8787          _html += '   <div class="d-ratio">' + Math.round(elem.contract_rate * 100, 2) + "%</div>";
8788          _html += '   <div class="d-amount">' + elem.amount + "</div>";
8789          _html += action;
8790          _html += "   </div>";
8791        }
8792      } else {
8793        _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
8794      }
8795    } else {
8796      _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
8797    }
8798
8799    $("#tblDisbursementRecords").html(_html);
8800  };
8801  tcg.ac.ui.loadDisbursementRecordsCopy = function (result) {
8802    var _html = "";
8803    if (result.value.list) {
8804      result = result.value.list;
8805      if (result.length > 0) {
8806        for (var i = 0; i < result.length; i++) {
8807          var elem = result[i];
8808          var action = "";
8809          if (elem.status === "0" && elem.amount > 0) {
8810            action =
8811              '<div class="hag_link_mangdetl tbl-link action-btn disburse" id="' +
8812              elem.id +
8813              '" data-beneficiaryId="' +
8814              elem.beneficiary_id +
8815              '">派发</div>';
8816          } else {
8817            action = '<div class="" id="' + elem.id + '" data-beneficiaryId="' + elem.beneficiary_id + '">-</div>';
8818          }
8819          _html += '   <div class="distbursement-content">';
8820          _html += '   <div class="d-name">' + elem.beneficiary_name + "</div>";
8821          _html += '   <div class="d-date">' + tcg.ac.formatDateFull(elem.create_date, "yyyy-MM-dd") + "</div>";
8822          _html += '   <div class="d-Tbeating">' + elem.team_bet + "</div>";
8823          _html += '   <div class="d-TPNL">' + elem.team_profit + "</div>";
8824          _html += '   <div class="d-active-member">' + elem.active_member + "</div>";
8825          _html += '   <div class="d-ratio">' + Math.round(elem.contract_rate * 100, 2) + "%</div>";
8826          _html += '   <div class="d-amount">' + elem.amount + "</div>";
8827          _html += action;
8828          _html += "   </div>";
8829        }
8830      } else {
8831        _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
8832      }
8833    } else {
8834      _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
8835    }
8836
8837    $("#tblDisbursementRecords").html(_html);
8838  };
8839
8840  tcg.ac.ui.loadContractManagementList = function (result, agentDownlines, search) {
8841    var list = result.downline;
8842    var adList = [];
8843    var _list = "";
8844
8845    $("#usedContracts").text(result.footer.usedContracts);
8846    $("#totalContracts").text(result.footer.totalContracts);
8847
8848    for (var i = 0; i < list.length; i++) {
8849      adList.push(list[i].receiver);
8850
8851      if (list[i].status != "C" && list[i].status != "R" && list[i].status != "V") {
8852        _list += "<div class='d-cont-wrp'>";
8853        _list += "<div class='d-name'>" + list[i].receiver + "</div>";
8854        _list +=
8855          "<div class='d-contact'><a href='javascript:void(0);' data-targetCustomer='" +
8856          list[i].receiver +
8857          "' data-requestedRate='" +
8858          list[i].contractRate +
8859          "' data-mode='view' class='action-btn viewList'>" +
8860          tcg.lib.prop("label_details") +
8861          "</a></div>";
8862        _list += "<div class='d-time'>" + tcg.ac.timeToDateFormat(list[i].createdDate, "dateTime") + "</div>";
8863        var approveDate =
8864          list[i].processedDate != null ? tcg.ac.timeToDateFormat(list[i].processedDate, "dateTime") : "-";
8865        _list += "<div class='d-apTime'>" + approveDate + "</div>";
8866        var status;
8867        var action;
8868        switch (list[i].status) {
8869          case "P":
8870            status = tcg.lib.prop("ac_status_P");
8871            action = tcg.lib.prop("ac_waiting_to_determined");
8872            break;
8873          case "A":
8874            status = tcg.lib.prop("ac_status_A");
8875            action =
8876              "<a href='javascript:void(0);' data-contractRate='" +
8877              list[i].contractRate +
8878              "' data-requestId='" +
8879              list[i].id +
8880              "' data-targetCustomer='" +
8881              list[i].receiver +
8882              "' class='action-btn void pointer'>" +
8883              tcg.lib.prop("ac_termination") +
8884              "</a>  |   <a href='javascript:void(0);' data-contractRate='" +
8885              list[i].contractRate +
8886              "' data-requestId='" +
8887              list[i].id +
8888              "' data-targetCustomer='" +
8889              list[i].receiver +
8890              "' data-contractRate='" +
8891              list[i].contractRate +
8892              "' data-minimumBet='" +
8893              list[i].minimumBet +
8894              "' data-activeMember='" +
8895              list[i].activeMember +
8896              "' data-mode='edit' class='action-btn viewList'>" +
8897              tcg.lib.prop("ac_modify") +
8898              "</a>";
8899            break;
8900          case "E":
8901            status = tcg.lib.prop("ac_status_P");
8902            action = tcg.lib.prop("ac_waiting_to_determined");
8903            break;
8904          case "C":
8905            status = "Cancelled";
8906            action =
8907              "<a href='javascript:void(0);' data-targetCustomer='" +
8908              list[i].receiver +
8909              "' data-requestedRate='" +
8910              list[i].contractRate +
8911              "' class='action-btn request'>" +
8912              tcg.lib.prop("ac_initiate_contract") +
8913              "</a>";
8914            break;
8915          case "R":
8916            status = "Rejected";
8917            action =
8918              "<a href='javascript:void(0);' data-targetCustomer='" +
8919              list[i].receiver +
8920              "' data-requestedRate='" +
8921              list[i].contractRate +
8922              "' class='action-btn request'>" +
8923              tcg.lib.prop("ac_initiate_contract") +
8924              "</a>";
8925            break;
8926          default:
8927            status = tcg.lib.prop("ac_status_DEF");
8928            action =
8929              "<a href='javascript:void(0);' data-targetCustomer='" +
8930              list[i].receiver +
8931              "' data-requestedRate='" +
8932              list[i].contractRate +
8933              "' class='action-btn request'>" +
8934              tcg.lib.prop("ac_initiate_contract") +
8935              "</a>";
8936        }
8937        _list += "<div class='d-status'>" + status + "</div>";
8938        _list += "<div class='d-histLog'>-</div>";
8939        _list += "<div class='d-action'>" + action + "</div>";
8940        _list += "</div>";
8941      }
8942    }
8943
8944    if (!search) {
8945      for (var i = 0; i < agentDownlines.length; i++) {
8946        if (_list.indexOf(agentDownlines[i].customerName) < 0) {
8947          _list += "<div class='d-cont-wrp'>";
8948          _list += "<div class='d-name'>" + agentDownlines[i].customerName + "</div>";
8949          _list += "<div class='d-contact'>-</div>";
8950          _list += "<div class='d-time'>-</div>";
8951          var approveDate =
8952            agentDownlines[i].processedDate != null
8953              ? tcg.ac.timeToDateFormat(agentDownlines[i].processedDate, "dateTime")
8954              : "-";
8955          _list += "<div class='d-apTime'>" + approveDate + "</div>";
8956          var status;
8957          var action;
8958          if (agentDownlines[i].status == "P") {
8959            status = tcg.lib.prop("ac_status_P");
8960            action = tcg.lib.prop("ac_waiting_to_determined");
8961          } else if (agentDownlines[i].status == "A" || agentDownlines[i].status == "E") {
8962            status = tcg.lib.prop("ac_status_A");
8963            action =
8964              "<a href='javascript:void(0);' data-contractRate='" +
8965              agentDownlines[i].contractRate +
8966              "' data-requestId='" +
8967              agentDownlines[i].id +
8968              "' class='action-btn void pointer'>" +
8969              tcg.lib.prop("ac_termination") +
8970              "</a>  |   <a href='javascript:void(0);' data-contractRate='" +
8971              agentDownlines[i].contractRate +
8972              "' data-targetCustomer='" +
8973              agentDownlines[i].receiver +
8974              "' data-contractRate='" +
8975              agentDownlines[i].contractRate +
8976              "' data-minimumBet='" +
8977              agentDownlines[i].minimumBet +
8978              "' data-activeMember='" +
8979              agentDownlines[i].activeMember +
8980              "' class='action-btn modify'>" +
8981              tcg.lib.prop("ac_modify") +
8982              "</a>";
8983          } else {
8984            status = tcg.lib.prop("ac_status_DEF");
8985            action =
8986              "<a href='javascript:void(0);' data-targetCustomer='" +
8987              agentDownlines[i].customerName +
8988              "' data-requestedRate='" +
8989              agentDownlines[i].contractRate +
8990              "' class='action-btn request'>" +
8991              tcg.lib.prop("ac_initiate_contract") +
8992              "</a>";
8993          }
8994          _list += "<div class='d-status'>" + status + "</div>";
8995          _list += "<div class='d-histLog'>-</div>";
8996          _list += "<div class='d-action'>" + action + "</div>";
8997          _list += "</div>";
8998        }
8999      }
9000    } else {
9001      for (var i = 0; i < agentDownlines.length; i++) {
9002        if (agentDownlines[i].customerName == search) {
9003          if (_list.indexOf(search) < 0) {
9004            _list += "<div class='d-cont-wrp'>";
9005            _list += "<div class='d-name'>" + search + "</div>";
9006            _list += "<div class='d-contact'>-</div>";
9007            _list += "<div class='d-time'>-</div>";
9008            _list += "<div class='d-apTime'>-</div>";
9009            var status;
9010            var action;
9011            status = tcg.lib.prop("ac_status_DEF");
9012            action =
9013              "<a href='javascript:void(0);' data-targetCustomer='" +
9014              search +
9015              "' data-requestedRate='' class='action-btn request'>" +
9016              tcg.lib.prop("ac_initiate_contract") +
9017              "</a>";
9018            _list += "<div class='d-status'>" + status + "</div>";
9019            _list += "<div class='d-histLog'>-</div>";
9020            _list += "<div class='d-action'>" + action + "</div>";
9021            _list += "</div>";
9022          }
9023        }
9024      }
9025    }
9026
9027    $("#contractManagementList").html(_list);
9028    tcg.ac.ui.sendContractRequest();
9029    tcg.ac.voidContract();
9030    tcg.ac.modifyContract();
9031    tcg.ac.ui.backToContractManagement();
9032  };
9033
9034  tcg.ac.ui.loadContractRequest = function (result) {
9035    var _html = "";
9036    _html += '<div id="contract_request_modal" class="hag_modal">';
9037    _html += '    <div class="hag_modal_main">';
9038    _html += '    <div class="hag_modal_body">';
9039    _html += '<div class="receiver-dvdnt" id="">';
9040    _html += '<div class="receiver-dvdnt-wrp">';
9041    _html += '<div class="inline-block top-contner">';
9042    _html += "</div>";
9043    _html += '<div class="reciever-title-header">';
9044    if (tcg.ac.getMerchant() == "hongda") {
9045      _html += '<div class="po-middle new r-betting">周期消费</div>';
9046      _html += '<div class="po-middle new r-betVolume">周期亏损</div>';
9047      _html += '<div class="po-middle new r-amember">活跃人数</div>';
9048      _html += '<div class="po-middle new r-drate">分红比例</div>';
9049    } else {
9050      _html += '<div class="r-betVolume po-middle">' + tcg.lib.prop("ac_dividend_requirements") + "</div>";
9051      _html += '<div class="r-amember po-middle">' + tcg.lib.prop("label_active_number") + "</div>";
9052      _html += '<div class="r-drate po-middle">' + tcg.lib.prop("label_dividend_ratio") + "</div>";
9053    }
9054    _html += "</div>";
9055    _html += '<div class="reciever-content-wrp" id="contractList">';
9056    _html += '<div class="reciever-content">';
9057    _html += "</div>";
9058    var new_result = tcg.ac.dividendChangeListVlue(result.value);
9059    for (var i = 0; i < new_result.length; i++) {
9060      var elem = new_result[i],
9061        minimumBetCol = "",
9062        widthClass = "";
9063      if (tcg.ac.getMerchant() == "hongda") {
9064        minimumBetCol = '<div class="po-middle">' + elem.minimumBet + tcg.lib.prop("ac_yuan") + "</div>";
9065        widthClass = "new";
9066      }
9067      _html +=
9068        '<div class="reciever-content">' +
9069        minimumBetCol +
9070        '<div class="po-middle ' +
9071        widthClass +
9072        '">' +
9073        elem.netLoss +
9074        tcg.lib.prop("ac_yuan") +
9075        '</div><div class="po-middle ' +
9076        widthClass +
9077        '">' +
9078        elem.activeMember +
9079        tcg.lib.prop("label_unit_people") +
9080        '</div><div class="po-middle ' +
9081        widthClass +
9082        '">' +
9083        parseInt(elem.contractRate * 100) +
9084        "%</div></div>";
9085    }
9086
9087    _html += "</div>";
9088    _html += '<div class="reciever-guide">';
9089    _html += '<div class="inline-block top-contner">';
9090    _html += "</div>";
9091    _html += '<div class="g-list-r"><span>' + tcg.lib.prop("ac_receiver_guide_1") + "</span>";
9092    _html += "<ol>";
9093    _html += "<li>" + tcg.lib.prop("ac_receiver_guide_2") + "</li>";
9094    _html += "<li>" + tcg.lib.prop("ac_receiver_guide_3") + "</li>";
9095    _html += "<li>" + tcg.lib.prop("ac_receiver_guide_4") + "</li>";
9096    _html += "</ol>";
9097    _html += "</div>";
9098    _html += '<div class="footer-con">';
9099    _html +=
9100      '<div class="red-bnt po-middle" id="approveContract"><input value="' +
9101      tcg.lib.prop("ac_datepicker_closeText") +
9102      '" class=" form-submit" type="button"></div>';
9103    _html +=
9104      '<div class="cancel_req po-middle" id="rejectContract"><input value="' +
9105      tcg.lib.prop("ac_cancel") +
9106      '" class=" ch-overyd" type="button"></div>';
9107    _html += "</div>";
9108    _html += "</div>";
9109    _html += "</div>";
9110    _html += "</div>";
9111    _html += "</div>";
9112    _html += "</div>";
9113    _html += "</div>";
9114    $("body").append(_html);
9115  };
9116  tcg.ac.ui.loadContractRequestCopy = function (result) {
9117    globalVar.contractRequests = result;
9118    var _html = "";
9119    _html += '<div id="contract_request_modal" class="hag_modal">';
9120    _html += '    <div class="hag_modal_main">';
9121    _html += '    <div class="hag_modal_body">';
9122    _html += '<div class="receiver-dvdnt" id="">';
9123    _html += '<div class="receiver-dvdnt-wrp">';
9124    _html += '<div class="inline-block top-contner">';
9125    _html += '<div class="label-name po-middle">产品</div>';
9126    _html += '<div class="slect-box-custom mem-icon2 po-middle red-up">';
9127    _html += '<select class="form-control ctSelect" name="gameType" data-placeholder="&nbsp;">';
9128    if (sessionStorage.merchantCode == "xinying") {
9129      _html += '<option value="CONS">综合</option>';
9130    } else {
9131      _html += '<option value="CONS">综合</option>';
9132      _html += '<option value="LOTT">彩票</option>';
9133    }
9134    _html += "</select></div>";
9135    //_html += '<div class="label-name po-middle" style="color: red;">请先选择产品</div>';
9136    _html += "</div>";
9137    _html += '<div class="reciever-title-header">';
9138    _html += '<div class="po-middle new r-betting">周期消费</div>';
9139    _html += '<div class="po-middle new r-betVolume">周期亏损</div>';
9140    _html += '<div class="po-middle new r-amember">活跃人数</div>';
9141    _html += '<div class="po-middle new r-drate">分红比例</div>';
9142    _html += "</div>";
9143    _html += '<div class="reciever-content-wrp" id="contractList">';
9144    _html += '<div class="reciever-content">';
9145    _html += "</div>";
9146    var new_result = tcg.ac.dividendChangeListVlue(result.value);
9147    for (var i = 0; i < new_result.length; i++) {
9148      if (new_result[i].gameType == "CONS") {
9149        var elem = new_result[i],
9150          minimumBetCol = "",
9151          widthClass = "";
9152        _html +=
9153          '<div class="reciever-content"><div class="po-middle new">' +
9154          elem.minimumBet +
9155          "元" +
9156          '</div><div class="po-middle new">' +
9157          elem.netLoss +
9158          "元" +
9159          '</div><div class="po-middle new">' +
9160          elem.activeMember +
9161          "人" +
9162          '</div><div class="po-middle new">' +
9163          parseInt(elem.contractRate * 100) +
9164          "%</div></div>";
9165      }
9166    }
9167
9168    _html += "</div>";
9169    _html += '<div class="reciever-guide">';
9170    _html += '<div class="inline-block top-contner">';
9171    _html += "</div>";
9172    _html +=
9173      '<div class="g-list-r"><span>为保障代理的分红利益,平台推出“契约分红协议”,该协议由平台上下级代理以自愿的原则签署,并接受平台的监督。</span>';
9174    _html += "<ol>";
9175    _html += "<li>
9175“契约协议” 就是上级与下级在平台内部建立一种分红约定。</li>";
9176    _html += "<li>如在当期结束时间后,仍未发放分红,平台将认定为拒绝发放,系统将冻结上级账号并强制发放给下级。</li>";
9177    _html += "<li>平台的所有规则与条款,平台保留最终解释权!</li>";
9178    _html += "</ol>";
9179    _html += "</div>";
9180    _html += '<div class="footer-con">';
9181    _html +=
9182      '<div class="red-bnt po-middle" id="approveContract"><input value="同意" class=" form-submit" type="button"></div>';
9183    _html +=
9184      '<div class="cancel_req po-middle" id="rejectContract"><input value="拒绝" class=" ch-overyd" type="button"></div>';
9185    _html += "</div>";
9186    _html += "</div>";
9187    _html += "</div>";
9188    _html += "</div>";
9189    _html += "</div>";
9190    _html += "</div>";
9191    _html += "</div>";
9192    $("body").append(_html);
9193    tcg.ac.ui.customSelect("#contract_request_modal select[name='gameType']");
9194    $('#contract_request_modal select[name="gameType"]').on("change", function (e) {
9195      $("#contractList").html("");
9196      var optionSelected = $("option:selected", this);
9197      var valueSelected = this.value;
9198      var new_result = tcg.ac.dividendChangeListVlue(globalVar.contractRequests.value);
9199      var _list = "";
9200      for (var i = 0; i < new_result.length; i++) {
9201        if (new_result[i].gameType == valueSelected) {
9202          var elem = new_result[i],
9203            minimumBetCol = "",
9204            widthClass = "";
9205          _list +=
9206            '<div class="reciever-content"><div class="po-middle new">' +
9207            elem.minimumBet +
9208            "元" +
9209            '</div><div class="po-middle new">' +
9210            elem.netLoss +
9211            "元" +
9212            '</div><div class="po-middle new">' +
9213            elem.activeMember +
9214            "人" +
9215            '</div><div class="po-middle new">' +
9216            parseInt(elem.contractRate * 100) +
9217            "%</div></div>";
9218        }
9219      }
9220      $("#contractList").html(_list);
9221    });
9222  };
9223
9224  //tcg.ac.ui.loadContractRequest = function (result) {
9225  //    var _html = '';
9226  //    _html += '<div id="contract_request_modal" class="hag_modal">';
9227  //    _html += '    <div class="hag_modal_main">';
9228  //    _html += '    <div class="hag_modal_body">';
9229  //    _html += '    <div id="viewDLContractList" class="hag_modal_body hide">';
9230  //    _html += '    <div class="hag_bonus_dirmtitle hag_modal_btitle">我的分红规则';
9231  //    _html += '    <span class="hag_modal_bclose"></span>';
9232  //    _html += '    </div>';
9233  //    _html += '    <div class="hag_modal_bilist">';
9234  //    _html += '    </div>';
9235  //    _html += '    </div>';
9236  //    _html += '    <div class="hag_modal_bwrite hag_alluse_scroll">';
9237  //    _html += '<ul class="hag_bouns_dirlul">';
9238  //    _html += '<li class="hag_bouns_dirlulf"><div class="hag_bouns_w310">分红要求:半月总量</div>    <div class="hag_bouns_w310">活跃人数</div><div class="hag_bouns_w310">分红比例</div></li>';
9239  //    for (var i = 0; i < result.value.length; i++) {
9240  //        var elem = result.value[i];
9241  //        _html += '<li><div class="hag_bouns_w310">半月≥' + elem.minimumBet + '元</div><div class="hag_bouns_w310">' + elem.activeMember + '人</div><div class="hag_bouns_w310">' + (elem.contractRate * 100) + '%</div></li>';
9242  //    }
9243  //    _html += '</ul>';
9244  //    _html += '<div class="c-r-instruc-cont"><ol>';
9245  //    _html += '<li>协议双发认可该协议所达成的分红规则。</li>';
9246  //    _html += '<li>每半个月为一个分红周期,不累计。</li>';
9247  //    _html += '<li>每个月的1号和16号为分红发放时间,分红金额按照亏损金额对应分红比例进行派发。</li>';
9248  //    _html += '<li>您的上级余额已被暂时冻结,优先下级分红领取。</li>';
9249  //    _html += '<li>无论发生任何情况上级必须优先发放下级的应得分红,否则平台将强制执行发放分红。</li>';
9250  //    _html += '<li>此协议分红仅对协议双方有效。</li>';
9251  //    _html += '<li>平台仅作为第三方监督机构来确保本协议的有效性。</li>';
9252  //    _html += '<li>彩享有最终解释和修改权。</li>';
9253  //    _html += '</ol></div>';
9254  //    _html += '<div class="hag_modal_srbtn c-r-width">';
9255  //    _html += '    <div id="approveContract" class="hag_bouns_dirltprbt hag_bouns_dirltprbs3">';
9256  //    _html += '    <span>接受</span>';
9257  //    _html += '    </div>';
9258  //    _html += '    <div id="rejectContract" class="hag_cancel hag_bouns_dirltprbt hag_bouns_dirltprbs4">';
9259  //    _html += '<span>拒绝</span></div>';
9260  //    _html += '</div>';
9261  //    _html += '</div>';
9262  //    _html += '</div>';
9263  //    _html += '</div>';
9264  //    _html += '</div>';
9265  //    _html += '</div>';
9266  //    $("body").append(_html);
9267  //};
9268  tcg.ac.ui.sendContractRequest = function () {
9269    $("#contractManagementList .request")
9270      .unbind("click")
9271      .bind("click", function () {
9272        $("#contractManagement").addClass("hide");
9273        $("#editContract").removeClass("hide");
9274        $(".add-contract").removeClass("hide");
9275        var targetCustomer = $(this).attr("data-targetCustomer");
9276        $(".nameHolder-div span.po-middle").html(targetCustomer);
9277        $(".contractList").html("");
9278
9279        tcg.ac.addContractItem();
9280      });
9281  };
9282  tcg.ac.ui.validateContractInput = function () {
9283    var form = $(".add-contract"),
9284      betVolume = form.find("#cm_betVolume"),
9285      actMember = form.find("#cm_actMember"),
9286      rate = form.find("#cm_rate");
9287
9288    $(document)
9289      .off("keypress", ".add-contract div input")
9290      .on("keypress", ".add-contract div input", function (e) {
9291        if (e.keyCode == 13) {
9292          $(".add-contract .add-action").trigger("click");
9293          e.preventDefault();
9294        }
9295      });
9296    $(document)
9297      .off("keyup", ".add-contract div input")
9298      .on("keyup", ".add-contract div input", function (e) {
9299        var extractedNumber = tcg.ac.extractNumber(this.value);
9300      });
9301  };
9302  tcg.ac.ui.loadContractManagementListDownlines = function (result, mode) {
9303    var _contractItem = "";
9304    var downline = result.result.downline;
9305    var action;
9306    if (mode == "view") {
9307      action = '<div class="d-action">-</div>';
9308    } else {
9309      action = '<div class="d-action action-btn">' + tcg.lib.prop("ac_delete_btn") + "</div>";
9310    }
9311    var i,
9312      id = 1;
9313    for (i = 0; i < downline.length; i++) {
9314      if (downline[i].status != "C" && downline[i].status != "R" && downline[i].status != "V") {
9315        _contractItem += '<div class="divident-content-wrp">';
9316        _contractItem += '<div class="d-rnumber" data-requestId="' + downline[i].id + '">' + id + "</div>";
9317        _contractItem += '<div class="d-betVolume">' + downline[i].minimumBet + "</div>";
9318        _contractItem += '<div class="d-act-member">' + downline[i].activeMember + "</div>";
9319        _contractItem +=
9320          '<div class="d-rate">' + tcg.ac.percentRate(downline[i].contractRate, "rateToPercent") + "</div>";
9321        _contractItem += action;
9322        _contractItem += "</div>";
9323        id++;
9324      }
9325    }
9326    $(".contractList").append(_contractItem);
9327    $(".add-contract .d-rnumber").text(id);
9328    if (mode != "view") {
9329      $(".add-contract").removeClass("hide");
9330    }
9331  };
9332  tcg.ac.ui.backToContractManagement = function () {
9333    $(document)
9334      .off("click", ".backToContractManagement")
9335      .on("click", ".backToContractManagement", function () {
9336        $("#contractManagementList").html("");
9337        $("#contractManagementForm .form-submit").click();
9338        $("#editContract").addClass("hide");
9339        $("#contractManagement").removeClass("hide");
9340      });
9341  };
9342  tcg.ac.ui.loadDisbursementList = function (result) {
9343    var list = result.list,
9344      _disbursementItem = "";
9345    $(".distbursement-content").remove();
9346    for (var i = 0; i < list.length; i++) {
9347      _disbursementItem += '<div class="distbursement-content">';
9348      _disbursementItem += '<div class="d-name">' + list[i].beneficiary_name + "</div>";
9349      _disbursementItem += '<div class="d-date">' + list[i].create_date + "</div>";
9350      _disbursementItem += '<div class="d-Tbeating">' + list[i].team_bet + "</div>";
9351      _disbursementItem += '<div class="d-TPNL">' + list[i].team_profit + "</div>";
9352      _disbursementItem += '<div class="d-active-member">' + list[i].active_member + "</div>";
9353      _disbursementItem +=
9354        '<div class="d-ratio">' + tcg.ac.percentRate(list[i].contract_rate, "rateToPercent") + "</div>";
9355      _disbursementItem += '<div class="d-amount">' + list[i].amount + "</div>";
9356      _disbursementItem +=
9357        '<div class="action-btn disburse" id="' +
9358        list[i].id +
9359        '" data-beneficiaryId="' +
9360        list[i].beneficiary_id +
9361        '">派发</div></div>';
9362    }
9363    $("#disbursementList").append(_disbursementItem);
9364  };
9365
9366  /******** agentDailyWages 日工资 ********/
9367
9368  tcg.ac.ui.dailySalDisbursementRecords = function (rs) {
9369    var _html =
9370      '<li class="hag_bouns_dirlulf"><div class="hag_bouns_w150">' +
9371      tcg.lib.prop("ac_subordination_username") +
9372      '</div><div class="hag_bouns_w150">' +
9373      tcg.lib.prop("ac_settlement_time") +
9374      '</div><div class="hag_bouns_w150">' +
9375      tcg.lib.prop("ac_lotto_pnl_summaryType_1_column_4") +
9376      '</div><div class="hag_bouns_w150">' +
9377      tcg.lib.prop("ac_active_member_no") +
9378      '</div><div class="hag_bouns_w200">' +
9379      tcg.lib.prop("ac_daily_wage_ratio") +
9380      '</div><div class="hag_bouns_w200">' +
9381      tcg.lib.prop("ac_amount_of_wages") +
9382      "</div></li>";
9383
9384    if (rs.length > 0) {
9385      for (var i = 0; i < rs.length; i++) {
9386        _html += "<li>";
9387        _html += '<div class="hag_bouns_w150">' + rs[i].beneficiary_unclude_merchant + "</div>";
9388        _html += '<div class="hag_bouns_w150">' + rs[i].create_time + "</div>";
9389        _html += '<div class="hag_bouns_w150">' + rs[i].team_betting + "</div>";
9390        _html += '<div class="hag_bouns_w150">' + rs[i].active_member + "</div>";
9391        if (rs[i].rate_type == "F") {
9392          _html += '<div class="hag_bouns_w200">' + tcg.lib.prop("ac_fixed_amount") + rs[i].rate + "</div>";
9393        } else {
9394          _html += '<div class="hag_bouns_w200">' + tcg.lib.prop("ac_proportion") + rs[i].rate * 100 + "%</div>";
9395        }
9396        _html += '<div class="hag_bouns_w200">' + rs[i].amount + "</div>";
9397        _html += "</li>";
9398      }
9399    } else {
9400      _html += "<div class='tableContent-wrp'>";
9401      _html += "<div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
9402      _html += "</div>";
9403    }
9404
9405    $("#dailySalDisbursementRList").html(_html);
9406  };
9407  tcg.ac.ui.loadSalaryDownlines = function (result, downlineContracts) {
9408    //  Declare
9409    var _html = "",
9410      registerAmount = 0;
9411    var status = {
9412      P: { status: tcg.lib.prop("ac_status_P") },
9413      A: { status: tcg.lib.prop("ac_status_A") },
9414      E: { status: tcg.lib.prop("ac_status_E") },
9415      C: { status: tcg.lib.prop("ac_status_C") },
9416      V: { status: tcg.lib.prop("ac_status_V") },
9417      R: { status: tcg.lib.prop("ac_status_R") },
9418      DEF: { status: tcg.lib.prop("ac_status_DEF") },
9419    };
9420
9421    //  Show result
9422    var downline_contracts = {};
9423    if (downlineContracts.value.downline) {
9424      var downlineContracts = downlineContracts.value.downline;
9425      $(downlineContracts).map(function () {
9426        downline_contracts[this.receiverId] = this;
9427      });
9428    }
9429    _html += '    <li class="hag_bouns_dirlulf">';
9430    _html +=
9431      '    <div class="hag_bouns_name">' +
9432      tcg.lib.prop("ac_subordinate_management_register_downline_account_placeholder") +
9433      "</div>";
9434    _html += '    <div class="hag_bouns_w100">' + tcg.lib.prop("ac_agreement_content") + "</div>";
9435    _html += '    <div class="hag_bouns_w200">' + tcg.lib.prop("ac_signing_time") + "</div>";
9436    _html += '    <div class="hag_bouns_w200">' + tcg.lib.prop("label_agreement_effective_time") + "</div>";
9437    _html += '    <div class="hag_bouns_w100">' + tcg.lib.prop("label_status") + "</div>";
9438    _html += '    <div class="hag_bouns_w100">' + tcg.lib.prop("label_history_of_sign_contract") + "</div>";
9439    _html +=
9440      '    <div class="hag_bouns_dirulicfr hag_bouns_w100 added-marg">' +
9441      tcg.lib.prop("ac_link_manager_column_8") +
9442      "</div>";
9443    _html += "    </li>";
9444
9445    try {
9446      if (result.length) {
9447        var status_mem = "DEF";
9448        for (var i = 0; i < result.length; i++) {
9449          var entry = result[i];
9450          var createdDate = "-";
9451          var processed_date = "-";
9452          var log_action = "-";
9453          var add_contract_btn = "";
9454          add_contract_btn +=
9455            '<div class="hag_bouns_dirulicfr add_salary hag_bouns_w100" data-targetCustomer="' +
9456            entry.customer_id +
9457            '">';
9458          add_contract_btn +=
9459            '<span class="hag_bouns_dirulibtn pointer action-btn" >' + tcg.lib.prop("ac_initiate_contract") + "</span>";
9460          add_contract_btn += "</div>";
9461          var dividend_info = '<div class="hag_bouns_w100 hag_bouns_c4c" >' + "-" + "</div>";
9462          if (downline_contracts[entry.customer_id]) {
9463            status_mem = downline_contracts[entry.customer_id].status;
9464            if (downline_contracts[entry.customer_id].processedDate) {
9465              processed_date = tcg.ac.formatDateFull(
9466                downline_contracts[entry.customer_id].processedDate * 1,
9467                "yyyy-MM-dd hh:mm"
9468              );
9469            }
9470            if (downline_contracts[entry.customer_id].createdDate) {
9471              createdDate = tcg.ac.formatDateFull(
9472                downline_contracts[entry.customer_id].createdDate * 1,
9473                "yyyy-MM-dd hh:mm"
9474              );
9475            }
9476            log_action =
9477              "<span class='salary_log hag_bouns_c4c pointer action-btn' data-customer_id='" +
9478              entry.customer_id +
9479              "'>" +
9480              tcg.lib.prop("ac_signing_history") +
9481              "</span>";
9482            dividend_info =
9483              '<div class="hag_bouns_w100 hag_bouns_c4c viewSalaryDetails action-btn pointer" data-request_id="' +
9484              downline_contracts[entry.customer_id].id +
9485              '" data-targetCustomer="' +
9486              entry.customer_name +
9487              '" data-requestedRate="' +
9488              downline_contracts[entry.customer_id].contractRate +
9489              '" >' +
9490              tcg.lib.prop("label_details") +
9491              "</div>";
9492            if (downline_contracts[entry.customer_id].status == "A") {
9493              add_contract_btn = "";
9494              add_contract_btn += '<div class="hag_bouns_dirulicfr hag_bouns_c4c hag_bouns_w100">';
9495              add_contract_btn +=
9496                '<span class="pointer void_salary action-btn" data-targetCustomer="' +
9497                entry.customer_name +
9498                '"  data-request_id="' +
9499                downline_contracts[entry.customer_id].id +
9500                '" >' +
9501                tcg.lib.prop("ac_termination") +
9502                "</span> | ";
9503              add_contract_btn +=
9504                '<span class="pointer edit_salary action-btn" data-targetCustomer="' +
9505                entry.customer_id +
9506                '" data-request_id="' +
9507                downline_contracts[entry.customer_id].id +
9508                '" >' +
9509                tcg.lib.prop("ac_modify") +
9510                "</span>";
9511              add_contract_btn += "</div>";
9512            } else if (
9513              downline_contracts[entry.customer_id].status == "P" ||
9514              downline_contracts[entry.customer_id].status == "V"
9515            ) {
9516              add_contract_btn = "";
9517              add_contract_btn += '<div class="hag_bouns_dirulicfr">';
9518              add_contract_btn += tcg.lib.prop("ac_waiting_to_determined");
9519              add_contract_btn += "</div>";
9520            } else if (downline_contracts[entry.customer_id].status == "E") {
9521              add_contract_btn = "";
9522              add_contract_btn += '<div class="hag_bouns_dirulicfr">';
9523              add_contract_btn += tcg.lib.prop("ac_waiting_to_determined");
9524              add_contract_btn += "</div>";
9525            }
9526          }
9527          _html += "<li>";
9528          _html += '<div class="hag_bouns_name">' + entry.customer_name + "</div>";
9529          _html += dividend_info;
9530          _html += '<div class="hag_bouns_w200">' + createdDate + "</div>";
9531          _html += '<div class="hag_bouns_w200">' + processed_date + "</div>";
9532          if (downline_contracts[entry.customer_id]) {
9533            _html += '<div class="hag_bouns_w100">' + status[status_mem].status + "</div>";
9534          } else {
9535            _html += '<div class="hag_bouns_w100">' + tcg.lib.prop("ac_status_DEF") + "</div>";
9536          }
9537
9538          _html += '<div class="hag_bouns_w100 hag_bouns_c4c">' + log_action + "</div>";
9539          _html += add_contract_btn;
9540          _html += "</li>";
9541        }
9542      } else {
9543        _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
9544      }
9545    } catch (e) {
9546      _html += "<div class='tableContent-wrp'><div class='noResult-data'>" + tcg.lib.prop("no_result") + "</div>";
9547    }
9548    $("#downlineList").html(_html);
9549    $("#totalEffectiveAmount").text(registerAmount);
9550  };
9551  tcg.ac.ui.addNewSalRow = function (data) {
9552    var curr_inc = $("#addDailySalaryForm .rec_increment").html() * 1;
9553    curr_inc++;
9554    var _html = "";
9555    var rate_type = {
9556      P: "比例",
9557      F: "固定金额",
9558    };
9559    var dataRate = data.rate,
9560      sign = "%",
9561      rate;
9562    if (data.rateType == "F") {
9563      dataRate = Decimal(data.rate / data.betVolume)
9564        .times(100)
9565        .toString();
9566      sign = "";
9567      rate = data.rate;
9568    }
9569    if (data.rateType == "P") {
9570      if (Decimal(data.rate).decimalPlaces() === 0) {
9571        rate = Decimal(data.rate).toFixed(2).toString();
9572      } else {
9573        rate = tcg.ac.trimDecimal(data.rate, 2);
9574      }
9575    }
9576    // data.rateType = "P";
9577    _html += '<li class="sal_row row_has_val" id="con_row_index_' + (curr_inc - 1) + '">';
9578    _html += '<div class="hag_bouns_w150 hag_bouns_c4c">' + (curr_inc - 1) + "</div>";
9579    _html += '<div class="hag_bouns_w150 betVolume">' + data.betVolume + "</div>";
9580    _html += '<div class="hag_bouns_w150 actMembers">' + data.activeMembers + "</div>";
9581    _html +=
9582      '<div class="hag_bouns_w150 rateType" data-rateType="' +
9583      data.rateType +
9584      '">' +
9585      rate_type[data.rateType] +
9586      "</div>";
9587    _html += '<div class="hag_bouns_w150 rate" data-rate="' + dataRate + '">' + rate + sign + "</div>";
9588    $(".delete_sal_row").html("-").removeClass("hag_bouns_cf6");
9589    _html +=
9590      '<div class="hag_bouns_w150 hag_bouns_cf6 delete_sal_row"><span id="delete_sal_row" class="action-btn pointer">' +
9591      tcg.lib.prop("ac_delete_btn") +
9592      "</span></div>";
9593    _html += "</li>";
9594    $("#addDailySalaryForm .rec_increment").html(curr_inc);
9595    $("#addDailySalaryForm").before(_html);
9596  };
9597  tcg.ac.ui.loadMydailyList = function (res, type) {
9598    var data;
9599    if (type == "topUser") {
9600      try {
9601        data = res.value.length == 0 ? [] : res.value;
9602      } catch (err) {
9603        tcg.lib.alert("errors", "功能未开放,请联系客服。");
9604        return;
9605      }
9606    } else {
9607      try {
9608        data = res.value.agent.length == 0 ? [] : res.value.agent[0].details;
9609      } catch (err) {
9610        tcg.lib.alert("errors", "功能未开放,请联系客服。");
9611        return;
9612      }
9613    }
9614    var html = "";
9615    for (var i = 0; i < data.length; i++) {
9616      var multiplier = 100;
9617      var rate;
9618      var type = tcg.lib.prop("ac_proportion");
9619      if (data[i].rateType == "F") {
9620        rate = data[i].rate;
9621        type = tcg.lib.prop("ac_fixed_amount");
9622      } else {
9623        rate = tcg.ac.dailyPercentRate(data[i].rate, "rateToPercent", multiplier);
9624      }
9625      html +=
9626        '<ul data-minimumbet="' +
9627        data[i].betVolume +
9628        '" data-activemember="' +
9629        data[i].activeMember +
9630        '" data-rateType="' +
9631        data[i].rateType +
9632        '" data-contractrate="' +
9633        data[i].rate +
9634        '"><li>' +
9635        tcg.lib.prop("ac_day_volume") +
9636        "≥" +
9637        data[i].betVolume +
9638        tcg.lib.prop("ac_yuan") +
9639        "</li><li>" +
9640        data[i].activeMember +
9641        tcg.lib.prop("label_unit_people") +
9642        "</li><li>" +
9643        type +
9644        rate +
9645        "</li></ul>";
9646    }
9647    $(".js-my-daily-data").html(html);
9648  };
9649  tcg.ac.ui.editAddNewSalaryRow = function (data, isAutomated) {
9650    var curr_inc = $("#edit_salary_form .rec_increment").html() * 1;
9651    curr_inc++;
9652    var _html = "";
9653    var rate_type = {
9654      P: tcg.lib.prop("ac_proportion"),
9655      F: tcg.lib.prop("ac_fixed_amount"),
9656    };
9657    var dataRate = data.rate,
9658      sign = "%",
9659      rate;
9660    if (data.rateType == "F") {
9661      dataRate = Decimal(data.rate / data.betVolume)
9662        .times(100)
9663        .toString();
9664      sign = "";
9665      rate = data.rate;
9666    }
9667    if (data.rateType == "P") {
9668      if (Decimal(data.rate).decimalPlaces() === 0) {
9669        rate = Decimal(data.rate).toFixed(2).toString();
9670      } else {
9671        rate = tcg.ac.trimDecimal(data.rate, 2);
9672      }
9673    }
9674    // data.rateType = "P";
9675    _html +=
9676      '<li class="sal_row ' +
9677      (isAutomated ? "row_has_val" : "row_has_val") +
9678      '" id="con_row_index_' +
9679      (curr_inc - 1) +
9680      '">';
9681    _html += '<div class="hag_bouns_w150 hag_bouns_c4c">' + (curr_inc - 1) + "</div>";
9682    _html += '<div class="hag_bouns_w150 betVolume">' + data.betVolume + "</div>";
9683    _html += '<div class="hag_bouns_w150 actMembers">' + data.activeMember + "</div>";
9684    _html +=
9685      '<div class="hag_bouns_w150 rateType" data-rateType="' +
9686      data.rateType +
9687      '">' +
9688      rate_type[data.rateType] +
9689      "</div>";
9690    _html += '<div class="hag_bouns_w150 rate" data-rate="' + dataRate + '">' + rate + sign + "</div>";
9691    $(".delete_sal_row").html("-").removeClass("hag_bouns_cf6");
9692    _html +=
9693      '<div class="hag_bouns_w150 hag_bouns_cf6 delete_sal_row"><span id="delete_sal_row" class="action-btn pointer">' +
9694      tcg.lib.prop("ac_delete_btn") +
9695      "</span></div>";
9696    _html += "</li>";
9697    $("#edit_salary_form .rec_increment").html(curr_inc);
9698    $("#edit_salary_form").before(_html);
9699  };
9700  tcg.ac.ui.loadSalaryDetails = function (result) {
9701    var _html = "";
9702    _html += '<li class="hag_bouns_dirlulf">';
9703    _html += '    <div class="hag_bouns_w150">' + tcg.lib.prop("label_sort") + "</div>";
9704    _html += '    <div class="hag_bouns_w150">' + tcg.lib.prop("label_team_daily_amount") + "</div>";
9705    _html += '     <div class="hag_bouns_w150">' + tcg.lib.prop("label_active_requirement_for_sub") + "</div>";
9706    _html += '    <div class="hag_bouns_w150">' + tcg.lib.prop("label_type") + "</div>";
9707    _html += '   <div class="hag_bouns_w150">' + tcg.lib.prop("label_standard_of_daily_salary") + "</div>";
9708    // _html += '   <div class="hag_bouns_w150">' +tcg.lib.prop("label_operation")+ '</div>';
9709    // _html += '   <div class="hag_bouns_w150"></div>';
9710    _html += "   </li>";
9711    var rate_type = {
9712      P: tcg.lib.prop("ac_proportion"),
9713      F: tcg.lib.prop("ac_fixed_amount"),
9714    };
9715    if (result.value.details.length > 0) {
9716      for (var i = 0; i < result.value.details.length; i++) {
9717        var item = result.value.details[i];
9718        var rate;
9719        if (item.rateType == "F") {
9720          rate = item.rate;
9721        } else {
9722          rate = tcg.ac.percentRate(item.rate, "rateToPercentDS");
9723        }
9724        _html += "    <li>";
9725        _html += '    <div class="hag_bouns_w150 hag_bouns_c4c">' + (i + 1) + "</div>";
9726        _html += '   <div class="hag_bouns_w150">' + item.betVolume * 1 + "</div>";
9727        _html += '   <div class="hag_bouns_w150">' + item.activeMember * 1 + "</div>";
9728        _html += '   <div class="hag_bouns_w150">' + rate_type[item.rateType] + "</div>";
9729        _html += '   <div class="hag_bouns_w150">' + rate + "</div>";
9730        _html += '    <div class="hag_bouns_w150 hag_bouns_cf6"></div>';
9731        _html += "   </li>";
9732      }
9733    }
9734
9735    $("#downlineSalaryDetailsList").html(_html);
9736  };
9737  tcg.ac.ui.loadSalaryHistoryLog = function (result) {
9738    var _html = "";
9739    // _html += '<div id="contract_history_modal" class="hag_modal">';
9740    _html += '    <div class="hag_modal_main">';
9741    _html += '    <div class="hag_modal_body">';
9742    _html += '  <div class="hag_bonus_dirmtitle hag_modal_btitle"><h3>' + tcg.lib.prop("ac_signing_history") + "</h3>";
9743    _html += '      <span class="hag_modal_bclose pointer"> X </span>';
9744    _html += "  </div>";
9745    _html += '    <div id="" class="hag_modal_body hide">';
9746    _html +=
9747      '    <div class="hag_bonus_dirmtitle hag_modal_btitle"><h3>' + tcg.lib.prop("ac_signing_history") + "</h3>";
9748    _html += '    <span class="hag_modal_bclose pointer"> X </span>';
9749    _html += "    </div>";
9750    _html += '    <div class="hag_modal_bilist">';
9751    _html += "    </div>";
9752    _html += "    </div>";
9753    _html += '    <div class="hag_modal_bwrite hag_alluse_scroll">';
9754    _html += '<ul class="hag_bouns_dirlul">';
9755    _html +=
9756      '<li class="hag_bouns_dirlulf"><div class="hag_bouns_w460">' +
9757      tcg.lib.prop("label_date") +
9758      '</div><div class="hag_bouns_w460">' +
9759      tcg.lib.prop("ac_history_record") +
9760      "</div></li>";
9761    for (var i = 0; i < result.value.length; i++) {
9762      var elem = result.value[i];
9763      var placeholder = "";
9764      switch (elem.action) {
9765        case "N":
9766          placeholder = tcg.lib.prop("ac_initiate_contract");
9767          break;
9768        case "E":
9769          placeholder = tcg.lib.prop("ac_modify_contract");
9770          break;
9771        case "C":
9772          placeholder = tcg.lib.prop("ac_termination_success");
9773          break;
9774        case "A":
9775          placeholder = tcg.lib.prop("ac_signed_success");
9776          break;
9777        case "R":
9778          placeholder = tcg.lib.prop("ac_termination");
9779          break;
9780        case "V":
9781          placeholder = tcg.lib.prop("ac_initiate_termination");
9782          break;
9783      }
9784      if (elem.action != "P") {
9785        _html +=
9786          '<li><div class="hag_bouns_w460">' +
9787          tcg.ac.timeToDateFormat(elem.activityDate, "dateTime") +
9788          '</div><div class="hag_bouns_w460">' +
9789          placeholder +
9790          "</div></li>";
9791      }
9792    }
9793    _html += "</ul>";
9794    _html += "</div>";
9795    _html += "</div>";
9796    _html += "</div>";
9797    _html += "</div>";
9798    _html += "</div>";
9799    // _html += '</div>';
9800    $("#contract_history_modal").append(_html);
9801    $("#contract_history_modal").removeClass("hide");
9802  };
9803  tcg.ac.ui.appendSalaryInfo = function (data) {
9804    for (var i = 0; i < data.length; i++) {
9805      $("#commission_container #one_container").append(
9806        "<p>" +
9807          tcg.lib.prop("ac_day_volume") +
9808          '≥<span id="">' +
9809          data[i].betVolume +
9810          "</span>" +
9811          tcg.lib.prop("ac_yuan") +
9812          "</p>"
9813      );
9814      $("#commission_container #two_container").append(
9815        '<p><span id="">' + data[i].activeMember + "</span>" + tcg.lib.prop("label_unit_people") + "</p>"
9816      );
9817      var multiplier = 100;
9818      var rate;
9819      var type = tcg.lib.prop("ac_proportion");
9820      if (data[i].rateType == "F") {
9821        multiplier = 1;
9822        rate = data[i].rate;
9823        type = tcg.lib.prop("ac_fixed_amount");
9824      } else {
9825        rate = tcg.ac.percentRate(data[i].rate, "rateToPercent", multiplier);
9826      }
9827      $("#commission_container #three_container").append('<p><span id="">' + type + rate + "</span></p>");
9828    }
9829  };
9830
9831  tcg.ac.ui.loadSalaryRequest = function (result) {
9832    rs = result;
9833    result = result.value[0].details;
9834
9835    var _html = "";
9836    _html += '<div id="contract_request_modal" class="hag_modal">';
9837    _html += '    <div class="hag_modal_main">';
9838    _html += '    <div class="hag_modal_body">';
9839    _html += '    <div id="viewDLContractList" class="hag_modal_body hide">';
9840    _html += '    <div class="hag_bonus_dirmtitle hag_modal_btitle">' + tcg.lib.prop("ac_modify_contract");
9841    _html += '    <span class="hag_modal_bclose"></span>';
9842    _html += "    </div>";
9843    _html += '    <div class="hag_modal_bilist">';
9844    _html += "    </div>";
9845    _html += "    </div>";
9846    _html += '    <div class="hag_modal_bwrite hag_alluse_scroll">';
9847    _html += '<ul class="hag_bouns_dirlul">';
9848    _html +=
9849      '<li class="hag_bouns_dirlulf"><div class="hag_bouns_w310">' +
9850      tcg.lib.prop("ac_salary_details_2") +
9851      '</div>    <div class="hag_bouns_w310">' +
9852      tcg.lib.prop("ac_salary_details_3") +
9853      '</div><div class="hag_bouns_w310">' +
9854      tcg.lib.prop("ac_salary_details_4") +
9855      "</div></li>";
9856    for (var i = 0; i < result.length; i++) {
9857      var elem = result[i];
9858      var rate;
9859      var type = tcg.lib.prop("ac_proportion");
9860      if (elem.rateType == "F") {
9861        rate = elem.rate;
9862        type = tcg.lib.prop("ac_fixed_amount");
9863      } else {
9864        rate = tcg.ac.percentRate(elem.rate, "rateToPercentDS");
9865      }
9866      _html +=
9867        '<li><div class="hag_bouns_w310">' +
9868        tcg.lib.prop("ac_day_volume") +
9869        "≥" +
9870        elem.betVolume +
9871        tcg.lib.prop("ac_yuan") +
9872        '</div><div class="hag_bouns_w310">' +
9873        elem.activeMember +
9874        '人</div><div class="hag_bouns_w310">' +
9875        type +
9876        rate +
9877        "</div></li>";
9878    }
9879    _html += "</ul>";
9880    _html += '<div class="c-r-instruc-cont"><ol>';
9881    _html += "<li>" + tcg.lib.prop("ac_daily_wage_stat_1") + "</li>";
9882    _html += "<li>" + tcg.lib.prop("ac_daily_wage_stat_2") + "</li>";
9883    _html += "<li>" + tcg.lib.prop("ac_daily_wage_stat_3") + "</li>";
9884    _html += "</ol></div>";
9885    _html += '<div class="hag_modal_srbtn c-r-width">';
9886    _html +=
9887      '    <div id="approveSalary" data-id="' + rs.value[0].id + '" class="hag_bouns_dirltprbt hag_bouns_dirltprbs3">';
9888    _html += "    <span>" + tcg.lib.prop("ac_accept") + "</span>";
9889    _html += "    </div>";
9890    _html +=
9891      '    <div id="rejectSalary"  data-id="' +
9892      rs.value[0].id +
9893      '" class="hag_cancel hag_bouns_dirltprbt hag_bouns_dirltprbs4">';
9894    _html += "<span>拒绝</span></div>";
9895    _html += "</div>";
9896    _html += "</div>";
9897    _html += "</div>";
9898    _html += "</div>";
9899    _html += "</div>";
9900    _html += "</div>";
9901    $("body").append(_html);
9902  };
9903
9904  /******** agentDailyWages 日工资 END********/
9905  /******** AgentTeamPeopleCount 团队信息、AgentTeamContribution 团队分析、AgentProfitSharing 代理佣金 start********/
9906
9907  tcg.ac.ui.loadagentTeamPeopleCount = function (rs) {
9908    var _column = "";
9909    _column += "<div>账号</div>";
9910    _column += "<div>团队人数</div>";
9911    _column += "<div>代理人数</div>";
9912    _column += "<div>会员人数</div>";
9913    _column += "<div>新增人数</div>";
9914    _column += "<div>投注人数</div>";
9915    _column += "<div>充值人数</div>";
9916    _column += "<div>提现人数</div>";
9917    $("#agentTeamPeopleCountListTitle").html(_column);
9918    var decimal = 2,
9919      _html = "";
9920    for (var i = 0; i < rs.length; i++) {
9921      _html += '<div class="agteam_icp_listmtit">';
9922      _html += "<div>" + rs[i].customer_name + "</div>";
9923      _html += "<div>" + rs[i].total_ppl + "</div>";
9924      _html += "<div>" + rs[i].agent_ppl + "</div>";
9925      _html += "<div>" + rs[i].member_ppl + "</div>";
9926      _html += "<div>" + rs[i].increased_ppl + "</div>";
9927      _html += "<div>" + rs[i].bet_ppl + "</div>";
9928      _html += "<div>" + rs[i].deposit_ppl + "</div>";
9929      _html += "<div>" + rs[i].withdraw_ppl + "</div>";
9930      _html += "</div>";
9931    }
9932    $("#agentTeamPeopleCountListMain").html(_html);
9933  };
9934  tcg.ac.ui.loadAgentTeamContribution = function (rs) {
9935    var _column = "";
9936    _column += "<div>用户名</div>";
9937    _column += "<div>充值</div>";
9938    _column += "<div>提款</div>";
9939    _column += "<div>棋牌净赢</div>";
9940    _column += "<div>棋牌净输</div>";
9941    _column += "<div>团队返点收入</div>";
9942    _column += "<div>团队贡献</div>";
9943    _column += "<div>棋牌盈利</div>";
9944    _column += "<div>真人投注</div>";
9945    _column += "<div>真人派奖</div>";
9946    _column += "<div>真人输赢</div>";
9947    _column += "<div>真人返点</div>";
9948    _column += "<div>电子投注</div>";
9949    _column += "<div>电子派奖</div>";
9950    _column += "<div>电子输赢</div>";
9951    _column += "<div>电子返点</div>";
9952    _column += "<div>娱乐红利</div>";
9953    _column += "<div>捕鱼投注</div>";
9954    _column += "<div>捕鱼派奖</div>";
9955    _column += "<div>捕鱼玩家返水</div>";
9956    _column += "<div>捕鱼代理返点</div>";
9957    _column += "<div>捕鱼盈亏</div>";
9958    _column += "<div>体育投注</div>";
9959    _column += "<div>体育派奖</div>";
9960    _column += "<div>体育玩家返水</div>";
9961    _column += "<div>体育代理返点</div>";
9962    _column += "<div>体育盈亏</div>";
9963    $("#agentTeamContributionListTitle").html(_column);
9964    var _html = "";
9965    for (var i = 0; i < rs.length; i++) {
9966      _html += '<div class="agteam_icp_listmtit">';
9967      _html += "<div>" + rs[i].agent_name + "</div>";
9968      _html += "<div>" + rs[i].deposit + "</div>";
9969      _html += "<div>" + rs[i].withdraw + "</div>";
9970      _html += "<div>" + rs[i].pvp_game_winnings + "</div>";
9971      _html += "<div>" + rs[i].pvp_game_loses + "</div>";
9972      _html += "<div>" + rs[i].pvp_commission + "</div>";
9973      _html += "<div>" + rs[i].pvp_commission_contribution + "</div>";
9974      _html += "<div>" + rs[i].pvp_game_pnl + "</div>";
9975      _html += "<div>" + rs[i].live_game_betting + "</div>";
9976      _html += "<div>" + rs[i].live_game_winning + "</div>";
9977      _html += "<div>" + rs[i].live_game_pnl + "</div>";
9978      _html += "<div>" + rs[i].live_game_rebate + "</div>";
9979      _html += "<div>" + rs[i].rng_game_betting + "</div>";
9980      _html += "<div>" + rs[i].rng_game_winning + "</div>";
9981      _html += "<div>" + rs[i].rng_game_pnl + "</div>";
9982      _html += "<div>" + rs[i].rng_game_rebate + "</div>";
9983      _html += "<div>" + rs[i].rng_promotion + "</div>";
9984      _html += "<div>" + rs[i].fish_game_betting + "</div>";
9985      _html += "<div>" + rs[i].fish_game_winning + "</div>";
9986      _html += "<div>" + rs[i].fish_game_rebate + "</div>";
9987      _html += "<div>" + rs[i].fish_agent_commission + "</div>";
9988      _html += "<div>" + rs[i].fish_game_pnl + "</div>";
9989      _html += "<div>" + rs[i].sports_game_betting + "</div>";
9990      _html += "<div>" + rs[i].sports_game_winning + "</div>";
9991      _html += "<div>" + rs[i].sports_game_rebate + "</div>";
9992      _html += "<div>" + rs[i].sports_agent_commission + "</div>";
9993      _html += "<div>" + rs[i].sports_game_pnl + "</div>";
9994      _html += "</div>";
9995    }
9996    $("#agentTeamContributionListMain").html(_html);
9997  };
9998  tcg.ac.ui.loadAgentProfitSharing = function (rs) {
9999    var _column = "";
10000    _column += "<div>日期</div>";
10001    _column += "<div>总投注</div>";
10002    _column += "<div>总派奖</div>";
10003    _column += "<div>红利费用</div>";
10004    _column += "<div>玩家反水</div>";
10005    _column += "<div>净盈利</div>";
10006    _column += "<div>负累计</div>";
10007    _column += "<div>最终盈亏</div>";
10008    _column += "<div>活跃人数</div>";
10009    _column += "<div>佣金比例</div>";
10010    _column += "<div>本月佣金</div>";
10011    $("#agentProfitSharingListTitle").html(_column);
10012    var _html = "";
10013    for (var i = 0; i < rs.length; i++) {
10014      _html += '<div class="agteam_icp_listmtit">';
10015      _html += "<div>" + rs[i].balance_date + "</div>";
10016      _html += "<div>" + rs[i].betting + "</div>";
10017      _html += "<div>" + rs[i].winning + "</div>";
10018      _html += "<div>" + rs[i].promotion + "</div>";
10019      _html += "<div>" + rs[i].player_rebate + "</div>";
10020      _html += "<div>" + rs[i].net_profit + "</div>";
10021      _html += "<div>" + rs[i].balance_brought_forward + "</div>";
10022      _html += "<div>" + rs[i].last_net_profit + "</div>";
10023      _html += "<div>" + rs[i].active_members + "</div>";
10024      _html += "<div>" + rs[i].rate + "</div>";
10025      _html += "<div>" + rs[i].actual_amount + "</div>";
10026      _html += "</div>";
10027    }
10028    $("#agentProfitSharingListMain").html(_html);
10029  };
10030
10031  /******** AgentTeamPeopleCount 团队信息、AgentTeamContribution 团队分析、AgentProfitSharing 代理佣金 end********/
10032  // HTML Custom Popups and Confirmation Popups
10033  tcg.ac.ui.agentGenerateAffiliateUrlConfirm = function (data) {
10034    var TYPE = [tcg.lib.prop("label_member"), tcg.lib.prop("label_agent")];
10035
10036    var qq =
10037      $.trim(data.qq) !== ""
10038        ? "<li><span>" + tcg.lib.prop("label_qq_promotion") + " : </span><span>" + $.trim(data.qq) + "</span></li>"
10039        : "";
10040
10041    var _html = "";
10042    _html += '<div class="bet_content" style="max-height: 500px;overflow-y: auto;line-height: 1.5;">';
10043    _html += "    <p>" + tcg.lib.prop("ac_specific_info_confirm") + "</p>";
10044    _html += '   <ul class="" style="line-height: 1.5;text-align:center">';
10045    _html +=
10046      '   <li style="line-height: inherit; text-align: center;"><span style="line-height: inherit;">' +
10047      tcg.lib.prop("ac_bet_content_1") +
10048      " : </span><span>" +
10049      TYPE[data.type] +
10050      "</span></li>";
10051    _html +=
10052      '   <li style="line-height: inherit;width: 300px;word-break: break-all;display: inline-block;text-align: center;"><span style="line-height: inherit;">' +
10053      tcg.lib.prop("label_promotion_channel") +
10054      " : </span><span>" +
10055      data.path +
10056      "</span></li>";
10057    _html += qq;
10058    for (var i = 0; i < data.configs.length; i++) {
10059      var e = data.configs[i],
10060        playNameId = e.playNameId ? "-" + e.playNameId : "";
10061      prizeModeId = e.prizeModeId ? "_" + e.prizeModeId : "";
10062      _html +=
10063        '<li style="line-height: inherit;"><span style="line-height: inherit;">' +
10064        `${
10065          e.productType !== "5"
10066            ? `${tcg.ac.lotto_translate(e.gameCode + prizeModeId + playNameId)}`
10067            : `${
10068                e.gameCode === "ALLEXCLUDE" || e.gameCode === "SPORTS-PARLAY"
10069                  ? `${tcg.lib.prop(e.gameCode)}`
10070                  : `${tcg.lib.prop("SPORTS")} - ${e.gameCode}`
10071              }`
10072        }` +
10073        " : </span><span>" +
10074        e.rebate +
10075        "</span></li>";
10076    }
10077    _html += "</ul>";
10078    _html += "</div>";
10079    return _html;
10080  };
10081  tcg.ac.ui.linkManagerEnrollmentPopup = function (rs) {
10082    var _html = "";
10083    var entry = null;
10084    var list = "";
10085    //	Result
10086    for (var i = 0; i < rs.value.length; i++) {
10087      entry = rs.value[i];
10088
10089      list += '<div class="dira-lm-enroll-trow clearfix">';
10090      list += '<div class="dira-lm-enroll-tcol">' + entry.customerName + "</div>";
10091      list += '<div class="dira-lm-enroll-tcol">' + tcg.ac.formatDateFull(entry.registeredDate) + "</div>";
10092      list += "</div>";
10093    }
10094
10095    _html =
10096      "<div class='dira-lm-enroll x-pop'> \
10097				<h2>" +
10098      tcg.lib.prop("ac_link_manager_column_3") +
10099      "</h2> \
10100				<div class='dira-lm-enroll-thead clearfix'> \
10101					<div class='uname'>" +
10102      tcg.lib.prop("ac_subordinate_management_member_management_username_label") +
10103      "</div> \
10104					<div class='regDate'>" +
10105      tcg.lib.prop("ac_subordinate_management_member_management_column_4") +
10106      "</div> \
10107				</div> \
10108				<div class='dira-lm-enroll-tbody'>" +
10109      list +
10110      "</div> \
10111			</div>";
10112
10113    return _html;
10114  };
10115  tcg.ac.ui.linkManagerAffiliateDetailPopup = function (entry) {
10116    //  Declare
10117    var _html = "";
10118    var list = "";
10119    //  Get entry
10120    var TYPE = [tcg.lib.prop("label_member"), tcg.lib.prop("label_agent")],
10121      STATUS = [
10122        tcg.lib.prop("ac_link_manager_status_option_4"),
10123        tcg.lib.prop("ac_link_manager_status_option_2"),
10124        tcg.lib.prop("ac_link_manager_status_option_3"),
10125      ];
10126
10127    //	Result
10128    for (var i = 0; i < entry.configs.length; i++) {
10129      list += '<dl class="dira-lm-affdtl-gameItem">';
10130      list +=
10131        '<dt class="dira-lm-affdtl-gameName">' + tcg.lib.prop("series_label_" + entry.configs[i].gameCode) + "</dt>";
10132      list += '<dd class="dira-lm-affdtl-gameRebate">' + entry.configs[i].rebate + "</dd>";
10133      list += "</dl>";
10134    }
10135
10136    _html =
10137      "<div class='dira-lm-affdtl x-pop'> \
10138				<h2>" +
10139      tcg.lib.prop("ac_bonus_group_details") +
10140      "</h2> \
10141				<dl class='dira-lm-affdtl-main'> \
10142					<dt>" +
10143      tcg.lib.prop("ac_register_link") +
10144      "</dt><dd class='regLink'>" +
10145      tcg.ac.ui.generateAffiliateUrl(entry.code).url +
10146      "</dd> \
10147					<dt>" +
10148      tcg.lib.prop("ac_link_manager_type_label") +
10149      "</dt><dd class='regType'>" +
10150      TYPE[entry.type] +
10151      "</dd> \
10152					<dt>" +
10153      tcg.lib.prop("ac_link_manager_status_label") +
10154      "</dt><dd class='regStatus'>" +
10155      STATUS[entry.status] +
10156      "</dd> \
10157				</dl> \
10158				<div class='dira-lm-affdtl-games'>" +
10159      list +
10160      "</div> \
10161			</div>";
10162
10163    return _html;
10164  };
10165
10166  tcg.ac.ui.graphify = function (date, moneyRange, moneyList, draw_line_color, callback) {
10167    var c = document.getElementById("chart-canvas");
10168    var ctx = c.getContext("2d");
10169    var percentage = [];
10170    var height = c.height;
10171    var textWidth = 0;
10172    var offsetX = c.width * 0.13;
10173    var offsetY = c.height * 0.2;
10174    var textYPos = c.height * 0.9;
10175    var totalAreaOfGraph = height * 0.7;
10176    var totalAreaOfGraphX = c.width * 0.9;
10177    draw_line_color = draw_line_color || "#4beac0";
10178    ctx.clearRect(0, 0, c.width, c.height);
10179
10180    function getYpos(perc) {
10181      return Math.abs(totalAreaOfGraph * perc - Math.abs(height - offsetY));
10182    }
10183
10184    var drawText = function (t, size, x, y, color) {
10185      ctx.textAlign = "right";
10186      ctx.font = size + "px Arial";
10187      ctx.fillStyle = color;
10188      textWidth = ctx.measureText(t).width;
10189      ctx.fillText(t, x, y);
10190    };
10191    var drawLine = function (startX, startY, endX, endY, lineWidth, color) {
10192      ctx.beginPath();
10193      ctx.moveTo(startX, startY);
10194      ctx.lineTo(endX, endY);
10195      ctx.strokeStyle = color;
10196      ctx.lineWidth = lineWidth;
10197      ctx.stroke();
10198    };
10199    var drawDot = function (x, y) {
10200      ctx.beginPath();
10201      ctx.arc(x, y, 4.5, 2 * Math.PI, false);
10202      ctx.fillStyle = draw_line_color;
10203      ctx.fill();
10204    };
10205    var drawGraph = function (data) {
10206      for (var l = 0; l < data.length; l++) {
10207        ctx.beginPath();
10208        ctx.strokeStyle = draw_line_color;
10209        ctx.moveTo(data[l].x - 40, data[l].y);
10210
10211        if (l < data.length - 1) {
10212          ctx.lineTo(data[l + 1].x - 40, data[l + 1].y);
10213        }
10214        ctx.lineWidth = 3;
10215        ctx.stroke();
10216
10217        var newDot = new drawDot(data[l].x - 40, data[l].y);
10218      }
10219    };
10220    var largest = Math.max.apply(Math, moneyList);
10221    for (var h = 0; h < moneyList.length; h++) {
10222      var v = 0;
10223      if (isNaN(Number(moneyList[h] / largest).toFixed(2))) {
10224        v = 0;
10225      } else {
10226        v = Number(moneyList[h] / largest).toFixed(2);
10227      }
10228      percentage.push(v);
10229    }
10230    var lineOffsetY = Math.abs(height - offsetY);
10231    var lineDistanceY = totalAreaOfGraph * 0.25;
10232    var textXPos = c.width * 0.05;
10233    var textOffsetY = totalAreaOfGraph * 0.18;
10234    var textOffsetX = c.height * 0.17;
10235    var textPositions = [];
10236    var lineStart = c.width * 0.055;
10237    var lineEnd = c.width * 0.97;
10238    for (var i = 0; i < moneyRange.length; i++) {
10239      var newLine;
10240      var yPos = lineOffsetY - i * lineDistanceY;
10241      if (i == 0) {
10242        newLine = new drawLine(lineStart, yPos, lineEnd, yPos, 2, "#8d9091");
10243      } else {
10244        newLine = new drawLine(lineStart, yPos, lineEnd, yPos, 2, "#e4eaed");
10245      }
10246
10247      textPositions.push({
10248        x: textXPos,
10249        y: textOffsetY + i * lineDistanceY - 5,
10250        t: largest < 50 ? moneyRange[moneyRange.length - (i + 1)] : Math.floor(moneyRange[moneyRange.length - (i + 1)]),
10251      });
10252    }
10253    for (var j = 0; j < textPositions.length; j++) {
10254      var valueText = new drawText(
10255        textPositions[j].t,
10256        Math.floor(c.height * 0.044).toString(),
10257        textPositions[j].x,
10258        textPositions[j].y,
10259        "#848484"
10260      );
10261    }
10262    for (var k = 0; k < date.length; k++) {
10263      var dateText = new drawText(
10264        date[k],
10265        Math.floor(c.height * 0.044).toString(),
10266        c.width * 0.13 + k * ((c.width - textWidth) / date.length),
10267        textYPos,
10268        "#848484"
10269      );
10270    }
10271    var targetXPos = 0;
10272    var targetYPos = 0;
10273    var graphData = [];
10274    for (var l = 0; l < date.length; l++) {
10275      targetXPos = c.width * 0.13 + l * ((c.width - textWidth) / date.length);
10276      targetYPos = getYpos(percentage[l]);
10277      graphData.push({ x: targetXPos, y: targetYPos });
10278    }
10279    var newGraph = new drawGraph(graphData);
10280
10281    if (callback) {
10282      callback();
10283    }
10284  };
10285
10286  tcg.ac.ui._btn_loader_show = function (elem) {
10287    $(elem).attr("data-old-content", $(elem).html());
10288    $(elem).html('<div class="_loader"></div>');
10289    $(elem).prop("disabled", true);
10290  };
10291
10292  tcg.ac.ui._btn_loader_hide = function () {
10293    var elem = $("._loader").parent();
10294    $(elem).html($(elem).attr("data-old-content"));
10295    $(elem).prop("disabled", false);
10296  };
10297
10298  tcg.ac.ui.strPad = function (i, l, s) {
10299    var o = i.toString();
10300    if (!s) {
10301      s = "0";
10302    }
10303    while (o.length < l) {
10304      o = s + o;
10305    }
10306    return o;
10307  };
10308
10309  tcg.ac.ui.alertSizes = {
10310    XXS: { width: "298px", height: "230px" },
10311    XS: { width: "379px", height: "259px" },
10312    SL: { width: "298px", height: "327px" },
10313    S: { width: "397px", height: "370px" },
10314    M: { width: "500px", height: "460px" },
10315    AM: { width: "500px", height: "490px" },
10316    L: { width: "561px", height: "580px" },
10317    CL: { width: "511px", height: "514px" },
10318    CLL: { width: "347px", height: "365px" },
10319    depoL: { width: "710px", height: "500px" },
10320  };
10321})(window, document, jQuery, tcg);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.