fix: only show Auth token & Account SID rest make read only

This commit is contained in:
Shariq Ansari 2024-07-01 18:17:09 +05:30
parent 4cd0db89b1
commit 879fbb231d
3 changed files with 32 additions and 12 deletions

View File

@ -667,9 +667,6 @@ def get_fields(doctype: str, allow_all_fieldtypes: bool = False):
for field in fields:
if (
field.fieldtype not in not_allowed_fieldtypes
and not field.hidden
and not field.read_only
and not field.is_virtual
and field.fieldname
):
_fields.append({
@ -678,6 +675,8 @@ def get_fields(doctype: str, allow_all_fieldtypes: bool = False):
"value": field.fieldname,
"options": field.options,
"mandatory": field.reqd,
"read_only": field.read_only,
"hidden": field.hidden,
})
return _fields

View File

@ -11,13 +11,15 @@
"enabled",
"column_break_avmt",
"record_calls",
"section_break_malx",
"section_break_eklq",
"account_sid",
"api_key",
"api_secret",
"column_break_idds",
"column_break_yqvr",
"auth_token",
"twiml_sid"
"section_break_malx",
"api_key",
"twiml_sid",
"column_break_idds",
"api_secret"
],
"fields": [
{
@ -31,13 +33,15 @@
"fieldname": "api_key",
"fieldtype": "Data",
"label": "API Key",
"permlevel": 1
"permlevel": 1,
"read_only": 1
},
{
"fieldname": "api_secret",
"fieldtype": "Password",
"label": "API Secret",
"permlevel": 1
"permlevel": 1,
"read_only": 1
},
{
"fieldname": "column_break_idds",
@ -54,7 +58,8 @@
"fieldname": "twiml_sid",
"fieldtype": "Data",
"label": "TwiML SID",
"permlevel": 1
"permlevel": 1,
"read_only": 1
},
{
"fieldname": "section_break_ssqj",
@ -79,12 +84,20 @@
"fieldname": "enabled",
"fieldtype": "Check",
"label": "Enabled"
},
{
"fieldname": "section_break_eklq",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_yqvr",
"fieldtype": "Column Break"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-06-11 17:42:38.256260",
"modified": "2024-07-01 17:55:25.003703",
"modified_by": "Administrator",
"module": "FCRM",
"name": "Twilio Settings",

View File

@ -33,6 +33,7 @@
:options="field.options"
v-model="data[field.name]"
:placeholder="__(field.placeholder || field.label)"
:disabled="Boolean(field.read_only)"
>
<template v-if="field.prefix" #prefix>
<IndicatorIcon :class="field.prefix" />
@ -65,6 +66,7 @@
@change="(v) => (data[field.name] = v)"
:placeholder="__(field.placeholder || field.label)"
:onCreate="field.create"
:disabled="Boolean(field.read_only)"
/>
<Link
v-else-if="field.type === 'User'"
@ -74,6 +76,7 @@
@change="(v) => (data[field.name] = v)"
:placeholder="__(field.placeholder || field.label)"
:hideMe="true"
:disabled="Boolean(field.read_only)"
>
<template #prefix>
<UserAvatar class="mr-2" :user="data[field.name]" size="sm" />
@ -143,30 +146,35 @@
v-model="data[field.name]"
:placeholder="__(field.placeholder || field.label)"
input-class="border-none"
:disabled="Boolean(field.read_only)"
/>
<DatePicker
v-else-if="field.type === 'Date'"
v-model="data[field.name]"
:placeholder="__(field.placeholder || field.label)"
input-class="border-none"
:disabled="Boolean(field.read_only)"
/>
<FormControl
v-else-if="['Small Text', 'Text', 'Long Text'].includes(field.type)"
type="textarea"
:placeholder="__(field.placeholder || field.label)"
v-model="data[field.name]"
:disabled="Boolean(field.read_only)"
/>
<FormControl
v-else-if="['Int'].includes(field.type)"
type="number"
:placeholder="__(field.placeholder || field.label)"
v-model="data[field.name]"
:disabled="Boolean(field.read_only)"
/>
<FormControl
v-else
type="text"
:placeholder="__(field.placeholder || field.label)"
v-model="data[field.name]"
:disabled="Boolean(field.read_only)"
/>
</div>
</div>