PageSourceSearch

https://shopnfc.com/modules/lpsproaccount/views/js/front/lpsproaccountauthentication.js

js shopnfc.com collected 2026-10-02 03:31:52 UTC 9,142 bytes, 182 lines download raw bytes

1/**
2 * Loulou66
3 * LpsProAccount module for Prestashop
4 * NOTICE OF LICENSE
5 *
6 * This source file is subject to the Academic Free License (AFL 3.0)
7 * that is bundled with this package in the file LICENSE.txt.
8 * It is also available through the world-wide-web at this URL:
9 * http://opensource.org/licenses/afl-3.0.php*
10 *
11 * DISCLAIMER
12 *
13 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
14 * versions in the future. If you wish to customize PrestaShop for your
15 * needs please refer to http://www.prestashop.com for more information.
16 *
17 *  @author    Loulou66.fr <[email protected]>
18 *  @copyright loulou66.fr
19 *  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
20 */
21'use strict';
22if (typeof isFormPro && isFormPro === true) {
23    var iso_country_fr =  ['FR', 'MC', 'COS', 'GP', 'GF', 'RE', 'MQ', 'YT', 'NC', 'PF', 'BL', 'MF', 'PM', 'WF'];
24    var iso_country_EU =  ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'GR', 'ES', 'FI', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'FR', 'MC', 'COS', 'XI'];
25    var lps_pa_select_country = $('select[name="lpsproaccount_country"]');
26    if (lpsdisplayaskvat) {
27        var lps_pa_pro_status = $('select[name="lpsproaccount_pro_status"]');
28    }
29}
30$(document).on('ready', function () {
31    if (typeof isFormPro && isFormPro === true) {
32        $('#customer-form .form-control-label').removeClass('required').removeAttr('required');
33        $('#customer-form').attr('enctype', 'multipart/form-data');
34        $('.lpsudloaderror').remove();
35        $('select[name="lpsproaccount_pro_status"]').closest('.form-group').find('.form-control-comment').remove('');
36        if (lps_pa_select_country[0].value == '') {
37            $('input[name="lpsproaccount_siret"]').closest('.form-group').hide();
38            $('input[name="lpsproaccount_vatNumber"]').closest('.form-group').hide();
39            $('input[name="lpsproaccount_vatNumber"]').val('');
40            $('select[name="lpsproaccount_pro_status"]').closest('.form-group').hide();
41            $('input[name="lpsproaccount_ape"]').closest('.form-group').hide();
42            $('input[name="lpsproaccount_ape"]').removeAttr('required');
43        } else {
44            showhideELements(lps_pa_select_country[0].value);
45        }
46        $(lps_pa_select_country).change(function(e) {
47            showhideELements($(this).val());
48        });
49        if (lpsdisplayaskvat) {
50            $(lps_pa_pro_status).change(function(e) {
51                showhideVatNumber(lps_pa_select_country[0].value, $(this).val());
52            });
53        }
54        $('input[name="lpsproaccount_fileupload"]').click(function(e) {
55            $('.lpsudloaderror').remove();
56            $('button[data-link-action="save-customer"]').removeAttr('disabled');
57        });
58        $('input[name="lpsproaccount_fileupload"]').change(function(e) {
59            $('.lpsudloaderror').remove();
60            var files = e.originalEvent.target.files;
61            var filesize = files[0].size;
62            var name = files[0].name;
63            var comment = $(this).parent().find('.form-control-comment');
64            var html = '';
65            var badExtension, badFileSize;
66            var fileExtension = ['txt', 'rtf', 'doc', 'docx', 'pdf', 'png', 'jpeg', 'gif', 'jpg'];
67            if (filesize > 5242880) {
68                badFileSize = 1;
69            }
70            if ($.inArray(name.split('.').pop().toLowerCase(), fileExtension) == -1) {
71                badExtension = 1;
72            }
73            if (badFileSize) {
74                html += '<p class="alert alert-danger lpsudloaderror">' + lpserroruploadmessage + '</p>';
75            }
76            if (badExtension) {
77                html += '<p class="alert alert-danger lpsudloaderror">' + lpserroruploadextension + '</p>';
78            }
79            if (badFileSize || badExtension) {
80                $('button[data-link-action="save-customer"]').attr('disabled', true);
81                $(comment).after(html);
82                $('html, body').animate({
83                    scrollTop: $(this).parent().offset().top
84                }, 500);
85            } else {
86                $('.lpsudloaderror').remove();
87                $('button[data-link-action="save-customer"]').removeAttr('disabled');
88            }
89        });
90    } else {
91        $('input[name="company"]').closest('.form-group').hide();
92        $('input[name="siret"]').closest('.form-group').hide();
93    }
94    $('input[name="lpsproaccount_honeypot"]').closest('.form-group').hide();
95});
96function showhideELements(iso_code)
97{
98    if (iso_country_fr.includes(iso_code)) {
99        if (lpsdisplaysiret) {
100            if (lpsrequiredsiret) {
101                $('input[name="lpsproaccount_siret"]').closest('.form-group').find('.form-control-comment').text('');
102                $('input[name="lpsproaccount_siret"]').attr('required', true);
103            } else {
104                $('input[name="lpsproaccount_siret"]').closest('.form-group').find('.form-control-comment').text(optional);
105                $('input[name="lpsproaccount_siret"]').removeAttr('required');
106            }
107            $('input[name="lpsproaccount_siret"]').closest('.form-group').show();
108        } else {
109            $('input[name="lpsproaccount_siret"]').closest('.form-group').hide();
110            $('input[name="lpsproaccount_siret"]').removeAttr('required');
111        }
112        if (lpsdisplayape) {
113            if (lpsrequiredape) {
114                $('input[name="lpsproaccount_ape"]').attr('required', true);
115                $('input[name="lpsproaccount_ape"]').closest('.form-group').find('.form-control-comment').text('');
116            } else {
117                $('input[name="lpsproaccount_ape"]').removeAttr('required');
118                $('input[name="lpsproaccount_ape"]').closest('.form-group').find('.form-control-comment').text(optional);
119            }
120            $('input[name="lpsproaccount_ape"]').closest('.form-group').show();
121        } else {
122            $('input[name="lpsproaccount_ape"]').closest('.form-group').hide();
123            $('input[name="lpsproaccount_ape"]').removeAttr('required');
124        }
125    } else {
126        $('input[name="lpsproaccount_siret"]').closest('.form-group').hide();
127        $('input[name="lpsproaccount_siret"]').removeAttr('required');
128        $('input[name="lpsproaccount_ape"]').closest('.form-group').hide();
129        $('input[name="lpsproaccount_ape"]').removeAttr('required');
130    }
131    if (lpsdisplayvatnumber && iso_country_EU.includes(iso_code)) {
132        if (iso_code == lpsdefaultshop || (lpsdefaultshop == 'FR' && (iso_code == 'MC' || iso_code == 'COS'))) {
133            if (lpsdisplayaskvat) {
134                if (lpsrequiredvatnumber) {
135                    $('select[name="lpsproaccount_pro_status"]').attr('required', true);
136                } else {
137                    $('select[name="lpsproaccount_pro_status"]').removeAttr('required');
138                }
139                $('select[name="lpsproaccount_pro_status"]').closest('.form-group').show();
140                showhideVatNumber(iso_code, lps_pa_pro_status[0].value);
141            } else {
142                $('select[name="lpsproaccount_pro_status"]').removeAttr('required');
143                showhideVatNumber(iso_code, '1');
144            }
145        } else {
146            $('select[name="lpsproaccount_pro_status"]').closest('.form-group').hide();
147            $('select[name="lpsproaccount_pro_status"]').removeAttr('required');
148            showhideVatNumber(iso_code, '1');
149        }
150    } else {
151        showhideVatNumber(iso_code, null);
152        $('select[name="lpsproaccount_pro_status"]').closest('.form-group').hide();
153        $('select[name="lpsproaccount_pro_status"]').removeAttr('required');
154    }
155    if (lpsdisplaywebsite) {
156        $('input[name="lpsproaccount_website"]').closest('.form-group').show();
157    } else {
158        $('input[name="lpsproaccount_website"]').closest('.form-group').hide();
159    }
160}
161function showhideVatNumber(iso_code, status)
162{
163    if (status !== '1') {
164        $('input[name="lpsproaccount_vatNumber"]').closest('.form-group').hide();
165        $('input[name="lpsproaccount_vatNumber"]').val('');
166        $('input[name="lpsproaccount_vatNumber"]').removeAttr('required');
167    } else {
168        if (lpsdisplayvatnumber && iso_country_EU.includes(iso_code)) {
169            if (lpsrequiredvatnumber) {
170                    $('input[name="lpsproaccount_vatNumber"]').closest('.form-group').find('.form-control-comment').text('');
171                    $('input[name="lpsproaccount_vatNumber"]').attr('required', true);
172            } else {
173                $('input[name="lpsproaccount_vatNumber"]').closest('.form-group').find('.form-control-comment').text(optional);
174                $('input[name="lpsproaccount_vatNumber"]').removeAttr('required');
175            }
176            $('input[name="lpsproaccount_vatNumber"]').closest('.form-group').show();
177        } else {
178            $('input[name="lpsproaccount_vatNumber"]').closest('.form-group').hide();
179            $('input[name="lpsproaccount_vatNumber"]').removeAttr('required');
180        }
181    }
182}

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.