			{"id":10,"date":"2025-07-05T13:27:05","date_gmt":"2025-07-05T09:57:05","guid":{"rendered":"https:\/\/persian-coders.site\/waterland\/customer-register\/"},"modified":"2025-07-05T13:27:05","modified_gmt":"2025-07-05T09:57:05","slug":"customer-register","status":"publish","type":"page","link":"https:\/\/persian-coders.site\/waterland\/customer-register\/","title":{"rendered":"\u062b\u0628\u062a \u0646\u0627\u0645 \u0645\u0634\u062a\u0631\u06cc"},"content":{"rendered":"        <div class=\"nn-container nn-my-5\">\n            <div class=\"nn-p-4 nn-login-form\">\n                <div class=\"nn-text-center nn-mb-4\">\n                    <h2 class=\"nn-text-primary\">\u062b\u0628\u062a \u0646\u0627\u0645<\/h2>\n                <\/div>\n                <form id=\"customer-register-form\">\n                    <div id=\"nn-step1\" class=\"nn-step\">\n                        <div class=\"nn-mb-3\">\n                            <label for=\"name\" class=\"nn-form-label\">\u0646\u0627\u0645<\/label>\n                            <div class=\"nn-input-group\">\n                                <input type=\"text\" class=\"nn-form-control\" id=\"name\" name=\"name\" required>\n                            <\/div>\n                        <\/div>\n                        <div class=\"nn-mb-3\">\n                            <label for=\"mobile\" class=\"nn-form-label\">\u062a\u0644\u0641\u0646 \u0647\u0645\u0631\u0627\u0647<\/label>\n                            <div class=\"nn-input-group\">\n                                <input dir=\"ltr\" type=\"text\" class=\"nn-form-control\" id=\"mobile\" name=\"mobile\" placeholder=\"091212345678\" required pattern=\"\\d{11}\" title=\"\u0634\u0645\u0627\u0631\u0647 \u0645\u0648\u0628\u0627\u06cc\u0644 \u0628\u0627\u06cc\u062f \u06f1\u06f1 \u0631\u0642\u0645 \u0628\u0627\u0634\u062f\">\n                            <\/div>\n                        <\/div>\n                        <button type=\"button\" id=\"send-code-btn\" class=\"nn-btn nn-btn-primary\">\u0627\u0631\u0633\u0627\u0644 \u06a9\u062f \u062a\u0623\u06cc\u06cc\u062f<\/button>\n                        <div id=\"nn-send-message\" class=\"nn-text-success nn-mt-3\" style=\"display:none;\"><\/div>\n                    <\/div>\n                    <div id=\"nn-step2\" class=\"nn-step\" style=\"display:none;\">\n                        <div class=\"nn-mb-3\">\n                            <label for=\"verification_code\" class=\"nn-form-label\">\u06a9\u062f \u062a\u0623\u06cc\u06cc\u062f (\u0645\u0639\u062a\u0628\u0631 \u062a\u0627 \u06f2 \u062f\u0642\u06cc\u0642\u0647)<\/label>\n                            <div class=\"nn-input-group\">\n                                <input type=\"text\" class=\"nn-form-control\" id=\"verification_code\" name=\"verification_code\" required maxlength=\"6\">\n                            <\/div>\n                        <\/div>\n                        <div id=\"nn-timer\" class=\"nn-text-info nn-mb-3\">\u0632\u0645\u0627\u0646 \u0628\u0627\u0642\u06cc \u0645\u0627\u0646\u062f\u0647: <span id=\"countdown\">02:00<\/span><\/div>\n                        <button type=\"button\" id=\"back-btn\" class=\"nn-btn nn-btn-outline-secondary\">\u0628\u0627\u0632\u06af\u0634\u062a \u0648 \u062a\u063a\u06cc\u06cc\u0631 \u0634\u0645\u0627\u0631\u0647<\/button>\n                        <button type=\"button\" id=\"register-btn\" class=\"nn-btn nn-btn-primary\">\u062b\u0628\u062a \u0646\u0627\u0645<\/button>\n                    <\/div>\n\t\t\t\t\t<input type=\"hidden\" id=\"redirect_url\" name=\"redirect_url\" value=\"\">\n                <\/form>\n                <div class=\"nn-text-center nn-mt-3\">\n                    <p><a href=\"https:\/\/persian-coders.site\/waterland\/customer-dashboard\/\" class=\"nn-website-link\">\u0628\u0627\u0632\u06af\u0634\u062a \u0628\u0647 \u0648\u0631\u0648\u062f<\/a><\/p>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <script>\n        jQuery(document).ready(function($) {\n            var sendNonce = 'a55f53bc9f';\n            var verifyNonce = 'c8973d070e';\n            var countdownInterval;\n            var lastMobile = '';\n\n            function startCountdown() {\n                var timeLeft = 120;\n                clearInterval(countdownInterval);\n                $('#countdown').text('02:00');\n                countdownInterval = setInterval(function() {\n                    timeLeft--;\n                    var minutes = Math.floor(timeLeft \/ 60);\n                    var seconds = timeLeft % 60;\n                    $('#countdown').text((minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds);\n                    if (timeLeft <= 0) {\n                        clearInterval(countdownInterval);\n                        $('#send-code-btn').prop('disabled', false);\n                        $('#nn-send-message').hide();\n                    }\n                }, 1000);\n            }\n\n            $('#send-code-btn').on('click', function() {\n                var mobile = $('#mobile').val();\n                var name = $('#name').val();\n                if (!\/^\\d{11}$\/.test(mobile)) {\n                    Swal.fire({\n                        icon: 'error',\n                        title: '\u062e\u0637\u0627',\n                        text: '\u0634\u0645\u0627\u0631\u0647 \u0645\u0648\u0628\u0627\u06cc\u0644 \u0646\u0627\u0645\u0639\u062a\u0628\u0631 \u0627\u0633\u062a',\n                        confirmButtonText: '\u062a\u0623\u06cc\u06cc\u062f'\n                    });\n                    return;\n                }\n                if (!name) {\n                    Swal.fire({\n                        icon: 'error',\n                        title: '\u062e\u0637\u0627',\n                        text: '\u0644\u0637\u0641\u0627 \u0646\u0627\u0645 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f',\n                        confirmButtonText: '\u062a\u0623\u06cc\u06cc\u062f'\n                    });\n                    return;\n                }\n                $.ajax({\n                    url: 'https:\/\/persian-coders.site\/waterland\/wp-admin\/admin-ajax.php',\n                    type: 'POST',\n                    data: {\n                        action: 'send_verification_code',\n                        mobile: mobile,\n                        name: name,\n                        nonce: sendNonce\n                    },\n                    success: function(response) {\n                        if (response.success) {\n                            lastMobile = mobile;\n                            $('#nn-step1').hide();\n                            $('#nn-step2').show();\n                            $('#send-code-btn').prop('disabled', true);\n                            $('#nn-send-message').text('\u06a9\u062f \u062a\u0623\u06cc\u06cc\u062f \u0627\u0631\u0633\u0627\u0644 \u0634\u062f').show();\n                            startCountdown();\n                        } else {\n                            Swal.fire({\n                                icon: 'error',\n                                title: '\u062e\u0637\u0627',\n                                text: response.data || '\u062e\u0637\u0627 \u062f\u0631 \u0627\u0631\u0633\u0627\u0644 \u06a9\u062f \u062a\u0623\u06cc\u06cc\u062f',\n                                confirmButtonText: '\u062a\u0623\u06cc\u06cc\u062f'\n                            });\n                        }\n                    },\n                    error: function(xhr, status, error) {\n                        console.log('AJAX Error:', error);\n                        console.log('Response:', xhr.responseText);\n                        Swal.fire({\n                            icon: 'error',\n                            title: '\u062e\u0637\u0627',\n                            text: '\u062e\u0637\u0627 \u062f\u0631 \u0627\u0631\u0633\u0627\u0644 \u062f\u0631\u062e\u0648\u0627\u0633\u062a',\n                            confirmButtonText: '\u062a\u0623\u06cc\u06cc\u062f'\n                        });\n                    }\n                });\n            });\n\n            $('#back-btn').on('click', function() {\n                $('#nn-step2').hide();\n                $('#nn-step1').show();\n                $('#nn-send-message').hide();\n                clearInterval(countdownInterval);\n                $('#send-code-btn').prop('disabled', false);\n            });\n\n\t\t\t$('#register-btn').on('click', function() {\n\t\t\t\tvar mobile = $('#mobile').val();\n\t\t\t\tvar name = $('#name').val();\n\t\t\t\tvar verification_code = $('#verification_code').val();\n\t\t\t\tvar redirect_url = $('#redirect_url').val();\n\t\t\t\t\n\t\t\t\tif (!mobile || !name || !verification_code) {\n\t\t\t\t\tSwal.fire({\n\t\t\t\t\t\ticon: 'error',\n\t\t\t\t\t\ttitle: '\u062e\u0637\u0627',\n\t\t\t\t\t\ttext: '\u0644\u0637\u0641\u0627 \u0647\u0645\u0647 \u0641\u06cc\u0644\u062f\u0647\u0627 \u0631\u0627 \u067e\u0631 \u06a9\u0646\u06cc\u062f',\n\t\t\t\t\t\tconfirmButtonText: '\u062a\u0623\u06cc\u06cc\u062f'\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$.ajax({\n\t\t\t\t\turl: 'https:\/\/persian-coders.site\/waterland\/wp-admin\/admin-ajax.php',\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\taction: 'verify_and_register',\n\t\t\t\t\t\tmobile: mobile,\n\t\t\t\t\t\tname: name,\n\t\t\t\t\t\tverification_code: verification_code,\n\t\t\t\t\t\tredirect_url: redirect_url, \n\t\t\t\t\t\tnonce: verifyNonce\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\tif (response.success) {\n\t\t\t\t\t\t\tSwal.fire({\n\t\t\t\t\t\t\t\ticon: 'success',\n\t\t\t\t\t\t\t\ttitle: '\u0645\u0648\u0641\u0642\u06cc\u062a',\n\t\t\t\t\t\t\t\ttext: '\u062b\u0628\u062a \u0646\u0627\u0645 \u0628\u0627 \u0645\u0648\u0641\u0642\u06cc\u062a \u0627\u0646\u062c\u0627\u0645 \u0634\u062f',\n\t\t\t\t\t\t\t\tconfirmButtonText: '\u062a\u0623\u06cc\u06cc\u062f'\n\t\t\t\t\t\t\t}).then(function() {\n\t\t\t\t\t\t\t\tif(response.data && response.data.redirect_url) {\n\t\t\t\t\t\t\t\t\twindow.location.href = response.data.redirect_url;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tSwal.fire({\n\t\t\t\t\t\t\t\ticon: 'error',\n\t\t\t\t\t\t\t\ttitle: '\u062e\u0637\u0627',\n\t\t\t\t\t\t\t\ttext: response.data || '\u062e\u0637\u0627 \u062f\u0631 \u062b\u0628\u062a \u0646\u0627\u0645',\n\t\t\t\t\t\t\t\tconfirmButtonText: '\u062a\u0623\u06cc\u06cc\u062f'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror: function(xhr, status, error) {\n\t\t\t\t\t\tconsole.log('AJAX Error:', error);\n\t\t\t\t\t\tconsole.log('Response:', xhr.responseText);\n\t\t\t\t\t\tSwal.fire({\n\t\t\t\t\t\t\ticon: 'error',\n\t\t\t\t\t\t\ttitle: '\u062e\u0637\u0627',\n\t\t\t\t\t\t\ttext: '\u062e\u0637\u0627 \u062f\u0631 \u062b\u0628\u062a \u0646\u0627\u0645',\n\t\t\t\t\t\t\tconfirmButtonText: '\u062a\u0623\u06cc\u06cc\u062f'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n        });\n        <\/script>\n        \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-10","page","type-page","status-publish","hentry"],"noorgfx_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":7}},"_links":{"self":[{"href":"https:\/\/persian-coders.site\/waterland\/wp-json\/wp\/v2\/pages\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/persian-coders.site\/waterland\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/persian-coders.site\/waterland\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/persian-coders.site\/waterland\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/persian-coders.site\/waterland\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":0,"href":"https:\/\/persian-coders.site\/waterland\/wp-json\/wp\/v2\/pages\/10\/revisions"}],"wp:attachment":[{"href":"https:\/\/persian-coders.site\/waterland\/wp-json\/wp\/v2\/media?parent=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}