-
Notifications
You must be signed in to change notification settings - Fork 102
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(mail): implement the send mail view #337
Merged
Merged
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
393d5f0
feat: 메일 발송 페이지 기능 베이스 레이아웃 추가
Rok93 947ac76
feat: 대략적인 개별, 그룹 발송 기능 틀 구현
Rok93 cf2f20f
feat: 업로드 기능 제외한 메일 발송 페이지 구현
Rok93 b528570
feat: 업로드 버튼 추가
Rok93 c4b8f59
refactor: 메일 첨부파일 업로드 기능의 최대 용량을 10MB로 변경 및 모든 파일 타입을 업로드 허용하도록 변경
Rok93 8e6b68f
refactor: 첨부파일 업로드 버튼이 메일 본문 아래에 위치하도록 변경
Rok93 e6322b0
feat: 메일을 보내는 발신자 표시 추가
Rok93 47231b0
refactor: 개별 발송, 그룹 발송 기능을 하나의 페이지에서 가능하도록 변경
Rok93 d9f5c93
refactor: 그룹 발송 기능을 Dialog 컴포넌트 클래스로 분리
Rok93 24f387e
refactor: 개별 발송 기능을 Dialog 컴포넌트 클래스로 분리
Rok93 355547b
refactor: 개별 발송 Dialog 컴포넌트 클래스의 파라미터 순서 변경
Rok93 cc54a2d
refactor: 개별 발송 Dialog의 추가 버튼을 적용 버튼으로 변경
Rok93 c7fc6c4
resolve conflict
Rok93 cd0c86e
feat: form layout 적용 및 Grid 추가
Rok93 619dfde
feat: MailTarget Grid 삭제 버튼 추가
Rok93 e22c80a
feat: MailTarget Grid 삭제 버튼 추가
Rok93 a5a7bda
refactor: 메일의 각 컴포넌트의 라벨을 텍스트 라벨로 변경
Rok93 7bbad19
refactor: UI 피드백 반영
Rok93 7ab7abb
Merge branch 'develop' into feature/send-mail-page
Rok93 7566eb1
refactor: 마찌 피드백 반영
Rok93 97a7bd4
refactor(mail): polish the code
woowahan-pjs 32f321b
refactor(support): rename search bar to search box
woowahan-pjs 98597dd
refactor(mail): polish the code
woowahan-pjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package apply.application.mail | ||
|
||
import javax.validation.constraints.NotNull | ||
|
||
data class MailSendData( | ||
@field:NotNull | ||
var subject: String = "", | ||
@field:NotNull | ||
var content: String = "", | ||
@field:NotNull | ||
var targetMails: List<String> = listOf() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
src/main/kotlin/apply/ui/admin/mail/GroupMailTargetFormDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
package apply.ui.admin.mail | ||
|
||
import apply.application.EvaluationService | ||
import apply.application.MailTargetResponse | ||
import apply.application.MailTargetService | ||
import apply.application.RecruitmentResponse | ||
import apply.application.RecruitmentService | ||
import apply.domain.evaluation.Evaluation | ||
import apply.domain.evaluationtarget.EvaluationStatus | ||
import com.vaadin.flow.component.dialog.Dialog | ||
import com.vaadin.flow.component.grid.Grid | ||
import com.vaadin.flow.component.html.H2 | ||
import com.vaadin.flow.component.orderedlayout.FlexComponent | ||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout | ||
import com.vaadin.flow.component.select.Select | ||
import support.views.addSortableColumn | ||
import support.views.createContrastButton | ||
import support.views.createItemSelect | ||
import support.views.createPrimaryButton | ||
|
||
class GroupMailTargetFormDialog( | ||
private val recruitmentService: RecruitmentService, | ||
private val evaluationService: EvaluationService, | ||
private val mailTargetService: MailTargetService, | ||
private val reloadComponent: (List<MailTargetResponse>) -> Unit | ||
) : Dialog() { | ||
private val evaluation: Select<Evaluation> = createItemSelect("평가") | ||
private val recruitment: Select<RecruitmentResponse> = createRecruitmentItem(evaluation) | ||
private val evaluationStatus: Select<EvaluationStatus> = createEvaluationStatusItem(evaluation) | ||
private val mailTargets: MutableList<MailTargetResponse> = mutableListOf() | ||
private val currentMailTargetsGrid: Grid<MailTargetResponse> = createMailTargetsGrid() | ||
|
||
init { | ||
add( | ||
H2("지원자 정보 조회"), | ||
createMailTargetFilter(), | ||
currentMailTargetsGrid, | ||
createButtons() | ||
) | ||
width = "900px" | ||
height = "70%" | ||
open() | ||
} | ||
|
||
private fun createRecruitmentItem(evaluation: Select<Evaluation>): Select<RecruitmentResponse> { | ||
return createItemSelect<RecruitmentResponse>("모집").apply { | ||
setItems(*recruitmentService.findAll().toTypedArray()) | ||
setItemLabelGenerator { it.title } | ||
addValueChangeListener { | ||
evaluation.apply { | ||
setItems(*evaluationService.findAllByRecruitmentId(it.value.id).toTypedArray()) | ||
setItemLabelGenerator { it.title } | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun createEvaluationStatusItem( | ||
evaluation: Select<Evaluation>, | ||
): Select<EvaluationStatus> { | ||
return createItemSelect<EvaluationStatus>("모집 상태").apply { | ||
setItems(*EvaluationStatus.values()) | ||
setItemLabelGenerator { it.toText() } | ||
addValueChangeListener { | ||
val mailTargetResponses = mailTargetService.findMailTargets(evaluation.value.id, it.value) | ||
mailTargets.clear() | ||
mailTargets.addAll(mailTargetResponses) | ||
currentMailTargetsGrid.apply { | ||
setItems(mailTargetResponses) | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun EvaluationStatus.toText() = | ||
when (this) { | ||
EvaluationStatus.WAITING -> "평가 전" | ||
EvaluationStatus.PASS -> "합격" | ||
EvaluationStatus.FAIL -> "탈락" | ||
EvaluationStatus.PENDING -> "보류" | ||
} | ||
|
||
private fun createMailTargetsGrid(mailTargets: List<MailTargetResponse> = emptyList()): Grid<MailTargetResponse> { | ||
return Grid<MailTargetResponse>(10).apply { | ||
addSortableColumn("이름", MailTargetResponse::name) | ||
addSortableColumn("이메일", MailTargetResponse::email) | ||
setItems(mailTargets) | ||
} | ||
} | ||
|
||
private fun createMailTargetFilter(): HorizontalLayout { | ||
return HorizontalLayout( | ||
recruitment, evaluation, evaluationStatus, | ||
).apply { | ||
element.style.set("margin-bottom", "10px") | ||
} | ||
} | ||
|
||
private fun createButtons(): HorizontalLayout { | ||
return HorizontalLayout( | ||
createPrimaryButton("추가") { | ||
reloadComponent(mailTargets) | ||
close() | ||
}, | ||
createContrastButton("취소") { | ||
close() | ||
} | ||
).apply { | ||
justifyContentMode = FlexComponent.JustifyContentMode.CENTER | ||
defaultVerticalComponentAlignment = FlexComponent.Alignment.END | ||
element.style.set("margin-top", "10px") | ||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
src/main/kotlin/apply/ui/admin/mail/IndividualMailTargetFormDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package apply.ui.admin.mail | ||
|
||
import apply.application.ApplicantResponse | ||
import apply.application.ApplicantService | ||
import apply.application.MailTargetResponse | ||
import com.vaadin.flow.component.Component | ||
import com.vaadin.flow.component.button.Button | ||
import com.vaadin.flow.component.dialog.Dialog | ||
import com.vaadin.flow.component.grid.Grid | ||
import com.vaadin.flow.component.html.H2 | ||
import com.vaadin.flow.component.orderedlayout.FlexComponent | ||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout | ||
import com.vaadin.flow.data.renderer.ComponentRenderer | ||
import com.vaadin.flow.data.renderer.Renderer | ||
import support.views.addSortableColumn | ||
import support.views.createContrastButton | ||
import support.views.createPrimaryButton | ||
import support.views.createSearchBar | ||
|
||
class IndividualMailTargetFormDialog( | ||
private val applicantService: ApplicantService, | ||
private val reloadComponent: (MailTargetResponse) -> Unit | ||
) : Dialog() { | ||
private val currentMailTargetsGrid: Grid<ApplicantResponse> = createGrid() | ||
|
||
init { | ||
add( | ||
H2("지원자 정보 조회"), | ||
createMailTargetFilter(), | ||
currentMailTargetsGrid | ||
) | ||
width = "900px" | ||
height = "70%" | ||
open() | ||
} | ||
|
||
private fun createGrid(applicantResponse: List<ApplicantResponse> = emptyList()): Grid<ApplicantResponse> { | ||
return Grid<ApplicantResponse>(10).apply { | ||
addSortableColumn("이름", ApplicantResponse::name) | ||
addSortableColumn("이메일", ApplicantResponse::email) | ||
addColumn(createAddButton()).apply { isAutoWidth = true } | ||
setItems(applicantResponse) | ||
} | ||
} | ||
|
||
private fun createAddButton(): Renderer<ApplicantResponse> { | ||
return ComponentRenderer<Component, ApplicantResponse> { applicantResponse -> | ||
HorizontalLayout(createMailTargetAddButton(applicantResponse)) | ||
} | ||
} | ||
|
||
private fun createMailTargetAddButton(applicantResponse: ApplicantResponse): Button { | ||
return createPrimaryButton("추가") { | ||
reloadComponent(MailTargetResponse(applicantResponse)) | ||
}.apply { | ||
isDisableOnClick = true | ||
} | ||
} | ||
|
||
private fun createMailTargetFilter(): Component { | ||
return HorizontalLayout( | ||
createSearchBar { | ||
val founds = applicantService.findAllByKeyword(it) | ||
currentMailTargetsGrid.apply { | ||
setItems(founds) | ||
} | ||
}, | ||
createCancelButton() | ||
).apply { | ||
justifyContentMode = FlexComponent.JustifyContentMode.START | ||
element.style.set("margin-top", "10px") | ||
element.style.set("margin-bottom", "10px") | ||
} | ||
} | ||
|
||
private fun createCancelButton(): Button { | ||
return createContrastButton("취소") { | ||
close() | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
전반적인 그리드에 메일 대상자 이름도 추가했다면 여기에서도 이름 컬럼을 추가하면 어떨까요???
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.
그렇네요 여기에서도 이름을 추가하면 좋을 것 같아요 😃