@ -14,7 +14,7 @@ import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.notification.NotificationVariant ;
import com.vaadin.flow.component.notification.NotificationVariant ;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout ;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout ;
import com.vaadin.flow.component.orderedlayout.VerticalLayout ;
import com.vaadin.flow.component.orderedlayout.VerticalLayout ;
import com.vaadin.flow.component.textfield.TextArea ;
import com.vaadin.flow.component.richtexteditor.RichTextEditor ;
import com.vaadin.flow.component.textfield.TextField ;
import com.vaadin.flow.component.textfield.TextField ;
import com.vaadin.flow.component.upload.Upload ;
import com.vaadin.flow.component.upload.Upload ;
import com.vaadin.flow.component.upload.UploadI18N ;
import com.vaadin.flow.component.upload.UploadI18N ;
@ -61,7 +61,7 @@ public class CrearnuevoTicketView extends VerticalLayout {
/ / Componentes principales de la UI
/ / Componentes principales de la UI
ComboBox < String > tipoTickets = createTicketTypeComboBox ( ) ;
ComboBox < String > tipoTickets = createTicketTypeComboBox ( ) ;
TextField asunto = createTextField ( "Asunto" , "1000px" ) ;
TextField asunto = createTextField ( "Asunto" , "1000px" ) ;
TextArea descripcion = createTextArea ( "Descripcion" , "1000px" , "250px" ) ;
RichTextEditor descripcion = createTextArea ( "Descripcion" , "1000px" , "250px" ) ;
/ / Marcar campos como obligatorios
/ / Marcar campos como obligatorios
tipoTickets . setRequiredIndicatorVisible ( true ) ;
tipoTickets . setRequiredIndicatorVisible ( true ) ;
@ -172,14 +172,13 @@ public class CrearnuevoTicketView extends VerticalLayout {
private TextField createTextField ( String label , String width ) {
private TextField createTextField ( String label , String width ) {
TextField textField = new TextField ( label ) ;
TextField textField = new TextField ( label ) ;
textField . setWidth ( width ) ;
textField . setSizeFull ( ) ;
return textField ;
return textField ;
}
}
private TextArea createTextArea ( String label , String width , String height ) {
TextArea textArea = new TextArea ( label ) ;
textArea . setWidth ( width ) ;
textArea . setHeight ( height ) ;
private RichTextEditor createTextArea ( String label , String width , String height ) {
RichTextEditor textArea = new RichTextEditor ( ) ;
textArea . setSizeFull ( ) ;
return textArea ;
return textArea ;
}
}
@ -199,7 +198,7 @@ public class CrearnuevoTicketView extends VerticalLayout {
}
}
}
}
private void handleCreateButton ( RedmineUser user , ComboBox < String > tipoTickets , TextField asunto , TextArea descripcion ) {
private void handleCreateButton ( RedmineUser user , ComboBox < String > tipoTickets , TextField asunto , RichTextEditor descripcion ) {
if ( user . getKey ( ) = = null | | user . getKey ( ) . isEmpty ( ) ) {
if ( user . getKey ( ) = = null | | user . getKey ( ) . isEmpty ( ) ) {
Notification . show ( "No se encontró la API key en la sesión." , 5000 , Notification . Position . MIDDLE )
Notification . show ( "No se encontró la API key en la sesión." , 5000 , Notification . Position . MIDDLE )
. addThemeVariants ( NotificationVariant . LUMO_ERROR ) ;
. addThemeVariants ( NotificationVariant . LUMO_ERROR ) ;
@ -252,7 +251,7 @@ public class CrearnuevoTicketView extends VerticalLayout {
handleResponse ( response , asunto , descripcion , tipoTickets ) ;
handleResponse ( response , asunto , descripcion , tipoTickets ) ;
}
}
private void handleResponse ( String response , TextField asunto , TextArea descripcion , ComboBox < String > tipoTickets ) {
private void handleResponse ( String response , TextField asunto , RichTextEditor descripcion , ComboBox < String > tipoTickets ) {
if ( response . startsWith ( "{\"issue\":" ) ) {
if ( response . startsWith ( "{\"issue\":" ) ) {
JsonObject jsonResponse = JsonParser . parseString ( response ) . getAsJsonObject ( ) ;
JsonObject jsonResponse = JsonParser . parseString ( response ) . getAsJsonObject ( ) ;
int issueNumber = jsonResponse . getAsJsonObject ( "issue" ) . get ( "id" ) . getAsInt ( ) ;
int issueNumber = jsonResponse . getAsJsonObject ( "issue" ) . get ( "id" ) . getAsInt ( ) ;
@ -265,14 +264,14 @@ public class CrearnuevoTicketView extends VerticalLayout {
}
}
}
}
private void resetForm ( TextField asunto , TextArea descripcion , ComboBox < String > tipoTickets ) {
private void resetForm ( TextField asunto , RichTextEditor descripcion , ComboBox < String > tipoTickets ) {
asunto . clear ( ) ;
asunto . clear ( ) ;
descripcion . clear ( ) ;
descripcion . clear ( ) ;
tipoTickets . clear ( ) ;
tipoTickets . clear ( ) ;
ticketTypeDesc . setText ( "" ) ;
ticketTypeDesc . setText ( "" ) ;
asunto . setInvalid ( false ) ;
asunto . setInvalid ( false ) ;
descripcion . setInvalid ( false ) ;
/ / descripcion . setInvalid ( false ) ;
tipoTickets . setInvalid ( false ) ;
tipoTickets . setInvalid ( false ) ;
buffer = new MultiFileMemoryBuffer ( ) ;
buffer = new MultiFileMemoryBuffer ( ) ;