step 15 : add master dokter dengan foto dan tanpa foto
This commit is contained in:
@@ -11,6 +11,8 @@ import (
|
||||
"cpone/services"
|
||||
"cpone/utils"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -48,6 +50,21 @@ type MdDoctorHandler struct {
|
||||
MdDoctorServices MdDoctorServices
|
||||
}
|
||||
|
||||
// GET FOTO PROFILE DOCTOR
|
||||
func (lh *MdDoctorHandler) GetFotoProfile(c echo.Context) error {
|
||||
// Mengambil nama file dari parameter URL
|
||||
filename := c.Param("filename")
|
||||
_, b, _, _ := runtime.Caller(0)
|
||||
basepath := filepath.Dir(b)
|
||||
println("Basepath")
|
||||
println(basepath)
|
||||
// Menentukan path file (relative to the dev/services folder)
|
||||
filePath := filepath.Join(basepath, "..", "..", "uploads", "doctor", filename)
|
||||
|
||||
// Mengembalikan file sebagai respon
|
||||
return c.File(filePath)
|
||||
}
|
||||
|
||||
// INITIAL
|
||||
func (lh *MdDoctorHandler) HandleShowMdDoctorScreen(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
@@ -661,6 +678,13 @@ func (lh *MdDoctorHandler) HandleShowMdDoctorScreen(c echo.Context) error {
|
||||
ID: "doctoragama",
|
||||
},
|
||||
listItemResultAgamaComponent,
|
||||
models.CustomUploadFotoPrmV0{
|
||||
ID: "doctorfoto",
|
||||
Name: "doctorfoto",
|
||||
Accept: ".png, .jpg, .jpeg",
|
||||
Label: "Update Foto",
|
||||
LinkFoto: "",
|
||||
},
|
||||
dialogAddBodyID, dev_mddoctorview.JsHideModalDoctor(""))
|
||||
|
||||
modalActioAddCmp := dev_mddoctorview.ActionFormDoctor(
|
||||
@@ -1446,6 +1470,13 @@ func (lh *MdDoctorHandler) HandleCloseFormAdd(c echo.Context) error {
|
||||
ID: "doctoragama",
|
||||
},
|
||||
listItemResultAgamaComponent,
|
||||
models.CustomUploadFotoPrmV0{
|
||||
ID: "doctorfoto",
|
||||
Name: "doctorfoto",
|
||||
Accept: ".png, .jpg, .jpeg",
|
||||
Label: "Update Foto",
|
||||
LinkFoto: "",
|
||||
},
|
||||
dialogAddBodyID, dev_mddoctorview.JsHideModalDoctor(""))
|
||||
return utils.View(c, newForm)
|
||||
}
|
||||
@@ -1483,6 +1514,12 @@ func (lh *MdDoctorHandler) HandleAddMdDoctor(c echo.Context) error {
|
||||
doctorGolonganEtnis := c.FormValue("doctorgolonganetnis")
|
||||
doctorImbuhanNoHP := c.FormValue("doctorimbuhannohp")
|
||||
doctorAgama := c.FormValue("doctoragama")
|
||||
// doctorFoto, err := c.FormFile("doctorfoto")
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
|
||||
doctorfotobase64string := c.FormValue("doctorfotobase64string")
|
||||
|
||||
separator := "$$"
|
||||
|
||||
@@ -1526,6 +1563,8 @@ func (lh *MdDoctorHandler) HandleAddMdDoctor(c echo.Context) error {
|
||||
zap.String("doctorGolonganEtnis", doctorGolonganEtnis),
|
||||
zap.String("doctorImbuhanNoHP", doctorImbuhanNoHP),
|
||||
zap.String("doctorAgama", doctorAgama),
|
||||
zap.String("doctorfotobase64string", doctorfotobase64string),
|
||||
// zap.Any("doctorFoto", doctorFoto),
|
||||
zap.Any("tableid", tableID),
|
||||
zap.Any("search", search),
|
||||
zap.Any("currpage", currPage),
|
||||
@@ -2187,6 +2226,15 @@ func (lh *MdDoctorHandler) HandleAddMdDoctor(c echo.Context) error {
|
||||
ID: "doctoragama",
|
||||
},
|
||||
listItemResultAgamaComponent,
|
||||
models.CustomUploadFotoPrmV0{
|
||||
ID: "doctorfoto",
|
||||
Name: "doctorfoto",
|
||||
Accept: ".png, .jpg, .jpeg",
|
||||
Label: "Update Foto",
|
||||
// LinkFoto: "",
|
||||
LinkFoto: doctorfotobase64string,
|
||||
Value: doctorfotobase64string,
|
||||
},
|
||||
dialogAddBodyID, dev_mddoctorview.JsHideModalDoctor(""))
|
||||
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Warning", formValidation, "warning"), newForm})
|
||||
}
|
||||
@@ -2457,6 +2505,14 @@ func (lh *MdDoctorHandler) HandleAddMdDoctor(c echo.Context) error {
|
||||
ID: "doctoragama",
|
||||
},
|
||||
listItemResultAgamaComponent,
|
||||
models.CustomUploadFotoPrmV0{
|
||||
ID: "doctorfoto",
|
||||
Name: "doctorfoto",
|
||||
Accept: ".png, .jpg, .jpeg",
|
||||
Label: "Update Foto",
|
||||
LinkFoto: doctorfotobase64string,
|
||||
Value: doctorfotobase64string,
|
||||
},
|
||||
dialogAddBodyID, dev_mddoctorview.JsHideModalDoctor(""))
|
||||
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Error", "Error Get Doctor Code", "danger"), newForm})
|
||||
|
||||
@@ -2492,12 +2548,16 @@ func (lh *MdDoctorHandler) HandleAddMdDoctor(c echo.Context) error {
|
||||
M_DoctorM_SpecialistID: idSpesialisAdd,
|
||||
M_DoctorAddress: "",
|
||||
M_DoctorAddressRegionalCd: 0,
|
||||
M_DoctorAddressRT: "",
|
||||
M_DoctorAddressRW: "",
|
||||
M_DoctorAddressVillage: "",
|
||||
M_DoctorAddressCity: "",
|
||||
M_DoctorAddressDistrict: "",
|
||||
M_DoctorAddressState: "",
|
||||
M_DoctorAddressCountry: "",
|
||||
M_DoctorIsActive: "Y",
|
||||
M_DoctorCreatedUserID: "1",
|
||||
M_DoctorPhoto: doctorfotobase64string,
|
||||
}
|
||||
|
||||
dataDoctorAdd, err := lh.MdDoctorServices.AddMdDoctor(doctor)
|
||||
@@ -2791,6 +2851,14 @@ func (lh *MdDoctorHandler) HandleAddMdDoctor(c echo.Context) error {
|
||||
ID: "doctoragama",
|
||||
},
|
||||
listItemResultAgamaComponent,
|
||||
models.CustomUploadFotoPrmV0{
|
||||
ID: "doctorfoto",
|
||||
Name: "doctorfoto",
|
||||
Accept: ".png, .jpg, .jpeg",
|
||||
Label: "Update Foto",
|
||||
LinkFoto: doctorfotobase64string,
|
||||
Value: doctorfotobase64string,
|
||||
},
|
||||
dialogAddBodyID, dev_mddoctorview.JsHideModalDoctor(""))
|
||||
return utils.ViewMulti(c, []templ.Component{
|
||||
customtoastv2.CustomToastV2Show("Error", err.Error(), "danger"),
|
||||
@@ -3040,6 +3108,14 @@ func (lh *MdDoctorHandler) HandleAddMdDoctor(c echo.Context) error {
|
||||
ID: "doctoragama",
|
||||
},
|
||||
listItemResultAgamaComponent,
|
||||
models.CustomUploadFotoPrmV0{
|
||||
ID: "doctorfoto",
|
||||
Name: "doctorfoto",
|
||||
Accept: ".png, .jpg, .jpeg",
|
||||
Label: "Update Foto",
|
||||
LinkFoto: "",
|
||||
Value: "",
|
||||
},
|
||||
dialogAddBodyID, dev_mddoctorview.JsHideModalDoctor("#"+dialogAddID))
|
||||
toastSuccess := customtoastv2.CustomToastV2Show("Success", "Success add master doctor "+doctorImbuhanNama, "success")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user