Skip to content

Commit e9c7a01

Browse files
authored
Merge pull request #22 from sagelga/documentation
Documentation
2 parents 2d97cc9 + 8c2374d commit e9c7a01

File tree

24 files changed

+643
-48
lines changed

24 files changed

+643
-48
lines changed

docs/.vuepress/config.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,35 @@ module.exports = {
7777
path: '/approval-workflow/docs/develop/',
7878
children: [
7979
'docs/develop/',
80-
'docs/develop/configuration/',
81-
'docs/develop/module/',
80+
{
81+
title: 'Configuration',
82+
path: '/approval-workflow/docs/develop/config/',
83+
children: [
84+
'docs/develop/config/config/',
85+
'docs/develop/config/response/',
86+
],
87+
},
88+
{
89+
title: 'Module',
90+
path: '/approval-workflow/docs/develop/module/',
91+
children: [
92+
'docs/develop/module/main/',
93+
'docs/develop/module/functions/',
94+
'docs/develop/module/utility/',
95+
'docs/develop/module/sheets/',
96+
'docs/develop/module/sheetsInbound/',
97+
'docs/develop/module/email/',
98+
'docs/develop/module/email-function/',
99+
],
100+
},
82101
],
83102
},
84103
{
85104
title: 'Maintain',
86105
path: '/approval-workflow/docs/maintain/',
87106
children: [
88107
'docs/maintain/issues/',
108+
'docs/maintain/constraints/',
89109
],
90110
},
91111
]

docs/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ This is a homepage for documentation. Select your preferred documentation page h
99

1010
## Approval Workflow
1111
[approval-workflow](approval-workflow)
12+
13+
## Point of Sales (compro-project)
14+
[compro-project](compro-project)
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
# Develop
1+
# Getting Started
22
This is the documentation for developers to develop or edit my script. There will be sections below to choose from, range from editing the configurations to changing the workflow.
33

44
## Configuring
5-
- [Configuring CONFIG file]()
6-
5+
- [Configuring Script Overalls (CONFIG file)](./config/config/)
6+
- [Configuring Responses (Response)](./config/response/)
77

88
## Create-your-own approval workflow
9+
- [General Flow (Main module)](./module/main)
10+
- [Support Functions (Functions module)](./module/functions/)
11+
- [Data Conversion Functions (Utility module)](./module/utility/)
12+
- [Sending Emails (Email module)](./module/email/)
13+
- [Composing Emails (Email-function module)](./module/email-function/)
14+
- [Data Retrieval + Storage (sheet module)](./module/sheets/)
15+
- [Approval Response Data Retrieval + Storage (inboundSheet module)](./module/sheetsInbound/)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Configuration
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Response Object
2+
3+
``` javascript
4+
var response = {
5+
step1: {
6+
status: {
7+
value: null,
8+
cell: columnToLetter(getColumnNumber('Step 1 Status', {
9+
rowNumber: 1,
10+
sheetObject: sheet
11+
})) + i
12+
},
13+
timestamp: {
14+
value: null,
15+
cell: columnToLetter(getColumnNumber('Step 1 Timestamp', {
16+
rowNumber: 1,
17+
sheetObject: sheet
18+
})) + i
19+
},
20+
comments: {
21+
value: null,
22+
cell: columnToLetter(getColumnNumber('Step 1 Comments', {
23+
rowNumber: 1,
24+
sheetObject: sheet
25+
})) + i
26+
},
27+
formUrl: {
28+
value: null,
29+
cell: columnToLetter(getColumnNumber('Step 1 Response Form URL', {
30+
rowNumber: 1,
31+
sheetObject: sheet
32+
})) + i
33+
},
34+
email: {
35+
value: null,
36+
cell: columnToLetter(getColumnNumber("User's manager email address", {
37+
rowNumber: 1,
38+
sheetObject: sheet
39+
})) + i
40+
}
41+
},
42+
step2: {
43+
status: {
44+
value: null,
45+
cell: columnToLetter(getColumnNumber('Step 2 Status', {
46+
rowNumber: 1,
47+
sheetObject: sheet
48+
})) + i
49+
},
50+
timestamp: {
51+
value: null,
52+
cell: columnToLetter(getColumnNumber('Step 2 Timestamp', {
53+
rowNumber: 1,
54+
sheetObject: sheet
55+
})) + i
56+
},
57+
comments: {
58+
value: null,
59+
cell: columnToLetter(getColumnNumber('Step 2 Comments', {
60+
rowNumber: 1,
61+
sheetObject: sheet
62+
})) + i
63+
},
64+
formUrl: {
65+
value: null,
66+
cell: columnToLetter(getColumnNumber('Step 2 Response Form URL', {
67+
rowNumber: 1,
68+
sheetObject: sheet
69+
})) + i
70+
},
71+
email: {
72+
value: CONFIG.email.step2.email,
73+
cell: null
74+
}
75+
},
76+
step3: {
77+
status: {
78+
value: null,
79+
cell: null
80+
},
81+
timestamp: {
82+
value: null,
83+
cell: null
84+
},
85+
comments: {
86+
value: null,
87+
cell: null
88+
},
89+
formUrl: {
90+
value: null,
91+
cell: null
92+
},
93+
email: {
94+
value: CONFIG.email.step3.email,
95+
cell: null
96+
}
97+
},
98+
payloads: {
99+
id: {
100+
value: null,
101+
cell: columnToLetter(getColumnNumber('Response ID', {
102+
rowNumber: 1,
103+
sheetObject: sheet
104+
})) + i
105+
},
106+
skipRow: {
107+
value: null,
108+
cell: columnToLetter(getColumnNumber('Skips Override', {
109+
rowNumber: 1,
110+
sheetObject: sheet
111+
})) + i
112+
},
113+
email: {
114+
value: null,
115+
cell: columnToLetter(getColumnNumber('Email Address', {
116+
rowNumber: 1,
117+
sheetObject: sheet
118+
})) + i
119+
},
120+
requestType: {
121+
value: null,
122+
cell: columnToLetter(getColumnNumber('Request Type', {
123+
rowNumber: 1,
124+
sheetObject: sheet
125+
})) + i
126+
},
127+
timestamp: {
128+
value: null,
129+
cell: columnToLetter(getColumnNumber('Timestamp', {
130+
rowNumber: 1,
131+
sheetObject: sheet
132+
})) + i
133+
},
134+
requestTimeout: null,
135+
bodyField: null,
136+
rowNumber: i
137+
}
138+
}
139+
```
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
11
# Email Function Module
2+
## `getSubjectField()`
3+
Generates the subject field for the email sending procedure.
4+
Retrieves the information about the subject format from the `config` file,
5+
as they are composed from the `prefix` and `suffix` of each type of request.
6+
7+
Retrieves the `response ID` and `request type` from the `response` object.
8+
9+
```js
10+
getSubjectField(response: {}, args: {prefix: String, suffix: String})
11+
```
12+
13+
### Input
14+
| Attribute | Type | Description |
15+
| ----------- | -------- | --------------------------------------- |
16+
| response | `{}` | a response that will email will send to |
17+
| args | `{}` | |
18+
| args.prefix | `String` | Prefix for Subject Field |
19+
| args.suffix | `String` | Suffix for Subject Field |
20+
21+
## `getBodyField()`
22+
Retrieves the body (response information) from the sheet to compose an email body in the table format, then store the calculated body field to the response object.
23+
24+
```js
25+
getBodyField(rowNumber: Number)
26+
```
27+
28+
### Input
29+
| Attribute | Type | Description |
30+
| --------- | -------- | ---------------------------------------------- |
31+
| rowNumber | `Number` | row number that it will retrieve the data from |
32+
33+
### Output
34+
| Attribute | Type | Description |
35+
| --------- | -------- | ----------------------------------- |
36+
| body | `String` | body of the email, in a HTML format |
37+
38+
## `sendEmails()`
39+
Send emails to the given recipient.
40+
41+
This script is using `MailApp` object, which is 100% on Google Apps Script.
42+
43+
User that runs the script is the 'send from' .
44+
In the production, you should have another email address space to run this script and they are the one sending emails.
45+
46+
```js
47+
sendEmails(toAddress: String | Array, subject: String, body: String)
48+
```
49+
50+
### Input
51+
| Attribute | Type | Description |
52+
| --------- | ---------------- | ------------------------------------------ |
53+
| toAddress | `String | Array` | email address that this email will send to |
54+
| subject | `String` | subject of the email |
55+
| body | `String` | body of the email |
56+
57+
### Output
58+
| Attribute | Type | Description |
59+
| --------- | -------- | ----------------------------------- |
60+
| body | `String` | body of the email, in a HTML format |
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,88 @@
11
# Email Module
2+
## `sendRecieptEmail()`
3+
Function compose the emails, based on the setting of the email design.
4+
This function creates a receipt email (copy of the response) to the responder.
5+
6+
By pulling the data from the `response.payloads.email.value` as the email address.
7+
8+
```js
9+
sendRecieptEmail(response)
10+
```
11+
12+
### Input
13+
| Attribute | Type | Description |
14+
| --------- | ---- | --------------------------------------- |
15+
| response | `{}` | a response that will email will send to |
16+
17+
## `stepOneApprovalEmail()`
18+
Function compose the emails, based on the setting of the email design.
19+
This function sends request for approval email to the first responder (step 1)
20+
21+
By pulling the data from the `response.step1.email.value` as the email address.
22+
23+
```js
24+
stepOneApprovalEmail(response: {})
25+
```
26+
27+
### Input
28+
| Attribute | Type | Description |
29+
| --------- | ---- | --------------------------------------- |
30+
| response | `{}` | a response that will email will send to |
31+
32+
## `stepTwoApprovalEmail()`
33+
Function compose the emails, based on the setting of the email design.
34+
This function sends to 'request for approval' to step 2 responder.
35+
36+
By pulling the data from the `response.step2.email.value` as the email address.
37+
38+
```js
39+
stepTwoApprovalEmail(response: {})
40+
```
41+
42+
### Input
43+
| Attribute | Type | Description |
44+
| --------- | ---- | --------------------------------------- |
45+
| response | `{}` | a response that will email will send to |
46+
47+
## `sendFinalEmail()`
48+
Function compose the emails, based on the setting of the email design.
49+
This function sends the confirmation email to MDM after step 1 and step2 has approved the request.
50+
51+
By pulling the data from the `response.step3.email.value` as the email address.
52+
53+
```js
54+
sendFinalEmail(response: {})
55+
```
56+
57+
### Input
58+
| Attribute | Type | Description |
59+
| --------- | ---- | --------------------------------------- |
60+
| response | `{}` | a response that will email will send to |
61+
62+
## `stepOneRejectEmail()`
63+
Function compose the emails, based on the setting of the email design.
64+
This function notifies the requester that their following manager rejects the request.
65+
66+
By pulling the data from the `response.payloads.email.value` as the email address.
67+
68+
```js
69+
stepOneRejectEmail(response: {})
70+
```
71+
72+
### Input
73+
| Attribute | Type | Description |
74+
| --------- | ---- | --------------------------------------- |
75+
| response | `{}` | a response that will email will send to |
76+
77+
## `stepTwoRejectEmail()`
78+
Function compose the emails, based on the setting of the email design.
79+
By pulling the data from the `response.payloads.email.value` AND `response.step2.email.value` as the email address.
80+
81+
```js
82+
stepTwoRejectEmail(response: {})
83+
```
84+
85+
### Input
86+
| Attribute | Type | Description |
87+
| --------- | ---- | --------------------------------------- |
88+
| response | `{}` | a response that will email will send to |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
11
# Functions Module
2+
## `createMandatoryColumn()`
3+
Create a column that is required for the system to run normally by calling createNewColumn() function with specified arguments.
4+
5+
## `padLeadingZero()`
6+
Add a leading (front) zero to the string, until the length of the requirement (defined by padLength parameter) is matched.
7+
8+
## `generateHashCode()`
9+
A hash function that's for checking the data correction.
10+
Note: Hash Function is a one-way function. A same input will results in same output.
11+
12+
## `generateId()`
13+
Generate a Response ID, based on the timestamp of that response.
14+
ID is consisted of YYYYMMXXXX, in which XXXX is a auto increment number.

docs/approval-workflow/docs/develop/module/inbound-sheet/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
11
# Main Module
2+
3+
## `onOpen()`
4+
**Triggers automatically** after the host containers (sheet that this script hosted in) open.
5+
It will opens the menu in the Google Sheets UI for manual operations.
6+
7+
In `functionName` key, there will be a function name labeled with `name` key.
8+
`name` will be shown in the menu UI, and it will triggers `functionName`.
9+
10+
## `approveProcess()`
11+
Starts the `approveResponse()` multiple times (as the first row of response to the last row of sheet).
12+
That makes sure that every line has been run once.
13+
14+
Editing this function to run multiple times (currently running once) makes the script to updates the approval status and then proceeds the process by sending emails or mark to skip.
15+
16+
## `approveResponse(rowNumber: Number)`
17+
A core process of the script. As it reads the information from the sheet and redistribute it throughout the script's function.
18+
19+
This function runs only a single row.
20+
21+
## `sheetPreparation()`
22+
Script built for checking whether the system-required column is there or not. Not to be confused with fixing the missing column.
23+
If they are not available, alert UI will be triggered, and show the value of the missing column.
24+
25+
This function should be executed in a `standalone` trigger mode (as it requires UI to show the response). To trigger a standalone execution, please read the other documentation page for more information.

0 commit comments

Comments
 (0)