Created
September 27, 2018 10:14
-
-
Save VSeryoga/e6631082c28d2f57f3382d92af7fc931 to your computer and use it in GitHub Desktop.
Взаимосвязь полей Битрикс24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| function hideNotZastroy(){ | |
| console.log('click'); | |
| $('#crm-crm-additional-uf-crm-1537536664-open_UF_CRM_1537536664-blocks .crm-block-cont-contact-info span:not(:contains("Застройщик"))').parent('span').parent('span').css("display", "none"); | |
| $('#crm-crm-uf-crm-1537536664-uf-crm-1537536664-open_UF_CRM_1537536664-blocks .crm-block-cont-contact-info span:not(:contains("Застройщик"))').parent('span').parent('span').css("display", "none"); | |
| } | |
| var ids_zhk; | |
| $(document).ready(function() { | |
| //Открытие выбора застройщика | |
| $('body').on('click', '#crm-additional-uf-crm-1537536664-open', function(){ | |
| hideNotZastroy(); | |
| }); | |
| $('body').on('click', '#crm-uf-crm-1537536664-uf-crm-1537536664-open', function(){ | |
| hideNotZastroy(); | |
| }); | |
| $('body').on('change', '[name="UF_CRM_1537536664"]', function(){ | |
| var id = $(this).val(); | |
| if(id > 0){ | |
| $.ajax({ | |
| url: '/local/ajax/ajax.php', | |
| type: 'POST', | |
| data: {action: 'getZkPoIdZastr', id: id}, | |
| }) | |
| .done(function(data) { | |
| ids_zhk = $.parseJSON(data); | |
| hideZhk(); | |
| console.log(ids_zhk); | |
| }) | |
| .fail(function() { | |
| console.log("error"); | |
| }) | |
| .always(function() { | |
| console.log("complete"); | |
| }); | |
| } | |
| }) | |
| //ОТкрытие ЖК | |
| // $('body').on('click', '') | |
| }); | |
| BX.addCustomEvent('onAjaxSuccess', function(data){ | |
| // setTimeout(function(){ | |
| // $('#crm-crm-additional-uf-crm-1537536664-open_UF_CRM_1537536664-blocks .crm-block-cont-contact-info span:not(:contains("Застройщик"))').parent('span').parent('span').css("display", "none"); | |
| // $('#crm-crm-uf-crm-1537536664-uf-crm-1537536664-open_UF_CRM_1537536664-blocks .crm-block-cont-contact-info span:not(:contains("Застройщик"))').parent('span').parent('span').css("display", "none"); | |
| // }, 500); | |
| console.log(data); | |
| if(data.FIELD && data.FIELD.UF_CRM_1537533514){ | |
| hideZhk(); | |
| } | |
| }); | |
| function hideZhk(){ | |
| $('[data-cid="UF_CRM_1537533514"] label').hide(); | |
| $('[data-cid="UF_CRM_1537533514"] label').next().hide(); | |
| $('[data-cid="UF_CRM_1537533514"] input').hide(); | |
| console.log(123); | |
| console.log(ids_zhk); | |
| for (var i in ids_zhk) { | |
| console.log(ids_zhk[i]); | |
| $('[for="UF_CRM_1537533514[]_' + ids_zhk[i] + '"]').show(); | |
| $('[for="UF_CRM_1537533514[]_' + ids_zhk[i] + '"]').next().show(); | |
| $('input[name="UF_CRM_1537533514[]"][value="' + ids_zhk[i] + '"]').show(); | |
| } | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment