feat: allow super admin to update candidate tenant on profile page

This commit is contained in:
jeremy bayse
2026-03-30 17:03:20 +02:00
parent 7ece2036c1
commit 4810ca9d9c
3 changed files with 62 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ import InputError from '@/Components/InputError.vue';
const props = defineProps({
candidate: Object,
jobPositions: Array,
tenants: Array,
ai_config: Object
});
@@ -29,6 +30,16 @@ const updatePosition = () => {
});
};
const tenantForm = useForm({
tenant_id: props.candidate.tenant_id || ''
});
const updateTenant = () => {
tenantForm.patch(route('admin.candidates.update-tenant', props.candidate.id), {
preserveScroll: true,
});
};
const selectedDocument = ref(null);
const docForm = useForm({
@@ -207,6 +218,22 @@ const runAI = async () => {
</option>
</select>
</div>
<!-- Structure de rattachement (Super Admin only) -->
<div v-if="page.props.auth.user.role === 'super_admin'" class="mb-6">
<label class="text-[10px] font-black uppercase tracking-widest text-slate-400 mb-2 block text-left">Structure de Rattachement</label>
<select
v-model="tenantForm.tenant_id"
@change="updateTenant"
class="w-full bg-slate-50 dark:bg-slate-900 border-none rounded-xl py-2 px-3 text-xs font-bold text-emerald-600 focus:ring-2 focus:ring-emerald-500/20 transition-all cursor-pointer"
>
<option value="">Aucune structure</option>
<option v-for="tenant in tenants" :key="tenant.id" :value="tenant.id">
{{ tenant.name }}
</option>
</select>
<p class="text-[9px] text-slate-400 mt-1 italic text-left">Note: modifie aussi le rattachement de l'utilisateur.</p>
</div>
<div class="flex flex-col gap-3 text-left">
<div class="flex items-center gap-3 p-3 bg-slate-50 dark:bg-slate-900 rounded-xl">