Merge branch 'master' of bitbucket.org:venbainformationtechnology/pocketbase

This commit is contained in:
Surendiran 2025-06-16 17:46:16 +05:30
commit 916a841429
3 changed files with 117 additions and 74 deletions

191
main.go
View File

@ -612,66 +612,66 @@ func main() {
body := fmt.Sprintf(`
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Registration Update UAE Stats App</title>
</head>
<body style="font-family: Arial, sans-serif; margin: 0; padding: 0; background-color: #f8f8f8;">
<table role="presentation" width="100%%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td align="center" style="padding: 20px;">
<table role="presentation" width="600px" cellspacing="0" cellpadding="0" border="0" style="background-color: #ffffff; border: 2px solid #d1ad5c; padding: 20px;">
<tr>
<td align="center" style="font-size: 18px; font-weight: bold;">
<span style=" font-size:16px; border-bottom:1px solid #d1ad5c">
إعادة تعيين كلمة المرور - تطبيق إحصاءات الإمارات العربية المتحدة<br>
</span><br><span style="font-size: 18px;">Reset your FCSC password</span>
<br><br><br>
</td>
</tr>
<tr>
<td style="padding-top: 20px; padding-bottom:30px; font-size: 12px;">
<table role="presentation" width="100%%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="left" style="width: 50%%; vertical-align: top;">
<strong>Hello,</strong><br><br>
Click on the link below to reset your password.
<br><br>
<a href="%s" style="color: #d1ad5c; text-decoration: none; font-weight: bold;">Reset Password</a>
<br><br>
If you didn't ask to reset your password, you can ignore this email.
</td>
<td align="right" style="width: 50%%; vertical-align: top; direction: rtl;">
<strong>مرحبًا،</strong><br><br>
يُرجى الضغط على الرابط أدناه لإعادة تعيين كلمة المرور الخاصة بك: <br><br>
<a href="%s" style="color: #d1ad5c; text-decoration: none; font-weight: bold;">إعادة تعيين كلمة المرور</a>
<br><br>
إذا لم تطلب إعادة تعيين كلمة المرور، يمكنك تجاهل هذا البريد الإلكتروني.
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" padding-top: 20px;">
<img src="https://imageats.s3.ap-south-1.amazonaws.com/signature.png" alt="We The UAE 2031" width="100%%">
</td>
</tr>
<tr>
<td style="padding-top: 20px; font-size: 12px; color: #777; border-top: 1px solid #ccc;">
<strong>تنويه:</strong> المعلومات الواردة في هذه الرسالة الإلكترونية والمرفقات الخاصة بها سرية وقد تكون محمية بموجب القانون. إذا لم تكن الشخص المعني باستلام هذه الرسالة، فيرجى إخطار المرسل وحذف هذه الرسالة فوراً.
<br><br>
<strong>Disclaimer:</strong> The information contained and transmitted within this email message is PRIVILEGED AND/OR CONFIDENTIAL. If you are not the intended recipient, please notify the sender and delete this email immediately.
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>`, resetURL, resetURL)
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Registration Update UAE Stats App</title>
</head>
<body style="font-family: Arial, sans-serif; margin: 0; padding: 0; background-color: #f8f8f8;">
<table role="presentation" width="100%%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td align="center" style="padding: 20px;">
<table role="presentation" width="600px" cellspacing="0" cellpadding="0" border="0" style="background-color: #ffffff; border: 2px solid #d1ad5c; padding: 20px;">
<tr>
<td align="center" style="font-size: 18px; font-weight: bold;">
<span style=" font-size:16px; border-bottom:1px solid #d1ad5c">
إعادة تعيين كلمة المرور - تطبيق إحصاءات الإمارات العربية المتحدة<br>
</span><br><span style="font-size: 18px;">Reset your FCSC password</span>
<br><br><br>
</td>
</tr>
<tr>
<td style="padding-top: 20px; padding-bottom:30px; font-size: 12px;">
<table role="presentation" width="100%%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="left" style="width: 50%%; vertical-align: top;">
<strong>Hello,</strong><br><br>
Click on the link below to reset your password.
<br><br>
<a href="%s" style="color: #d1ad5c; text-decoration: none; font-weight: bold;">Reset Password</a>
<br><br>
If you didn't ask to reset your password, you can ignore this email.
</td>
<td align="right" style="width: 50%%; vertical-align: top; direction: rtl;">
<strong>مرحبًا،</strong><br><br>
يُرجى الضغط على الرابط أدناه لإعادة تعيين كلمة المرور الخاصة بك: <br><br>
<a href="%s" style="color: #d1ad5c; text-decoration: none; font-weight: bold;">إعادة تعيين كلمة المرور</a>
<br><br>
إذا لم تطلب إعادة تعيين كلمة المرور، يمكنك تجاهل هذا البريد الإلكتروني.
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" padding-top: 20px;">
<img src="https://imageats.s3.ap-south-1.amazonaws.com/signature.png" alt="We The UAE 2031" width="100%%">
</td>
</tr>
<tr>
<td style="padding-top: 20px; font-size: 12px; color: #777; border-top: 1px solid #ccc;">
<strong>تنويه:</strong> المعلومات الواردة في هذه الرسالة الإلكترونية والمرفقات الخاصة بها سرية وقد تكون محمية بموجب القانون. إذا لم تكن الشخص المعني باستلام هذه الرسالة، فيرجى إخطار المرسل وحذف هذه الرسالة فوراً.
<br><br>
<strong>Disclaimer:</strong> The information contained and transmitted within this email message is PRIVILEGED AND/OR CONFIDENTIAL. If you are not the intended recipient, please notify the sender and delete this email immediately.
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>`, resetURL, resetURL)
// Create the email message
message := &mailer.Message{
@ -937,6 +937,7 @@ func main() {
Dataset string `json:"dataset"`
KPI string `json:"kpi"`
Language string `json:"language"`
ColorMode string `json:"color_mode"`
FilterData []utils.Filter `json:"filter_data"`
}
@ -955,6 +956,7 @@ func main() {
dataset := requestData.Dataset
language := requestData.Language
langKey := "value_" + language
colorMode := requestData.ColorMode
// Fetch all matching records from charts table
param := dbx.NewExp("dataset = {:dataset}", dbx.Params{"dataset": dataset})
@ -1225,10 +1227,13 @@ func main() {
BorderColor string `db:"border_color" json:"border_color"`
}{}
header_color := "header_color_" + colorMode
body_color := "body_color_" + colorMode
border_color := "border_color_" + colorMode
data_set_tile_heading := "data_set_tile_heading_" + language
main_topic := "main_topic_" + language
sub_topic := "sub_topic_" + language
query := ` SELECT id,data_set,` + data_set_tile_heading + ` AS data_set_tile_heading,` + main_topic + ` AS main_topic,` + sub_topic + ` AS sub_topic,header_color,body_color,border_color FROM uae_numbers_screen WHERE data_set = {:data_set} `
query := ` SELECT id,data_set,` + data_set_tile_heading + ` AS data_set_tile_heading,` + main_topic + ` AS main_topic,` + sub_topic + ` AS sub_topic, ` + header_color + ` AS header_color,` + body_color + ` AS body_color, ` + border_color + ` AS border_color FROM uae_numbers_screen WHERE data_set = {:data_set} `
err = app.DB().NewQuery(query).Bind(dbx.Params{"data_set": dataset}).One(&headingAndColor)
if err != nil {
log.Printf("Failed to fetch data-set for sub topic %s: %v", dataset, err)
@ -1254,6 +1259,10 @@ func main() {
e.Router.GET("/api/getHomePageData", func(c echo.Context) error {
language := c.QueryParam("language")
colorMode := c.QueryParam("color_mode")
// Determine the column name dynamically
colorPatternColumn := "color_pattern_" + colorMode
// Define the struct for holding the query results
mainTopics := []struct {
@ -1264,12 +1273,25 @@ func main() {
}{}
// Execute the query
err := app.DB().
Select("main_topic_en", "main_topic_ar", "main_topic_list_order", "color_pattern").
From("home_screen").
GroupBy("main_topic_en", "main_topic_ar", "color_pattern").
OrderBy("main_topic_list_order ASC").
All(&mainTopics)
query := fmt.Sprintf(`
SELECT
main_topic_en,
main_topic_ar,
main_topic_list_order,
%s AS color_pattern
FROM home_screen
GROUP BY main_topic_en, main_topic_ar, main_topic_list_order, %s
ORDER BY main_topic_list_order ASC
`, colorPatternColumn, colorPatternColumn)
err := app.DB().NewQuery(query).All(&mainTopics)
// err := app.DB().
// Select("main_topic_en", "main_topic_ar", "main_topic_list_order", "color_pattern").
// From("home_screen").
// GroupBy("main_topic_en", "main_topic_ar", "color_pattern").
// OrderBy("main_topic_list_order ASC").
// All(&mainTopics)
if err != nil {
log.Printf("Failed to fetch home_screen data: %v", err)
@ -1333,6 +1355,10 @@ func main() {
e.Router.GET("/api/getUAENumbersData", func(c echo.Context) error {
language := c.QueryParam("language")
colorMode := c.QueryParam("color_mode")
// Determine the column name dynamically
colorPatternColumn := "color_pattern_" + colorMode
// Define the struct for holding the query results
mainTopics := []struct {
@ -1343,12 +1369,27 @@ func main() {
}{}
// Execute the query
err := app.DB().
Select("main_topic_en", "main_topic_ar", "main_topic_list_order", "color_pattern").
From("uae_numbers_screen").
GroupBy("main_topic_en", "main_topic_ar", "color_pattern").
OrderBy("main_topic_list_order ASC").
All(&mainTopics)
// Execute the query
query := fmt.Sprintf(`
SELECT
main_topic_en,
main_topic_ar,
main_topic_list_order,
%s AS color_pattern
FROM uae_numbers_screen
GROUP BY main_topic_en, main_topic_ar, %s
ORDER BY main_topic_list_order ASC
`, colorPatternColumn, colorPatternColumn)
err := app.DB().NewQuery(query).All(&mainTopics)
// err := app.DB().
// Select("main_topic_en", "main_topic_ar", "main_topic_list_order", "color_pattern").
// From("uae_numbers_screen").
// GroupBy("main_topic_en", "main_topic_ar", "color_pattern").
// OrderBy("main_topic_list_order ASC").
// All(&mainTopics)
if err != nil {
log.Printf("Failed to fetch uae_numbers_screen data: %v", err)
@ -1460,6 +1501,7 @@ func main() {
language := c.QueryParam("language")
user_id := c.QueryParam("user_id")
colorMode := c.QueryParam("color_mode")
// Define the struct for holding the query results
bookmarks := []struct {
@ -1503,7 +1545,8 @@ func main() {
data_set_tile_heading := "data_set_tile_heading_" + language
main_topic := "main_topic_" + language
sub_topic := "sub_topic_" + language
query := ` SELECT id,data_set,` + data_set_tile_heading + ` AS data_set_tile_heading,` + main_topic + ` AS main_topic,` + sub_topic + ` AS sub_topic,color_pattern,value_source,value FROM uae_numbers_screen WHERE data_set = {:bookmark} `
color_pattern := "color_pattern_" + colorMode
query := ` SELECT id,data_set,` + data_set_tile_heading + ` AS data_set_tile_heading,` + main_topic + ` AS main_topic,` + sub_topic + ` AS sub_topic,` + color_pattern + ` AS color_pattern,value_source,value FROM uae_numbers_screen WHERE data_set = {:bookmark} `
err := app.DB().
NewQuery(query).
Bind(dbx.Params{

Binary file not shown.

Binary file not shown.