PageSourceSearch

https://app.formstatus.co/build/assets/Index-B44TjQ34.js

js formstatus.co collected 2026-09-24 09:07:29 UTC 7,821 bytes, 205 lines download raw bytes

1import { X, r as reactExports, j as jsxRuntimeExports, S as Se, a as axios } from "./app-DJioUbN4.js";
2import { A as AuthenticatedLayout } from "./AuthenticatedLayout-BHFGLD_a.js";
3import { C as Card } from "./index-DKyGKZhh.js";
4import { E as Empty } from "./index-B9sJjom6.js";
5import { B as Button } from "./button-CEU8hL_t.js";
6import { T as Typography } from "./index-CFq58Aey.js";
7import { F as ForwardTable } from "./Table-Bz5-QJLW.js";
8import { M as Modal } from "./index-CJi8uQVF.js";
9import { I as Input } from "./index-CX1nRkNE.js";
10import { s as staticMethods } from "./index-Sv55INy7.js";
11import { S as Space } from "./index-uI2Px38P.js";
12import { P as Popconfirm } from "./index-DSMlAZCd.js";
13import "./logo-DZUjIKjN.js";
14import "./Modal-1kAAfUhb.js";
15import "./transition-Mw8jrymF.js";
16import "./index-DZL9fRVq.js";
17import "./ContextIsolator-B0hFr7x3.js";
18import "./asyncToGenerator-DBQnNTOo.js";
19import "./compact-item-DGA2vHNm.js";
20import "./reactNode-B_hytNsN.js";
21import "./index-CePQiBE9.js";
22import "./pickAttrs-odLRUG6a.js";
23import "./PurePanel-CAWogl25.js";
24import "./CheckOutlined-B5v3icNn.js";
25import "./CloseCircleFilled-CjLMhGFe.js";
26import "./shouldDisableButton-ti8szdbp.js";
27import "./index-CS_oGK2Z.js";
28import "./context-BgWH0adB.js";
29import "./CheckCircleFilled-B2LmPAOx.js";
30import "./ExclamationCircleFilled-Ka7CpAGL.js";
31import "./InfoCircleFilled-ClfJNR-1.js";
32import "./Skeleton-CedpGP7a.js";
33import "./index-DxQ97apg.js";
34import "./EllipsisOutlined-C9yAOY9Z.js";
35import "./PlusOutlined-BSPmm6F3.js";
36import "./styleChecker-C1aHGQEm.js";
37import "./index-Bm7egiKX.js";
38import "./zoom-B_eM1mkQ.js";
39import "./colors-DhNuxP_h.js";
40import "./TextArea-CJdPGunb.js";
41import "./getAllowClear-BrssXZkv.js";
42import "./HolderOutlined-B9JOhK4q.js";
43import "./LeftOutlined-CUWV3y9m.js";
44import "./collapse-DdhdDMvL.js";
45import "./useForm-B55nB5xc.js";
46import "./useBreakpoint-BhPEZ9ZL.js";
47import "./useForceUpdate-D5eV3kSs.js";
48import "./Pagination-BHVw9-KI.js";
49import "./index-D7iCP-tM.js";
50import "./extendsObject-2rRqFlJz.js";
51import "./Input-DkuUtiMs.js";
52import "./ActionButton-G_xxefOE.js";
53import "./index-uI8lezvp.js";
54import "./useClosable-Bpa2dDe5.js";
55import "./EyeOutlined-CZWGjvEz.js";
56function Index({ auth, account_id }) {
57  var _a;
58  const { props } = X();
59  const { teams: initialTeams } = props;
60  const isImpersonating = (_a = props.auth) == null ? void 0 : _a.is_impersonating;
61  const [teams, setTeams] = reactExports.useState(initialTeams);
62  const [open, setOpen] = reactExports.useState(false);
63  const [teamName, setTeamName] = reactExports.useState("");
64  const [confirmLoading, setConfirmLoading] = reactExports.useState(false);
65  const [openPopconfirmId, setOpenPopconfirmId] = reactExports.useState(null);
66  const showModal = () => {
67    setOpen(true);
68  };
69  const handleOk = async () => {
70    if (!teamName.trim()) {
71      staticMethods.error("Team name cannot be empty");
72      return;
73    }
74    setConfirmLoading(true);
75    try {
76      const response = await axios.post(route("teams.store", { name: teamName }));
77      if (response.data && response.data.group) {
78        const group = response.data.group;
79        setTeams((prevTeams) => [
80          ...prevTeams,
81          {
82            key: group.id,
83            name: group.name,
84            members_count: 0,
85            forms_count: 0
86          }
87        ]);
88        staticMethods.success("Team created successfully!");
89        setTeamName("");
90        setOpen(false);
91      } else {
92        throw new Error("Invalid response structure.");
93      }
94    } catch (err) {
95      console.error(err);
96      staticMethods.error("Failed to create team. Please try again.");
97    } finally {
98      setConfirmLoading(false);
99    }
100  };
101  const handleCancel = () => {
102    setOpen(false);
103    setTeamName("");
104  };
105  const showTeamDetails = (groupId) => {
106    window.location.href = route("teams.detail", { team: groupId });
107  };
108  const handleDeleteTeam = async (groupId) => {
109    var _a2, _b;
110    setConfirmLoading(true);
111    try {
112      const response = await axios.delete(route("teams.delete", { team: groupId }));
113      staticMethods.success(response.data.success || "Team successfully deleted.");
114      setTeams((prevTeams) => prevTeams.filter((team) => team.id !== groupId));
115    } catch (error) {
116      staticMethods.error(((_b = (_a2 = error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.error) || "Failed to delete team.");
117    } finally {
118      setConfirmLoading(false);
119      setOpenPopconfirmId(null);
120    }
121  };
122  const columns = [
123    {
124      title: "Name",
125      dataIndex: "name",
126      key: "name"
127    },
128    {
129      title: "Total Members",
130      dataIndex: "total_members",
131      key: "total_members"
132    },
133    {
134      title: "Total Forms",
135      dataIndex: "total_forms",
136      key: "total_forms"
137    },
138    {
139      title: "Actions",
140      dataIndex: "actions",
141      key: "actions",
142      render: (_, record) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { size: "middle", children: [
143        /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "default", onClick: () => showTeamDetails(record.key), children: "View" }),
144        !isImpersonating && /* @__PURE__ */ jsxRuntimeExports.jsx(
145          Popconfirm,
146          {
147            title: "Are you sure you want to delete this team?",
148            open: openPopconfirmId === record.key,
149            okButtonProps: { loading: confirmLoading },
150            onConfirm: () => handleDeleteTeam(record.key),
151            onCancel: () => setOpenPopconfirmId(null),
152            okText: "Yes",
153            cancelText: "No",
154            children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "default", danger: true, onClick: () => setOpenPopconfirmId(record.key), children: "Delete" })
155          }
156        )
157      ] })
158    }
159  ];
160  const dataSource = teams.map((team) => ({
161    key: team.id,
162    // Use unique key for each row
163    name: team.name,
164    total_members: team.members_count,
165    total_forms: team.forms_count
166  }));
167  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
168    AuthenticatedLayout,
169    {
170      header: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "font-semibold text-xl text-gray-800 leading-tight", children: "Teams" }),
171      children: [
172        /* @__PURE__ */ jsxRuntimeExports.jsx(Se, { title: "Teams" }),
173        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-10 pb-12", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-7xl mx-auto sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { title: "Teams", extra: teams.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "primary", size: "middle", onClick: showModal, children: "Add Team" }), children: teams.length <= 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
174          Empty,
175          {
176            image: Empty.PRESENTED_IMAGE_SIMPLE,
177            description: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography.Text, { children: "No teams available" }),
178            children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "primary", onClick: showModal, children: "Create Now" })
179          }
180        ) : /* @__PURE__ */ jsxRuntimeExports.jsx(ForwardTable, { columns, dataSource }) }) }) }),
181        /* @__PURE__ */ jsxRuntimeExports.jsx(
182          Modal,
183          {
184            title: "Add new team",
185            open,
186            onOk: handleOk,
187            confirmLoading,
188            onCancel: handleCancel,
189            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
190              Input,
191              {
192                placeholder: "Enter team name",
193                value: teamName,
194                onChange: (e) => setTeamName(e.target.value)
195              }
196            )
197          }
198        )
199      ]
200    }
201  );
202}
203export {
204  Index as default
205};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.