import{aa as c,ab as i}from"./_applist-tangy-colts-beg-36.js";import{_ as t}from"./main-tangy-colts-beg.js";import{h as n,s as _}from"./machine.-tangy-colts-beg-869.js";import{h as p,g as E,f as T,a as d,b as l,c as C,d as h}from"./zohoproj-tangy-colts-beg-65.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(a,e){return this.cache.has(a)?this.cache.get(a):(this.cache.set(a,e),e)}};const u=c(({helpers:a})=>({states:{components:[h(a),{componentName:a.componentName.select,fieldType:"config",helperText:t("Select the portal where you want to create the task."),id:"portal-id",label:t("Portal ID"),onChange:"HANDLE_SELECT_PORTAL",onRefetch:"REFETCH_PORTAL_LIST",options:[],path:"portal-id",render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:a.componentName.select,fieldType:"config",helperText:t("Select the project where you want to create the task."),id:"project-id",label:t("Project ID"),onChange:"HANDLE_SELECT_PROJECT",onRefetch:"REFETCH_PROJECT_LIST",options:[],path:"project.id",render:"IF_PORTAL_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:a.componentName.mixInput,helperText:t("Enter the task name."),id:"task-name",label:t("Task Name"),onChange:"SET_TASK_NAME",path:"name",render:"IF_CONNECTION_SELECTED",required:!0,value:[]},{componentName:a.componentName.mixInput,helperText:t("Enter the task description."),id:"task-description",label:t("Task Description"),onChange:"SET_TASK_DESCRIPTION",path:"description",render:"IF_CONNECTION_SELECTED",value:[]},{componentName:a.componentName.mixInput,helperText:t("Enter the task start date (e.g., 2025-12-20)."),id:"start-date",label:t("Start Date"),onChange:"SET_START_DATE",path:"start_date",render:"IF_CONNECTION_SELECTED",value:[]},{componentName:a.componentName.mixInput,helperText:t("Enter the task end date (e.g., 2025-12-31)."),id:"end-date",label:t("End Date"),onChange:"SET_END_DATE",path:"end_date",render:"IF_CONNECTION_SELECTED",value:[]},{allowClear:!0,componentName:a.componentName.select,helperText:t("Select the tasklist for the task."),id:"tasklist-id",label:t("Tasklist ID"),onChange:"SET_TASKLIST_ID",onRefetch:"REFETCH_TASKLIST_LIST",options:[],path:"tasklist.id",render:"IF_PROJECT_SELECTED",showSearch:!0,value:void 0},{allowClear:!0,componentName:a.componentName.select,helperText:t("Select the person responsible for the task."),id:"owner-id",label:t("Person Responsible (Owner ID)"),onChange:"SET_OWNER_ID",onRefetch:"REFETCH_OWNER_LIST",options:[],path:"owners_and_work.owners.add.zpuid",render:"IF_PORTAL_SELECTED",showSearch:!0,value:void 0},{allowClear:!0,componentName:a.componentName.select,helperText:t("Select the priority for the task."),id:"priority",label:t("Priority"),onChange:"SET_PRIORITY",options:[{label:t("High"),value:"high"},{label:t("Medium"),value:"medium"},{label:t("Low"),value:"low"}],path:"priority",render:"IF_CONNECTION_SELECTED",value:void 0}]},actions:{CONNECTION_ADD_CHANGE:C,IF_CONNECTION_SELECTED:({$:e})=>{var o;return i((o=e.getComponent("connection-id"))==null?void 0:o.value)},REFETCH_OWNER_LIST:({$:e})=>l(e),REFETCH_PORTAL_LIST:({$:e})=>d(e),REFETCH_PROJECT_LIST:({$:e})=>T(e),REFETCH_TASKLIST_LIST:({$:e})=>E(e),SET_DOMAIN:p,SET_END_DATE:n("endDate"),SET_OWNER_ID:n("ownerId"),SET_PRIORITY:n("priority"),SET_START_DATE:n("startDate"),SET_TASK_DESCRIPTION:n("taskDescription"),SET_TASK_NAME:n("taskName"),SET_TASKLIST_ID:n("tasklistId"),HANDLE_SELECT_PORTAL:async({$:e,e:o})=>{n("portalId")({$:e,e:o}),await Promise.all([T(e),l(e)])},HANDLE_SELECT_PROJECT:({$:e,e:o})=>{n("projectId")({$:e,e:o}),E(e)},IF_PORTAL_SELECTED:({$:e})=>{var o,r;return i((o=e.getComponent("connection-id"))==null?void 0:o.value)&&i((r=e.getComponent("portal-id"))==null?void 0:r.value)},IF_PROJECT_SELECTED:({$:e})=>{var o,r,s;return i((o=e.getComponent("connection-id"))==null?void 0:o.value)&&i((r=e.getComponent("portal-id"))==null?void 0:r.value)&&i((s=e.getComponent("project-id"))==null?void 0:s.value)},SET_CONNECTION:({$:e,e:o})=>{n("connectionId")({$:e,e:o}),d(e)},ON_MACHINE_LOAD:async({$:e})=>{_(e,[{db:"connectionId",id:"connection-id"},{db:"portalId",id:"portal-id"},{db:"projectId",id:"project-id"},{db:"taskName",id:"task-name"},{db:"taskDescription",id:"task-description"},{db:"startDate",id:"start-date"},{db:"endDate",id:"end-date"},{db:"tasklistId",id:"tasklist-id"},{db:"ownerId",id:"owner-id"},{db:"priority",id:"priority"}]),await Promise.all([T(e),l(e),d(e),E(e)])}}}));export{u as default};
