generator-pninja 2.0.0 → 2.0.2

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 (69) hide show
  1. package/generators/client/templates/react/public/locales/common/am.json.ejs +7 -2
  2. package/generators/client/templates/react/public/locales/common/ar.json.ejs +7 -2
  3. package/generators/client/templates/react/public/locales/common/az.json.ejs +7 -2
  4. package/generators/client/templates/react/public/locales/common/bg.json.ejs +7 -2
  5. package/generators/client/templates/react/public/locales/common/bn.json.ejs +7 -2
  6. package/generators/client/templates/react/public/locales/common/ca.json.ejs +7 -2
  7. package/generators/client/templates/react/public/locales/common/cs.json.ejs +7 -2
  8. package/generators/client/templates/react/public/locales/common/cy.json.ejs +7 -2
  9. package/generators/client/templates/react/public/locales/common/da.json.ejs +7 -2
  10. package/generators/client/templates/react/public/locales/common/de.json.ejs +7 -2
  11. package/generators/client/templates/react/public/locales/common/el.json.ejs +7 -2
  12. package/generators/client/templates/react/public/locales/common/en.json.ejs +7 -2
  13. package/generators/client/templates/react/public/locales/common/es.json.ejs +7 -2
  14. package/generators/client/templates/react/public/locales/common/et.json.ejs +7 -2
  15. package/generators/client/templates/react/public/locales/common/eu.json.ejs +7 -2
  16. package/generators/client/templates/react/public/locales/common/fa.json.ejs +7 -2
  17. package/generators/client/templates/react/public/locales/common/fi.json.ejs +7 -2
  18. package/generators/client/templates/react/public/locales/common/fr.json.ejs +7 -2
  19. package/generators/client/templates/react/public/locales/common/fy.json.ejs +7 -2
  20. package/generators/client/templates/react/public/locales/common/ga.json.ejs +7 -2
  21. package/generators/client/templates/react/public/locales/common/gl.json.ejs +7 -2
  22. package/generators/client/templates/react/public/locales/common/gu.json.ejs +7 -2
  23. package/generators/client/templates/react/public/locales/common/ha.json.ejs +7 -2
  24. package/generators/client/templates/react/public/locales/common/he.json.ejs +7 -2
  25. package/generators/client/templates/react/public/locales/common/hi.json.ejs +7 -2
  26. package/generators/client/templates/react/public/locales/common/hr.json.ejs +7 -2
  27. package/generators/client/templates/react/public/locales/common/ht.json.ejs +7 -2
  28. package/generators/client/templates/react/public/locales/common/hu.json.ejs +7 -2
  29. package/generators/client/templates/react/public/locales/common/hy.json.ejs +7 -2
  30. package/generators/client/templates/react/public/locales/common/id.json.ejs +7 -2
  31. package/generators/client/templates/react/public/locales/common/is.json.ejs +7 -2
  32. package/generators/client/templates/react/public/locales/common/it.json.ejs +7 -2
  33. package/generators/client/templates/react/public/locales/common/ja.json.ejs +7 -2
  34. package/generators/client/templates/react/public/locales/common/kk.json.ejs +7 -2
  35. package/generators/client/templates/react/public/locales/common/ko.json.ejs +7 -2
  36. package/generators/client/templates/react/public/locales/common/lt.json.ejs +7 -2
  37. package/generators/client/templates/react/public/locales/common/lv.json.ejs +7 -2
  38. package/generators/client/templates/react/public/locales/common/mi.json.ejs +7 -2
  39. package/generators/client/templates/react/public/locales/common/ms.json.ejs +7 -2
  40. package/generators/client/templates/react/public/locales/common/mt.json.ejs +7 -2
  41. package/generators/client/templates/react/public/locales/common/nl.json.ejs +7 -2
  42. package/generators/client/templates/react/public/locales/common/no.json.ejs +7 -2
  43. package/generators/client/templates/react/public/locales/common/om.json.ejs +7 -2
  44. package/generators/client/templates/react/public/locales/common/pl.json.ejs +7 -2
  45. package/generators/client/templates/react/public/locales/common/pt.json.ejs +7 -2
  46. package/generators/client/templates/react/public/locales/common/ro.json.ejs +7 -2
  47. package/generators/client/templates/react/public/locales/common/ru.json.ejs +7 -2
  48. package/generators/client/templates/react/public/locales/common/rw.json.ejs +7 -2
  49. package/generators/client/templates/react/public/locales/common/sk.json.ejs +7 -2
  50. package/generators/client/templates/react/public/locales/common/sl.json.ejs +7 -2
  51. package/generators/client/templates/react/public/locales/common/sq.json.ejs +7 -2
  52. package/generators/client/templates/react/public/locales/common/sr.json.ejs +7 -2
  53. package/generators/client/templates/react/public/locales/common/sv.json.ejs +7 -2
  54. package/generators/client/templates/react/public/locales/common/sw.json.ejs +7 -2
  55. package/generators/client/templates/react/public/locales/common/ta.json.ejs +7 -2
  56. package/generators/client/templates/react/public/locales/common/tr.json.ejs +7 -2
  57. package/generators/client/templates/react/public/locales/common/uk.json.ejs +7 -2
  58. package/generators/client/templates/react/public/locales/common/ur.json.ejs +7 -2
  59. package/generators/client/templates/react/public/locales/common/uz.json.ejs +7 -2
  60. package/generators/client/templates/react/public/locales/common/vi.json.ejs +7 -2
  61. package/generators/client/templates/react/public/locales/common/yo.json.ejs +7 -2
  62. package/generators/client/templates/react/public/locales/common/zh.json.ejs +7 -2
  63. package/generators/client/templates/react/public/locales/common/zu.json.ejs +7 -2
  64. package/generators/client/templates/react/src/components/BlobViewer.tsx.ejs +63 -33
  65. package/generators/client/templates/react/src/components/entities/EntityForm.tsx.ejs +1 -0
  66. package/generators/client/templates/react/src/components/formElements/FileField.tsx.ejs +267 -110
  67. package/generators/client/templates/react/src/index.css.ejs +8 -0
  68. package/generators/client/templates/react/src/pages/entities/EntityEdit.tsx.ejs +21 -21
  69. package/package.json +1 -1
@@ -55,30 +55,30 @@ export default function <%= entity.name %>Edit() {
55
55
  }
56
56
  }, [id, addNotification, navigate, t]);
57
57
 
58
- const handleSubmit = (data: I<%= entity.name %>) => {
59
- (id
60
- ? <%= entity.name %>Service.update(Number(id), data)
61
- : <%= entity.name %>Service.create(data)
62
- )
63
- .then((data: I<%= entity.name %>) => {
58
+ const handleSubmit = async (data: I<%= entity.name %>) => {
59
+ try {
60
+ const result = await (id
61
+ ? <%= entity.name %>Service.update(Number(id), data)
62
+ : <%= entity.name %>Service.create(data)
63
+ );
64
64
  <%_ if (entity.pessimisticLock) { _%>
65
- release();
65
+ release();
66
66
  <%_ } _%>
67
- addNotification({
68
- type: 'success',
69
- message: t(`actions.crud.successfully${id ? 'Updated' : 'Created'}`, {
70
- id: id || data.id,
71
- }),
72
- });
73
- navigate('/<%- entity.name === 'AcRule' ? 'admin' : 'entities' %>/<%=to.slug(pluralize(entity.name))%>');
74
- })
75
- .catch((error: AxiosError<ErrorResponseData>) => {
76
- addNotification({
77
- type: 'error',
78
- message: `${t(id ? 'errors.entities.update' : 'errors.entities.create')} ${t('entities:<%-to.snake(entity.name)%>.<%= entity.name %>')}${id ? ` ID ${id}` : ''}`,
79
- error,
80
- });
67
+ addNotification({
68
+ type: 'success',
69
+ message: t(`actions.crud.successfully${id ? 'Updated' : 'Created'}`, {
70
+ id: id || result.id,
71
+ }),
81
72
  });
73
+ navigate('/<%- entity.name === 'AcRule' ? 'admin' : 'entities' %>/<%=to.slug(pluralize(entity.name))%>');
74
+ } catch (error) {
75
+ addNotification({
76
+ type: 'error',
77
+ message: `${t(id ? 'errors.entities.update' : 'errors.entities.create')} ${t('entities:<%-to.snake(entity.name)%>.<%= entity.name %>')}${id ? ` ID ${id}` : ''}`,
78
+ error: error as AxiosError<ErrorResponseData>,
79
+ });
80
+ throw error;
81
+ }
82
82
  };
83
83
 
84
84
  const handleCancel = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-pninja",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Generator for PHP/Laravel + SQL + Vite + React applications",
5
5
  "type": "module",
6
6
  "files": [