module.exports=[24912,a=>{"use strict";var b=a.i(1640);a.s([],87481),a.i(87481),a.s(["40a45ed048e9edc240ca8196a81e57aa179cd2b3b3",()=>b.createTraining,"40d73376dac54d57db943f0c572163db6b69d41e2e",()=>b.createCoachingSession],24912)},1640,a=>{"use strict";var b=a.i(37936),c=a.i(18558),d=a.i(66518),e=a.i(9307),f=a.i(36580);function g(a){if(null==a)return null;let b=String(a).trim();return""===b?null:b}async function h(a){let b=await (0,e.requireAccess)("teams","write"),g=String(a.get("name")??"").trim();g&&(await d.prisma.team.create({data:{name:g}}),await (0,f.logActivity)({userId:b.id,action:"CREATION",entity:"Équipe",details:g}),(0,c.revalidatePath)("/teams"))}async function i(a){let b=await (0,e.requireAccess)("teams","write"),h=String(a.get("id")),i=g(a.get("managerId"));await d.prisma.team.update({where:{id:h},data:{managerId:i}}),await (0,f.logActivity)({userId:b.id,action:"MODIFICATION",entity:"Équipe",entityId:h}),(0,c.revalidatePath)("/teams")}async function j(a){let b=await (0,e.requireAccess)("teams","write"),g=String(a.get("teamId")),h=String(a.get("creatorId"));await d.prisma.creator.update({where:{id:h},data:{teamId:g}}),await (0,f.logActivity)({userId:b.id,action:"MODIFICATION",entity:"Créateur",entityId:h,details:"Affectation à une équipe"}),(0,c.revalidatePath)("/teams")}async function k(a){let b=await (0,e.requireAccess)("teams","write"),g=String(a.get("creatorId"));await d.prisma.creator.update({where:{id:g},data:{teamId:null}}),await (0,f.logActivity)({userId:b.id,action:"MODIFICATION",entity:"Créateur",entityId:g,details:"Retrait d'une équipe"}),(0,c.revalidatePath)("/teams")}async function l(a){let b=await (0,e.requireAccess)("coaching","write"),h=String(a.get("creatorId"));await d.prisma.coachingSession.create({data:{creatorId:h,coachId:g(a.get("coachId"))??b.id,date:new Date(String(a.get("date")??new Date().toISOString().slice(0,10))),report:g(a.get("report")),recommendations:g(a.get("recommendations")),nextObjective:g(a.get("nextObjective"))}}),await (0,f.logActivity)({userId:b.id,action:"CREATION",entity:"Coaching",entityId:h}),(0,c.revalidatePath)("/coaching"),(0,c.revalidatePath)(`/creators/${h}`)}async function m(a){let b=await (0,e.requireAccess)("trainings","write");await d.prisma.training.create({data:{title:String(a.get("title")??"").trim(),creatorId:g(a.get("creatorId")),date:g(a.get("date"))?new Date(String(a.get("date"))):null,notes:g(a.get("notes")),status:"PLANIFIE"}}),await (0,f.logActivity)({userId:b.id,action:"CREATION",entity:"Formation"}),(0,c.revalidatePath)("/trainings")}async function n(a){let b=await (0,e.requireAccess)("trainings","write"),g=String(a.get("id")),h=String(a.get("status")??"PLANIFIE");await d.prisma.training.update({where:{id:g},data:{status:h}}),await (0,f.logActivity)({userId:b.id,action:"MODIFICATION",entity:"Formation",entityId:g}),(0,c.revalidatePath)("/trainings")}(0,a.i(13095).ensureServerEntryExports)([h,i,j,k,l,m,n]),(0,b.registerServerReference)(h,"40ecefceb05ae62a1af20db8fba31d67dba581b8c8",null),(0,b.registerServerReference)(i,"40d8b0ac5a311279df4437cbcca922bf71d7471aa8",null),(0,b.registerServerReference)(j,"40e4d458c7d21c8deabf3091353d7f79cd42559d37",null),(0,b.registerServerReference)(k,"40ac3391759f6bc805cd358b72797385ae658ceeea",null),(0,b.registerServerReference)(l,"40d73376dac54d57db943f0c572163db6b69d41e2e",null),(0,b.registerServerReference)(m,"40a45ed048e9edc240ca8196a81e57aa179cd2b3b3",null),(0,b.registerServerReference)(n,"4008d2cc7807a3ac9018b37fa0f27ec75c16db5893",null),a.s(["addCreatorToTeam",0,j,"createCoachingSession",0,l,"createTeam",0,h,"createTraining",0,m,"removeCreatorFromTeam",0,k,"setTeamManager",0,i,"setTrainingStatus",0,n])},36580,a=>{"use strict";var b=a.i(66518);async function c(a){return b.prisma.activityLog.create({data:{userId:a.userId,action:a.action,entity:a.entity,entityId:a.entityId??null,details:a.details??null}})}a.s(["logActivity",0,c])}];

//# sourceMappingURL=_1x_q_u5._.js.map