generated from PackagrIO/goweb-template
-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding ability to submit support tickets in-app.
added logos to the patient profile menu added link to fundraising doc in-app update fontawesome version. fixes #272
- Loading branch information
Showing
10 changed files
with
289 additions
and
9 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package models | ||
|
||
type SupportRequest struct { | ||
FullName string `json:"full_name"` | ||
Email string `json:"email"` | ||
RequestContent string `json:"request_content"` | ||
|
||
CurrentPage string `json:"current_page"` | ||
DistType string `json:"dist_type"` | ||
Version string `json:"version"` | ||
Flavor string `json:"flavor"` | ||
Os string `json:"os"` | ||
Arch string `json:"arch"` | ||
} |
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,58 @@ | ||
package handler | ||
|
||
import ( | ||
"fmt" | ||
"github.com/fastenhealth/fasten-onprem/backend/pkg/models" | ||
"github.com/gin-gonic/gin" | ||
"io/ioutil" | ||
"net/http" | ||
"net/url" | ||
) | ||
|
||
func SupportRequest(c *gin.Context) { | ||
|
||
var supportRequest models.SupportRequest | ||
if err := c.ShouldBindJSON(&supportRequest); err != nil { | ||
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()}) | ||
return | ||
} | ||
|
||
//submit support request to Google Form | ||
//https://medium.com/front-end-augustus-study-notes/custom-google-form-en-f7be4c27a98b | ||
|
||
//source: https://docs.google.com/forms/d/e/1FAIpQLSfFxttuzE4mYNtQxa2XxsHw3uyNsxUzE-BeYF4JXxoKku3R5A/viewform | ||
formUrl := "https://docs.google.com/forms/u/0/d/e/1FAIpQLSfFxttuzE4mYNtQxa2XxsHw3uyNsxUzE-BeYF4JXxoKku3R5A/formResponse" | ||
|
||
supportRequestResponse, err := http.PostForm(formUrl, url.Values{ | ||
"entry.1688458216": {supportRequest.FullName}, | ||
"entry.153181769": {supportRequest.Email}, | ||
"entry.1194157548": {supportRequest.RequestContent}, | ||
"entry.108410483": {supportRequest.CurrentPage}, | ||
"entry.1640090028": {supportRequest.DistType}, | ||
"entry.882116507": {supportRequest.Flavor}, | ||
"entry.1331679697": {supportRequest.Version}, | ||
"entry.164864077": {supportRequest.Arch}, | ||
"entry.1469583108": {supportRequest.Os}, | ||
}) | ||
if err != nil { | ||
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()}) | ||
return | ||
} | ||
|
||
defer supportRequestResponse.Body.Close() | ||
body, err := ioutil.ReadAll(supportRequestResponse.Body) | ||
|
||
if err != nil { | ||
//handle read response error | ||
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()}) | ||
return | ||
} else if supportRequestResponse.StatusCode != 200 { | ||
//handle non 200 response | ||
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": fmt.Sprintf("status code error: %d %s", supportRequestResponse.StatusCode, supportRequestResponse.Status)}) | ||
return | ||
} | ||
|
||
fmt.Printf("%s\n", string(body)) | ||
|
||
c.JSON(http.StatusOK, gin.H{"success": true}) | ||
} |
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
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,13 @@ | ||
|
||
export class SupportRequest { | ||
full_name: string | ||
email: string | ||
request_content: string | ||
|
||
current_page: string | ||
dist_type: 'desktop' | 'docker' | 'cloud' | ||
flavor: string | ||
version: string | ||
arch: string | ||
os: string | ||
} |
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