slthcore 0.3.6__tar.gz → 0.3.8__tar.gz
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.
Potentially problematic release.
This version of slthcore might be problematic. Click here for more details.
- {slthcore-0.3.6/slthcore.egg-info → slthcore-0.3.8}/PKG-INFO +1 -1
- {slthcore-0.3.6 → slthcore-0.3.8}/setup.py +1 -1
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/auth.py +10 -1
- slthcore-0.3.8/slth/endpoints/timezone.py +11 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/middleware/timezone.py +12 -9
- slthcore-0.3.8/slth/migrations/0011_usertimezone.py +31 -0
- slthcore-0.3.8/slth/migrations/0012_timezone_remove_usertimezone_key_and_more.py +37 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/models.py +32 -4
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/static/js/slth.min.js +1 -1
- slthcore-0.3.8/slth/tz.py +13 -0
- {slthcore-0.3.6 → slthcore-0.3.8/slthcore.egg-info}/PKG-INFO +1 -1
- {slthcore-0.3.6 → slthcore-0.3.8}/slthcore.egg-info/SOURCES.txt +4 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/MANIFEST.in +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/setup.cfg +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/apps.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/configure/__main__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/__main__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/__pycache__/__main__.cpython-312.pyc +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/.DS_Store +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/.gitignore +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/api/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/api/asgi.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/api/endpoints/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/api/models.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/api/settings.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/api/tests.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/api/urls.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/api/wsgi.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/application.yml +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/entrypoint.sh +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/manage.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/requirements.txt +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/base.env +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/docker-compose.yml +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/frontend/package.json +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/frontend/src/main.jsx +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/frontend/vite.config.js +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/local.env +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/run.sh +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/selenium/run.sh +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/test.sh +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/components.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/db/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/db/generic.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/db/models.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/deletion.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/dev.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/email.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/job.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/log.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/profile.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/pushsubscription.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/report.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/role.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/task.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/endpoints/user.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/exceptions.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/factory.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/forms.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/management/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/management/commands/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/management/commands/integration_test.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/management/commands/sync.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/management/commands/worker.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/middleware/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0001_initial.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0002_email_role_pushsubscription_error.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0003_rename_photo_profile_alter_profile_options.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0004_alter_profile_photo.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0005_alter_profile_photo.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0006_user.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0007_deletion_log.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0008_alter_deletion_datetime_alter_log_datetime.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0009_remove_email_from_email_email_action_email_attempt_and_more.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0010_email_key_alter_email_action_alter_email_attempt_and_more.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/notifications.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/oauth.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/pdf/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/pdf/tests.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/permissions.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/printer.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/queryset.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/roles.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/selenium/__init__.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/selenium/browser.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/serializer.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/static/.DS_Store +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/static/css/.DS_Store +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/static/css/slth.css +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/static/js/index.min.js +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/static/js/react.min.js +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/statistics.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/tasks.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/templates/email.html +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/templates/index.html +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/templates/report.html +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/templates/service-worker.js +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/templates/signature.html +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/tests.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/threadlocal.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/urls.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/utils.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slth/views.py +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slthcore.egg-info/dependency_links.txt +0 -0
- {slthcore-0.3.6 → slthcore-0.3.8}/slthcore.egg-info/top_level.txt +0 -0
|
@@ -3,10 +3,11 @@ from django.conf import settings
|
|
|
3
3
|
from django.core.exceptions import ValidationError
|
|
4
4
|
from slth import forms
|
|
5
5
|
from django.contrib.auth import authenticate
|
|
6
|
-
from ..models import Token
|
|
6
|
+
from ..models import Token, UserTimeZone, TimeZone
|
|
7
7
|
from ..components import Response
|
|
8
8
|
from .. import oauth
|
|
9
9
|
from . import PublicEndpoint, Endpoint
|
|
10
|
+
from django.utils import timezone
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class Login(PublicEndpoint):
|
|
@@ -39,6 +40,14 @@ class Login(PublicEndpoint):
|
|
|
39
40
|
)
|
|
40
41
|
if user:
|
|
41
42
|
token = Token.objects.create(user=user)
|
|
43
|
+
current_timezone = timezone.get_current_timezone()
|
|
44
|
+
timezone_instance = TimeZone.objects.get_or_create(name=current_timezone.__str__())[0]
|
|
45
|
+
user_timezone = UserTimeZone.objects.filter(user=user).first()
|
|
46
|
+
if user_timezone is None:
|
|
47
|
+
UserTimeZone.objects.create(user=user, timezone=timezone_instance)
|
|
48
|
+
else:
|
|
49
|
+
user_timezone.key = current_timezone.__str__()
|
|
50
|
+
user_timezone.save()
|
|
42
51
|
return Response(
|
|
43
52
|
message="Bem-vindo!",
|
|
44
53
|
redirect=self.request.GET.get("next", "/api/dashboard/"),
|
|
@@ -2,6 +2,18 @@ import pytz
|
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from django.utils import timezone
|
|
4
4
|
|
|
5
|
+
def now():
|
|
6
|
+
return datetime.now().astimezone(timezone.get_current_timezone()).replace(tzinfo=None)
|
|
7
|
+
|
|
8
|
+
def today():
|
|
9
|
+
return now().date()
|
|
10
|
+
|
|
11
|
+
def local(dt, tz):
|
|
12
|
+
from_timezone = timezone.get_default_timezone()
|
|
13
|
+
to_timezone = pytz.timezone(tz)
|
|
14
|
+
from_timezone.localize(dt).astimezone(to_timezone).replace(tzinfo=None)
|
|
15
|
+
|
|
16
|
+
|
|
5
17
|
class Middleware:
|
|
6
18
|
def __init__(self, get_response):
|
|
7
19
|
self.get_response = get_response
|
|
@@ -14,12 +26,3 @@ class Middleware:
|
|
|
14
26
|
if tz:
|
|
15
27
|
timezone.deactivate()
|
|
16
28
|
return response
|
|
17
|
-
|
|
18
|
-
def now():
|
|
19
|
-
return datetime.now().astimezone(timezone.get_current_timezone()).replace(tzinfo=None)
|
|
20
|
-
|
|
21
|
-
def today():
|
|
22
|
-
return now().date()
|
|
23
|
-
|
|
24
|
-
def local_datetime(dt, tz):
|
|
25
|
-
pass
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Generated by Django 5.1.3 on 2024-12-03 15:42
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
import slth
|
|
5
|
+
import slth.db.models
|
|
6
|
+
from django.conf import settings
|
|
7
|
+
from django.db import migrations, models
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Migration(migrations.Migration):
|
|
11
|
+
|
|
12
|
+
dependencies = [
|
|
13
|
+
('slth', '0010_email_key_alter_email_action_alter_email_attempt_and_more'),
|
|
14
|
+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
operations = [
|
|
18
|
+
migrations.CreateModel(
|
|
19
|
+
name='UserTimeZone',
|
|
20
|
+
fields=[
|
|
21
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
22
|
+
('key', slth.db.models.CharField(max_length=255, verbose_name='Fuso Horário')),
|
|
23
|
+
('user', slth.db.models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Usuário')),
|
|
24
|
+
],
|
|
25
|
+
options={
|
|
26
|
+
'verbose_name': 'Fuso Horário do Usuário',
|
|
27
|
+
'verbose_name_plural': 'Fusos Horários do Usuário',
|
|
28
|
+
},
|
|
29
|
+
bases=(models.Model, slth.ModelMixin),
|
|
30
|
+
),
|
|
31
|
+
]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Generated by Django 5.1.3 on 2024-12-05 14:14
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
import slth
|
|
5
|
+
import slth.db.models
|
|
6
|
+
from django.db import migrations, models
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Migration(migrations.Migration):
|
|
10
|
+
|
|
11
|
+
dependencies = [
|
|
12
|
+
('slth', '0011_usertimezone'),
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
operations = [
|
|
16
|
+
migrations.CreateModel(
|
|
17
|
+
name='TimeZone',
|
|
18
|
+
fields=[
|
|
19
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
20
|
+
('name', slth.db.models.CharField(max_length=255, verbose_name='Nome')),
|
|
21
|
+
],
|
|
22
|
+
options={
|
|
23
|
+
'verbose_name': 'Fuso Horário',
|
|
24
|
+
'verbose_name_plural': 'Fusos Horários',
|
|
25
|
+
},
|
|
26
|
+
bases=(models.Model, slth.ModelMixin),
|
|
27
|
+
),
|
|
28
|
+
migrations.RemoveField(
|
|
29
|
+
model_name='usertimezone',
|
|
30
|
+
name='key',
|
|
31
|
+
),
|
|
32
|
+
migrations.AddField(
|
|
33
|
+
model_name='usertimezone',
|
|
34
|
+
name='timezone',
|
|
35
|
+
field=slth.db.models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='slth.timezone', verbose_name='Fuso Horário'),
|
|
36
|
+
),
|
|
37
|
+
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import json
|
|
3
|
-
import
|
|
3
|
+
import pytz
|
|
4
4
|
import binascii
|
|
5
5
|
from uuid import uuid1
|
|
6
6
|
import traceback
|
|
@@ -9,7 +9,6 @@ from django.conf import settings
|
|
|
9
9
|
from django.utils.translation import gettext_lazy as _
|
|
10
10
|
from django.contrib.auth.models import User
|
|
11
11
|
from django.db import transaction
|
|
12
|
-
from django.db.models.base import ModelBase
|
|
13
12
|
from django.apps import apps
|
|
14
13
|
from datetime import datetime
|
|
15
14
|
from django.core.cache import cache
|
|
@@ -19,7 +18,6 @@ from django.template.loader import render_to_string
|
|
|
19
18
|
from django.core.mail import EmailMultiAlternatives
|
|
20
19
|
from .notifications import send_push_web_notification
|
|
21
20
|
from .components import HtmlContent
|
|
22
|
-
|
|
23
21
|
from slth import APPLICATON
|
|
24
22
|
from django.contrib.auth.models import BaseUserManager
|
|
25
23
|
|
|
@@ -64,7 +62,7 @@ class User(User):
|
|
|
64
62
|
return (
|
|
65
63
|
super().serializer()
|
|
66
64
|
.fieldset('Dados Gerais', (('first_name', 'last_name'), 'email'))
|
|
67
|
-
.fieldset('Dados de Acesso', ('username', ('is_superuser', 'is_active'),))
|
|
65
|
+
.fieldset('Dados de Acesso', (('username', 'get_timezone'), ('is_superuser', 'is_active'),))
|
|
68
66
|
.queryset('Notificação', 'get_push_subscriptions')
|
|
69
67
|
.queryset('Papéis', 'get_roles')
|
|
70
68
|
)
|
|
@@ -79,6 +77,11 @@ class User(User):
|
|
|
79
77
|
@meta('Papéis')
|
|
80
78
|
def get_roles(self):
|
|
81
79
|
return Role.objects.filter(username=self.username).fields('get_description')
|
|
80
|
+
|
|
81
|
+
@meta('Fuso Horário')
|
|
82
|
+
def get_timezone(self):
|
|
83
|
+
user_timezone = self.usertimezone_set.first()
|
|
84
|
+
return user_timezone.key if user_timezone else None
|
|
82
85
|
|
|
83
86
|
|
|
84
87
|
|
|
@@ -507,6 +510,31 @@ class Deletion(models.Model):
|
|
|
507
510
|
self.save()
|
|
508
511
|
|
|
509
512
|
|
|
513
|
+
class TimeZone(models.Model):
|
|
514
|
+
name = models.CharField(verbose_name='Nome')
|
|
515
|
+
|
|
516
|
+
class Meta:
|
|
517
|
+
verbose_name = 'Fuso Horário'
|
|
518
|
+
verbose_name_plural = 'Fusos Horários'
|
|
519
|
+
|
|
520
|
+
def __str__(self):
|
|
521
|
+
return self.name
|
|
522
|
+
|
|
523
|
+
def localtime(self, datetime=None):
|
|
524
|
+
return datetime.astimezone(pytz.timezone(self.name)).replace(tzinfo=None)
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
class UserTimeZone(models.Model):
|
|
528
|
+
user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name='Usuário', on_delete=models.CASCADE)
|
|
529
|
+
timezone = models.ForeignKey(TimeZone, verbose_name='Fuso Horário', on_delete=models.CASCADE, null=True)
|
|
530
|
+
|
|
531
|
+
class Meta:
|
|
532
|
+
verbose_name = 'Fuso Horário do Usuário'
|
|
533
|
+
verbose_name_plural = 'Fusos Horários do Usuário'
|
|
534
|
+
|
|
535
|
+
def __str__(self):
|
|
536
|
+
return '{} - {}'.format(self.user.username, self.key)
|
|
537
|
+
|
|
510
538
|
|
|
511
539
|
# class Task(models.Model):
|
|
512
540
|
# total = models.IntegerField(verbose_name='Total', default=0)
|
|
@@ -124,7 +124,7 @@ import{j as t,c as P,r as I,R as Ie}from"./react.min.js";const w={colors:{primar
|
|
|
124
124
|
.tooltip:hover .tooltiptext {
|
|
125
125
|
visibility: visible;
|
|
126
126
|
}
|
|
127
|
-
`),t.jsxs("div",{className:"tooltip",children:[e.children,t.jsx("div",{className:"tooltiptext",children:H(e.text)})]})}return n()}const xt=["text","password","email","number","date","datetime-local","file","image","range","search","tel","time","url","week","hidden","color"],Z={padding:15,border:"solid 1px #d9d9d9",borderRadius:5,backgroundColor:"white"};function yt(e,n){const a=new FormData(e);for(let[r,i]of Array.from(a.entries())){const o=e[r];n!=r&&(o.tagName=="SELECT"&&i!==""||o.tagName==null&&i!==""||o.type=="radio"&&i!==""||o.type=="checkbox"&&i!==""||a.delete(r))}return new URLSearchParams(a).toString()}function $(e,n,a){const r=e.indexOf("?")<0?"?":"&",i=yt(n,a);return e=e+(i?r+i:""),e}function le(e){if(e){const a=[".png",".jpeg",".jpeg",".gif"];for(var n=0;n<a.length;n++)if(e.toLowerCase().indexOf(a[n])>0)return!0}}function K(e,n){B("GET",$(n,e.closest("form"),e.name),Me)}function vt(e){if(e){var n=document.querySelector(".form-fieldset."+e);n&&(n.style.display="none");var a=document.querySelector(".form-group."+e);a&&(a.style.display="none")}}function bt(e){if(e){var n=document.querySelector(".form-fieldset."+e);n&&(n.style.display="block");var a=document.querySelector(".form-group."+e);a&&(a.style.display="block")}}function pt(e){const n="reload-"+e+"-field";window[n]&&window[n]()}function wt(e,n){var a=document.querySelector(".form-group."+e),r=a.querySelector('*[name="'+e+'"]');if(r.tagName=="INPUT")r.value=n;else if(r.tagName=="SELECT"){if(r.style.display!="none")r.dispatchEvent(new CustomEvent("customchange",{detail:{value:n}}));else for(var i=0;i<r.options.length;i++)if(r.options[i].value==n){r.selectedIndex=i;break}}}function Me(e){if(e){for(var n=0;n<e.hide.length;n++)vt(e.hide[n]);for(var n=0;n<e.show.length;n++)bt(e.show[n]);for(var n=0;n<e.reload.length;n++)pt(e.reload[n]);for(var a in e.set)wt(a,e.set[a])}}function jt(e){function n(){const a={color:w.colors.info,backgroundColor:w.background.info,padding:20,display:"flex",justifyContent:"space-between",marginTop:10,marginBottom:10};return t.jsxs("div",{style:a,children:[t.jsxs("div",{children:[t.jsx(E,{icon:"circle-check",style:{color:w.colors.info,marginRight:20}}),e.data.text]}),e.children&&t.jsx("div",{children:e.children})]})}return n()}function kt(e){function n(){const a={color:"white",display:"none",backgroundColor:"#e52207",marginTop:2,marginBottom:2,padding:8};return t.jsxs("div",{style:a,id:e.id,className:"error",children:[t.jsx(E,{icon:"xmark-circle",style:{marginRight:5}}),t.jsx("span",{})]})}return n()}function St(e){function n(){const a={marginTop:2,marginBottom:2,fontStyle:"italic"};return t.jsx("div",{style:a,children:t.jsx("span",{children:e.text})})}return n()}function ae(e){const n=e.data.name+Math.random();function a(){const d={display:"flex",justifyContent:"space-between",alignItems:"baseline"};return e.data.action&&(e.data.action.icon=null,e.data.action.modal=!0,e.data.action.urlfunc=function(){return $(e.data.action.url,document.getElementById(n).closest("form"))}),t.jsxs("div",{style:d,children:[t.jsxs("label",{className:"bold",children:[e.data.label," ",e.data.label&&e.data.required?"*":""]}),e.data.action&&t.jsx(F,{data:e.data.action,style:{padding:0,margin:0}})]})}function r(){return e.data.type=="datetime"&&(e.data.type="datetime-local"),xt.indexOf(e.data.type)>=0?t.jsx(ye,{data:e.data}):e.data.type=="choice"&&Array.isArray(e.data.choices)?e.data.pick?Array.isArray(e.data.value)?t.jsx(ve,{data:e.data}):t.jsx(de,{data:e.data}):t.jsx(Mt,{data:e.data}):e.data.type=="choice"?e.data.pick?Array.isArray(e.data.value)?t.jsx(ve,{data:e.data}):t.jsx(de,{data:e.data}):t.jsx(Te,{data:e.data}):e.data.type=="decimal"?t.jsx(ye,{data:e.data}):e.data.type=="boolean"?t.jsx(Et,{data:e.data}):e.data.type=="textarea"?t.jsx(Ct,{data:e.data}):e.data.type=="scheduler"?(e.data.scheduler.input_name=e.data.name,t.jsx(Ee,{data:e.data.scheduler})):t.jsx("span",{children:e.data.name})}function i(){return t.jsx("div",{children:t.jsx(kt,{id:e.data.name+"_error"})})}function o(){return e.data.help_text&&t.jsx(St,{text:e.data.help_text})}function s(){const d={display:e.data.type=="hidden"?"none":"flex",flexDirection:"column",padding:5,width:"calc(100%-5px)"};return t.jsxs("div",{id:n,style:d,children:[a(),r(),o(),i()]})}return s()}function ye(e){var n="";const a=e.data.name+Math.random();e.data.mask=="decimal"&&(n="decimal",e.data.value&&(e.data.value=Math.round(parseFloat(e.data.value)).toFixed(2).replace(".",","))),I.useEffect(()=>{function s(h,l,m){var f=m.target,p=f.value.replace(/\D/g,""),y=f.value.length>l?1:0;VMasker(f).unMask(),VMasker(f).maskPattern(h[y]),f.value=VMasker.toPattern(p,h[y])}if(e.data.mask){var d=document.getElementById(a);if(e.data.mask=="decimal")VMasker(d).maskMoney({precision:2,separator:",",delimiter:"."});else if(e.data.mask.indexOf("|")>0){var c=e.data.mask.split("|");VMasker(d).maskPattern(c[0]),d.addEventListener("input",s.bind(void 0,c,14),!1)}else VMasker(d).maskPattern(e.data.mask)}},[]);function r(s){K(s.target,e.data.onchange)}function i(s){if(e.data.type=="file"&&s.target.files){let c=s.target.files[0];var d=new FileReader;d.onload=function(h){if(le(c.name)){const p="display"+a;var l=document.createElement("img");l.id=s.target.id+"img",l.style.width="200px",l.style.display="block",l.style.margin="auto",l.style.marginTop="20px",l.onload=function(y){const b=e.data.width>e.data.height?e.data.width/l.width:e.data.height/l.height;var D=document.createElement("canvas");const k=D.getContext("2d");D.height=D.width*(l.height/l.width);const q=document.createElement("canvas"),N=q.getContext("2d");q.width=l.width*b,q.height=l.height*b,N.drawImage(l,0,0,q.width,q.height),k.drawImage(q,0,0,q.width*b,q.height*b,0,0,D.width,D.height),q.toBlob(function(M){const S=new DataTransfer;S.items.add(new File([M],c.name)),s.target.files=S.files});var v=document.getElementById(p);v==null?(v=document.createElement("div"),v.id=p):v.removeChild(v.childNodes[0]),v.appendChild(l),s.target.parentNode.appendChild(v)},l.src=h.target.result}const m=document.getElementById("fileinfo"+a);var f=c.size/1024;f<1024?f=parseInt(f)+" Kb":f=(f/1024).toFixed(2)+" Mb",m.innerHTML=c.name+" / "+f,e.data.max_size&&c.size/1024/1024>e.data.max_size&&alert("O limite de tamanho é "+e.data.max_size+"Mb. O arquivo informado possui "+f+". Por favor, adicione um arquivo menor.")},d.readAsDataURL(c)}}function o(){var s=e.data.type;if(s=="datetime"&&(s="datetime-regional"),s=="decimal"&&(s="text"),s=="file"){const h={alignContent:"center",minHeight:75,padding:5,maxWidth:"100%",margin:"auto"};var d=null;return e.data.extensions&&e.data.extensions.length>0&&(d=e.data.extensions.map(l=>"."+l).join(", ")),t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{display:window.innerWidth<800?"block":"flex",justifyContent:"space-between",backgroundColor:"rgba(15, 145, 210, 0.05)",border:"1px dashed rgba(15, 145, 210, 0.4)",borderRadius:10,textAlign:"center"},children:[t.jsx("div",{style:h,children:t.jsx(E,{icon:"cloud-upload",style:{fontSize:"2.5rem",color:w.colors.primary}})}),t.jsxs("div",{style:h,children:[e.data.value&&le(e.data.value)&&t.jsx("div",{style:{textAlign:"center"},children:t.jsx("img",{src:e.data.value,height:50})}),e.data.value&&!le(e.data.value)&&t.jsx("div",{style:{textAlign:"center"},children:e.data.value}),"Selecione um arquivo clicando no botão ao lado.",t.jsxs("div",{className:"bold",id:"fileinfo"+a,children:["O arquivo",e.data.max_size&&"deve possuir até "+e.data.max_size+" Mb e ","deve ter extensão"," ",e.data.extensions.map(l=>"."+l).join(" ou "),"."]})]}),t.jsx("div",{style:h,align:"center",children:t.jsx(_,{label:"Selecionar Arquivo",onClick:()=>document.getElementById(a).click()})})]}),t.jsx("input",{className:"form-control "+n,type:s,name:e.data.name,id:a,"data-label":T(e.data.label),readOnly:e.data.read_only,onBlur:e.data.onchange?r:null,onChange:i,style:{zIndex:"-1",marginTop:-20},accept:d})]})}else{var c=Z;return s=="color"&&(c={...Z},c.width="100%",c.backgroundColor="white",c.height=47.5),t.jsx("input",{className:"form-control "+n,type:s,name:e.data.name,id:a,defaultValue:e.data.value,"data-label":T(e.data.label),readOnly:e.data.read_only,onBlur:e.data.onchange?r:null,onChange:i,style:c})}}return o()}function Te(e){var n=[];Array.isArray(e.data.value)?e.data.value.forEach(function(v,M){n.push({id:v.id,value:v.label})}):e.data.value!=null&&n.push({id:e.data.value.id,value:e.data.value.label}),e.data.id==null&&(e.data.id=Math.random()),e.data.id2==null&&(e.data.id2=e.data.id+"__autocomplete");const a=e.data.id,r=e.data.id2,i=Array.isArray(e.data.value),[o,s]=I.useState(!1),[d,c]=I.useState(null);var h=!1;let l;I.useEffect(()=>{k(n,!0),document.getElementById(a).addEventListener("customchange",function(v){k(v.detail.value);const M=document.getElementById(e.data.name);M&&reactTriggerChange(M)})},[]);function m(){const v=document.getElementById(a);if(i){const M={padding:5,display:"inline"},S={cursor:"pointer",marginRight:5},u={fontSize:"0.8rem"};return t.jsxs("div",{children:[v==null&&n.map((g,j)=>t.jsxs("div",{style:M,children:[t.jsx("span",{onClick:()=>q(j),style:S,children:t.jsx(E,{icon:"trash-can",style:u})}),g.value]},Math.random())),v!=null&&Array.from(v.options).map((g,j)=>t.jsxs("div",{style:M,children:[t.jsx("span",{onClick:()=>q(j),style:S,children:t.jsx(E,{icon:"trash-can",style:u})}),g.innerHTML]},Math.random()))]})}}function f(){return t.jsx("select",{id:a,name:e.data.name,multiple:i,readOnly:!0,style:{display:"contents"}})}function p(){const v={...Z,...e.style||{}},M={padding:0,margin:0,border:"solid 1px #d9d9d9",marginTop:-1,borderRadius:5,maxHeight:150,overflowY:"auto",zIndex:99999};M.position="absolute",M.backgroundColor="white";const S=document.getElementById(r);if(e.data.icon&&(v.paddingLeft=30),S){let L=null,R=S,U=null;for(;!U&&(R=R.parentElement)instanceof HTMLElement;)R.matches("dialog")&&(U=R);L=U;const G=S.getBoundingClientRect();var u=G.top+G.height,g=G.left;if(L){const te=L.getBoundingClientRect();u=u-te.top,g=g-te.left}else u+=window.scrollY,g+=window.scrollX;M.width=G.width,M.top=u,M.left=g}const j={cursor:"pointer",padding:10},C=!i&&n.length>0&&n[0].value||"";return t.jsxs(t.Fragment,{children:[e.data.icon&&t.jsx(E,{icon:e.data.icon,style:{position:"absolute",margin:13,color:"#d9d9d9"}}),t.jsx("input",{id:r,name:e.data.name+"__autocomplete",type:"text",className:"form-control",onFocus:L=>{L.target.select(),D(L)},onChange:D,onMouseLeave:y,onBlur:y,defaultValue:C,style:v,"data-label":T(e.data.label)}),d&&o&&t.jsxs("ul",{style:M,onMouseLeave:b,onMouseEnter:function(L){h=!0},children:[d.length==0&&t.jsx("li",{style:j,children:"Nenhuma opção encontrada."}),d.map(L=>t.jsx("li",{onClick:()=>{s(!1),e.onSelect?e.onSelect(L):k(L)},style:j,className:"autocomplete-item","data-label":T(L.value),children:L.value},Math.random()))]})]})}function y(v){h=!1,setTimeout(function(){h||b(v)},250)}function b(v){const M=document.getElementById(a);if(M){const S=document.getElementById(r);i||M.options.length>0&&S.value!=M.options[0].innerHTML&&(M.innerHTML="",S.value="",s(!1),e.data.onchange&&K(S,e.data.onchange)),v.target.tagName=="UL"?s(!1):h||s(!1)}}function D(v){clearTimeout(l),l=setTimeout(function(){const M=v.target.closest("form"),S=e.data.choices.indexOf("?")<0?"?":"&";s(!0),B("GET",$(e.data.choices+S+"term="+v.target.value,M),function(g){c(g)})},1e3)}function k(v,M=!1){const S=document.getElementById(a),u=document.getElementById(r);S.innerHTML==null&&(S.innerHTML=""),Array.isArray(v)?S.innerHTML=v.map(g=>`<option selected value="${g.id}">${g.value}</option>`).join(""):v?i?(S.innerHTML+=`<option selected value="${v.id}">${v.value}</option>`,u.value=""):(S.innerHTML=`<option selected value="${v.id}">${v.value}</option>`,u.value=v.value):(S.innerHTML="",u.value=""),e.data.onchange&&!M&&K(u,e.data.onchange)}function q(v){const M=document.getElementById(a);var S=Array.from(M.options);M.innerHTML=S.slice(0,v).concat(S.slice(v+1)).map(u=>`<option selected value="${u.value}">${u.innerHTML}</option>`).join(""),c([])}function N(){return t.jsxs(t.Fragment,{children:[m(),f(),p()]})}return N()}function Ct(e){function n(){var a={...Z};return a.height=100,t.jsx("textarea",{id:e.data.name,name:e.data.name,"data-label":T(e.data.label),style:a,defaultValue:e.data.value||"",className:"form-control"})}return n()}function Et(e){var n=e.data;return n.choices=[{id:!0,value:"Sim"},{id:!1,value:"Não"}],t.jsx(de,{data:n})}function de(e){const[n,a]=I.useState(e.data.choices);var r=Math.random(),i=e.data;function o(h){return i.value!=null?i.value==h.id?!0:i.value.id==h.id:!1}function s(h){var l=document.getElementById(h);i.checked&&(l.checked=!1),e.data.onchange&&K(l,e.data.onchange)}function d(h){var l=document.getElementById(h);i.checked=l.checked}function c(){return window["reload-"+i.name+"-field"]=function(){B("GET",$(e.data.pick,document.querySelector(".radio-group."+i.name).closest("form")),function(l){a(l)})},n.length>0?t.jsx("div",{className:"radio-group "+i.name,children:n.map((h,l)=>(h.id||h.id===!1)&&t.jsxs("div",{style:{paddingTop:10,display:"inline-block",marginRight:25,width:window.innerWidth>800?"auto":"100%"},children:[t.jsx("input",{id:i.name+r+l,type:"radio",name:i.name,defaultValue:h.id,defaultChecked:o(h),"data-label":T(h.value),onClick:function(){s(i.name+r+l)},onMouseEnter:function(){d(i.name+r+l)}}),t.jsx("label",{htmlFor:i.name+r+l,children:h.value})]},r+l))}):t.jsx("div",{className:"radio-group empty "+i.name,children:t.jsx(ee,{data:{text:"Nenhuma opção disponível para seleção."}})})}return c()}function ve(e){const[n,a]=I.useState(e.data.choices);var r=Math.random(),i=e.data;function o(c){var h=!1;if(i.value)for(var l=0;l<i.value.length;l++){var m=i.value[l];(m==c.id||m.id==c.id)&&(h=!0)}return h}function s(c){e.data.onchange&&K(c.target,e.data.onchange)}function d(){return window["reload-"+i.name+"-field"]=function(){B("GET",$(e.data.pick,document.querySelector(".checkbox-group."+i.name).closest("form")),function(h){a(h)})},n.length>0?t.jsx("div",{className:"checkbox-group "+i.name,children:n.map((c,h)=>(c.id||c.id===!1)&&t.jsxs("div",{style:{paddingTop:10,display:"inline-block",marginRight:25,width:window.innerWidth>800?"auto":"100%"},children:[t.jsx("input",{id:i.name+r+h,type:"checkbox",name:i.name,onClick:s,defaultValue:c.id,defaultChecked:o(c),"data-label":T(c.value)}),t.jsx("label",{htmlFor:i.name+r+h,children:c.value})]},r+h))}):t.jsx("div",{className:"checkbox-group empty "+i.name,children:t.jsx(ee,{data:{text:"Nenhuma opção disponível para seleção."}})})}return d()}function Mt(e){var n=e.data;return t.jsx(t.Fragment,{children:t.jsx("select",{className:"form-control",id:n.name,name:n.name,"data-label":T(n.label),defaultValue:n.value,style:Z,children:n.choices.map(a=>t.jsx("option",{value:a.id,children:a.value},Math.random()))})})}function Tt(e){const n=Math.random(),a=e.data.value[0],r=a.fields?a.fields[0]:a.fieldsets[0].fields[0][0];function i(){return!e.data.required&&t.jsx("div",{id:"info-"+n,children:t.jsxs(ee,{data:{text:"Esta informação é opcional. Controle seu preenchimento com o botão ao lado."},children:[t.jsx(_,{primary:!0,icon:"pen-clip",onClick:()=>o(!0),id:"show-"+n,display:r.value?"none":"inline"}),t.jsx(_,{primary:!0,icon:"trash",onClick:()=>o(!1),id:"hide-"+n,display:r.value?"inline":"none"})]})})}function o(c){const h=document.querySelector("input[name="+r.name+"]"),l=document.getElementById("inline-form-"+n),m=document.getElementById("show-"+n),f=document.getElementById("hide-"+n);l.style.display=c?"block":"none",m.style.display=c?"none":"inline",f.style.display=c?"inline":"none",c?h.value===""?h.value=0:h.value=-parseInt(h.value):parseInt(h.value)==0?h.value="":h.value=-parseInt(h.value)}function s(){const c={display:r.value?"block":"none"};return e.data.required&&(c.display="block",r.value===""&&(r.value=0)),t.jsx("div",{className:"fieldset-inline-forms",style:c,id:"inline-form-"+n,children:e.data.value.map(function(h){return t.jsx(he,{data:h},Math.random())})})}function d(){const c={margin:0};return t.jsxs("div",{className:"form-fieldset",children:[t.jsx("h2",{style:c,"data-label":T(e.data.label),children:e.data.label}),i(),s()]})}return d()}function It(e){var n=0;const a=Math.random();e.data.template==null&&(e.data.template=e.data.value.pop());function r(l,m){const f=n;return n+=1,t.jsxs("div",{style:{display:"block"},id:"form-"+f+"-"+a,children:[t.jsx(he,{data:l}),t.jsxs("div",{style:{textAlign:"center",marginTop:10,marginBottom:10},children:[t.jsx(_,{primary:!0,icon:"plus",onClick:()=>o(),id:"extra-add-"+f+"-",display:m}),t.jsx(_,{primary:!0,icon:"trash",onClick:()=>s(f),display:"inline"})]})]},Math.random())}function i(){const l=d(),m=l.length>0?"none":"inline";document.getElementById("add-"+a).style.display=m;for(var f=0;f<n;f++){var p=document.getElementById("extra-add-"+f+"-");p.style.display="none"}if(l.length>0){var p=document.getElementById("extra-add-"+l[l.length-1]+"-");p.style.display="inline"}}function o(){i();var l=JSON.parse(JSON.stringify(e.data.template));l.fields?(l.fields.map(function(m){m.name=m.name.replace("__n__","__"+n+"__")}),l.fields[0].value=0):l.fieldsets.map(function(m){m.fields.map(function(f){f.map(function(p){p.name=p.name.replace("__n__","__"+n+"__")}),f[0].value=0})}),P.createRoot(document.getElementById(a).appendChild(document.createElement("div"))).render(r(l,"inline")),setTimeout(i,100)}function s(l){const m=e.data.template,p=(m.fields?m.fields[0]:m.fieldsets[0].fields[0][0]).name.replace("__n__","__"+l+"__"),y=document.querySelector("input[name="+p+"]");parseInt(y.value)==0?y.value="":y.value=-parseInt(y.value),document.getElementById("form-"+l+"-"+a).style.display="none",i()}function d(){for(var l=[],m=0;m<n;m++)document.getElementById("form-"+m+"-"+a).style.display=="block"&&l.push(m);return l}function c(){return t.jsx("div",{id:"info-"+a,children:t.jsx(ee,{data:{text:'Clique no botão com o ícone de "+" para adicionar e com o ícone da "lixeira" para remover.'},children:t.jsx(_,{primary:!0,icon:"add",onClick:()=>o(),id:"add-"+a,display:e.data.value.length>0?"none":"inline"})})})}function h(){const l={margin:0};return t.jsxs("div",{className:"form-fieldset",children:[t.jsx("h2",{style:l,"data-label":T(e.data.label),children:e.data.label}),t.jsx("div",{children:!1}),t.jsxs("div",{id:a,className:"fieldset-inline-forms",children:[c(),e.data.value.map(function(m,f){return r(m,f==e.data.value.length-1?"inline":"none")})]})]})}return h()}function he(e){I.useEffect(()=>{e.data.controls&&Me(e.data.controls)},[]);function n(r){return r.type=="inline"?r.max==r.min==1?t.jsx(Tt,{data:r},Math.random()):t.jsx(It,{data:r},Math.random()):t.jsx(ae,{data:r},Math.random())}function a(){return e.data.fields?t.jsx("div",{className:"form-fields",children:e.data.fields.map(r=>n(r))}):e.data.fieldsets.map(r=>t.jsx("div",{className:"form-fieldset",children:r.type=="inline"?n(r):t.jsxs(t.Fragment,{children:[t.jsx("h2",{"data-label":T(r.title),style:{margin:0},children:r.title}),r.fields.map(i=>t.jsx("div",{children:i.map(o=>t.jsx("div",{className:"form-group "+o.name,style:{verticalAlign:"bottom",width:100/i.length+"%",display:o.type=="hidden"?"none":"inline-block"},children:n(o)},Math.random()))},Math.random()))]})},Math.random()))}return a()}function Nt(e){const n=Math.random();I.useEffect(()=>{e.data.autosubmit&&setInterval(m,e.data.autosubmit*1e3)},[]);function a(){const f={margin:0,color:w.colors.primary};return t.jsx("h1",{style:f,children:e.data.title})}function r(){return e.data.info&&t.jsx(jt,{data:{text:e.data.info}})}function i(){if(e.data.display)return t.jsxs(t.Fragment,{children:[e.data.display.map(f=>t.jsx(x,{data:f},Math.random())),t.jsx("div",{style:{marginTop:30}})]})}function o(){return t.jsx(he,{data:e.data})}function s(){return t.jsxs("div",{style:{marginTop:20,textAlign:"right"},children:[t.jsx(_,{onClick:l,label:"Cancelar",default:!0,display:"inline"}),t.jsx(_,{onClick:m,label:"Enviar",primary:!0,display:"inline",icon:"chevron-right",spin:!0})]})}function d(){return t.jsx("div",{id:"output",style:{marginTop:30}})}function c(){if(e.data.image)return t.jsx("div",{style:{margin:"auto",width:"100%",textAlign:"center"},children:t.jsx("img",{src:e.data.image})})}function h(){return t.jsxs("form",{id:n,className:e.data.key,action:e.data.url,style:{margin:"auto",backgroundColor:"white"},method:e.data.method,children:[t.jsx("div",{children:!1}),t.jsxs("div",{style:{padding:5},children:[a(),c(),r(),i(),o(),s(),d()]})]})}function l(){J()}function m(f){f&&f.preventDefault();var p=e.data.url,y=document.getElementById(n),b=new FormData(y);if(y.method.toUpperCase()=="GET"){const D=p.indexOf("?")>=0?"&":"?";p=p+D+"form="+e.data.title+"&"+new URLSearchParams(b).toString(),b=null}e.data.autosubmit&&f==null&&(p+="&autosubmit=1"),B(y.method.toUpperCase(),p,function(k){if(y.querySelectorAll(".error").forEach(N=>N.style.display="none"),f&&f.target.dataset.spinning&&(f.target.querySelector("i.fa-spin").style.display="none",f.target.querySelector("i.fa-"+f.target.dataset.spinning).style.display="inline-block"),k.type=="response")if(k.store&&we(k.store),k.redirect&&k.redirect.length>2)k.message&&localStorage.setItem("message",k.message),document.location.href=V(k.redirect);else if(k.message&&z(k.message),k.task){let N=function(){B("GET","/api/job/progress/"+k.task+"/",function(S){S==null||S.progress==100?f.target.innerHTML=v:(f.target.innerHTML="Aguarde... ("+(S.progress||0)+"%)",setTimeout(N,5e3))})};const v=f.target.innerHTML;f.target.innerHTML="Aguarde... (0%)",N()}else k.redirect==".."&&(document.getElementsByTagName("dialog").length==0?history.back():J()),k.redirect=="."&&y.reset(),k.dispose&&(y.style.display="none"),Ke();else if(k.type=="error"){var q=k.text;console.log(k),Object.keys(k.errors).map(function(N){if(N=="__all__")q=k.errors[N];else{const v=y.querySelector("#"+N+"_error");v==null?q=N+":"+k.errors[N]:(v.querySelector("span").innerHTML=k.errors[N],v.style.display="block")}}),z(q,!0)}else{const N=document.querySelector("#output");N.innerHTML="",P.createRoot(N.appendChild(document.createElement("div"))).render(t.jsx(x,{data:k}))}},b)}return h()}function Dt(e){A(`
|
|
127
|
+
`),t.jsxs("div",{className:"tooltip",children:[e.children,t.jsx("div",{className:"tooltiptext",children:H(e.text)})]})}return n()}const xt=["text","password","email","number","date","datetime-local","file","image","range","search","tel","time","url","week","hidden","color"],Z={padding:15,border:"solid 1px #d9d9d9",borderRadius:5,backgroundColor:"white"};function yt(e,n){const a=new FormData(e);for(let[r,i]of Array.from(a.entries())){const o=e[r];n!=r&&(o.tagName=="SELECT"&&i!==""||o.tagName==null&&i!==""||o.type=="radio"&&i!==""||o.type=="checkbox"&&i!==""||a.delete(r))}return new URLSearchParams(a).toString()}function $(e,n,a){const r=e.indexOf("?")<0?"?":"&",i=yt(n,a);return e=e+(i?r+i:""),e}function le(e){if(e){const a=[".png",".jpeg",".jpeg",".gif"];for(var n=0;n<a.length;n++)if(e.toLowerCase().indexOf(a[n])>0)return!0}}function K(e,n){B("GET",$(n,e.closest("form"),e.name),Me)}function vt(e){if(e){var n=document.querySelector(".form-fieldset."+e);n&&(n.style.display="none");var a=document.querySelector(".form-group."+e);a&&(a.style.display="none")}}function bt(e){if(e){var n=document.querySelector(".form-fieldset."+e);n&&(n.style.display="block");var a=document.querySelector(".form-group."+e);a&&(a.style.display="block")}}function pt(e){const n="reload-"+e+"-field";window[n]&&window[n]()}function wt(e,n){var a=document.querySelector(".form-group."+e),r=a.querySelector('*[name="'+e+'"]');if(r.tagName=="INPUT")r.value=n;else if(r.tagName=="SELECT"){if(r.style.display!="none")r.dispatchEvent(new CustomEvent("customchange",{detail:{value:n}}));else for(var i=0;i<r.options.length;i++)if(r.options[i].value==n){r.selectedIndex=i;break}}}function Me(e){if(e){for(var n=0;n<e.hide.length;n++)vt(e.hide[n]);for(var n=0;n<e.show.length;n++)bt(e.show[n]);for(var n=0;n<e.reload.length;n++)pt(e.reload[n]);for(var a in e.set)wt(a,e.set[a])}}function jt(e){function n(){const a={color:w.colors.info,backgroundColor:w.background.info,padding:20,display:"flex",justifyContent:"space-between",marginTop:10,marginBottom:10};return t.jsxs("div",{style:a,children:[t.jsxs("div",{children:[t.jsx(E,{icon:"circle-check",style:{color:w.colors.info,marginRight:20}}),e.data.text]}),e.children&&t.jsx("div",{children:e.children})]})}return n()}function kt(e){function n(){const a={color:"white",display:"none",backgroundColor:"#e52207",marginTop:2,marginBottom:2,padding:8};return t.jsxs("div",{style:a,id:e.id,className:"error",children:[t.jsx(E,{icon:"xmark-circle",style:{marginRight:5}}),t.jsx("span",{})]})}return n()}function St(e){function n(){const a={marginTop:2,marginBottom:2,fontStyle:"italic"};return t.jsx("div",{style:a,children:t.jsx("span",{children:e.text})})}return n()}function ae(e){const n=e.data.name+Math.random();function a(){const d={display:"flex",justifyContent:"space-between",alignItems:"baseline"};return e.data.action&&(e.data.action.icon=null,e.data.action.modal=!0,e.data.action.urlfunc=function(){return $(e.data.action.url,document.getElementById(n).closest("form"))}),t.jsxs("div",{style:d,children:[t.jsxs("label",{className:"bold",children:[e.data.label," ",e.data.label&&e.data.required?"*":""]}),e.data.action&&t.jsx(F,{data:e.data.action,style:{padding:0,margin:0}})]})}function r(){return e.data.type=="datetime"&&(e.data.type="datetime-local"),xt.indexOf(e.data.type)>=0?t.jsx(ye,{data:e.data}):e.data.type=="choice"&&Array.isArray(e.data.choices)?e.data.pick?Array.isArray(e.data.value)?t.jsx(ve,{data:e.data}):t.jsx(de,{data:e.data}):t.jsx(Mt,{data:e.data}):e.data.type=="choice"?e.data.pick?Array.isArray(e.data.value)?t.jsx(ve,{data:e.data}):t.jsx(de,{data:e.data}):t.jsx(Te,{data:e.data}):e.data.type=="decimal"?t.jsx(ye,{data:e.data}):e.data.type=="boolean"?t.jsx(Et,{data:e.data}):e.data.type=="textarea"?t.jsx(Ct,{data:e.data}):e.data.type=="scheduler"?(e.data.scheduler.input_name=e.data.name,t.jsx(Ee,{data:e.data.scheduler})):t.jsx("span",{children:e.data.name})}function i(){return t.jsx("div",{children:t.jsx(kt,{id:e.data.name+"_error"})})}function o(){return e.data.help_text&&t.jsx(St,{text:e.data.help_text})}function s(){const d={display:e.data.type=="hidden"?"none":"flex",flexDirection:"column",padding:5,width:"calc(100%-5px)"};return t.jsxs("div",{id:n,style:d,children:[a(),r(),o(),i()]})}return s()}function ye(e){var n="";const a=e.data.name+Math.random();e.data.mask=="decimal"&&(n="decimal",e.data.value&&(e.data.value=Math.round(parseFloat(e.data.value)).toFixed(2).replace(".",","))),I.useEffect(()=>{function s(h,l,m){var f=m.target,p=f.value.replace(/\D/g,""),y=f.value.length>l?1:0;VMasker(f).unMask(),VMasker(f).maskPattern(h[y]),f.value=VMasker.toPattern(p,h[y])}if(e.data.mask){var d=document.getElementById(a);if(e.data.mask=="decimal")VMasker(d).maskMoney({precision:2,separator:",",delimiter:"."});else if(e.data.mask.indexOf("|")>0){var c=e.data.mask.split("|");VMasker(d).maskPattern(c[0]),d.addEventListener("input",s.bind(void 0,c,14),!1)}else VMasker(d).maskPattern(e.data.mask)}},[]);function r(s){K(s.target,e.data.onchange)}function i(s){if(e.data.type=="file"&&s.target.files){let c=s.target.files[0];var d=new FileReader;d.onload=function(h){if(le(c.name)){const p="display"+a;var l=document.createElement("img");l.id=s.target.id+"img",l.style.width="200px",l.style.display="block",l.style.margin="auto",l.style.marginTop="20px",l.onload=function(y){const b=e.data.width>e.data.height?e.data.width/l.width:e.data.height/l.height;var D=document.createElement("canvas");const k=D.getContext("2d");D.height=D.width*(l.height/l.width);const q=document.createElement("canvas"),N=q.getContext("2d");q.width=l.width*b,q.height=l.height*b,N.drawImage(l,0,0,q.width,q.height),k.drawImage(q,0,0,q.width*b,q.height*b,0,0,D.width,D.height),q.toBlob(function(M){const S=new DataTransfer;S.items.add(new File([M],c.name)),s.target.files=S.files});var v=document.getElementById(p);v==null?(v=document.createElement("div"),v.id=p):v.removeChild(v.childNodes[0]),v.appendChild(l),s.target.parentNode.appendChild(v)},l.src=h.target.result}const m=document.getElementById("fileinfo"+a);var f=c.size/1024;f<1024?f=parseInt(f)+" Kb":f=(f/1024).toFixed(2)+" Mb",m.innerHTML=c.name+" / "+f,e.data.max_size&&c.size/1024/1024>e.data.max_size&&alert("O limite de tamanho é "+e.data.max_size+"Mb. O arquivo informado possui "+f+". Por favor, adicione um arquivo menor.")},d.readAsDataURL(c)}}function o(){var s=e.data.type;if(s=="datetime"&&(s="datetime-regional"),s=="decimal"&&(s="text"),s=="file"){const h={alignContent:"center",minHeight:75,padding:5,maxWidth:"100%",margin:"auto"};var d=null;return e.data.extensions&&e.data.extensions.length>0&&(d=e.data.extensions.map(l=>"."+l).join(", ")),t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{display:window.innerWidth<800?"block":"flex",justifyContent:"space-between",backgroundColor:"rgba(15, 145, 210, 0.05)",border:"1px dashed rgba(15, 145, 210, 0.4)",borderRadius:10,textAlign:"center"},children:[t.jsx("div",{style:h,children:t.jsx(E,{icon:"cloud-upload",style:{fontSize:"2.5rem",color:w.colors.primary}})}),t.jsxs("div",{style:h,children:[e.data.value&&le(e.data.value)&&t.jsx("div",{style:{textAlign:"center"},children:t.jsx("img",{src:e.data.value,height:50})}),e.data.value&&!le(e.data.value)&&t.jsx("div",{style:{textAlign:"center"},children:e.data.value}),"Selecione um arquivo clicando no botão ao lado.",t.jsxs("div",{className:"bold",id:"fileinfo"+a,children:["O arquivo",e.data.max_size&&"deve possuir até "+e.data.max_size+" Mb e ","deve ter extensão"," ",e.data.extensions.map(l=>"."+l).join(" ou "),"."]})]}),t.jsx("div",{style:h,align:"center",children:t.jsx(_,{label:"Selecionar Arquivo",onClick:()=>document.getElementById(a).click()})})]}),t.jsx("input",{className:"form-control "+n,type:s,name:e.data.name,id:a,"data-label":T(e.data.label),readOnly:e.data.read_only,onBlur:e.data.onchange?r:null,onChange:i,style:{zIndex:"-1",marginTop:-20},accept:d})]})}else{var c=Z;return s=="color"&&(c={...Z},c.width="100%",c.backgroundColor="white",c.height=47.5),t.jsx("input",{className:"form-control "+n,type:s,name:e.data.name,id:a,defaultValue:e.data.value,"data-label":T(e.data.label),readOnly:e.data.read_only,onBlur:e.data.onchange?r:null,onChange:i,style:c})}}return o()}function Te(e){var n=[];Array.isArray(e.data.value)?e.data.value.forEach(function(v,M){n.push({id:v.id,value:v.label})}):e.data.value!=null&&n.push({id:e.data.value.id,value:e.data.value.label}),e.data.id==null&&(e.data.id=Math.random()),e.data.id2==null&&(e.data.id2=e.data.id+"__autocomplete");const a=e.data.id,r=e.data.id2,i=Array.isArray(e.data.value),[o,s]=I.useState(!1),[d,c]=I.useState(null);var h=!1;let l;I.useEffect(()=>{k(n,!0),document.getElementById(a).addEventListener("customchange",function(v){k(v.detail.value);const M=document.getElementById(e.data.name);M&&reactTriggerChange(M)})},[]);function m(){const v=document.getElementById(a);if(i){const M={padding:5,display:"inline"},S={cursor:"pointer",marginRight:5},u={fontSize:"0.8rem"};return t.jsxs("div",{children:[v==null&&n.map((g,j)=>t.jsxs("div",{style:M,children:[t.jsx("span",{onClick:()=>q(j),style:S,children:t.jsx(E,{icon:"trash-can",style:u})}),g.value]},Math.random())),v!=null&&Array.from(v.options).map((g,j)=>t.jsxs("div",{style:M,children:[t.jsx("span",{onClick:()=>q(j),style:S,children:t.jsx(E,{icon:"trash-can",style:u})}),g.innerHTML]},Math.random()))]})}}function f(){return t.jsx("select",{id:a,name:e.data.name,multiple:i,readOnly:!0,style:{display:"contents"}})}function p(){const v={...Z,...e.style||{}},M={padding:0,margin:0,border:"solid 1px #d9d9d9",marginTop:-1,borderRadius:5,maxHeight:150,overflowY:"auto",zIndex:99999};M.position="absolute",M.backgroundColor="white";const S=document.getElementById(r);if(e.data.icon&&(v.paddingLeft=30),S){let L=null,R=S,U=null;for(;!U&&(R=R.parentElement)instanceof HTMLElement;)R.matches("dialog")&&(U=R);L=U;const G=S.getBoundingClientRect();var u=G.top+G.height,g=G.left;if(L){const te=L.getBoundingClientRect();u=u-te.top,g=g-te.left}else u+=window.scrollY,g+=window.scrollX;M.width=G.width,M.top=u,M.left=g}const j={cursor:"pointer",padding:10},C=!i&&n.length>0&&n[0].value||"";return t.jsxs(t.Fragment,{children:[e.data.icon&&t.jsx(E,{icon:e.data.icon,style:{position:"absolute",margin:13,color:"#d9d9d9"}}),t.jsx("input",{id:r,name:e.data.name+"__autocomplete",type:"text",className:"form-control",onFocus:L=>{L.target.select(),D(L)},onChange:D,onMouseLeave:y,onBlur:y,defaultValue:C,style:v,"data-label":T(e.data.label)}),d&&o&&t.jsxs("ul",{style:M,onMouseLeave:b,onMouseEnter:function(L){h=!0},children:[d.length==0&&t.jsx("li",{style:j,children:"Nenhuma opção encontrada."}),d.map(L=>t.jsx("li",{onClick:()=>{s(!1),e.onSelect?e.onSelect(L):k(L)},style:j,className:"autocomplete-item","data-label":T(L.value),children:L.value},Math.random()))]})]})}function y(v){h=!1,setTimeout(function(){h||b(v)},250)}function b(v){const M=document.getElementById(a);if(M){const S=document.getElementById(r);i||M.options.length>0&&S.value!=M.options[0].innerHTML&&(M.innerHTML="",S.value="",s(!1),e.data.onchange&&K(S,e.data.onchange)),v.target.tagName=="UL"?s(!1):h||s(!1)}}function D(v){clearTimeout(l),l=setTimeout(function(){const M=v.target.closest("form"),S=e.data.choices.indexOf("?")<0?"?":"&";s(!0),B("GET",$(e.data.choices+S+"term="+v.target.value,M),function(g){c(g)})},1e3)}function k(v,M=!1){const S=document.getElementById(a),u=document.getElementById(r);S.innerHTML==null&&(S.innerHTML=""),Array.isArray(v)?S.innerHTML=v.map(g=>`<option selected value="${g.id}">${g.value}</option>`).join(""):v?i?(S.innerHTML+=`<option selected value="${v.id}">${v.value}</option>`,u.value=""):(S.innerHTML=`<option selected value="${v.id}">${v.value}</option>`,u.value=v.value):(S.innerHTML="",u.value=""),e.data.onchange&&!M&&K(u,e.data.onchange)}function q(v){const M=document.getElementById(a);var S=Array.from(M.options);M.innerHTML=S.slice(0,v).concat(S.slice(v+1)).map(u=>`<option selected value="${u.value}">${u.innerHTML}</option>`).join(""),c([])}function N(){return t.jsxs(t.Fragment,{children:[m(),f(),p()]})}return N()}function Ct(e){function n(){var a={...Z};return a.height=100,t.jsx("textarea",{id:e.data.name,name:e.data.name,"data-label":T(e.data.label),style:a,defaultValue:e.data.value||"",className:"form-control"})}return n()}function Et(e){var n=e.data;return n.choices=[{id:!0,value:"Sim"},{id:!1,value:"Não"}],t.jsx(de,{data:n})}function de(e){const[n,a]=I.useState(e.data.choices);var r=Math.random(),i=e.data;function o(h){return i.value!=null?i.value==h.id?!0:i.value.id==h.id:!1}function s(h){var l=document.getElementById(h);i.checked&&(l.checked=!1),e.data.onchange&&K(l,e.data.onchange)}function d(h){var l=document.getElementById(h);i.checked=l.checked}function c(){return window["reload-"+i.name+"-field"]=function(){B("GET",$(e.data.pick,document.querySelector(".radio-group."+i.name).closest("form")),function(l){a(l)})},n.length>0?t.jsx("div",{className:"radio-group "+i.name,children:n.map((h,l)=>(h.id||h.id===!1)&&t.jsxs("div",{style:{paddingTop:10,display:"inline-block",marginRight:25,width:window.innerWidth>800?"auto":"100%"},children:[t.jsx("input",{id:i.name+r+l,type:"radio",name:i.name,defaultValue:h.id,defaultChecked:o(h),"data-label":T(h.value),onClick:function(){s(i.name+r+l)},onMouseEnter:function(){d(i.name+r+l)}}),t.jsx("label",{htmlFor:i.name+r+l,children:h.value})]},r+l))}):t.jsx("div",{className:"radio-group empty "+i.name,children:t.jsx(ee,{data:{text:"Nenhuma opção disponível para seleção."}})})}return c()}function ve(e){const[n,a]=I.useState(e.data.choices);var r=Math.random(),i=e.data;function o(c){var h=!1;if(i.value)for(var l=0;l<i.value.length;l++){var m=i.value[l];(m==c.id||m.id==c.id)&&(h=!0)}return h}function s(c){e.data.onchange&&K(c.target,e.data.onchange)}function d(){return window["reload-"+i.name+"-field"]=function(){B("GET",$(e.data.pick,document.querySelector(".checkbox-group."+i.name).closest("form")),function(h){a(h)})},n.length>0?t.jsx("div",{className:"checkbox-group "+i.name,children:n.map((c,h)=>(c.id||c.id===!1)&&t.jsxs("div",{style:{paddingTop:10,display:"inline-block",marginRight:25,width:window.innerWidth>800?"auto":"100%"},children:[t.jsx("input",{id:i.name+r+h,type:"checkbox",name:i.name,onClick:s,defaultValue:c.id,defaultChecked:o(c),"data-label":T(c.value)}),t.jsx("label",{htmlFor:i.name+r+h,children:c.value})]},r+h))}):t.jsx("div",{className:"checkbox-group empty "+i.name,children:t.jsx(ee,{data:{text:"Nenhuma opção disponível para seleção."}})})}return d()}function Mt(e){var n=e.data;return t.jsx(t.Fragment,{children:t.jsx("select",{className:"form-control",id:n.name,name:n.name,"data-label":T(n.label),defaultValue:n.value,style:Z,children:n.choices.map(a=>t.jsx("option",{value:a.id,children:a.value},Math.random()))})})}function Tt(e){const n=Math.random(),a=e.data.value[0],r=a.fields?a.fields[0]:a.fieldsets[0].fields[0][0];function i(){return!e.data.required&&t.jsx("div",{id:"info-"+n,children:t.jsxs(ee,{data:{text:"Esta informação é opcional. Controle seu preenchimento com o botão ao lado."},children:[t.jsx(_,{primary:!0,icon:"pen-clip",onClick:()=>o(!0),id:"show-"+n,display:r.value?"none":"inline"}),t.jsx(_,{primary:!0,icon:"trash",onClick:()=>o(!1),id:"hide-"+n,display:r.value?"inline":"none"})]})})}function o(c){const h=document.querySelector("input[name="+r.name+"]"),l=document.getElementById("inline-form-"+n),m=document.getElementById("show-"+n),f=document.getElementById("hide-"+n);l.style.display=c?"block":"none",m.style.display=c?"none":"inline",f.style.display=c?"inline":"none",c?h.value===""?h.value=0:h.value=-parseInt(h.value):parseInt(h.value)==0?h.value="":h.value=-parseInt(h.value)}function s(){const c={display:r.value?"block":"none"};return e.data.required&&(c.display="block",r.value===""&&(r.value=0)),t.jsx("div",{className:"fieldset-inline-forms",style:c,id:"inline-form-"+n,children:e.data.value.map(function(h){return t.jsx(he,{data:h},Math.random())})})}function d(){const c={margin:0};return t.jsxs("div",{className:"form-fieldset",children:[t.jsx("h2",{style:c,"data-label":T(e.data.label),children:e.data.label}),i(),s()]})}return d()}function It(e){var n=0;const a=Math.random();e.data.template==null&&(e.data.template=e.data.value.pop());function r(l,m){const f=n;return n+=1,t.jsxs("div",{style:{display:"block"},id:"form-"+f+"-"+a,children:[t.jsx(he,{data:l}),t.jsxs("div",{style:{textAlign:"center",marginTop:10,marginBottom:10},children:[t.jsx(_,{primary:!0,icon:"plus",onClick:()=>o(),id:"extra-add-"+f+"-",display:m}),t.jsx(_,{primary:!0,icon:"trash",onClick:()=>s(f),display:"inline"})]})]},Math.random())}function i(){const l=d(),m=l.length>0?"none":"inline";document.getElementById("add-"+a).style.display=m;for(var f=0;f<n;f++){var p=document.getElementById("extra-add-"+f+"-");p.style.display="none"}if(l.length>0){var p=document.getElementById("extra-add-"+l[l.length-1]+"-");p.style.display="inline"}}function o(){i();var l=JSON.parse(JSON.stringify(e.data.template));l.fields?(l.fields.map(function(m){m.name=m.name.replace("__n__","__"+n+"__")}),l.fields[0].value=0):l.fieldsets.map(function(m){m.fields.map(function(f){f.map(function(p){p.name=p.name.replace("__n__","__"+n+"__")}),f[0].value=0})}),P.createRoot(document.getElementById(a).appendChild(document.createElement("div"))).render(r(l,"inline")),setTimeout(i,100)}function s(l){const m=e.data.template,p=(m.fields?m.fields[0]:m.fieldsets[0].fields[0][0]).name.replace("__n__","__"+l+"__"),y=document.querySelector("input[name="+p+"]");parseInt(y.value)==0?y.value="":y.value=-parseInt(y.value),document.getElementById("form-"+l+"-"+a).style.display="none",i()}function d(){for(var l=[],m=0;m<n;m++)document.getElementById("form-"+m+"-"+a).style.display=="block"&&l.push(m);return l}function c(){return t.jsx("div",{id:"info-"+a,children:t.jsx(ee,{data:{text:'Clique no botão com o ícone de "+" para adicionar e com o ícone da "lixeira" para remover.'},children:t.jsx(_,{primary:!0,icon:"add",onClick:()=>o(),id:"add-"+a,display:e.data.value.length>0?"none":"inline"})})})}function h(){const l={margin:0};return t.jsxs("div",{className:"form-fieldset",children:[t.jsx("h2",{style:l,"data-label":T(e.data.label),children:e.data.label}),t.jsx("div",{children:!1}),t.jsxs("div",{id:a,className:"fieldset-inline-forms",children:[c(),e.data.value.map(function(m,f){return r(m,f==e.data.value.length-1?"inline":"none")})]})]})}return h()}function he(e){I.useEffect(()=>{e.data.controls&&Me(e.data.controls)},[]);function n(r){return r.type=="inline"?r.max==r.min==1?t.jsx(Tt,{data:r},Math.random()):t.jsx(It,{data:r},Math.random()):t.jsx(ae,{data:r},Math.random())}function a(){return e.data.fields?t.jsx("div",{className:"form-fields",children:e.data.fields.map(r=>n(r))}):e.data.fieldsets.map(r=>t.jsx("div",{className:"form-fieldset",children:r.type=="inline"?n(r):t.jsxs(t.Fragment,{children:[t.jsx("h2",{"data-label":T(r.title),style:{margin:0},children:r.title}),r.fields.map(i=>t.jsx("div",{children:i.map(o=>t.jsx("div",{className:"form-group "+o.name,style:{verticalAlign:"bottom",width:100/i.length+"%",display:o.type=="hidden"?"none":"inline-block"},children:n(o)},Math.random()))},Math.random()))]})},Math.random()))}return a()}function Nt(e){const n=Math.random();I.useEffect(()=>{e.data.autosubmit&&setInterval(m,e.data.autosubmit*1e3)},[]);function a(){const f={margin:0,color:w.colors.primary};return t.jsx("h1",{style:f,children:e.data.title})}function r(){return e.data.info&&t.jsx(jt,{data:{text:e.data.info}})}function i(){if(e.data.display)return t.jsxs(t.Fragment,{children:[e.data.display.map(f=>t.jsx(x,{data:f},Math.random())),t.jsx("div",{style:{marginTop:30}})]})}function o(){return t.jsx(he,{data:e.data})}function s(){return t.jsxs("div",{style:{marginTop:20,textAlign:"right"},children:[t.jsx(_,{onClick:l,label:"Cancelar",default:!0,display:"inline"}),t.jsx(_,{onClick:m,label:"Enviar",primary:!0,display:"inline",icon:"chevron-right",spin:!0})]})}function d(){return t.jsx("div",{id:"output",style:{marginTop:30}})}function c(){if(e.data.image)return t.jsx("div",{style:{margin:"auto",width:"100%",textAlign:"center"},children:t.jsx("img",{src:e.data.image})})}function h(){return t.jsxs("form",{id:n,className:e.data.key,action:e.data.url,style:{margin:"auto",backgroundColor:"white"},method:e.data.method,children:[t.jsx("div",{children:!1}),t.jsxs("div",{style:{padding:5},children:[a(),c(),r(),i(),o(),s(),d()]})]})}function l(){J()}function m(f){f&&f.preventDefault();var p=e.data.url,y=document.getElementById(n),b=new FormData(y);if(y.method.toUpperCase()=="GET"){const D=p.indexOf("?")>=0?"&":"?";p=p+D+"form="+e.data.title+"&"+new URLSearchParams(b).toString(),b=null}e.data.autosubmit&&f==null&&(p+="&autosubmit=1"),B(y.method.toUpperCase(),p,function(k){if(y.querySelectorAll(".error").forEach(N=>N.style.display="none"),f&&f.target.dataset.spinning&&(f.target.querySelector("i.fa-spin").style.display="none",f.target.querySelector("i.fa-"+f.target.dataset.spinning).style.display="inline-block"),k.type=="response")if(k.store&&we(k.store),k.redirect&&k.redirect.length>2)k.message&&localStorage.setItem("message",k.message),document.location.href=V(k.redirect);else if(k.message&&z(k.message),k.task){let N=function(){B("GET","/api/job/progress/"+k.task+"/",function(S){S==null||S.progress==100?f.target.innerHTML=v:(f.target.innerHTML="Aguarde... ("+(S.progress||0)+"%)",setTimeout(N,5e3))})};const v=f.target.innerHTML;f.target.innerHTML="Aguarde... (0%)",N()}else k.redirect==".."&&(document.getElementsByTagName("dialog").length==0?history.back():J()),k.redirect=="."&&y.reset(),k.dispose&&(y.style.display="none"),Ke();else if(k.type=="error"){var q=k.text;console.log(k),Object.keys(k.errors).map(function(N){if(N=="__all__")q=k.errors[N];else{const v=y.querySelector("#"+N+"_error");v==null?q=N+":"+k.errors[N]:(v.querySelector("span").innerHTML=k.errors[N],v.style.display="block")}}),z(q,!0)}else if(k.type!="redirect"){const N=document.querySelector("#output");N.innerHTML="",P.createRoot(N.appendChild(document.createElement("div"))).render(t.jsx(x,{data:k}))}},b)}return h()}function Dt(e){A(`
|
|
128
128
|
.calendar table{
|
|
129
129
|
width: 100%;
|
|
130
130
|
border-spacing: 0px;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import pytz
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from django.utils import timezone
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def now():
|
|
7
|
+
return datetime.now().astimezone(timezone.get_current_timezone()).replace(tzinfo=None)
|
|
8
|
+
|
|
9
|
+
def today():
|
|
10
|
+
return now().date()
|
|
11
|
+
|
|
12
|
+
def localtime(tz, _datetime=None):
|
|
13
|
+
return (_datetime or datetime.now()).replace(tzinfo=timezone.get_default_timezone()).astimezone(pytz.timezone(tz)).replace(tzinfo=None)
|
|
@@ -18,6 +18,7 @@ slth/statistics.py
|
|
|
18
18
|
slth/tasks.py
|
|
19
19
|
slth/tests.py
|
|
20
20
|
slth/threadlocal.py
|
|
21
|
+
slth/tz.py
|
|
21
22
|
slth/urls.py
|
|
22
23
|
slth/utils.py
|
|
23
24
|
slth/views.py
|
|
@@ -62,6 +63,7 @@ slth/endpoints/pushsubscription.py
|
|
|
62
63
|
slth/endpoints/report.py
|
|
63
64
|
slth/endpoints/role.py
|
|
64
65
|
slth/endpoints/task.py
|
|
66
|
+
slth/endpoints/timezone.py
|
|
65
67
|
slth/endpoints/user.py
|
|
66
68
|
slth/management/__init__.py
|
|
67
69
|
slth/management/commands/__init__.py
|
|
@@ -80,6 +82,8 @@ slth/migrations/0007_deletion_log.py
|
|
|
80
82
|
slth/migrations/0008_alter_deletion_datetime_alter_log_datetime.py
|
|
81
83
|
slth/migrations/0009_remove_email_from_email_email_action_email_attempt_and_more.py
|
|
82
84
|
slth/migrations/0010_email_key_alter_email_action_alter_email_attempt_and_more.py
|
|
85
|
+
slth/migrations/0011_usertimezone.py
|
|
86
|
+
slth/migrations/0012_timezone_remove_usertimezone_key_and_more.py
|
|
83
87
|
slth/migrations/__init__.py
|
|
84
88
|
slth/pdf/__init__.py
|
|
85
89
|
slth/pdf/tests.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{slthcore-0.3.6 → slthcore-0.3.8}/slth/cmd/init/boilerplate/backend/api/endpoints/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0003_rename_photo_profile_alter_profile_options.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{slthcore-0.3.6 → slthcore-0.3.8}/slth/migrations/0008_alter_deletion_datetime_alter_log_datetime.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|