"""Remove audit refs and functions from Appointments.vue"""
with open('mp-sc-admin/src/pages/Appointments.vue', 'rb') as f:
    content = f.read()

# Lines to remove - the refs
old1 = b"const auditVisible = ref(false)\r\nconst auditTarget = ref<any>(null)\r\nconst auditStatus = ref(1)\r\nconst auditComment = ref('')\r\nconst auditing = ref(false)\r\n"
new1 = b""
content = content.replace(old1, new1)

# The functions handleAudit + submitAudit
old2 = b"function handleAudit(row, status) {\r\n  auditTarget.value = row; auditStatus.value = status; auditComment.value = ''; auditVisible.value = true\r\n}\r\nasync function submitAudit() {\r\n  auditing.value = true\r\n  try {\r\n    const status = auditStatus.value\r\n"
content = content.replace(old2, b"")

# Find the closing part of submitAudit and remove it
old3 = b"    await request.Put(`/v1/admin/appointments/${auditTarget.value.id}/audit`, { status, comment: auditComment.value })\r\n    ElMessage.success(`${text}\xe6\x88\x90\xe5\x8a\x9f`)\r\n    auditVisible.value = false\r\n    await fetchData()\r\n  } catch (err) { ElMessage.error(err.message || '\xe6\x93\x8d\xe4\xbd\x9c\xe5\xa4\xb1\xe8\xb4\xa5') }\r\n  finally { auditing.value = false }\r\n}\r\n"
content = content.replace(old3, b"")

with open('mp-sc-admin/src/pages/Appointments.vue', 'wb') as f:
    f.write(content)
print('done')
