-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Custom field improvement #328
base: development
Are you sure you want to change the base?
Feat: Custom field improvement #328
Conversation
Now it is possible to choose the field type
@@ -75,13 +75,15 @@ def update | |||
if params[:contact][:deal_page_id] | |||
redirect_to account_deal_path(current_user.account, params[:contact][:deal_page_id]) | |||
else | |||
render :update, status: :ok | |||
redirect_to account_contact_path(current_user.account, @contact) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boa! Esses dois redirects estão meio confusos por conta do params[:contact][:deal_page_id]
. Basicamente essa action está sendo usada na pagina do deal
, e a resposta de redirect dela será diferente. Depois tenho q refatorar essas regras, 😄 .
class AddColumnFieldTypeCustomAttributeDefinition < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :custom_attribute_definitions, :attribute_type_field, :integer, default: 0 | ||
add_column :custom_attribute_definitions, :attribute_options_select, :string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nas nossas migrações, é um padrão a gnt já deixar setado um valor default para as colunas. Nesse caso, por ser uma string, vamos deixar setado como uma string vazia para default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Precisamos implementar a máscara nos input custom attributes
["Moeda", "number_field"], "R$", | ||
["Data", "date_field"], "DD/MM/AAAA", | ||
["Select", "select_custom"], "Seleção única"], | ||
{:disabled => ["Campo livre para escrita", "R$", "Seleção única", "DD/MM/AAAA"]}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esses aqui estão desabilitados?
["Campo livre para escrita", "R$", "Seleção única", "DD/MM/AAAA"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esses campos são para exibição de exemplos do select. Acho interessante remover o campo do tipo moeda, pq no futuro a gnt pretende colocá-lo como um atributo do model deal, pq esse campo tem q ser guardado em centavos. Logo, se a gnt implementar ele como um campo customizavel, no futuro pode acabar confundindo as pessoas quando tiver um campo moeda no deal.
Encontrei um problema. Quando utilizo um campo select, ele n guarda no jsonb custom attributes do contato, o valor key do custom attribute, ele guarda o tipo do campo do custom_attribute, como nessa situação: irb(main):028> Contact.last
Contact Load (1.0ms) SELECT "contacts".* FROM "contacts" ORDER BY "contacts"."id" DESC LIMIT $1 [["LIMIT", 1]]
=>
#<Contact:0x0000563c818cf050
id: 572,
account_id: 1,
full_name: "qwerty",
phone: "",
email: "[email protected]",
custom_attributes:
{"data_key"=>"[FILTERED]", "moeda_key"=>"[FILTERED]", "texto_key"=>"[FILTERED]", "select_custom"=>"100"},
additional_attributes: {"chatwoot_id"=>6846},
app_type: nil,
app_id: nil,
created_at: Wed, 22 May 2024 14:41:57.337304000 -03 -03:00,
updated_at: Wed, 22 May 2024 14:53:22.070167000 -03 -03:00,
label_list: nil,
chatwoot_conversations_label_list: nil> Vc ve que na linha: |
#290
Adiciona melhoria para escolher o tipo do campo no cadastro de atributos customizados..
Atualmente suportando: