diff --git a/asset/templates/cbv/asset_category/detail_view_action.html b/asset/templates/cbv/asset_category/detail_view_action.html
index 658811c57..9155e5237 100644
--- a/asset/templates/cbv/asset_category/detail_view_action.html
+++ b/asset/templates/cbv/asset_category/detail_view_action.html
@@ -9,11 +9,11 @@
{{ message }}
-
+
{%if message.tags == "oh-alert--success" %}
- {% endif %}
+ hx-target="#assetCategory{{instance.asset_category_id.id}}">
+ {% endif %}
{% endfor %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/biometric/templates/biometric/biometric_device_form.html b/biometric/templates/biometric/biometric_device_form.html
index f96613783..383edb23c 100644
--- a/biometric/templates/biometric/biometric_device_form.html
+++ b/biometric/templates/biometric/biometric_device_form.html
@@ -175,4 +175,4 @@
}
});
});
-
\ No newline at end of file
+
diff --git a/employee/templates/cbv/disciplinary_actions/main_dis.html b/employee/templates/cbv/disciplinary_actions/main_dis.html
index 4bebb06b4..425330b2d 100644
--- a/employee/templates/cbv/disciplinary_actions/main_dis.html
+++ b/employee/templates/cbv/disciplinary_actions/main_dis.html
@@ -1,4 +1,4 @@
-
+
{% include "generic/horilla_list.html" %}
-
\ No newline at end of file
+
diff --git a/horilla_automations/forms.py b/horilla_automations/forms.py
index a6ea475ea..60eb90476 100644
--- a/horilla_automations/forms.py
+++ b/horilla_automations/forms.py
@@ -33,6 +33,8 @@ class AutomationForm(ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
+
+ # --- Field: also_sent_to ---
self.fields["also_sent_to"] = HorillaMultiSelectField(
queryset=Employee.objects.all(),
required=False,
@@ -46,41 +48,57 @@ class AutomationForm(ModelForm):
label="Also Sent to",
help_text=_("The employees selected here will receive the email as Cc."),
)
- if not self.data:
- mail_to = []
- initial = []
- mail_details_choice = []
- if self.instance.pk:
- mail_to = generate_choices(self.instance.model)[0]
- mail_details_choice = generate_choices(self.instance.model)[1]
- self.fields["mail_to"] = forms.MultipleChoiceField(choices=mail_to)
- self.fields["mail_details"] = forms.ChoiceField(
- choices=mail_details_choice,
- help_text="Fill mail template details(reciever/instance, `self` will be the person who trigger the automation)",
- )
- self.fields["mail_to"].initial = initial
- attrs = self.fields["mail_to"].widget.attrs
- attrs["class"] = "oh-select oh-select-2 w-100"
- attrs = self.fields["model"].widget.attrs
- self.fields["model"].choices = [("", "Select model")] + list(set(MODEL_CHOICES))
- attrs["onchange"] = "getToMail($(this))"
+ # --- Determine model for generate_choices ---
+ model = getattr(self.instance, "model", None) or self.data.get("model")
+ mail_to, mail_details_choice = [], []
+
+ if model:
+ choices = generate_choices(model)
+ mail_to, mail_details_choice = choices[0], choices[1]
+
+ # --- Field: mail_to ---
+ self.fields["mail_to"] = forms.MultipleChoiceField(
+ choices=mail_to,
+ initial=self.data.get("mail_to"),
+ widget=forms.SelectMultiple(attrs={"class": "oh-select oh-select-2 w-100"}),
+ )
+
+ # --- Field: mail_details ---
+ self.fields["mail_details"] = forms.ChoiceField(
+ choices=mail_details_choice,
+ help_text=_(
+ "Fill mail template details (receiver/instance, `self` will be the person who triggers the automation)"
+ ),
+ )
+ self.fields["mail_details"].widget.attrs = {
+ "class": "oh-select oh-select-2 w-100"
+ }
+
+ # --- Field: model ---
+ self.fields["model"].choices = [("", "Select model")] + sorted(
+ set(MODEL_CHOICES)
+ )
+ self.fields["model"].widget.attrs["onchange"] = "getToMail($(this))"
+
+ # --- Field: mail_template ---
self.fields["mail_template"].empty_label = "----------"
- attrs = attrs.copy()
- del attrs["onchange"]
- self.fields["mail_details"].widget.attrs = attrs
+
+ # --- Instance condition fields ---
if self.instance.pk:
self.fields["condition"].initial = self.instance.condition_html
self.fields["condition_html"].initial = self.instance.condition_html
self.fields["condition_querystring"].initial = (
self.instance.condition_querystring
)
- for _field_name, field in self.fields.items():
+
+ # --- Apply option template name for all select fields ---
+ for field in self.fields.values():
if isinstance(field.widget, forms.Select):
field.widget.option_template_name = default_select_option_template
- is_active_field = self.fields.pop("is_active")
- self.fields["is_active"] = is_active_field
+ # --- Re-insert is_active field to ensure order ---
+ self.fields["is_active"] = self.fields.pop("is_active")
def clean(self):
cleaned_data = super().clean()
diff --git a/horilla_theme/static/cdn/alpine/alpine.min.js b/horilla_theme/static/cdn/alpine/alpine.min.js
index eae6c40b0..2fdd6ecfd 100644
--- a/horilla_theme/static/cdn/alpine/alpine.min.js
+++ b/horilla_theme/static/cdn/alpine/alpine.min.js
@@ -2,4 +2,4 @@
${r?'Expression: "'+r+`"
-`:""}`,t),setTimeout(()=>{throw e},0)}var Me=!0;function ke(e){let t=Me;Me=!1;let r=e();return Me=t,r}function R(e,t,r={}){let n;return x(e,t)(i=>n=i,r),n}function x(...e){return sr(...e)}var sr=xt;function ar(e){sr=e}function xt(e,t){let r={};fe(r,e);let n=[r,...B(e)],i=typeof t=="function"?$n(n,t):Fn(n,t,e);return or.bind(null,e,t,i)}function $n(e,t){return(r=()=>{},{scope:n={},params:i=[]}={})=>{let o=t.apply(z([n,...e]),i);Ne(r,o)}}var gt={};function jn(e,t){if(gt[e])return gt[e];let r=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(e.trim())||/^(let|const)\s/.test(e.trim())?`(async()=>{ ${e} })()`:e,o=(()=>{try{let s=new r(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`);return Object.defineProperty(s,"name",{value:`[Alpine] ${e}`}),s}catch(s){return re(s,t,e),Promise.resolve()}})();return gt[e]=o,o}function Fn(e,t,r){let n=jn(t,r);return(i=()=>{},{scope:o={},params:s=[]}={})=>{n.result=void 0,n.finished=!1;let a=z([o,...e]);if(typeof n=="function"){let c=n(n,a).catch(l=>re(l,r,t));n.finished?(Ne(i,n.result,a,s,r),n.result=void 0):c.then(l=>{Ne(i,l,a,s,r)}).catch(l=>re(l,r,t)).finally(()=>n.result=void 0)}}}function Ne(e,t,r,n,i){if(Me&&typeof t=="function"){let o=t.apply(r,n);o instanceof Promise?o.then(s=>Ne(e,s,r,n)).catch(s=>re(s,i,t)):e(o)}else typeof t=="object"&&t instanceof Promise?t.then(o=>e(o)):e(t)}var wt="x-";function C(e=""){return wt+e}function cr(e){wt=e}var De={};function d(e,t){return De[e]=t,{before(r){if(!De[r]){console.warn(String.raw`Cannot find directive \`${r}\`. \`${e}\` will use the default order of execution`);return}let n=G.indexOf(r);G.splice(n>=0?n:G.indexOf("DEFAULT"),0,e)}}}function lr(e){return Object.keys(De).includes(e)}function pe(e,t,r){if(t=Array.from(t),e._x_virtualDirectives){let o=Object.entries(e._x_virtualDirectives).map(([a,c])=>({name:a,value:c})),s=Et(o);o=o.map(a=>s.find(c=>c.name===a.name)?{name:`x-bind:${a.name}`,value:`"${a.value}"`}:a),t=t.concat(o)}let n={};return t.map(dr((o,s)=>n[o]=s)).filter(mr).map(zn(n,r)).sort(Kn).map(o=>Bn(e,o))}function Et(e){return Array.from(e).map(dr()).filter(t=>!mr(t))}var yt=!1,de=new Map,ur=Symbol();function fr(e){yt=!0;let t=Symbol();ur=t,de.set(t,[]);let r=()=>{for(;de.get(t).length;)de.get(t).shift()();de.delete(t)},n=()=>{yt=!1,r()};e(r),n()}function _t(e){let t=[],r=a=>t.push(a),[n,i]=Yt(e);return t.push(i),[{Alpine:K,effect:n,cleanup:r,evaluateLater:x.bind(x,e),evaluate:R.bind(R,e)},()=>t.forEach(a=>a())]}function Bn(e,t){let r=()=>{},n=De[t.type]||r,[i,o]=_t(e);Oe(e,t.original,o);let s=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,i),n=n.bind(n,e,t,i),yt?de.get(ur).push(n):n())};return s.runCleanups=o,s}var Pe=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),Ie=e=>e;function dr(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=pr.reduce((o,s)=>s(o),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var pr=[];function ne(e){pr.push(e)}function mr({name:e}){return hr().test(e)}var hr=()=>new RegExp(`^${wt}([^:^.]+)\\b`);function zn(e,t){return({name:r,value:n})=>{let i=r.match(hr()),o=r.match(/:([a-zA-Z0-9\-_:]+)/),s=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[r]||r;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:s.map(c=>c.replace(".","")),expression:n,original:a}}}var bt="DEFAULT",G=["ignore","ref","data","id","anchor","bind","init","for","model","modelable","transition","show","if",bt,"teleport"];function Kn(e,t){let r=G.indexOf(e.type)===-1?bt:e.type,n=G.indexOf(t.type)===-1?bt:t.type;return G.indexOf(r)-G.indexOf(n)}function J(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function D(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>D(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)D(n,t,!1),n=n.nextElementSibling}function E(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var _r=!1;function gr(){_r&&E("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),_r=!0,document.body||E("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `
\ No newline at end of file
+
diff --git a/horilla_views/generic/cbv/views.py b/horilla_views/generic/cbv/views.py
index a93a5d3c8..2732498c4 100644
--- a/horilla_views/generic/cbv/views.py
+++ b/horilla_views/generic/cbv/views.py
@@ -1896,6 +1896,7 @@ class HorillaFormView(FormView):
context["form_class_path"] = self.form_class_path
context["view_id"] = self.view_id
context["hx_confirm"] = self.hx_confirm
+ context["hx_target"] = self.request.META.get("HTTP_HX_TARGET", "this")
pk = None
if self.form.instance:
pk = self.form.instance.pk
diff --git a/horilla_views/templates/generic/horilla_form.html b/horilla_views/templates/generic/horilla_form.html
index 1c921f97f..c39f9e47b 100644
--- a/horilla_views/templates/generic/horilla_form.html
+++ b/horilla_views/templates/generic/horilla_form.html
@@ -1,80 +1,74 @@
{% load generic_template_filters %}
-
- {% for field_tuple in dynamic_create_fields %}
-
-
- {% endfor %}
-
- {% for field_tuple in dynamic_create_fields %}
-
+
+
+ {{ form.structured }}
+
+
+{% for field_tuple in dynamic_create_fields %}
+
+
+
+
+
+
+ {% for field in field_tuple.2 %}
+
+ {% endfor %}
+
+ {{ field_tuple.0 }}
+
+
+
+
+
+
+ {{ field_tuple.0 }}
+
+
+
+
+{% endfor %}
diff --git a/pms/templates/cbv/question_template/main.html b/pms/templates/cbv/question_template/main.html
index 91eac89fb..b2c7a8339 100644
--- a/pms/templates/cbv/question_template/main.html
+++ b/pms/templates/cbv/question_template/main.html
@@ -1,4 +1,4 @@
{% include "generic/horilla_list.html" %}
-
\ No newline at end of file
+
diff --git a/static/index/country.js b/static/index/country.js
index b58f67196..6ae5fc3de 100644
--- a/static/index/country.js
+++ b/static/index/country.js
@@ -750,5 +750,3 @@ document.addEventListener("DOMContentLoaded", function () {
document.body.addEventListener("htmx:afterSettle", function (event) {
initCountryStateDropdowns();
});
-
-