landing page templ & slick library
This commit is contained in:
153
services/landingpage.services.go
Normal file
153
services/landingpage.services.go
Normal file
@@ -0,0 +1,153 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/emarifer/go-templ-project-structure/db"
|
||||
)
|
||||
|
||||
func NewServicesLandingPage(u LandingPage, uStore db.LandingPageStore) *ServicesLandingPage {
|
||||
|
||||
return &ServicesLandingPage{
|
||||
LandingPage: u,
|
||||
LandingPageStore: uStore,
|
||||
}
|
||||
}
|
||||
|
||||
type LandingPage struct {
|
||||
ID int `json:"id"`
|
||||
LandingPagename string `json:"LandingPagename"`
|
||||
Email string `json:"email"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
type ClientService struct {
|
||||
ClientServiceID int `json:"ClientServiceID"`
|
||||
ClientServiceName string `json:"ClientServiceName"`
|
||||
ClientServiceDescription string `json:"ClientServiceDescription"`
|
||||
ClientServiceIcon string `json:"ClientServiceIcon"`
|
||||
ClientServiceLink string `json:"ClientServiceLink"`
|
||||
}
|
||||
type AdvantageClient struct {
|
||||
AdvantageClientID int `json:"AdvantageClientID"`
|
||||
AdvantageClientName string `json:"AdvantageClientName"`
|
||||
AdvantageClientDesc string `json:"AdvantageClientDesc"`
|
||||
}
|
||||
|
||||
type ServicesLandingPage struct {
|
||||
LandingPage LandingPage
|
||||
LandingPageStore db.LandingPageStore
|
||||
}
|
||||
|
||||
func (su *ServicesLandingPage) GetAllLandingPages() ([]LandingPage, error) {
|
||||
query := `SELECT id, LandingPagename, email, created_at FROM LandingPages ORDER BY created_at DESC`
|
||||
|
||||
rows, err := su.LandingPageStore.Db.Query(query)
|
||||
if err != nil {
|
||||
return []LandingPage{}, err
|
||||
}
|
||||
// We close the resource
|
||||
defer rows.Close()
|
||||
|
||||
LandingPages := []LandingPage{}
|
||||
for rows.Next() {
|
||||
rows.Scan(
|
||||
&su.LandingPage.ID,
|
||||
&su.LandingPage.LandingPagename,
|
||||
&su.LandingPage.Email,
|
||||
&su.LandingPage.CreatedAt,
|
||||
)
|
||||
|
||||
LandingPages = append(LandingPages, su.LandingPage)
|
||||
}
|
||||
|
||||
return LandingPages, nil
|
||||
}
|
||||
|
||||
func (su *ServicesLandingPage) GetLandingPageById(id int) (LandingPage, error) {
|
||||
|
||||
query := `SELECT id, LandingPagename, email, created_at FROM LandingPages
|
||||
WHERE id = ?`
|
||||
|
||||
stmt, err := su.LandingPageStore.Db.Prepare(query)
|
||||
if err != nil {
|
||||
return LandingPage{}, err
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
|
||||
su.LandingPage.ID = id
|
||||
err = stmt.QueryRow(
|
||||
su.LandingPage.ID,
|
||||
).Scan(
|
||||
&su.LandingPage.ID,
|
||||
&su.LandingPage.LandingPagename,
|
||||
&su.LandingPage.Email,
|
||||
&su.LandingPage.CreatedAt,
|
||||
)
|
||||
if err != nil {
|
||||
return LandingPage{}, err
|
||||
}
|
||||
|
||||
return su.LandingPage, nil
|
||||
}
|
||||
func (su *ServicesLandingPage) GetClientService() ([]ClientService, error) {
|
||||
|
||||
data := []ClientService{
|
||||
{
|
||||
ClientServiceID: 1,
|
||||
ClientServiceName: "In House Clinic",
|
||||
ClientServiceDescription: "Maintaining health in the workplace by carrying out promotional, preventive, curative and rehabilitative programs.",
|
||||
ClientServiceIcon: "uil:clinic-medical",
|
||||
ClientServiceLink: "/",
|
||||
},
|
||||
{
|
||||
ClientServiceID: 2,
|
||||
ClientServiceName: "Laboratorium Test",
|
||||
ClientServiceDescription: "Maintaining health in the workplace by carrying out promotional, preventive, curative and rehabilitative programs.",
|
||||
ClientServiceIcon: "healthicons:clinical-a-outline",
|
||||
ClientServiceLink: "/",
|
||||
},
|
||||
{
|
||||
ClientServiceID: 3,
|
||||
ClientServiceName: "Medical Check Up",
|
||||
ClientServiceDescription: "Supported by a professional medical, paramedical team, and as well as laboratory equipment ",
|
||||
ClientServiceIcon: "jam:medical",
|
||||
ClientServiceLink: "/",
|
||||
},
|
||||
}
|
||||
|
||||
return data, nil
|
||||
}
|
||||
func (su *ServicesLandingPage) GetClientAdvantage() ([]AdvantageClient, error) {
|
||||
|
||||
data := []AdvantageClient{
|
||||
{
|
||||
AdvantageClientID: 1,
|
||||
AdvantageClientName: "ISO Certificate",
|
||||
AdvantageClientDesc: "Westerindo Clinical Laboratory has obtained ISO 15189:2009 (ISO 15189:2007) Accreditation from the National Accreditation Committee (KAN) and the Health Laboratory Accreditation Commission (KALK).",
|
||||
},
|
||||
{
|
||||
AdvantageClientID: 2,
|
||||
AdvantageClientName: "Modern Technology",
|
||||
AdvantageClientDesc: "Laboratory Information System (LIS) is an information system in which laboratory equipment and diagnostic support have been integrated automatically so that examination results can be immediately filled in in employee data. This eliminates the possibility of human error.",
|
||||
},
|
||||
{
|
||||
AdvantageClientID: 3,
|
||||
AdvantageClientName: "Good Quality Facilities",
|
||||
AdvantageClientDesc: "The laboratory and medical support equipment used at the Westerindo Clinical Laboratory is international scale for precise, fast and accurate results. Lab and medical equipment certificates are periodically renewed according to standards.",
|
||||
},
|
||||
{
|
||||
AdvantageClientID: 4,
|
||||
AdvantageClientName: "Professional Service",
|
||||
AdvantageClientDesc: "Westerindo Clinical Laboratory is committed to providing professional and excellent service. Therefore, all staff and doctors at the Westerindo Clinical Laboratory have competency certification according to their field.",
|
||||
},
|
||||
{
|
||||
AdvantageClientID: 5,
|
||||
AdvantageClientName: "Experienced",
|
||||
AdvantageClientDesc: "Westerindo Clinical Laboratory is very experienced in carrying out Medical Check Ups both onsite and insite, in all corners of Indonesia. Serving various kinds of companies, from oil and gas companies, automotive, manufacturing, offices, and others.",
|
||||
},
|
||||
}
|
||||
|
||||
return data, nil
|
||||
}
|
||||
Reference in New Issue
Block a user