zet-lib 1.2.60 → 1.2.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/zAppRouter.js +1 -1
- package/lib/zRoleRouter.js +3 -2
- package/lib/zRoute.js +4 -2
- package/lib/zdataTable.js +8 -4
- package/package.json +1 -1
package/lib/zAppRouter.js
CHANGED
|
@@ -1360,7 +1360,7 @@ router.post('/zapproval-update/:table', async (req, res) => {
|
|
|
1360
1360
|
let approval_history = result.approval_history || []
|
|
1361
1361
|
if (approval_status == null) {
|
|
1362
1362
|
canUpdate = true
|
|
1363
|
-
} else if (approval_status ==
|
|
1363
|
+
} else if (approval_status == 22) {
|
|
1364
1364
|
canUpdate = true
|
|
1365
1365
|
} else {
|
|
1366
1366
|
if (+value > +approval_status) {
|
package/lib/zRoleRouter.js
CHANGED
|
@@ -209,11 +209,12 @@ router.post('/approval-access', async (req, res) => {
|
|
|
209
209
|
html += `<form id="approvalform">`
|
|
210
210
|
html += `<table class="table table-hover"><thead><tr><th>Name </th><th>Level <input type="checkbox" onclick="tabApprovals(this)" id="checkapprovals" /></th></tr></thead><tbody></tbody>`
|
|
211
211
|
results.map((item) => {
|
|
212
|
-
|
|
212
|
+
if (item.id != 1) {
|
|
213
|
+
html += `<tr>
|
|
213
214
|
<td>${item.name}</td>
|
|
214
215
|
<td><input type="checkbox" class="checkapproval" name="approval_${item.id}" ${checkedFn(myapprovalsRole, item.id)} /></td>
|
|
215
|
-
|
|
216
216
|
</tr>`
|
|
217
|
+
}
|
|
217
218
|
})
|
|
218
219
|
html += `</tbody></table>`
|
|
219
220
|
html += `</form>`
|
package/lib/zRoute.js
CHANGED
|
@@ -3639,19 +3639,21 @@ zRoute.import = async (req, res, MYMODEL) => {
|
|
|
3639
3639
|
columnCut++
|
|
3640
3640
|
}
|
|
3641
3641
|
try {
|
|
3642
|
+
delete data.lock
|
|
3643
|
+
delete data.approval_status
|
|
3644
|
+
delete data.approval_history
|
|
3642
3645
|
if (isInsert) {
|
|
3643
3646
|
if (Util.in_array('company_id', fields)) data.company_id = res.locals.companyId
|
|
3644
3647
|
if (Util.in_array('created_at', fields)) data.created_at = Util.now()
|
|
3645
3648
|
if (Util.in_array('created_by', fields)) data.created_by = res.locals.userId
|
|
3646
3649
|
if (Util.in_array('updated_at', fields)) data.updated_at = Util.now()
|
|
3647
3650
|
if (Util.in_array('updated_by', fields)) data.updated_by = res.locals.userId
|
|
3648
|
-
|
|
3651
|
+
|
|
3649
3652
|
await connection.insert({ table: MYMODEL.table, data: data })
|
|
3650
3653
|
hd += `<td class='text text-success'>${LANGUAGE['success']}</td>`
|
|
3651
3654
|
} else {
|
|
3652
3655
|
if (Util.in_array('updated_at', fields)) data.updated_at = Util.now()
|
|
3653
3656
|
if (Util.in_array('updated_by', fields)) data.updated_by = res.locals.userId
|
|
3654
|
-
delete data.lock
|
|
3655
3657
|
//check data is lock
|
|
3656
3658
|
let mydatas = await connection.result({
|
|
3657
3659
|
select: 'id,lock',
|
package/lib/zdataTable.js
CHANGED
|
@@ -194,17 +194,21 @@ class dataTable {
|
|
|
194
194
|
if (this.hasLevels) {
|
|
195
195
|
//modal-body-approval
|
|
196
196
|
let APPROVAL_LEVELS = myCache.get('APPROVAL_LEVELS')
|
|
197
|
+
console.log(APPROVAL_LEVELS)
|
|
197
198
|
let approvalButtonHtml = ``
|
|
198
199
|
for (let item in this.level_approval) {
|
|
200
|
+
console.log(item)
|
|
199
201
|
let imageapproval = 'brand-bunpo'
|
|
200
|
-
if (item ==
|
|
202
|
+
if (item == 22) {
|
|
201
203
|
imageapproval = 'rubber-stamp-off'
|
|
202
|
-
} else if (item ==
|
|
204
|
+
} else if (item == 2) {
|
|
203
205
|
imageapproval = 'list-check'
|
|
204
|
-
} else if (item ==
|
|
206
|
+
} else if (item == 21) {
|
|
205
207
|
imageapproval = 'rubber-stamp'
|
|
206
208
|
}
|
|
207
|
-
|
|
209
|
+
let name = APPROVAL_LEVELS.hasOwnProperty(item) ? APPROVAL_LEVELS[item].name : ''
|
|
210
|
+
let color = APPROVAL_LEVELS.hasOwnProperty(item) ? APPROVAL_LEVELS[item].color : ''
|
|
211
|
+
approvalButtonHtml += ` <button title="${name}" data-value="${item}" style="background-color: ${color}; color:white" class="btn btn-approval-levels boxy-small dimens2x image-button mb-3" type="button"><img src="/assets/icons/${imageapproval}.svg" class="icons-bg-white"> ${name}</button> `
|
|
208
212
|
}
|
|
209
213
|
approvalButtonHtml += `<div class="row"><div class="col-md-10"><textarea class="form-control boxy purple-border" id="zapproval_message" placeholder="tulis alasan..." rows="2"></textarea></div><div class="col-md-1"></div></div>`
|
|
210
214
|
|