slthcore 0.3.5__tar.gz → 0.3.7__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.5/slthcore.egg-info → slthcore-0.3.7}/PKG-INFO +1 -1
- {slthcore-0.3.5 → slthcore-0.3.7}/setup.py +1 -1
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/__init__.py +4 -1
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/forms.py +4 -3
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/serializer.py +1 -3
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/static/js/slth.min.js +1 -1
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/utils.py +1 -1
- {slthcore-0.3.5 → slthcore-0.3.7/slthcore.egg-info}/PKG-INFO +1 -1
- {slthcore-0.3.5 → slthcore-0.3.7}/MANIFEST.in +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/setup.cfg +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/apps.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/configure/__main__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/__main__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/__pycache__/__main__.cpython-312.pyc +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/.DS_Store +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/.gitignore +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/api/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/api/asgi.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/api/endpoints/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/api/models.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/api/settings.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/api/tests.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/api/urls.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/api/wsgi.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/application.yml +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/entrypoint.sh +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/manage.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/backend/requirements.txt +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/base.env +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/docker-compose.yml +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/frontend/package.json +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/frontend/src/main.jsx +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/frontend/vite.config.js +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/local.env +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/run.sh +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/selenium/run.sh +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/cmd/init/boilerplate/test.sh +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/components.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/db/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/db/generic.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/db/models.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/auth.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/deletion.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/dev.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/email.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/job.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/log.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/profile.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/pushsubscription.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/report.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/role.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/task.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/endpoints/user.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/exceptions.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/factory.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/management/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/management/commands/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/management/commands/integration_test.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/management/commands/sync.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/management/commands/worker.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/middleware/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/middleware/timezone.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0001_initial.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0002_email_role_pushsubscription_error.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0003_rename_photo_profile_alter_profile_options.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0004_alter_profile_photo.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0005_alter_profile_photo.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0006_user.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0007_deletion_log.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0008_alter_deletion_datetime_alter_log_datetime.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0009_remove_email_from_email_email_action_email_attempt_and_more.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/0010_email_key_alter_email_action_alter_email_attempt_and_more.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/migrations/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/models.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/notifications.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/oauth.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/pdf/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/pdf/tests.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/permissions.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/printer.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/queryset.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/roles.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/selenium/__init__.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/selenium/browser.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/static/.DS_Store +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/static/css/.DS_Store +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/static/css/slth.css +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/static/js/index.min.js +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/static/js/react.min.js +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/statistics.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/tasks.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/templates/email.html +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/templates/index.html +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/templates/report.html +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/templates/service-worker.js +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/templates/signature.html +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/tests.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/threadlocal.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/urls.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slth/views.py +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slthcore.egg-info/SOURCES.txt +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slthcore.egg-info/dependency_links.txt +0 -0
- {slthcore-0.3.5 → slthcore-0.3.7}/slthcore.egg-info/top_level.txt +0 -0
|
@@ -65,6 +65,7 @@ class Endpoint(metaclass=EnpointMetaclass):
|
|
|
65
65
|
cache = cache
|
|
66
66
|
|
|
67
67
|
def __init__(self):
|
|
68
|
+
self.baseurl = None
|
|
68
69
|
self.request = None
|
|
69
70
|
self.source = None
|
|
70
71
|
self.instantiator = None
|
|
@@ -231,7 +232,9 @@ class Endpoint(metaclass=EnpointMetaclass):
|
|
|
231
232
|
args = (source,) if cls.has_args() else ()
|
|
232
233
|
else:
|
|
233
234
|
args = (source.pk,) if cls.has_args() else ()
|
|
234
|
-
|
|
235
|
+
endpoint = cls(*args).configure(source).contextualize(request)
|
|
236
|
+
endpoint.baseurl = cls.get_api_url(*args)
|
|
237
|
+
return endpoint
|
|
235
238
|
|
|
236
239
|
@classmethod
|
|
237
240
|
def has_args(cls):
|
|
@@ -9,7 +9,7 @@ from .models import Token, Profile
|
|
|
9
9
|
from django.db import transaction
|
|
10
10
|
from django.db.models import Manager
|
|
11
11
|
from .exceptions import JsonResponseException
|
|
12
|
-
from .utils import absolute_url, build_url
|
|
12
|
+
from .utils import absolute_url, build_url, append_url
|
|
13
13
|
from .serializer import Serializer
|
|
14
14
|
from slth import ENDPOINTS
|
|
15
15
|
from .components import Scheduler
|
|
@@ -351,6 +351,7 @@ class FormMixin:
|
|
|
351
351
|
elif ftype == "scheduler":
|
|
352
352
|
data.update(scheduler=field.scheduler)
|
|
353
353
|
elif ftype == "choice" or pick:
|
|
354
|
+
choiceurl = self._endpoint.baseurl if self._endpoint else None
|
|
354
355
|
if name in self.request.GET and not choices_field_name:
|
|
355
356
|
data.update(type="hidden", value=self.request.GET[name])
|
|
356
357
|
else:
|
|
@@ -364,7 +365,7 @@ class FormMixin:
|
|
|
364
365
|
[dict(id=obj.id, value=str(obj).strip()) for obj in qs[0:(50 if pick else 25)]]
|
|
365
366
|
)
|
|
366
367
|
else:
|
|
367
|
-
data["choices"] = absolute_url(
|
|
368
|
+
data["choices"] = append_url(choiceurl, f"choices={fname}") if choiceurl else absolute_url(
|
|
368
369
|
self.request, f"choices={fname}"
|
|
369
370
|
)
|
|
370
371
|
else:
|
|
@@ -378,7 +379,7 @@ class FormMixin:
|
|
|
378
379
|
dict(id=str(k), value=v) for k, v in field.choices
|
|
379
380
|
]
|
|
380
381
|
if pick:
|
|
381
|
-
data.update(pick=absolute_url(
|
|
382
|
+
data.update(pick=append_url(choiceurl, f"choices={fname}") if choiceurl else absolute_url(
|
|
382
383
|
self.request, f"choices={fname}"
|
|
383
384
|
))
|
|
384
385
|
|
|
@@ -311,10 +311,8 @@ class Serializer:
|
|
|
311
311
|
returned = {}
|
|
312
312
|
endpoint = cls.instantiate(self.request, self.obj)
|
|
313
313
|
if endpoint.check_permission():
|
|
314
|
-
if not lazy:
|
|
315
|
-
self.request.subpath = cls.get_api_url(self.obj.id) if cls.has_args() else cls.get_api_url()
|
|
314
|
+
if not lazy:
|
|
316
315
|
returned = endpoint.process()
|
|
317
|
-
del self.request.subpath
|
|
318
316
|
path = self.path + [key]
|
|
319
317
|
if wrap:
|
|
320
318
|
data = dict(type='fieldset', key=key, title=title, url=None, data=serialize(returned))
|
|
@@ -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;
|
|
@@ -3,7 +3,7 @@ from django.template.engine import Engine
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
def build_url(request, path=None):
|
|
6
|
-
return path or
|
|
6
|
+
return path or request.path if request else ''
|
|
7
7
|
|
|
8
8
|
def absolute_url(request, *querystrings):
|
|
9
9
|
url = build_url(request)
|
|
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.5 → slthcore-0.3.7}/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.5 → slthcore-0.3.7}/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.5 → slthcore-0.3.7}/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
|