84 lines
3.1 KiB
JavaScript
84 lines
3.1 KiB
JavaScript
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
import { u as useRoute } from "../app.js";
|
|
import { A as ActionMessage } from "./ActionMessage-s_mcCJ3s.js";
|
|
import { F as FormSection } from "./FormSection-DI6t3wFC.js";
|
|
import { T as TextInput, I as InputError } from "./TextInput-CMJy2hIv.js";
|
|
import { I as InputLabel } from "./InputLabel-DhqxoV6M.js";
|
|
import { P as PrimaryButton } from "./PrimaryButton-C2B8UWiv.js";
|
|
import { useForm } from "@inertiajs/react";
|
|
import classNames from "classnames";
|
|
import "axios";
|
|
import "lodash";
|
|
import "react-dom/client";
|
|
import "react";
|
|
import "@headlessui/react";
|
|
import "./SectionTitle-DnuUNpyS.js";
|
|
function UpdateTeamNameForm({ team, permissions }) {
|
|
const route = useRoute();
|
|
const form = useForm({
|
|
name: team.name
|
|
});
|
|
function updateTeamName() {
|
|
form.put(route("teams.update", [team]), {
|
|
errorBag: "updateTeamName",
|
|
preserveScroll: true
|
|
});
|
|
}
|
|
return /* @__PURE__ */ jsxs(
|
|
FormSection,
|
|
{
|
|
onSubmit: updateTeamName,
|
|
title: "Team Name",
|
|
description: `The team's name and owner information.`,
|
|
renderActions: permissions.canUpdateTeam ? () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
/* @__PURE__ */ jsx(ActionMessage, { on: form.recentlySuccessful, className: "mr-3", children: "Saved." }),
|
|
/* @__PURE__ */ jsx(
|
|
PrimaryButton,
|
|
{
|
|
className: classNames({ "opacity-25": form.processing }),
|
|
disabled: form.processing,
|
|
children: "Save"
|
|
}
|
|
)
|
|
] }) : void 0,
|
|
children: [
|
|
/* @__PURE__ */ jsxs("div", { className: "col-span-6", children: [
|
|
/* @__PURE__ */ jsx(InputLabel, { value: "Team Owner" }),
|
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center mt-2", children: [
|
|
/* @__PURE__ */ jsx(
|
|
"img",
|
|
{
|
|
className: "w-12 h-12 rounded-full object-cover",
|
|
src: team.owner.profile_photo_url,
|
|
alt: team.owner.name
|
|
}
|
|
),
|
|
/* @__PURE__ */ jsxs("div", { className: "ml-4 leading-tight", children: [
|
|
/* @__PURE__ */ jsx("div", { className: "text-gray-900 dark:text-white", children: team.owner.name }),
|
|
/* @__PURE__ */ jsx("div", { className: "text-gray-700 dark:text-gray-300 text-sm", children: team.owner.email })
|
|
] })
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ jsxs("div", { className: "col-span-6 sm:col-span-4", children: [
|
|
/* @__PURE__ */ jsx(InputLabel, { htmlFor: "name", value: "Team Name" }),
|
|
/* @__PURE__ */ jsx(
|
|
TextInput,
|
|
{
|
|
id: "name",
|
|
type: "text",
|
|
className: "mt-1 block w-full",
|
|
value: form.data.name,
|
|
onChange: (e) => form.setData("name", e.currentTarget.value),
|
|
disabled: !permissions.canUpdateTeam
|
|
}
|
|
),
|
|
/* @__PURE__ */ jsx(InputError, { message: form.errors.name, className: "mt-2" })
|
|
] })
|
|
]
|
|
}
|
|
);
|
|
}
|
|
export {
|
|
UpdateTeamNameForm as default
|
|
};
|