odant-work 1.0.61 → 1.0.63

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.
Files changed (161) hide show
  1. package/#system/package-manifest.json +139 -106
  2. package/$server/$folder/$class/$structure/handlers/pages/form/gantt/$handler/class.js +27 -0
  3. package/$server/$folder/$class/$structure/handlers/pages/form/gantt/$handler/gantt.js +293 -0
  4. package/$server/$folder/$class/$structure/handlers/pages/form/scheduler/$handler/class.js +27 -0
  5. package/$server/$folder/$class/$structure/handlers/pages/form/scheduler/$handler/scheduler.js +234 -0
  6. package/$server/$folder/$class/$structure/handlers/pages/form/staff/$handler/staff.js +119 -0
  7. package/$server/$folder/lib/explorer/explorer.js +29 -0
  8. package/MODULES/Geo/$module/readme.md +6 -4
  9. package/MODULES/Geo//320/223/320/265/320/276/321/202/320/276/321/207/320/272/320/270/$catalog/class.js +9 -3
  10. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/class.js +10 -0
  11. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/class.js +21 -0
  12. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/map.js +623 -0
  13. package/MODULES/Geo//320/232/320/276/320/276/321/200/320/264/320/270/320/275/320/260/321/202/321/213/$struct/class.js +1 -0
  14. package/MODULES/Geo//320/250/320/265/320/271/320/277/$struct/class.js +17 -0
  15. package/MODULES/KLADR/$module/$folder/$class/$catalog/class.js +9 -0
  16. package/MODULES/KLADR/$module/class.js +4 -0
  17. package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/class.js +7 -0
  18. package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/kladr.js +134 -0
  19. package/MODULES/KLADR/$module/readme.md +10 -0
  20. package/MODULES/KLADR//320/235/320/260/321/201/320/265/320/273/321/221/320/275/320/275/321/213/320/265 /320/277/321/203/320/275/320/272/321/202/321/213/$catalog/class.js" +14 -0
  21. package/MODULES/KLADR//320/237/320/276/320/264/321/200/320/260/320/267/320/264/320/265/320/273/320/265/320/275/320/270/321/217 /320/234/320/222/320/224/$catalog/class.js" +13 -0
  22. package/MODULES/KLADR//320/240/320/265/320/263/320/270/320/276/320/275/321/213/$catalog/class.js +14 -0
  23. package/MODULES/KLADR//320/243/320/273/320/270/321/206/321/213/$catalog/class.js +13 -0
  24. package/MODULES/Process/$module/$folder/$class/$catalog/class.js +4 -0
  25. package/MODULES/Process/$module/class.js +4 -0
  26. package/MODULES/Process/$module/readme.md +7 -0
  27. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/class.js" +29 -0
  28. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/class.js" +7 -0
  29. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/gantt.js" +1 -0
  30. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/class.js" +7 -0
  31. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/scheduler.js" +1 -0
  32. package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/class.js" +18 -0
  33. package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/bpmn.js" +406 -0
  34. package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/class.js" +19 -0
  35. package/MODULES/Register/$module/readme.md +3 -3
  36. package/MODULES/Register/CATALOGS/$catalog/class.js +1 -6
  37. package/MODULES/Register/CATALOGS/$catalog/readme.md +1 -1
  38. package/MODULES/Register/CATALOGS//320/222/320/270/320/264/321/213 /320/275/320/276/321/200/320/274/320/260/321/202/320/270/320/262/320/276/320/262/$catalog/class.js" +11 -4
  39. package/MODULES/Register/CATALOGS//320/224/320/276/320/263/320/276/320/262/320/276/321/200/321/213/$catalog/class.js +21 -19
  40. package/MODULES/Register/CATALOGS//320/224/320/276/320/273/320/266/320/275/320/276/321/201/321/202/320/270/$catalog/class.js +1 -1
  41. package/MODULES/Register/CATALOGS//320/232/320/273/320/270/320/265/320/275/321/202/321/213/$virtual/class.js +11 -10
  42. package/MODULES/Register/CATALOGS//320/235/320/276/320/274/320/265/320/275/320/272/320/273/320/260/321/202/321/203/321/200/320/260/$catalog/class.js +24 -13
  43. package/MODULES/Register/CATALOGS//320/237/320/260/321/200/321/202/320/270/320/270/$catalog/class.js +13 -13
  44. package/MODULES/Register/CATALOGS//320/237/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/320/270/$virtual/class.js +9 -8
  45. package/MODULES/Register/CATALOGS//320/241/320/272/320/273/320/260/320/264/321/213/$catalog/class.js +17 -0
  46. package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/class.js +11 -9
  47. package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270//320/222 /320/276/321/202/320/277/321/203/321/201/320/272/320/265/$virtual/class.js" +1 -1
  48. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/class.js +13 -11
  49. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/230/320/237/$catalog/class.js +4 -6
  50. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/244/320/270/320/267. /320/273/320/270/321/206/320/260/$catalog/class.js" +12 -11
  51. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/256/321/200. /320/273/320/270/321/206/320/260/$catalog/class.js" +15 -14
  52. package/MODULES/Register/CATALOGS//320/242/321/200/320/260/320/275/321/201/320/277/320/276/321/200/321/202/$catalog/class.js +19 -18
  53. package/MODULES/Register/OPERATIONS/$operation/class.js +1 -1
  54. package/MODULES/Register/OPERATIONS/$operation/readme.md +1 -1
  55. package/MODULES/Register/OPERATIONS//320/224/320/276/321/201/321/202/320/260/320/262/320/272/320/260/$operation/class.js +22 -21
  56. package/MODULES/Register/OPERATIONS//320/227/320/260/321/200/320/277/320/273/320/260/321/202/320/260/$operation/class.js +48 -47
  57. package/MODULES/Register/OPERATIONS//320/230/320/275/320/262/320/265/320/275/321/202/320/260/321/200/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js +46 -45
  58. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/class.js +1 -1
  59. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/236/321/202/320/277/321/200/320/260/320/262/320/270/321/202/321/214 /320/262 /320/276/321/202/320/277/321/203/321/201/320/272/$operation/class.js" +1 -1
  60. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213//320/237/321/200/320/270/321/221/320/274 /320/275/320/260 /321/200/320/260/320/261/320/276/321/202/321/203/$operation/class.js" +18 -14
  61. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/class.js +1 -1
  62. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/220/320/262/320/260/320/275/321/201/320/276/320/262/321/213/320/271 /320/276/321/202/321/207/321/221/321/202/$operation/class.js" +1 -1
  63. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/237/320/232/320/236/$operation/class.js +3 -3
  64. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260//320/240/320/232/320/236/$operation/class.js +1 -1
  65. package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/class.js +1 -1
  66. package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270//320/227/320/262/320/276/320/275/320/276/320/272/$operation/class.js +2 -2
  67. package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270//320/237/320/270/321/201/321/214/320/274/320/276/$operation/class.js +1 -1
  68. package/MODULES/Register/OPERATIONS//320/{244/320/260/321/201/320/276/320/262/320/272/320/260 → 232/320/276/320/274/320/277/320/273/320/265/320/272/321/202/320/260/321/206/320/270/321/217}/$operation/class.js +52 -57
  69. package/MODULES/Register/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/235/320/260/321/207/320/270/321/201/320/273/320/265/320/275/320/270/320/265 /320/260/320/274/320/276/321/200/321/202/320/270/320/267/320/260/321/206/320/270/320/270/$operation/class.js" +2 -2
  70. package/MODULES/Register/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/320/265 /320/236/320/241/$operation/class.js" +7 -6
  71. package/MODULES/Register/OPERATIONS//320/236/321/201/320/275/320/276/320/262/320/275/321/213/320/265 /321/201/321/200/320/265/320/264/321/201/321/202/320/262/320/260//320/237/321/200/320/270/320/275/321/217/321/202/320/270/320/265 /320/272 /321/203/321/207/321/221/321/202/321/203 /320/236/320/241/$operation/class.js" +2 -2
  72. package/MODULES/Register/OPERATIONS//320/237/320/265/321/200/320/265/320/274/320/265/321/211/320/265/320/275/320/270/320/265/$operation/class.js +41 -40
  73. package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/class.js" +1 -1
  74. package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/227/320/260/321/200/320/277/320/273/320/260/321/202/320/260/$operation/class.js" +1 -1
  75. package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260//320/237/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/321/203/$operation/class.js" +11 -10
  76. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/320/265 /321/202/320/276/320/262/320/260/321/200/320/260/$operation/class.js" +45 -46
  77. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/class.js" +1 -1
  78. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202//320/222/320/276/320/267/320/262/321/200/320/260/321/202 /320/276/321/202 /320/277/320/276/321/201/321/202/320/260/320/262/321/211/320/270/320/272/320/260/$operation/class.js" +11 -10
  79. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202//320/236/321/202 /320/277/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/217/$operation/class.js" +11 -10
  80. package/MODULES/Register/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276//320/222/321/213/320/277/321/203/321/201/320/272 /320/263/320/276/321/202/320/276/320/262/320/276/320/271 /320/277/321/200/320/276/320/264/321/203/320/272/321/206/320/270/320/270/$operation/class.js" +4 -4
  81. package/MODULES/Register/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276//320/237/320/265/321/200/320/265/320/264/320/260/321/207/320/260 /320/274/320/260/321/202/320/265/321/200/320/270/320/260/320/273/320/276/320/262 /320/262 /320/277/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276/$operation/class.js" +5 -4
  82. package/MODULES/Register/OPERATIONS//320/237/321/200/320/276/320/270/320/267/320/262/320/276/320/264/321/201/321/202/320/262/320/276//320/241/320/277/320/270/321/201/320/260/320/275/320/270/320/265 /320/276/320/261/321/211/320/265/321/205/320/276/320/267/321/217/320/271/321/201/321/202/320/262/320/265/320/275/320/275/321/213/321/205 /320/267/320/260/321/202/321/200/320/260/321/202/$operation/class.js" +6 -6
  83. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js +26 -25
  84. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/222/320/276/320/267/320/262/321/200/320/260/321/202 /320/276/321/202 /320/277/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/217/$operation/class.js" +32 -31
  85. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/class.js +32 -31
  86. package/MODULES/Register/OPERATIONS//320/241/320/277/320/270/321/201/320/260/320/275/320/270/320/265 /320/242/320/234/320/246/$operation/class.js" +28 -0
  87. package/MODULES/Register/OPERATIONS//320/243/321/201/321/202/320/260/320/275/320/276/320/262/320/272/320/260 /320/275/320/276/321/200/320/274/320/260/321/202/320/270/320/262/320/260/$operation/class.js" +3 -3
  88. package/MODULES/Register/OPERATIONS//320/244/320/270/320/275/320/260/320/275/321/201/320/276/320/262/321/213/320/271 /321/200/320/265/320/267/321/203/320/273/321/214/321/202/320/260/321/202//320/227/320/260/320/272/321/200/321/213/321/202/320/270/320/265 /320/274/320/265/321/201/321/217/321/206/320/260/$operation/class.js" +1 -1
  89. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/class.js +1 -1
  90. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/readme.md +1 -1
  91. package/MODULES/Register/REGISTER/$register/readme.md +1 -1
  92. package/MODULES/Register/REGISTER/01/$account/class.js +1 -1
  93. package/MODULES/Register/REGISTER/02/$account/class.js +1 -1
  94. package/MODULES/Register/REGISTER/04/$account/class.js +1 -1
  95. package/MODULES/Register/REGISTER/08/$account/class.js +1 -1
  96. package/MODULES/Register/REGISTER/10/$account/class.js +23 -1
  97. package/MODULES/Register/REGISTER/10/01/$account/class.js +1 -1
  98. package/MODULES/Register/REGISTER/10/05/$account/class.js +1 -1
  99. package/MODULES/Register/REGISTER/41/$account/class.js +25 -24
  100. package/MODULES/Register/REGISTER/43/$account/class.js +2 -2
  101. package/MODULES/Register/REGISTER/44/$account/class.js +1 -1
  102. package/MODULES/Register/REGISTER/60/$account/class.js +24 -15
  103. package/MODULES/Register/REGISTER/62/$account/class.js +24 -15
  104. package/MODULES/Register/REGISTER/67/$account/class.js +1 -0
  105. package/MODULES/Register/REGISTER/70/$account/class.js +1 -1
  106. package/MODULES/Register/REGISTER/71/$account/class.js +1 -1
  107. package/MODULES/Register/REGISTER/73/$account/class.js +1 -1
  108. package/MODULES/Register/REGISTER/76/$account/class.js +1 -1
  109. package/MODULES/Register/REGISTER/90/01/$account/class.js +1 -1
  110. package/MODULES/Register/REGISTER/90/02/$account/class.js +1 -1
  111. package/MODULES/Register/REGISTER/90/03/$account/class.js +1 -1
  112. package/MODULES/Register/REGISTER/91/$account/class.js +1 -1
  113. package/MODULES/Register/REGISTER/94/$account/class.js +24 -23
  114. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/class.js +1 -1
  115. package/MODULES/Register/REGISTER//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$account/class.js +1 -1
  116. package/MODULES/Register/REGISTER//320/235/320/276/321/200/320/274/320/260/321/202/320/270/320/262/321/213/$account/class.js +2 -2
  117. package/MODULES/Register/STRUCTS//320/220/320/264/321/200/320/265/321/201/$struct/class.js +14 -11
  118. package/MODULES/Register/STRUCTS//320/225/320/264/320/270/320/275/320/270/321/206/320/260 /320/270/320/267/320/274/320/265/321/200/320/265/320/275/320/270/321/217/$struct/class.js" +11 -11
  119. package/MODULES/Register/STRUCTS//320/237/320/260/321/201/320/277/320/276/321/200/321/202/$struct/class.js +14 -11
  120. package/MODULES/Register/STRUCTS//320/244/320/230/320/236/$struct/class.js +16 -0
  121. package/package.json +1 -1
  122. package/scripts/check-ignored-code.mjs +1 -1
  123. package/scripts/demo-seed.mjs +7 -5
  124. package/sources/client.js +6 -1
  125. package/sources/data/fio.js +355 -0
  126. package/sources/data/objects.js +11 -1
  127. package/sources/data/print.js +29 -3
  128. package/sources/data/schema.js +15 -4
  129. package/sources/host/auth-methods.js +34 -2
  130. package/sources/modules/kladr/index.js +336 -0
  131. package/sources/modules/user-profile/user-profile.js +40 -2
  132. package/sources/server/access/gateway.js +6 -0
  133. package/sources/server/access/invites.js +416 -0
  134. package/sources/server/class/base-template.js +94 -61
  135. package/sources/server/class.js +22 -0
  136. package/sources/server/folder.js +72 -6
  137. package/sources/work.js +29 -8
  138. package/$server/$folder/$class/ai/progress.md +0 -33
  139. package/$server/$folder/$file/$task/progress.md +0 -20
  140. package/$server/$folder/handlers/methods/create/progress.md +0 -15
  141. package/$server/$folder/lib/dot/progress.md +0 -15
  142. package/$server/$folder/lib/menu/progress.md +0 -13
  143. package/$server/$folder/lib/node/progress.md +0 -13
  144. package/$server/$folder/lib/prompt-bar/progress.md +0 -13
  145. package/$server/$folder/lib/tree/progress.md +0 -16
  146. package/.cursor/rules/work.mdc +0 -8
  147. package/.cursorrules +0 -2
  148. package/MODULES/Register/CATALOGS//320/241/320/272/320/273/320/260/320/264/321/213 /320/270 /321/200/320/265/320/267/320/265/321/200/320/262/321/203/320/260/321/200/321/213/$catalog/class.js" +0 -17
  149. package/MODULES/Register/OPERATIONS//320/225/321/201/321/202/320/265/321/201/321/202/320/262/320/265/320/275/320/275/320/260/321/217 /321/203/320/261/321/213/320/273/321/214/$operation/class.js" +0 -21
  150. package/NODES/teewtew/$node/class.js +0 -3
  151. package/NODES/work.odant.org/$node/class.js +0 -4
  152. package/config.json +0 -1
  153. package/eslint.config.js +0 -51
  154. package/jsconfig.json +0 -37
  155. package/oda/components/packets/progress.md +0 -29
  156. package/oda/progress.md +0 -29
  157. package/opencode.json +0 -9
  158. package/progress.md +0 -13
  159. package/publish.cmd +0 -2
  160. package/sources/data/progress.md +0 -787
  161. package/sources/host/progress.md +0 -14
@@ -1,23 +1,24 @@
1
- export default {
2
1
  label: '94 Недостачи и потери',
3
- icon: 'carbon:warning',
4
- METADATA: {
5
- FIELDS: [
6
- {
7
- id: 'item',
8
- label: 'Номенклатура',
9
- type: 'Link',
10
- target: '/MODULES/Register/CATALOGS/Номенклатура',
11
- analytic: true,
12
- required: true,
13
- },
14
- {
15
- id: 'storage',
16
- label: 'Склад',
17
- type: 'Link',
18
- target: '/MODULES/Register/CATALOGS/Склады и резервуары',
19
- analytic: true,
20
- required: true,
21
- },
22
- ],
23
- },
24
- }
2
+ export default {
3
+ label: '94 Недостачи и потери',
4
+ icon: 'carbon:warning',
5
+ METADATA: {
6
+ FIELDS: [
7
+ {
8
+ id: 'item',
9
+ label: 'Номенклатура',
10
+ type: 'link',
11
+ target: '/MODULES/Register/CATALOGS/Номенклатура',
12
+ analytic: true,
13
+ required: true,
14
+ },
15
+ {
16
+ id: 'storage',
17
+ label: 'Склад',
18
+ type: 'link',
19
+ target: '/MODULES/Register/CATALOGS/Склады',
20
+ analytic: true,
21
+ required: true,
22
+ },
23
+ ],
24
+ },
25
+ }
@@ -5,7 +5,7 @@ export default {
5
5
  label: 'Кадры',
6
6
  {
7
7
  id: 'person',
8
8
  label: 'Сотрудник',
9
- type: 'Link',
9
+ type: 'link',
10
10
  target: '/MODULES/Register/CATALOGS/Субъекты/Физ. лица',
11
11
  analytic: true,
12
12
  required: true,
@@ -5,7 +5,7 @@ export default {
5
5
  label: 'Коммуникации',
6
6
  {
7
7
  id: 'counterparty',
8
8
  label: 'Контрагент',
9
- type: 'Link',
9
+ type: 'link',
10
10
  target: '/MODULES/Register/CATALOGS/Субъекты',
11
11
  analytic: true,
12
12
  required: true,
@@ -6,12 +6,12 @@ export default {
6
6
  label: 'Нормативы',
7
7
  {
8
8
  id: 'kind',
9
9
  label: 'Вид норматива',
10
- type: 'Link',
10
+ type: 'link',
11
11
  target: '/MODULES/Register/CATALOGS/Виды нормативов',
12
12
  analytic: true,
13
13
  required: true,
14
14
  },
15
- { id: 'object', label: 'Объект', type: 'Link', target: '/MODULES/Register/CATALOGS', analytic: true },
15
+ { id: 'object', label: 'Объект', type: 'link', target: '/MODULES/Register/CATALOGS', analytic: true },
16
16
  ],
17
17
  },
18
18
  }
@@ -1,11 +1,14 @@
1
- export default {
2
- label: 'Адрес',
3
- icon: 'carbon:location',
4
- METADATA: {
5
- FIELDS: [
6
- { id: 'city', label: 'Город', type: 'string' },
7
- { id: 'street', label: 'Улица', type: 'string' },
8
- { id: 'house', label: 'Дом', type: 'string' },
9
- ],
10
- },
11
- }
1
+ export default {
2
+ label: 'Адрес',
3
+ icon: 'carbon:location',
4
+ METADATA: {
5
+ FIELDS: [
6
+ { id: 'postcode', label: 'Индекс', type: 'string' },
7
+ { id: 'region', label: 'Регион', type: 'string' },
8
+ { id: 'city', label: 'Город / Населённый пункт', type: 'string' },
9
+ { id: 'street', label: 'Улица', type: 'string' },
10
+ { id: 'house', label: 'Дом', type: 'string' },
11
+ { id: 'flat', label: 'Квартира / Офис', type: 'string' },
12
+ ],
13
+ },
14
+ }
@@ -1,11 +1,11 @@
1
- export default {
2
- label: 'Единица измерения',
3
- icon: 'carbon:ruler',
4
- METADATA: {
5
- FIELDS: [
6
- { id: 'unit', label: 'Единица', type: 'string', required: true },
7
- { id: 'coef', label: 'Коэффициент к базовой', type: 'number', required: true },
8
- { id: 'price', label: 'Цена продажи за единицу', type: 'money' },
9
- ],
10
- },
11
- }
1
+ export default {
2
+ label: 'Единица измерения',
3
+ icon: 'carbon:ruler',
4
+ METADATA: {
5
+ FIELDS: [
6
+ { id: 'unit', label: 'Единица', type: 'string', required: true },
7
+ { id: 'coef', label: 'Коэффициент к базовой', type: 'number', required: true },
8
+ { id: 'price', label: 'Цена продажи за единицу', type: 'money' },
9
+ ],
10
+ },
11
+ }
@@ -1,11 +1,14 @@
1
- export default {
2
- label: 'Паспорт',
3
- icon: 'carbon:identification',
4
- METADATA: {
5
- FIELDS: [
6
- { id: 'series', label: 'Серия', type: 'string' },
7
- { id: 'number', label: 'Номер', type: 'string' },
8
- { id: 'address', label: 'Адрес регистрации', type: '/MODULES/Register/STRUCTS/Адрес' },
9
- ],
10
- },
11
- }
1
+ export default {
2
+ label: 'Паспорт',
3
+ icon: 'carbon:identification',
4
+ METADATA: {
5
+ FIELDS: [
6
+ { id: 'series', label: 'Серия', type: 'string' },
7
+ { id: 'number', label: 'Номер', type: 'string' },
8
+ { id: 'issued_date', label: 'Дата выдачи', type: 'date' },
9
+ { id: 'issued_unit_code', label: 'Код подразделения', type: 'string' },
10
+ { id: 'issued_unit', label: 'Подразделение МВД (кем выдан)', type: 'link', target: '/MODULES/KLADR/Подразделения МВД' },
11
+ { id: 'address', label: 'Адрес регистрации', type: '/MODULES/Register/STRUCTS/Адрес' },
12
+ ],
13
+ },
14
+ }
@@ -0,0 +1,16 @@
1
+ export default {
2
+ label: 'ФИО',
3
+ icon: 'carbon:user-identification',
4
+ FORMAT: {
5
+ field: 'format',
6
+ values: ['Именительный', 'Родительный', 'Дательный', 'Винительный', 'Творительный', 'Предложный', 'Инициалы', 'И. О. Фамилия'],
7
+ },
8
+ METADATA: {
9
+ FIELDS: [
10
+ { id: 'last_name', label: 'Фамилия', type: 'string', required: true },
11
+ { id: 'first_name', label: 'Имя', type: 'string', required: true },
12
+ { id: 'middle_name', label: 'Отчество', type: 'string' },
13
+ { id: 'gender', label: 'Пол', type: 'enum', values: ['auto', 'm', 'f'] },
14
+ ],
15
+ },
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odant-work",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
5
5
  "type": "module",
6
6
  "main": "sources/work.js",
@@ -53,7 +53,7 @@ if (!candidates.length) {
53
53
  process.exit(1);
54
54
  }
55
55
 
56
- const NPM_INTENTIONAL_EXCLUDE = /^MODELS\/(?:odant|Halogen)\/|^MODELS\/Local\/(?!\$provider\/)/;
56
+ const NPM_INTENTIONAL_EXCLUDE = /^MODELS\/(?:odant|Halogen)\/|^MODELS\/Local\/(?!\$provider\/)|^NODES\/(?!\$node\/|\$nodes\/)|^eslint\.config\.js$/;
57
57
  const gitCandidates = candidates.filter(f => !/^MODELS\/Local\/(?!\$provider\/)/.test(f));
58
58
 
59
59
  // git check-ignore --stdin печатает только игнорируемые пути; код 1 — «ни один» (это норма)
@@ -52,14 +52,16 @@ export function seedDemo(db, { since = `${new Date().getFullYear()}-01-01`, auth
52
52
  make('canister', `${prefix}/CATALOGS/Номенклатура`, { name: 'Канистра 20 л', kind: 'Тара', base_unit: 'шт' });
53
53
  make('barrel', `${prefix}/CATALOGS/Номенклатура`, { name: 'Бочка 200 л', kind: 'Тара', base_unit: 'шт' });
54
54
 
55
- make('tank', `${prefix}/CATALOGS/Склады и резервуары`, { name: 'Резервуар Р-1', kind: 'Резервуар', capacity: 50000, item: ids.oil });
56
- make('stock', `${prefix}/CATALOGS/Склады и резервуары`, { name: 'Склад готовой продукции', kind: 'Склад' });
57
- make('fuel_stock', `${prefix}/CATALOGS/Склады и резервуары`, { name: 'Склад ГСМ', kind: 'Склад' });
55
+ make('tank', `${prefix}/CATALOGS/Склады`, { name: 'Резервуар Р-1', kind: 'Резервуар', capacity: 50000, item: ids.oil });
56
+ make('stock', `${prefix}/CATALOGS/Склады`, { name: 'Склад готовой продукции', kind: 'Склад' });
57
+ make('fuel_stock', `${prefix}/CATALOGS/Склады`, { name: 'Склад ГСМ', kind: 'Склад' });
58
58
 
59
59
  make('supplier', `${prefix}/CATALOGS/Субъекты/Юр. лица`, { name: 'ООО «Нефтехим-Поставка»', inn: '7701000001' });
60
60
  make('client', `${prefix}/CATALOGS/Субъекты/Юр. лица`, { name: 'ООО «Автосервис Плюс»', inn: '7701000002' });
61
61
  make('ivanov', `${prefix}/CATALOGS/Субъекты/Физ. лица`, { name: 'Иванов Иван Иванович' });
62
62
  make('petrov', `${prefix}/CATALOGS/Субъекты/Физ. лица`, { name: 'Петров Пётр Петрович' });
63
+ make('pos_mgr', `${prefix}/CATALOGS/Должности`, { name: 'Менеджер по продажам', code: 'MGR', base_salary: 100000 });
64
+ make('pos_drv', `${prefix}/CATALOGS/Должности`, { name: 'Водитель бензовоза', code: 'DRV', base_salary: 80000 });
63
65
  make('truck', `${prefix}/CATALOGS/Транспорт`, { name: 'Бензовоз КамАЗ', plate: 'А123ВС77', kind: 'Бензовоз', capacity: 10000, fuel: ids.diesel });
64
66
  return ids;
65
67
  }
@@ -122,11 +124,11 @@ export function seedDemoOperations(db, ids, { year = new Date().getFullYear(), a
122
124
  }, 'finances', 'head');
123
125
 
124
126
  post('/OPERATIONS/Кадры/Приём на работу', '01-15', {
125
- person: ids.ivanov, position: 'Менеджер по продажам', salary: 100000,
127
+ person: ids.ivanov, position: ids.pos_mgr, salary: 100000,
126
128
  }, 'personal', 'head');
127
129
 
128
130
  post('/OPERATIONS/Кадры/Приём на работу', '01-15', {
129
- person: ids.petrov, position: 'Водитель бензовоза', salary: 80000,
131
+ person: ids.petrov, position: ids.pos_drv, salary: 80000,
130
132
  }, 'personal', 'head');
131
133
 
132
134
  post('/OPERATIONS/Зарплата', '09-30', {
package/sources/client.js CHANGED
@@ -458,7 +458,12 @@ WORK.login = async function(force = false){
458
458
  let privateKey = await crypto.subtle.importKey("pkcs8", KEY, { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, true, ["sign"]);
459
459
  let signature = await crypto.subtle.sign({ name: "RSASSA-PKCS1-v1_5" }, privateKey, new TextEncoder().encode(challenge));
460
460
  signature = WORK.arrayBufferToBase64(signature);
461
- const res = await WORK.fetch("/", 'user_login_finish' , { uid, time: WORK.credentials.time, challengeId}, {signature});
461
+ let pendingInviteToken = '';
462
+ try { pendingInviteToken = sessionStorage.getItem('work.pendingInviteToken') || ''; } catch { /* ignore */ }
463
+ const res = await WORK.fetch("/", 'user_login_finish' , { uid, time: WORK.credentials.time, challengeId}, {signature, ...(pendingInviteToken ? { inviteToken: pendingInviteToken } : {})});
464
+ if (pendingInviteToken) {
465
+ try { sessionStorage.removeItem('work.pendingInviteToken'); } catch { /* ignore */ }
466
+ }
462
467
  WORK.uid = uid;
463
468
  await WORK.syncAuthUI();
464
469
  WORK.notifyAuth?.({ uid, reason: 'login' });
@@ -0,0 +1,355 @@
1
+ /**
2
+ * Автоматическое склонение русских ФИО по 6 падежам и форматирование инициалов
3
+ * (`sources/data/fio.js`) — для структуры `$struct/ФИО`, печатных шаблонов и ИИ.
4
+ */
5
+
6
+ export const FIO_CASES = Object.freeze({
7
+ nominative: 'Именительный',
8
+ genitive: 'Родительный',
9
+ dative: 'Дательный',
10
+ accusative: 'Винительный',
11
+ instrumental: 'Творительный',
12
+ prepositional: 'Предложный',
13
+ });
14
+
15
+ export const FIO_FORMATS = Object.freeze([
16
+ 'Именительный',
17
+ 'Родительный',
18
+ 'Дательный',
19
+ 'Винительный',
20
+ 'Творительный',
21
+ 'Предложный',
22
+ 'Инициалы',
23
+ 'И. О. Фамилия',
24
+ ]);
25
+
26
+ const CASE_ALIASES = {
27
+ 'и': 'nominative', 'именительный': 'nominative', 'nom': 'nominative', 'nominative': 'nominative',
28
+ 'р': 'genitive', 'родительный': 'genitive', 'gen': 'genitive', 'genitive': 'genitive',
29
+ 'д': 'dative', 'дательный': 'dative', 'dat': 'dative', 'dative': 'dative',
30
+ 'в': 'accusative', 'винительный': 'accusative', 'acc': 'accusative', 'accusative': 'accusative',
31
+ 'т': 'instrumental', 'творительный': 'instrumental', 'ins': 'instrumental', 'inst': 'instrumental', 'instrumental': 'instrumental',
32
+ 'п': 'prepositional', 'предложный': 'prepositional', 'prep': 'prepositional', 'prepositional': 'prepositional',
33
+ };
34
+
35
+ const VOWELS = new Set([...'аеёиоуыэюя']);
36
+ const SIBILANTS = new Set([...'жшщчц']);
37
+ const GUTTURALS = new Set([...'гкх']);
38
+
39
+ function normCase(pad = 'Именительный') {
40
+ const k = String(pad ?? 'Именительный').trim().toLowerCase();
41
+ if (k === 'инициалы' || k === 'initials' || k === 'фамилия и. о.' || k === 'short')
42
+ return 'initials';
43
+ if (k === 'и. о. фамилия' || k === 'io_last' || k === 'initials_before')
44
+ return 'initials_before';
45
+ return CASE_ALIASES[k] || 'nominative';
46
+ }
47
+
48
+ function matchCase(src, out) {
49
+ if (!src || !out)
50
+ return out;
51
+ if (src === src.toUpperCase() && src !== src.toLowerCase())
52
+ return out.toUpperCase();
53
+ if (src[0] === src[0].toUpperCase())
54
+ return out[0].toUpperCase() + out.slice(1);
55
+ return out;
56
+ }
57
+
58
+ export function detectGender({ first_name = '', middle_name = '', last_name = '', gender = 'auto' } = {}) {
59
+ const g = String(gender || 'auto').trim().toLowerCase();
60
+ if (g === 'm' || g === 'м' || g === 'male' || g === 'муж' || g === 'мужской')
61
+ return 'm';
62
+ if (g === 'f' || g === 'ж' || g === 'female' || g === 'жен' || g === 'женский')
63
+ return 'f';
64
+
65
+ const m = String(middle_name || '').trim().toLowerCase();
66
+ if (m.endsWith('ич') || m.endsWith('оглы'))
67
+ return 'm';
68
+ if (m.endsWith('на') || m.endsWith('чна') || m.endsWith('кызы'))
69
+ return 'f';
70
+
71
+ const f = String(first_name || '').trim().toLowerCase();
72
+ if (['никита', 'илья', 'фома', 'лука', 'савва', 'кузьма', 'данила', 'гаврила', 'сила'].includes(f))
73
+ return 'm';
74
+ if (['любовь', 'нинель', 'юдифь', 'руфь', 'эсфирь'].includes(f))
75
+ return 'f';
76
+ if (f.endsWith('а') || f.endsWith('я'))
77
+ return 'f';
78
+ if (f && !VOWELS.has(f.at(-1)))
79
+ return 'm';
80
+
81
+ const l = String(last_name || '').trim().toLowerCase();
82
+ if (/(ова|ева|ёва|ина|ына|ская|цкая|ая|яя)$/.test(l))
83
+ return 'f';
84
+ if (/(ов|ев|ёв|ин|ын|ский|цкий|ой|ый|ий)$/.test(l))
85
+ return 'm';
86
+
87
+ return 'm';
88
+ }
89
+
90
+ function declineHyphen(word, fn) {
91
+ const parts = String(word || '').trim().split('-').filter(Boolean);
92
+ if (!parts.length)
93
+ return '';
94
+ return parts.map((p, idx) => fn(p, idx, parts.length)).join('-');
95
+ }
96
+
97
+ function declineLastNameWord(word, gender, pad) {
98
+ if (!word || pad === 'nominative')
99
+ return word;
100
+ const low = word.toLowerCase();
101
+
102
+ // Несклоняемые фамилии (иноязычные и украинские на гласный -о, -е, -и, -у, -ю, -ых, -их, -аго, -яго, -ово)
103
+ if (/(?:о|е|и|у|ю|ых|их|аго|яго|ово)$/.test(low))
104
+ return word;
105
+ // Женские фамилии на согласную или -ь не склоняются
106
+ if (gender === 'f' && !low.endsWith('а') && !low.endsWith('я'))
107
+ return word;
108
+
109
+ // 1. Прилагательные и причастные фамилии: -ский/-цкий/-ой/-ый/-ий (м), -ская/-цкая/-ая/-яя (ж)
110
+ if (gender === 'm') {
111
+ if (/(?:ский|цкий)$/.test(low)) {
112
+ const stem = word.slice(0, -2);
113
+ const map = { genitive: 'ого', dative: 'ому', accusative: 'ого', instrumental: 'им', prepositional: 'ом' };
114
+ return matchCase(word, stem + map[pad]);
115
+ }
116
+ if (/(?:ый|ой)$/.test(low)) {
117
+ const stem = word.slice(0, -2);
118
+ const map = { genitive: 'ого', dative: 'ому', accusative: 'ого', instrumental: 'ым', prepositional: 'ом' };
119
+ return matchCase(word, stem + map[pad]);
120
+ }
121
+ if (low.endsWith('ий')) {
122
+ const stem = word.slice(0, -2);
123
+ const map = { genitive: 'его', dative: 'ему', accusative: 'его', instrumental: 'им', prepositional: 'ем' };
124
+ return matchCase(word, stem + map[pad]);
125
+ }
126
+ // 2. Классические -ов/-ев/-ёв/-ин/-ын
127
+ if (/(?:ов|ев|ёв|ин|ын)$/.test(low)) {
128
+ const map = { genitive: 'а', dative: 'у', accusative: 'а', instrumental: 'ым', prepositional: 'е' };
129
+ return matchCase(word, word + map[pad]);
130
+ }
131
+ // 3. Мужские на -й
132
+ if (low.endsWith('й')) {
133
+ const stem = word.slice(0, -1);
134
+ const map = { genitive: 'я', dative: 'ю', accusative: 'я', instrumental: 'ем', prepositional: 'е' };
135
+ return matchCase(word, stem + map[pad]);
136
+ }
137
+ // 4. Мужские на -ь
138
+ if (low.endsWith('ь')) {
139
+ const stem = word.slice(0, -1);
140
+ const map = { genitive: 'я', dative: 'ю', accusative: 'я', instrumental: 'ем', prepositional: 'е' };
141
+ return matchCase(word, stem + map[pad]);
142
+ }
143
+ // 5. На -а / -я (мужские тоже склоняются: Була, Зозуля)
144
+ if (low.endsWith('а')) {
145
+ const stem = word.slice(0, -1);
146
+ const prev = stem.at(-1)?.toLowerCase() || '';
147
+ const gen = (GUTTURALS.has(prev) || SIBILANTS.has(prev)) ? 'и' : 'ы';
148
+ const inst = SIBILANTS.has(prev) ? 'ей' : 'ой';
149
+ const map = { genitive: gen, dative: 'е', accusative: 'у', instrumental: inst, prepositional: 'е' };
150
+ return matchCase(word, stem + map[pad]);
151
+ }
152
+ if (low.endsWith('я')) {
153
+ const stem = word.slice(0, -1);
154
+ const map = { genitive: 'и', dative: 'е', accusative: 'ю', instrumental: 'ей', prepositional: 'е' };
155
+ return matchCase(word, stem + map[pad]);
156
+ }
157
+ // 6. Согласная (Мельник, Шмидт и т.п.)
158
+ if (!VOWELS.has(low.at(-1))) {
159
+ const prev = low.at(-1);
160
+ const inst = SIBILANTS.has(prev) ? 'ем' : 'ом';
161
+ const map = { genitive: 'а', dative: 'у', accusative: 'а', instrumental: inst, prepositional: 'е' };
162
+ return matchCase(word, word + map[pad]);
163
+ }
164
+ return word;
165
+ }
166
+
167
+ // Женские фамилии:
168
+ if (/(?:ова|ева|ёва|ина|ына)$/.test(low)) {
169
+ const stem = word.slice(0, -1);
170
+ const map = { genitive: 'ой', dative: 'ой', accusative: 'у', instrumental: 'ой', prepositional: 'ой' };
171
+ return matchCase(word, stem + map[pad]);
172
+ }
173
+ if (/(?:ская|цкая|ая)$/.test(low)) {
174
+ const stem = word.slice(0, -2);
175
+ const map = { genitive: 'ой', dative: 'ой', accusative: 'ую', instrumental: 'ой', prepositional: 'ой' };
176
+ return matchCase(word, stem + map[pad]);
177
+ }
178
+ if (low.endsWith('яя')) {
179
+ const stem = word.slice(0, -2);
180
+ const map = { genitive: 'ей', dative: 'ей', accusative: 'юю', instrumental: 'ей', prepositional: 'ей' };
181
+ return matchCase(word, stem + map[pad]);
182
+ }
183
+ if (low.endsWith('а')) {
184
+ const stem = word.slice(0, -1);
185
+ const prev = stem.at(-1)?.toLowerCase() || '';
186
+ const gen = (GUTTURALS.has(prev) || SIBILANTS.has(prev)) ? 'и' : 'ы';
187
+ const inst = SIBILANTS.has(prev) ? 'ей' : 'ой';
188
+ const map = { genitive: gen, dative: 'е', accusative: 'у', instrumental: inst, prepositional: 'е' };
189
+ return matchCase(word, stem + map[pad]);
190
+ }
191
+ if (low.endsWith('я')) {
192
+ const stem = word.slice(0, -1);
193
+ const map = { genitive: 'и', dative: 'е', accusative: 'ю', instrumental: 'ей', prepositional: 'е' };
194
+ return matchCase(word, stem + map[pad]);
195
+ }
196
+ return word;
197
+ }
198
+
199
+ const SPECIAL_FIRST_NAMES_M = {
200
+ 'пётр': { genitive: 'Петра', dative: 'Петру', accusative: 'Петра', instrumental: 'Петром', prepositional: 'Петре' },
201
+ 'петр': { genitive: 'Петра', dative: 'Петру', accusative: 'Петра', instrumental: 'Петром', prepositional: 'Петре' },
202
+ 'павел': { genitive: 'Павла', dative: 'Павлу', accusative: 'Павла', instrumental: 'Павлом', prepositional: 'Павле' },
203
+ 'лев': { genitive: 'Льва', dative: 'Льву', accusative: 'Льва', instrumental: 'Львом', prepositional: 'Льве' },
204
+ 'илья': { genitive: 'Ильи', dative: 'Илье', accusative: 'Илью', instrumental: 'Ильёй', prepositional: 'Илье' },
205
+ };
206
+
207
+ function declineFirstNameWord(word, gender, pad) {
208
+ if (!word || pad === 'nominative')
209
+ return word;
210
+ const low = word.toLowerCase();
211
+
212
+ if (gender === 'm' && SPECIAL_FIRST_NAMES_M[low])
213
+ return matchCase(word, SPECIAL_FIRST_NAMES_M[low][pad]);
214
+
215
+ if (/(?:о|е|и|у|ю|э)$/.test(low))
216
+ return word;
217
+
218
+ if (gender === 'm') {
219
+ if (low.endsWith('ий')) {
220
+ const stem = word.slice(0, -1);
221
+ const map = { genitive: 'я', dative: 'ю', accusative: 'я', instrumental: 'ем', prepositional: 'и' };
222
+ return matchCase(word, stem + map[pad]);
223
+ }
224
+ if (low.endsWith('ей') || low.endsWith('ай') || low.endsWith('ой') || low.endsWith('уй')) {
225
+ const stem = word.slice(0, -1);
226
+ const map = { genitive: 'я', dative: 'ю', accusative: 'я', instrumental: 'ем', prepositional: 'е' };
227
+ return matchCase(word, stem + map[pad]);
228
+ }
229
+ if (low.endsWith('ь')) {
230
+ const stem = word.slice(0, -1);
231
+ const map = { genitive: 'я', dative: 'ю', accusative: 'я', instrumental: 'ем', prepositional: 'е' };
232
+ return matchCase(word, stem + map[pad]);
233
+ }
234
+ if (low.endsWith('а')) {
235
+ const stem = word.slice(0, -1);
236
+ const prev = stem.at(-1)?.toLowerCase() || '';
237
+ const gen = (GUTTURALS.has(prev) || SIBILANTS.has(prev)) ? 'и' : 'ы';
238
+ const inst = SIBILANTS.has(prev) ? 'ей' : 'ой';
239
+ const map = { genitive: gen, dative: 'е', accusative: 'у', instrumental: inst, prepositional: 'е' };
240
+ return matchCase(word, stem + map[pad]);
241
+ }
242
+ if (low.endsWith('я')) {
243
+ const stem = word.slice(0, -1);
244
+ const map = { genitive: 'и', dative: 'е', accusative: 'ю', instrumental: 'ей', prepositional: 'е' };
245
+ return matchCase(word, stem + map[pad]);
246
+ }
247
+ if (!VOWELS.has(low.at(-1))) {
248
+ const prev = low.at(-1);
249
+ const inst = SIBILANTS.has(prev) ? 'ем' : 'ом';
250
+ const map = { genitive: 'а', dative: 'у', accusative: 'а', instrumental: inst, prepositional: 'е' };
251
+ return matchCase(word, word + map[pad]);
252
+ }
253
+ return word;
254
+ }
255
+
256
+ // Женские имена
257
+ if (low.endsWith('ия')) {
258
+ const stem = word.slice(0, -1);
259
+ const map = { genitive: 'и', dative: 'и', accusative: 'ю', instrumental: 'ей', prepositional: 'и' };
260
+ return matchCase(word, stem + map[pad]);
261
+ }
262
+ if (low.endsWith('ья')) {
263
+ const stem = word.slice(0, -1);
264
+ const map = { genitive: 'и', dative: 'е', accusative: 'ю', instrumental: 'ей', prepositional: 'е' };
265
+ return matchCase(word, stem + map[pad]);
266
+ }
267
+ if (low.endsWith('я')) {
268
+ const stem = word.slice(0, -1);
269
+ const map = { genitive: 'и', dative: 'е', accusative: 'ю', instrumental: 'ей', prepositional: 'е' };
270
+ return matchCase(word, stem + map[pad]);
271
+ }
272
+ if (low.endsWith('а')) {
273
+ const stem = word.slice(0, -1);
274
+ const prev = stem.at(-1)?.toLowerCase() || '';
275
+ const gen = (GUTTURALS.has(prev) || SIBILANTS.has(prev)) ? 'и' : 'ы';
276
+ const inst = SIBILANTS.has(prev) ? 'ей' : 'ой';
277
+ const map = { genitive: gen, dative: 'е', accusative: 'у', instrumental: inst, prepositional: 'е' };
278
+ return matchCase(word, stem + map[pad]);
279
+ }
280
+ if (low.endsWith('ь')) {
281
+ const stem = word.slice(0, -1);
282
+ const map = { genitive: 'и', dative: 'и', accusative: 'ь', instrumental: 'ью', prepositional: 'и' };
283
+ return matchCase(word, stem + map[pad]);
284
+ }
285
+ return word;
286
+ }
287
+
288
+ function declineMiddleNameWord(word, gender, pad) {
289
+ if (!word || pad === 'nominative')
290
+ return word;
291
+ const low = word.toLowerCase();
292
+ if (low.endsWith('оглы') || low.endsWith('кызы'))
293
+ return word;
294
+ if (gender === 'm' && low.endsWith('ич')) {
295
+ const map = { genitive: 'а', dative: 'у', accusative: 'а', instrumental: 'ем', prepositional: 'е' };
296
+ return matchCase(word, word + map[pad]);
297
+ }
298
+ if (gender === 'f' && low.endsWith('на')) {
299
+ const stem = word.slice(0, -1);
300
+ const map = { genitive: 'ы', dative: 'е', accusative: 'у', instrumental: 'ой', prepositional: 'е' };
301
+ return matchCase(word, stem + map[pad]);
302
+ }
303
+ return word;
304
+ }
305
+
306
+ /**
307
+ * Принять объект `{ last_name, first_name, middle_name, gender }` или строку «Фамилия Имя Отчество»
308
+ * и вернуть просклонённую форму или инициалы.
309
+ */
310
+ export function formatFio(input, format = 'Именительный') {
311
+ if (!input)
312
+ return '';
313
+ let obj;
314
+ if (typeof input === 'string') {
315
+ const parts = input.trim().split(/\s+/).filter(Boolean);
316
+ obj = { last_name: parts[0] || '', first_name: parts[1] || '', middle_name: parts[2] || '' };
317
+ }
318
+ else if (typeof input === 'object') {
319
+ obj = {
320
+ last_name: String(input.last_name ?? input.lastName ?? '').trim(),
321
+ first_name: String(input.first_name ?? input.firstName ?? '').trim(),
322
+ middle_name: String(input.middle_name ?? input.middleName ?? '').trim(),
323
+ gender: input.gender,
324
+ };
325
+ }
326
+ else {
327
+ return String(input);
328
+ }
329
+
330
+ const mode = normCase(format);
331
+ if (mode === 'initials') {
332
+ const i1 = obj.first_name ? `${obj.first_name[0].toUpperCase()}.` : '';
333
+ const i2 = obj.middle_name ? `${obj.middle_name[0].toUpperCase()}.` : '';
334
+ return [obj.last_name, [i1, i2].filter(Boolean).join(' ')].filter(Boolean).join(' ');
335
+ }
336
+ if (mode === 'initials_before') {
337
+ const i1 = obj.first_name ? `${obj.first_name[0].toUpperCase()}.` : '';
338
+ const i2 = obj.middle_name ? `${obj.middle_name[0].toUpperCase()}.` : '';
339
+ return [[i1, i2].filter(Boolean).join(' '), obj.last_name].filter(Boolean).join(' ');
340
+ }
341
+
342
+ const gender = detectGender(obj);
343
+ const l = declineHyphen(obj.last_name, w => declineLastNameWord(w, gender, mode));
344
+ const f = declineHyphen(obj.first_name, w => declineFirstNameWord(w, gender, mode));
345
+ const m = declineMiddleNameWord(obj.middle_name, gender, mode);
346
+ return [l, f, m].filter(Boolean).join(' ');
347
+ }
348
+
349
+ /** Сгенерировать карту всех форматов для объекта ФИО. */
350
+ export function fioAllFormats(input) {
351
+ const out = {};
352
+ for (const fmt of FIO_FORMATS)
353
+ out[fmt] = formatFio(input, fmt);
354
+ return out;
355
+ }
@@ -18,6 +18,7 @@ import { tx } from './db.js';
18
18
  import { getClass, descendants } from './classes.js';
19
19
  import { classSchema, objectTitle, FAMILY } from './schema.js';
20
20
  import { toNumber, round } from './expr.js';
21
+ import { formatFio } from './fio.js';
21
22
  import { DataError } from './errors.js';
22
23
  import { parseTime, localDay, periodRange } from './time.js';
23
24
  import { registerOperation } from './posting.js';
@@ -169,7 +170,16 @@ function bodyFields(schema) {
169
170
  /** Проверить тело объекта класса; ошибки — DataError со списком. */
170
171
  export function validateBody(db, schema, body) {
171
172
  const errors = [];
172
- const out = checkBody(db, bodyFields(schema), body ?? {}, errors);
173
+ const fields = bodyFields(schema);
174
+ let sourceBody = body ?? {};
175
+ if (sourceBody && typeof sourceBody === 'object' && !Array.isArray(sourceBody)
176
+ && isEmpty(sourceBody.name) && sourceBody.fio && typeof sourceBody.fio === 'object'
177
+ && fields.some(f => f.id === 'name')) {
178
+ const autoName = formatFio(sourceBody.fio, 'Именительный');
179
+ if (autoName)
180
+ sourceBody = { ...sourceBody, name: autoName };
181
+ }
182
+ const out = checkBody(db, fields, sourceBody, errors);
173
183
  if (errors.length)
174
184
  throw new DataError(`${schema.label}: данные не прошли проверку`, errors);
175
185
  return out;