import re

file_path = r'c:\Users\Admin\Downloads\will _fwg\willl\ram\will _fwg\will-fwg\resources\views\agent\clients\create.blade.php'

with open(file_path, 'r', encoding='utf-8') as f:
    content = f.read()

# Replace all occurrences of the Address label with the button added
old_pattern = r'<label class="block text-sm font-semibold text-gray-700 mb-3">Address</label>'
new_pattern = '''<div class="flex items-center justify-between mb-3">
                            <label class="block text-sm font-semibold text-gray-700">Address</label>
                            <button type="button" class="text-xs bg-blue-50 text-blue-600 hover:bg-blue-100 px-3 py-1 rounded-lg transition" onclick="copyResidentialAddressToFamily(this)">
                                <i class="fas fa-copy mr-1"></i>Copy from Residential
                            </button>
                        </div>'''

new_content = re.sub(old_pattern, new_pattern, content)

with open(file_path, 'w', encoding='utf-8') as f:
    f.write(new_content)

print("✅ Successfully added Copy from Residential button to all family member address sections")
