import "./index.esm-0G7eAEV5.js";
import { t as _sfc_main$1 } from "./SecondaryButton-ub85RH3e.js";
import { A as _sfc_main$5, M as _sfc_main$2, S as _sfc_main$3, Y as $decimal, f as _sfc_main$4 } from "../ssr.js";
import { useForm } from "@inertiajs/vue3";
import { createTextVNode, toDisplayString, unref, useSSRContext, withCtx } from "vue";
import { ssrInterpolate, ssrRenderAttrs, ssrRenderComponent } from "vue/server-renderer";
import dayjs from "dayjs";
//#region resources/js/Pages/Sma/Accounting/AssetMaintenance/Form.vue
var _sfc_main = {
	__name: "Form",
	__ssrInlineRender: true,
	props: [
		"current",
		"assets",
		"types",
		"statuses"
	],
	emits: ["close", "done"],
	setup(__props, { emit: __emit }) {
		const emits = __emit;
		const props = __props;
		const form = useForm({
			_method: props.current?.id ? "put" : "post",
			asset_id: props.current?.asset_id,
			title: props.current?.title,
			type: props.current?.type ?? "Scheduled",
			start_date: props.current?.start_date ? dayjs(props.current?.start_date).format("YYYY-MM-DD") : null,
			end_date: props.current?.end_date ? dayjs(props.current?.end_date).format("YYYY-MM-DD") : null,
			cost: $decimal(props.current?.cost),
			note: props.current?.note,
			status: props.current?.status ?? "Scheduled"
		});
		return (_ctx, _push, _parent, _attrs) => {
			_push(`<form${ssrRenderAttrs(_attrs)}><div class="border-b border-gray-200 px-6 py-4 dark:border-gray-700"><div class="sm:flex sm:items-baseline sm:justify-between"><div class="sm:w-0 sm:flex-1"><h1 class="text-focus text-base font-semibold">${ssrInterpolate(__props.current?.id ? _ctx.$t("Edit {x}", { x: _ctx.$t("Asset Maintenance") }) : _ctx.$t("Add {x}", { x: _ctx.$t("Asset Maintenance") }))}</h1><p class="text-mute mt-1 truncate text-sm">${ssrInterpolate(_ctx.$t("Please fill the form below to {action} {record}.", {
				record: _ctx.$t("asset maintenance"),
				action: __props.current?.id ? _ctx.$t("edit") : _ctx.$t("add")
			}))}</p></div></div></div><div class="grid grid-cols-6 gap-6 p-6"><div class="col-span-6 sm:col-span-3">`);
			_push(ssrRenderComponent(unref(_sfc_main$2), {
				json: true,
				id: "asset_id",
				label: _ctx.$t("Asset"),
				modelValue: unref(form).asset_id,
				"onUpdate:modelValue": ($event) => unref(form).asset_id = $event,
				error: unref(form).errors.asset_id,
				suggestions: __props.assets.map((a) => ({
					value: a.id,
					label: a.name
				}))
			}, null, _parent));
			_push(`</div><div class="col-span-6 sm:col-span-3">`);
			_push(ssrRenderComponent(unref(_sfc_main$3), {
				id: "title",
				label: _ctx.$t("Title"),
				modelValue: unref(form).title,
				"onUpdate:modelValue": ($event) => unref(form).title = $event,
				error: unref(form).errors.title
			}, null, _parent));
			_push(`</div><div class="col-span-6 sm:col-span-3">`);
			_push(ssrRenderComponent(unref(_sfc_main$2), {
				json: true,
				id: "type",
				searchable: false,
				label: _ctx.$t("Type"),
				modelValue: unref(form).type,
				"onUpdate:modelValue": ($event) => unref(form).type = $event,
				error: unref(form).errors.type,
				suggestions: __props.types
			}, null, _parent));
			_push(`</div><div class="col-span-6 sm:col-span-3">`);
			_push(ssrRenderComponent(unref(_sfc_main$2), {
				json: true,
				id: "status",
				searchable: false,
				label: _ctx.$t("Status"),
				modelValue: unref(form).status,
				"onUpdate:modelValue": ($event) => unref(form).status = $event,
				error: unref(form).errors.status,
				suggestions: __props.statuses
			}, null, _parent));
			_push(`</div><div class="col-span-6 sm:col-span-3">`);
			_push(ssrRenderComponent(unref(_sfc_main$3), {
				type: "date",
				id: "start_date",
				label: _ctx.$t("Start Date"),
				modelValue: unref(form).start_date,
				"onUpdate:modelValue": ($event) => unref(form).start_date = $event,
				error: unref(form).errors.start_date
			}, null, _parent));
			_push(`</div><div class="col-span-6 sm:col-span-3">`);
			_push(ssrRenderComponent(unref(_sfc_main$3), {
				type: "date",
				id: "end_date",
				label: _ctx.$t("End Date"),
				modelValue: unref(form).end_date,
				"onUpdate:modelValue": ($event) => unref(form).end_date = $event,
				error: unref(form).errors.end_date
			}, null, _parent));
			_push(`</div><div class="col-span-6 sm:col-span-3">`);
			_push(ssrRenderComponent(unref(_sfc_main$3), {
				type: "number",
				id: "cost",
				label: _ctx.$t("Cost"),
				modelValue: unref(form).cost,
				"onUpdate:modelValue": ($event) => unref(form).cost = $event,
				error: unref(form).errors.cost
			}, null, _parent));
			_push(`</div><div class="col-span-full">`);
			_push(ssrRenderComponent(unref(_sfc_main$4), {
				id: "note",
				label: _ctx.$t("Note"),
				modelValue: unref(form).note,
				"onUpdate:modelValue": ($event) => unref(form).note = $event,
				error: unref(form).errors.note
			}, null, _parent));
			_push(`</div></div><div class="flex flex-row justify-end bg-gray-100 px-6 py-4 text-end dark:bg-gray-950">`);
			_push(ssrRenderComponent(unref(_sfc_main$1), { onClick: ($event) => emits("close") }, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`${ssrInterpolate(_ctx.$t("Cancel"))}`);
					else return [createTextVNode(toDisplayString(_ctx.$t("Cancel")), 1)];
				}),
				_: 1
			}, _parent));
			_push(ssrRenderComponent(unref(_sfc_main$5), {
				class: "ms-3",
				loading: unref(form).processing
			}, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`${ssrInterpolate(_ctx.$t("Save"))}`);
					else return [createTextVNode(toDisplayString(_ctx.$t("Save")), 1)];
				}),
				_: 1
			}, _parent));
			_push(`</div></form>`);
		};
	}
};
var _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
	const ssrContext = useSSRContext();
	(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/Pages/Sma/Accounting/AssetMaintenance/Form.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
//#endregion
export { _sfc_main as default };
