PageSourceSearch

https://www.e-tramits.ad/tramits/_ui/addons/publicsectoracceleratoraddon/responsive/common/js/acc.account.js

js e-tramits.ad collected 2026-10-02 19:17:05 UTC 11,443 bytes, 265 lines download raw bytes

1/*global ACC, $, document, window, PSACC*/
2ACC.account = {
3        _autoload: ["bindDraftDeleteOverlay", "bindDeleteDraftSubmit", "bindEditDraftServiceRequestSubmit",
4            "bindCancelWithColorboxClose", "displayRelationshipUserBills", "displayRelationshipUserDocuments", 
5            "displayRelationshipUserApplications" , "showRemovePaymentDetailsConfirmation"],
6
7            bindEditDraftServiceRequestSubmit: function() {
8        $(document).on("click", ".js-edit-draft-service-request", function(e) {
9            var draftCode = $(this).parent('.retrieveQuoteForm').find('.draftCode').val();
10            // check if it locked
11            if (ACC.account.checkLockedCart(draftCode)) {
12                 e.preventDefault();
13                ACC.account.displayLockedCartPopup(draftCode);
14                return false;
15            } else {
16                $(this).parent('.retrieveQuoteForm').submit();
17                return true;
18            }
19        });
20    },
21
22    bindDraftDeleteOverlay: function() {
23        $(document).on("click",".delete-draft", function(e) {
24            var draftCode = $(this).parent('.retrieveQuoteForm').find('.draftCode').val();
25            // check if it locked
26            if (ACC.account.checkLockedCart(draftCode)) {
27                 e.preventDefault();
28                ACC.account.displayLockedCartPopup(draftCode);
29                return false;
30            } else {
31                ACC.account.updateOverlayWithSelectedDraftInfo(this);
32                var deleteDraftPopupTitle;
33                deleteDraftPopupTitle = $('.divTableRow .hide').html();
34                   if (!deleteDraftPopupTitle){
35                       deleteDraftPopupTitle = $('.dashlet-application-request .hide').html();
36                  }
37                var deleteDraftPopupAriaLableTitle = $('.divTableRow .hide .headline-text').html();
38
39                ACC.colorbox.open($('#delete-draft-overlay #draftHeading')
40                        .html(), {
41                    href: "#delete-draft-overlay",
42                    inline: true,
43                    title: deleteDraftPopupTitle,
44                    width: "auto",
45                    overlayClose: false,
46                    escKey: false,
47                    fixed: true,
48                    transition: "elastic",
49                    close: '<span class="glyphicon glyphicon-remove overlay-close"></span>',
50                    onComplete: function() {
51                        $(window).resize(function(){
52                            if(!$('#colorbox').hasClass('variantSelectMobile')){
53                                $.colorbox.resize({
54                                    height: "63%"
55                                });
56                            }
57                        });
58                        $('#cboxTitle').insertBefore('#cboxLoadedContent');
59                        $('#cboxClose').insertBefore('#cboxLoadedContent');
60                        $('.headline-text').attr({'aria-label': deleteDraftPopupAriaLableTitle,'tabindex': '0','id': 'customTitle'});
61                        $('#cboxClose').attr({'aria-label': PSACC.textCloseOverlay,'tabindex': '0'});
62                    }
63                });
64            }
65            e.preventDefault();
66            return false;
67        });
68    },
69    bindCancelWithColorboxClose: function() {
70        $(document).on("click", ".delete-cancel", function(e) {
71            e.preventDefault();
72            $.colorbox.close();
73        });
74    },
75    updateOverlayWithSelectedDraftInfo: function(currentDraft) {
76        var deleteDraftUrl;
77        $('#delete-draft-overlay #productname').html(
78                $(currentDraft).data("product-name"));
79        $('#delete-draft-overlay #productname').attr(
80                'aria-label',$(currentDraft).data("product-name"));
81        $('#delete-draft-overlay #draftNumber').html(
82                $(currentDraft).data("draft-code"));
83        $('#delete-draft-overlay .draft-no').closest('div').attr(
84                'aria-label',$.trim($('.draft-no').html())  + ' ' + $(currentDraft).data("draft-code"));
85        if($(currentDraft).data("customer-email") === null || $(currentDraft).data("customer-email") === ''){
86            deleteDraftUrl = $('#delete-draft-overlay #delete-draft-submit')
87                    .data('url') + $(currentDraft).data("draft-code");
88        }else{
89            deleteDraftUrl = $('#delete-draft-overlay #delete-draft-submit')
90            .data('relationship-url') + $(currentDraft).data("draft-code") + "?customerId="+ $(currentDraft).data("customer-email");
91        }
92        $('#delete-draft-overlay #delete-draft-submit').attr('href', deleteDraftUrl);
93    },
94    bindDeleteDraftSubmit: function() {
95        $(document).on("click", '#delete-draft-submit', function() {
96            $("#delete-draft-overlay").html(ACC.address.spinner);
97        });
98    },
99
100    displayRelationshipUserDocuments: function() {
101        $('.relationDocumentsLink').on("click", function() {
102            ACC.account.bindRelationshipUserDocuments(this);
103        });
104    },
105    bindRelationshipUserDocuments: function(thisObject){
106            var loopCount = $(thisObject).first().find('#loopCount').val();
107            var customerId = $('#hidden_'+loopCount).val();
108            var options = {
109                'customerId': customerId
110            };
111            ACC.account.getRelationshipUserDocumentData(
112                options,loopCount
113            );
114            $(thisObject).addClass("loadedContent");
115    },
116
117    getRelationshipUserDocumentData: function(options, loopCount, callback) {
118        $.ajax(
119            {
120                url: ACC.config.encodedContextPath + '/my-account/documents/loadCustomerDocuments',
121                async: false,
122                data: options,
123                dataType: "html",
124                beforeSend: function() {
125                    $('#relationdocumentsSection_'+loopCount).html(ACC.address.spinner);
126                }
127            }).done(function(data) {
128                $('#relationdocumentsSection_'+loopCount).html(data);
129                if (typeof callback === 'function') {
130                    callback.call();
131                }
132            });
133    },
134    displayRelationshipUserBills: function() {
135        $('.relationbillsLink').on("click", function() {
136            ACC.account.bindRelationshipUserBills(this);
137        });
138    },
139
140    bindRelationshipUserBills: function(thisObject) {
141        var loopCount = $(thisObject).first().find('#loopCount').val();
142        var customerId = $('#hidden_'+loopCount).val();
143        var options = {
144            'customerId': customerId
145        };
146        var custormUrl = '/my-account/bills/loadCustomerBills';
147        var selector = "relationbillsSection";
148        ACC.account.getRelationshipUserBillApplicationData(options, loopCount, custormUrl, selector);
149        $(thisObject).addClass("loadedContent");
150    },
151
152    displayRelationshipUserApplications: function() {
153        $('.relationApplicationsLink').on("click", function() {
154            ACC.account.bindRelationshipUserApplications(this);
155        });
156    },
157
158    bindRelationshipUserApplications: function(thisObject){
159        var loopCount = $(thisObject).first().find('#loopCount').val();
160        var customerId = $('#hidden_'+loopCount).val();
161        var options = {
162            'customerId': customerId
163        };
164        var custormUrl = '/my-account/loadRelationApplications';
165        var selector = "relationApplicationsSection";
166        ACC.account.getRelationshipUserBillApplicationData(options, loopCount, custormUrl, selector);
167        $(thisObject).addClass("loadedContent");
168    },
169
170    checkLockedCart: function(draftCode) {
171        var cartLocked = false;
172        $.ajax(
173            {
174                url: ACC.config.encodedContextPath + '/my-account/checkLockedCart',
175                type: "GET",
176                async: false,
177                data: {
178                    draftCode: draftCode
179                },
180                success: function (response) {
181                    cartLocked = response;
182                }
183            });
184        return  cartLocked;
185    },
186
187    displayLockedCartPopup: function(draftCode, customerEmail, callback){
188        $.ajax({
189            url: ACC.config.encodedContextPath + '/my-account/displayLockedCartPopup',
190            type: "POST",
191            async: false,
192            data: {
193                draftCode: draftCode
194            },
195            dataType: "html"
196        }).done(function(data) {
197            $.colorbox({
198                html: data,
199                overlayClose: false,
200                maxWidth: "100%",
201                width: "auto",
202                opacity: 0.7,
203                fixed: true,
204                transition: "elastic",
205                title: PSACC.textTitleCartLockOverlay,
206                close: '<span class="glyphicon glyphicon-remove overlay-close"></span>',
207                onComplete: function() {
208                    $(window).resize(function(){
209                        if(!$('#colorbox').hasClass('variantSelectMobile')){
210                            $.colorbox.resize({
211                                height: "55%"
212                            });
213                        }
214                    });
215                    $('#cboxTitle').insertBefore('#cboxLoadedContent');
216                    $('#cboxClose').insertBefore('#cboxLoadedContent');
217                    $('.headline-text').attr({'aria-label': PSACC.textTitleCartLockOverlay,'tabindex': '0','id': 'customTitle'});
218                    $('#cboxClose').attr({'aria-label': PSACC.textCloseOverlay,'tabindex': '0'});
219                }
220            });
221
222            if (typeof callback === 'function') {
223                callback.call();
224            }
225        });
226    },
227    showRemovePaymentDetailsConfirmation: function ()
228    {
229        $(document).on("click", ".removePaymentDetailsButton", function (){
230            var paymentId = $(this).data("paymentId");
231            var popupTitle = $(this).data("popupTitle");
232            ACC.colorbox.open(popupTitle,{
233                inline: true,
234                href: "#popup_confirm_payment_removal_" + paymentId,
235                onComplete: function ()
236                {
237                    $(this).colorbox.resize();
238                    $('#cboxTitle').insertBefore('#cboxLoadedContent');
239                    $('#cboxClose').insertBefore('#cboxLoadedContent');
240                    $('.headline-text').attr({'aria-label': popupTitle,'tabindex': '0','id': 'customTitle'});
241                    $('#cboxClose').attr({'aria-label': PSACC.textCloseOverlay,'tabindex': '0'});
242                }
243            });
244
245        });
246    },
247    getRelationshipUserBillApplicationData: function(options, loopCount, custormUrl, selector, callback){
248        $.ajax(
249                {
250                    url: ACC.config.encodedContextPath + custormUrl,
251                    async: false,
252                    data: options,
253                    dataType: "html",
254                    beforeSend: function() {
255                        $('#'+selector+'_'+loopCount).html(ACC.address.spinner);
256                    }
257                }).done(function(data) {
258                $('#'+selector+'_'+loopCount).html(data);
259                $('#'+selector+'_'+loopCount).find('.content-space').removeClass('content-space');
260                if (typeof callback === 'function') {
261                    callback.call();
262                }
263            });
264    }
265};

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.