zet-lib 1.2.84 → 1.2.86

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 CHANGED
@@ -1593,7 +1593,18 @@ router.post('/zhistory-data', async (req, res) => {
1593
1593
  order_by: ['id asc'],
1594
1594
  })
1595
1595
  if (results.length > 0) {
1596
- let users = myCache.get('users')
1596
+ let users = {}
1597
+ if (myCache.has('users')) {
1598
+ users = myCache.get('users')
1599
+ } else {
1600
+ users = Util.arrayToObject(
1601
+ await connection.results({
1602
+ table: 'zuser',
1603
+ }),
1604
+ 'id'
1605
+ )
1606
+ myCache.set('users', users)
1607
+ }
1597
1608
  html = await zRoute.history(req, res, relations, id, MYMODEL, users, results)
1598
1609
  }
1599
1610
  res.json(html)
package/lib/zRoute.js CHANGED
@@ -2592,12 +2592,12 @@ zRoute.viewFormsSync = async (req, res, MYMODEL, data = {}) => {
2592
2592
  </div>
2593
2593
  </div>
2594
2594
 
2595
- <span class="icon-small icons-primary" title="History" style="position: fixed;bottom: 10px;left: 400px" data-bs-toggle="modal" data-bs-target="#modal-history"><img class="icons-bg-white icon-image-large" src="/assets/icons/history.svg"></span>
2595
+ <div class="ps-lg-4 my-5 text-lg-start col-lg-3 mb-3 float-end divhistory"><button title="History" class="btn btn-success image-button btn-rounded dimens2x" style="position: fixed;bottom: 100px;right: -40px; transform: rotate(90deg);" data-bs-toggle="modal" data-bs-target="#modal-history"><img src="/assets/icons/history.svg" class="icons-bg-white" alt="Delete"> <span>History Data</span></button></div>
2596
2596
  `
2597
2597
 
2598
2598
  moduleLib.slugHTML(req, res, contentModal)
2599
2599
  let contentScript = `$(function(){
2600
- ajaxPost("/zhistory-data",{id:${data.id},table:"${MYMODEL.table}"},(data) => {$("#modal-body-history").html(data)});
2600
+ ajaxPost("/zhistory-data",{id:${data.id},table:"${MYMODEL.table}"},(data) => {$("#modal-body-history").html(data); if(data == "") {$(".divhistory").remove()}});
2601
2601
  $("#${MYMODEL.table}-delete").on("click", (() => {
2602
2602
  window.confirm("Sure to remove data ?") && ajaxDelete("/${MYMODEL.table}/delete", {id: "${data.id}"}, (function (e) {
2603
2603
  toastrForm(e), 1 == e.status && (location.href = "/${MYMODEL.table}")
@@ -4357,7 +4357,7 @@ zRoute.history = async (req, res, relations, id, MYMODEL, users, results = []) =
4357
4357
  arrDataAttributes.push({
4358
4358
  date1: result.data_1_date,
4359
4359
  date2: result.data_2_date,
4360
- by1: result.data_1.created_by,
4360
+ by1: result.data_1.updated_by,
4361
4361
  by2: result.created_by,
4362
4362
  })
4363
4363
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "1.2.84",
3
+ "version": "1.2.86",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"