wip
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
epi "simrs-vx/internal/domain/main-entities/person-insurance"
|
||||
epr "simrs-vx/internal/domain/main-entities/person-relative"
|
||||
er "simrs-vx/internal/domain/main-entities/regency"
|
||||
"strings"
|
||||
|
||||
erp "simrs-vx/internal/domain/references/person"
|
||||
|
||||
@@ -58,3 +59,62 @@ func (d Person) IsSameResidentIdentityNumber(input *string) bool {
|
||||
}
|
||||
return d.ResidentIdentityNumber == input
|
||||
}
|
||||
|
||||
func (d Person) GenderString() string {
|
||||
if d.Gender_Code == nil {
|
||||
return ""
|
||||
}
|
||||
switch *d.Gender_Code {
|
||||
case erp.GCMale:
|
||||
return "Laki-laki(L)"
|
||||
case erp.GCFemale:
|
||||
return "Perempuan(P)"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (d Person) GetPhoneNumber() string {
|
||||
if d.Contacts == nil {
|
||||
return ""
|
||||
}
|
||||
for _, c := range *d.Contacts {
|
||||
if c.Type_Code == erp.CTPhone || c.Type_Code == erp.CTMPhone {
|
||||
return c.Value
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (d Person) FullName() string {
|
||||
name := strings.TrimSpace(d.Name)
|
||||
if name == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
parts := []string{}
|
||||
|
||||
// Front title (dr., drs., etc)
|
||||
if d.FrontTitle != nil {
|
||||
ft := strings.TrimSpace(*d.FrontTitle)
|
||||
if ft != "" {
|
||||
parts = append(parts, ft)
|
||||
}
|
||||
}
|
||||
|
||||
// Name (always included)
|
||||
parts = append(parts, name)
|
||||
|
||||
// Join front title + name
|
||||
full := strings.Join(parts, " ")
|
||||
|
||||
// End title → attach with comma
|
||||
if d.EndTitle != nil {
|
||||
et := strings.TrimSpace(*d.EndTitle)
|
||||
if et != "" {
|
||||
full = full + ", " + et
|
||||
}
|
||||
}
|
||||
|
||||
return full
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id uint `json:"id"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
|
||||
Reference in New Issue
Block a user