sdv Posted August 6, 2018 Share Posted August 6, 2018 Hello, Is there any way to change default country phone code at new clients search bar? 0 Quote Link to comment Share on other sites More sharing options...
sdv Posted August 8, 2018 Author Share Posted August 8, 2018 Here is an example of what I meant (see attachment). By default, +1 (USA) is selected. There is USA and UK pinned at the top of the list. But our billing does not have clients with such phone number. It also have not clients with +93, +355 etc phone codes. The new client search bar would be much better if default phone code could be set in settings. And, as a next step, only existing phone codes was shown (e.g. if all clients have +1xxxxxxxxxxx phone, there will be no other phone codes in list ). 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 9, 2018 Share Posted August 9, 2018 I answered a similar question a few months about this feature on the client side... your question about the admin side will require a similar solution - there's no way to do it via settings (I doubt there will ever be - not this year at least), so you'll going to have to edit some .js files - in this case, the file to edit will be either /admin/blend (or v4)/js/scripts.js (then later minified), or scripts.min.js directly (not for the faint-hearted!). 19 hours ago, sdv said: By default, +1 (USA) is selected. There is USA and UK pinned at the top of the list. ~ line 65893 & 65955... preferredCountries: [initialCountry, "us", "gb"].filter(function(value, index, self) { take "gb" out of those two lines, minify it and save it as scripts.min.js and UK will be removed from the initial dropdown... preferredCountries: [initialCountry, "us"].filter(function(value, index, self) { 19 hours ago, sdv said: But our billing does not have clients with such phone number. It also have not clients with +93, +355 etc phone codes. you can specify which countries are shown in the dropdown ~ line 64329 onlyCountries: ["us","ca"], 19 hours ago, sdv said: The new client search bar would be much better if default phone code could be set in settings. i'm not sure if it can be set dynamically like that, e.g taking default country and assigning it's phone number prefix to the dropdown... though I can see the logic behind the suggestion. 19 hours ago, sdv said: And, as a next step, only existing phone codes was shown (e.g. if all clients have +1xxxxxxxxxxx phone, there will be no other phone codes in list ). again, I wouldn't expect this to happen any time soon.... not least because the function isn't linked to the data, it's just creating a dropdown functionality based on general settings from the .js file. I should probably also mention that WHMCS may overwrite these modified files during an update - so if that occurs, you may have to do this process after every update (assuming it's still a valid solution in future releases)... or you could just disable the telephone function in general settings. 1 Quote Link to comment Share on other sites More sharing options...
sdv Posted August 9, 2018 Author Share Posted August 9, 2018 Thank you for the answer and mention of the lib's docs. Here is my solution: add_hook('AdminAreaPage', 1, function($vars) { if ($vars['filename'] != 'clients') return; $script = <<<'EOF' $('#inputPhone').intlTelInput("setCountry", "ua"); EOF; return ['jquerycode' => $vars['jquerycode'] . $script]; }); That's all I need! 👍 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.