kalenjordan / commercehero-issues

1 stars 0 forks source link

"Interested" in lead broken #68

Open adam-paterson opened 6 years ago

adam-paterson commented 6 years ago

When clicking "Interested" button in the leads section you get an alert with the message "undefined"

screen_shot_2017-11-07_at_09_04_20

Markup

<tr data-matched-user-id="178" data-user-id="3552" data-hiring-user-id="3552" data-job-id="1034">
    ...
    <div class="mb-3">
        <a class="mb-1 btn-job btn btn-md btn-secondary" data-fieldname="hero_interested_in_anon_job" data-value="1034" href="javascript://">
            <i/> Interested
        </a>

        <a class="mb-1 btn-job btn btn-md btn-secondary" data-fieldname="hero_not_interested_in_anon_job" data-value="1034" href="javascript://">
            <i/> Not Interested
        </a>
    </div>
    ...
</tr>

JS

        MainApp.prototype.initJobButtons = function() {
            $('.btn-job').unbind('click').click(function() {
                var $button = $(this);
                var $row = $button.closest('.record'); // no .record on page
                $row.css('opacity', 0.5);

                var jobId = $row.attr('data-job-id'); // unidentified
                var fieldName = $button.attr('data-fieldname');
                var fieldValue = $button.attr('data-value');

                var data = {
                    _token: $('#csrfToken').val()
                };
                data[fieldName] = fieldValue;

                if ((fieldName == 'client_interested_in_anon_hero' || fieldName == 'client_not_interested_in_anon_hero') && ! MainAppData.stripe_customer_id) {
                    alert("Missing billing info");
                    return;
                }

                $.ajax({
                    url: '/account/jobs/' + jobId + '.json',
                    method: 'POST',
                    data: data,
                    success: function(response) {
                        if (response.success) {
                            if (response.success_message) {
                                alertify.delay(10000).success(response.success_message);
                            }
                            if (response.should_close) {
                                $row.fadeOut();
                            } else {
                                $row.css('opacity', 1);
                            }
                        } else {
                            alert(response.message);
                        }
                    },
                    error: function() {
                        alert("Uh-oh there was a problem");
                    }
                });
            });
        },
kalenjordan commented 6 years ago

Thanks. Actually working on updating filters tonight. 😀

adam-paterson commented 6 years ago

@kalenjordan was that comment meant for #67?

kalenjordan commented 6 years ago

Sorry typo. Working on leads not filters. Hope to get to filters soon

adam-paterson commented 1 year ago

Hey, any update on this issue @kalenjordan?

kalenjordan commented 1 year ago

Hey sorry bud - I'm going to be sunsetting commerce hero this year.

On Fri, May 5, 2023 at 12:27 PM Adam Paterson @.***> wrote:

Hey, any update on this issue @kalenjordan https://github.com/kalenjordan?

— Reply to this email directly, view it on GitHub https://github.com/kalenjordan/commercehero-issues/issues/68#issuecomment-1536563489, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYQNLLEESHMUH22TPCDWLXEU2AJANCNFSM4ECR4F7A . You are receiving this because you were mentioned.Message ID: @.***>

-- Kalen @.***