import { defineComponent, ref, unref, withCtx, createTextVNode, createVNode, toDisplayString, createBlock, openBlock, Fragment, renderList, withModifiers, createCommentVNode, withDirectives, vModelText, useSSRContext } from "vue";
import { ssrRenderComponent, ssrInterpolate, ssrRenderList, ssrRenderAttr } from "vue/server-renderer";
import { useForm, Head, router } from "@inertiajs/vue3";
import { _ as _sfc_main$1 } from "./AppLayout-DXKl-uoF.js";
import { _ as _sfc_main$3 } from "./Input-CFG4Vy8n.js";
import { _ as _sfc_main$2 } from "./Label-CHEJyxWd.js";
import { _ as _sfc_main$b } from "./AppLogoIcon-DhmQfNIw.js";
import { _ as _sfc_main$4, a as _sfc_main$5, b as _sfc_main$6, c as _sfc_main$7, d as _sfc_main$8, e as _sfc_main$9, f as _sfc_main$a } from "./SelectValue-Bls_QTA2.js";
import { toast } from "vue-sonner";
import "class-variance-authority";
import "reka-ui";
import "@vueuse/core";
import "lucide-vue-next";
import "clsx";
import "tailwind-merge";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "Create",
  __ssrInlineRender: true,
  props: {
    installers: {}
  },
  setup(__props) {
    const breadcrumbs = [
      {
        title: "Добавление заявки",
        href: "/requests/create"
      }
    ];
    const form = useForm({
      title: "",
      description: "",
      address: "",
      scheduled_date: "",
      region: "",
      client_name: "",
      client_phone: "",
      subject: "",
      installer_id: null
    });
    const photos = ref(null);
    const previewUrls = ref([]);
    const handleFileChange = (e) => {
      const target = e.target;
      if (target && target.files) {
        photos.value = target.files;
        previewUrls.value = [];
        Array.from(target.files).forEach((file) => {
          previewUrls.value.push(URL.createObjectURL(file));
        });
      }
    };
    const submit = () => {
      const payload = new FormData();
      const data = form.data();
      Object.entries(data).forEach(([key, value]) => {
        payload.append(key, (value == null ? void 0 : value.toString()) ?? "");
      });
      if (photos.value) {
        for (let i = 0; i < photos.value.length; i++) {
          payload.append("photos[]", photos.value[i], photos.value[i].name);
        }
      }
      router.post("/requests", payload, {
        forceFormData: true,
        preserveScroll: true,
        onSuccess: () => {
          toast.success("Заявка создана: Фото и данные успешно отправлены");
          form.reset();
          photos.value = null;
          previewUrls.value = [];
        },
        onError: () => {
          toast.error("Ошибка при создании заявки");
        }
      });
    };
    return (_ctx, _push, _parent, _attrs) => {
      _push(`<!--[-->`);
      _push(ssrRenderComponent(unref(Head), { title: "Заявки на монтаж" }, null, _parent));
      _push(ssrRenderComponent(_sfc_main$1, { breadcrumbs }, {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`<div class="flex h-full flex-1 flex-col gap-4 rounded-xl p-4"${_scopeId}><h1 class="text-2xl font-bold mb-4"${_scopeId}>Новая заявка</h1><form class="space-y-6 max-w-xl"${_scopeId}><div class="space-y-2"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "title" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Заголовок`);
                } else {
                  return [
                    createTextVNode("Заголовок")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(unref(_sfc_main$3), {
              id: "title",
              modelValue: unref(form).title,
              "onUpdate:modelValue": ($event) => unref(form).title = $event,
              placeholder: "Введите заголовок"
            }, null, _parent2, _scopeId));
            if (unref(form).errors.title) {
              _push2(`<p class="text-sm text-red-500"${_scopeId}>${ssrInterpolate(unref(form).errors.title)}</p>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`</div><div class="space-y-2"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "description" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Описание`);
                } else {
                  return [
                    createTextVNode("Описание")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(`<textarea id="description" rows="4" class="w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm" placeholder="Краткое описание (необязательно)"${_scopeId}>${ssrInterpolate(unref(form).description)}</textarea></div><div class="space-y-2"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "region" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Регион`);
                } else {
                  return [
                    createTextVNode("Регион")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(unref(_sfc_main$3), {
              id: "region",
              modelValue: unref(form).region,
              "onUpdate:modelValue": ($event) => unref(form).region = $event,
              placeholder: "Укажите регион"
            }, null, _parent2, _scopeId));
            if (unref(form).errors.region) {
              _push2(`<p class="text-sm text-red-500"${_scopeId}>${ssrInterpolate(unref(form).errors.region)}</p>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`</div><div class="space-y-2"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "address" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Субъект`);
                } else {
                  return [
                    createTextVNode("Субъект")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(unref(_sfc_main$4), {
              modelValue: unref(form).subject,
              "onUpdate:modelValue": ($event) => unref(form).subject = $event,
              class: "w-full"
            }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(ssrRenderComponent(unref(_sfc_main$5), { class: "w-full" }, {
                    default: withCtx((_3, _push4, _parent4, _scopeId3) => {
                      if (_push4) {
                        _push4(ssrRenderComponent(unref(_sfc_main$6), { placeholder: "-- Не назначен --" }, null, _parent4, _scopeId3));
                      } else {
                        return [
                          createVNode(unref(_sfc_main$6), { placeholder: "-- Не назначен --" })
                        ];
                      }
                    }),
                    _: 1
                  }, _parent3, _scopeId2));
                  _push3(ssrRenderComponent(unref(_sfc_main$7), null, {
                    default: withCtx((_3, _push4, _parent4, _scopeId3) => {
                      if (_push4) {
                        _push4(ssrRenderComponent(unref(_sfc_main$8), null, {
                          default: withCtx((_4, _push5, _parent5, _scopeId4) => {
                            if (_push5) {
                              _push5(ssrRenderComponent(unref(_sfc_main$9), null, {
                                default: withCtx((_5, _push6, _parent6, _scopeId5) => {
                                  if (_push6) {
                                    _push6(`Субъект`);
                                  } else {
                                    return [
                                      createTextVNode("Субъект")
                                    ];
                                  }
                                }),
                                _: 1
                              }, _parent5, _scopeId4));
                              _push5(ssrRenderComponent(unref(_sfc_main$a), { value: "{null}" }, {
                                default: withCtx((_5, _push6, _parent6, _scopeId5) => {
                                  if (_push6) {
                                    _push6(`-- Не назначен --`);
                                  } else {
                                    return [
                                      createTextVNode("-- Не назначен --")
                                    ];
                                  }
                                }),
                                _: 1
                              }, _parent5, _scopeId4));
                              _push5(ssrRenderComponent(unref(_sfc_main$a), {
                                key: "physical",
                                value: "Физическое лицо"
                              }, {
                                default: withCtx((_5, _push6, _parent6, _scopeId5) => {
                                  if (_push6) {
                                    _push6(` Физическое лицо `);
                                  } else {
                                    return [
                                      createTextVNode(" Физическое лицо ")
                                    ];
                                  }
                                }),
                                _: 1
                              }, _parent5, _scopeId4));
                              _push5(ssrRenderComponent(unref(_sfc_main$a), {
                                key: "legal",
                                value: "Юридическое лицо"
                              }, {
                                default: withCtx((_5, _push6, _parent6, _scopeId5) => {
                                  if (_push6) {
                                    _push6(` Юридическое лицо `);
                                  } else {
                                    return [
                                      createTextVNode(" Юридическое лицо ")
                                    ];
                                  }
                                }),
                                _: 1
                              }, _parent5, _scopeId4));
                            } else {
                              return [
                                createVNode(unref(_sfc_main$9), null, {
                                  default: withCtx(() => [
                                    createTextVNode("Субъект")
                                  ]),
                                  _: 1
                                }),
                                createVNode(unref(_sfc_main$a), { value: "{null}" }, {
                                  default: withCtx(() => [
                                    createTextVNode("-- Не назначен --")
                                  ]),
                                  _: 1
                                }),
                                createVNode(unref(_sfc_main$a), {
                                  key: "physical",
                                  value: "Физическое лицо"
                                }, {
                                  default: withCtx(() => [
                                    createTextVNode(" Физическое лицо ")
                                  ]),
                                  _: 1
                                }),
                                createVNode(unref(_sfc_main$a), {
                                  key: "legal",
                                  value: "Юридическое лицо"
                                }, {
                                  default: withCtx(() => [
                                    createTextVNode(" Юридическое лицо ")
                                  ]),
                                  _: 1
                                })
                              ];
                            }
                          }),
                          _: 1
                        }, _parent4, _scopeId3));
                      } else {
                        return [
                          createVNode(unref(_sfc_main$8), null, {
                            default: withCtx(() => [
                              createVNode(unref(_sfc_main$9), null, {
                                default: withCtx(() => [
                                  createTextVNode("Субъект")
                                ]),
                                _: 1
                              }),
                              createVNode(unref(_sfc_main$a), { value: "{null}" }, {
                                default: withCtx(() => [
                                  createTextVNode("-- Не назначен --")
                                ]),
                                _: 1
                              }),
                              createVNode(unref(_sfc_main$a), {
                                key: "physical",
                                value: "Физическое лицо"
                              }, {
                                default: withCtx(() => [
                                  createTextVNode(" Физическое лицо ")
                                ]),
                                _: 1
                              }),
                              createVNode(unref(_sfc_main$a), {
                                key: "legal",
                                value: "Юридическое лицо"
                              }, {
                                default: withCtx(() => [
                                  createTextVNode(" Юридическое лицо ")
                                ]),
                                _: 1
                              })
                            ]),
                            _: 1
                          })
                        ];
                      }
                    }),
                    _: 1
                  }, _parent3, _scopeId2));
                } else {
                  return [
                    createVNode(unref(_sfc_main$5), { class: "w-full" }, {
                      default: withCtx(() => [
                        createVNode(unref(_sfc_main$6), { placeholder: "-- Не назначен --" })
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$7), null, {
                      default: withCtx(() => [
                        createVNode(unref(_sfc_main$8), null, {
                          default: withCtx(() => [
                            createVNode(unref(_sfc_main$9), null, {
                              default: withCtx(() => [
                                createTextVNode("Субъект")
                              ]),
                              _: 1
                            }),
                            createVNode(unref(_sfc_main$a), { value: "{null}" }, {
                              default: withCtx(() => [
                                createTextVNode("-- Не назначен --")
                              ]),
                              _: 1
                            }),
                            createVNode(unref(_sfc_main$a), {
                              key: "physical",
                              value: "Физическое лицо"
                            }, {
                              default: withCtx(() => [
                                createTextVNode(" Физическое лицо ")
                              ]),
                              _: 1
                            }),
                            createVNode(unref(_sfc_main$a), {
                              key: "legal",
                              value: "Юридическое лицо"
                            }, {
                              default: withCtx(() => [
                                createTextVNode(" Юридическое лицо ")
                              ]),
                              _: 1
                            })
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            if (unref(form).errors.subject) {
              _push2(`<p class="text-sm text-red-500"${_scopeId}>${ssrInterpolate(unref(form).errors.subject)}</p>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`</div><div class="space-y-2"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "region" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Клиент`);
                } else {
                  return [
                    createTextVNode("Клиент")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(unref(_sfc_main$3), {
              id: "region",
              modelValue: unref(form).client_name,
              "onUpdate:modelValue": ($event) => unref(form).client_name = $event,
              placeholder: "Укажите имя"
            }, null, _parent2, _scopeId));
            if (unref(form).errors.client_name) {
              _push2(`<p class="text-sm text-red-500"${_scopeId}>${ssrInterpolate(unref(form).errors.client_name)}</p>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`</div><div class="space-y-2"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "region" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Телефон`);
                } else {
                  return [
                    createTextVNode("Телефон")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(unref(_sfc_main$3), {
              id: "region",
              modelValue: unref(form).client_phone,
              "onUpdate:modelValue": ($event) => unref(form).client_phone = $event,
              placeholder: "Укажите контактный телефон"
            }, null, _parent2, _scopeId));
            if (unref(form).errors.client_phone) {
              _push2(`<p class="text-sm text-red-500"${_scopeId}>${ssrInterpolate(unref(form).errors.client_phone)}</p>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`</div><div class="space-y-2"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "address" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Адрес`);
                } else {
                  return [
                    createTextVNode("Адрес")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(unref(_sfc_main$3), {
              id: "address",
              modelValue: unref(form).address,
              "onUpdate:modelValue": ($event) => unref(form).address = $event,
              placeholder: "Адрес установки"
            }, null, _parent2, _scopeId));
            if (unref(form).errors.address) {
              _push2(`<p class="text-sm text-red-500"${_scopeId}>${ssrInterpolate(unref(form).errors.address)}</p>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`</div><div class="space-y-2"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "installer_id" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Назначить монтажника`);
                } else {
                  return [
                    createTextVNode("Назначить монтажника")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(unref(_sfc_main$4), {
              modelValue: unref(form).installer_id,
              "onUpdate:modelValue": ($event) => unref(form).installer_id = $event,
              class: "w-full"
            }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(ssrRenderComponent(unref(_sfc_main$5), { class: "w-full" }, {
                    default: withCtx((_3, _push4, _parent4, _scopeId3) => {
                      if (_push4) {
                        _push4(ssrRenderComponent(unref(_sfc_main$6), { placeholder: "-- Не назначен --" }, null, _parent4, _scopeId3));
                      } else {
                        return [
                          createVNode(unref(_sfc_main$6), { placeholder: "-- Не назначен --" })
                        ];
                      }
                    }),
                    _: 1
                  }, _parent3, _scopeId2));
                  _push3(ssrRenderComponent(unref(_sfc_main$7), null, {
                    default: withCtx((_3, _push4, _parent4, _scopeId3) => {
                      if (_push4) {
                        _push4(ssrRenderComponent(unref(_sfc_main$8), null, {
                          default: withCtx((_4, _push5, _parent5, _scopeId4) => {
                            if (_push5) {
                              _push5(ssrRenderComponent(unref(_sfc_main$9), null, {
                                default: withCtx((_5, _push6, _parent6, _scopeId5) => {
                                  if (_push6) {
                                    _push6(`Монтажники`);
                                  } else {
                                    return [
                                      createTextVNode("Монтажники")
                                    ];
                                  }
                                }),
                                _: 1
                              }, _parent5, _scopeId4));
                              _push5(ssrRenderComponent(unref(_sfc_main$a), { value: "{null}" }, {
                                default: withCtx((_5, _push6, _parent6, _scopeId5) => {
                                  if (_push6) {
                                    _push6(`-- Не назначен --`);
                                  } else {
                                    return [
                                      createTextVNode("-- Не назначен --")
                                    ];
                                  }
                                }),
                                _: 1
                              }, _parent5, _scopeId4));
                              _push5(`<!--[-->`);
                              ssrRenderList(_ctx.installers, (installer) => {
                                _push5(ssrRenderComponent(unref(_sfc_main$a), {
                                  key: installer.id,
                                  value: installer.id
                                }, {
                                  default: withCtx((_5, _push6, _parent6, _scopeId5) => {
                                    if (_push6) {
                                      _push6(`${ssrInterpolate(installer.name)}`);
                                    } else {
                                      return [
                                        createTextVNode(toDisplayString(installer.name), 1)
                                      ];
                                    }
                                  }),
                                  _: 2
                                }, _parent5, _scopeId4));
                              });
                              _push5(`<!--]-->`);
                            } else {
                              return [
                                createVNode(unref(_sfc_main$9), null, {
                                  default: withCtx(() => [
                                    createTextVNode("Монтажники")
                                  ]),
                                  _: 1
                                }),
                                createVNode(unref(_sfc_main$a), { value: "{null}" }, {
                                  default: withCtx(() => [
                                    createTextVNode("-- Не назначен --")
                                  ]),
                                  _: 1
                                }),
                                (openBlock(true), createBlock(Fragment, null, renderList(_ctx.installers, (installer) => {
                                  return openBlock(), createBlock(unref(_sfc_main$a), {
                                    key: installer.id,
                                    value: installer.id
                                  }, {
                                    default: withCtx(() => [
                                      createTextVNode(toDisplayString(installer.name), 1)
                                    ]),
                                    _: 2
                                  }, 1032, ["value"]);
                                }), 128))
                              ];
                            }
                          }),
                          _: 1
                        }, _parent4, _scopeId3));
                      } else {
                        return [
                          createVNode(unref(_sfc_main$8), null, {
                            default: withCtx(() => [
                              createVNode(unref(_sfc_main$9), null, {
                                default: withCtx(() => [
                                  createTextVNode("Монтажники")
                                ]),
                                _: 1
                              }),
                              createVNode(unref(_sfc_main$a), { value: "{null}" }, {
                                default: withCtx(() => [
                                  createTextVNode("-- Не назначен --")
                                ]),
                                _: 1
                              }),
                              (openBlock(true), createBlock(Fragment, null, renderList(_ctx.installers, (installer) => {
                                return openBlock(), createBlock(unref(_sfc_main$a), {
                                  key: installer.id,
                                  value: installer.id
                                }, {
                                  default: withCtx(() => [
                                    createTextVNode(toDisplayString(installer.name), 1)
                                  ]),
                                  _: 2
                                }, 1032, ["value"]);
                              }), 128))
                            ]),
                            _: 1
                          })
                        ];
                      }
                    }),
                    _: 1
                  }, _parent3, _scopeId2));
                } else {
                  return [
                    createVNode(unref(_sfc_main$5), { class: "w-full" }, {
                      default: withCtx(() => [
                        createVNode(unref(_sfc_main$6), { placeholder: "-- Не назначен --" })
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$7), null, {
                      default: withCtx(() => [
                        createVNode(unref(_sfc_main$8), null, {
                          default: withCtx(() => [
                            createVNode(unref(_sfc_main$9), null, {
                              default: withCtx(() => [
                                createTextVNode("Монтажники")
                              ]),
                              _: 1
                            }),
                            createVNode(unref(_sfc_main$a), { value: "{null}" }, {
                              default: withCtx(() => [
                                createTextVNode("-- Не назначен --")
                              ]),
                              _: 1
                            }),
                            (openBlock(true), createBlock(Fragment, null, renderList(_ctx.installers, (installer) => {
                              return openBlock(), createBlock(unref(_sfc_main$a), {
                                key: installer.id,
                                value: installer.id
                              }, {
                                default: withCtx(() => [
                                  createTextVNode(toDisplayString(installer.name), 1)
                                ]),
                                _: 2
                              }, 1032, ["value"]);
                            }), 128))
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    })
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            if (unref(form).errors.installer_id) {
              _push2(`<p class="text-sm text-red-500"${_scopeId}>${ssrInterpolate(unref(form).errors.installer_id)}</p>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`</div><div class="space-y-2"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "scheduled_date" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Дата и время`);
                } else {
                  return [
                    createTextVNode("Дата и время")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(unref(_sfc_main$3), {
              id: "scheduled_date",
              modelValue: unref(form).scheduled_date,
              "onUpdate:modelValue": ($event) => unref(form).scheduled_date = $event,
              type: "datetime-local"
            }, null, _parent2, _scopeId));
            if (unref(form).errors.scheduled_date) {
              _push2(`<p class="text-sm text-red-500"${_scopeId}>${ssrInterpolate(unref(form).errors.scheduled_date)}</p>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`</div><div class="space-y-2"${_scopeId}><div class="grid w-full max-w-sm items-center gap-1.5"${_scopeId}>`);
            _push2(ssrRenderComponent(unref(_sfc_main$2), { for: "photos" }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`Фото заявки (до 10Мб)`);
                } else {
                  return [
                    createTextVNode("Фото заявки (до 10Мб)")
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(ssrRenderComponent(unref(_sfc_main$3), {
              id: "photos",
              type: "file",
              multiple: "",
              accept: "image/*",
              onChange: handleFileChange
            }, null, _parent2, _scopeId));
            _push2(`</div>`);
            if (unref(form).errors.photos) {
              _push2(`<p class="text-sm text-red-500"${_scopeId}>${ssrInterpolate(unref(form).errors.photos)}</p>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`</div>`);
            if (previewUrls.value.length) {
              _push2(`<div class="flex gap-4 flex-wrap mt-2"${_scopeId}><!--[-->`);
              ssrRenderList(previewUrls.value, (url, index) => {
                _push2(`<div${_scopeId}><img${ssrRenderAttr("src", url)} class="w-32 h-32 object-cover rounded border"${_scopeId}></div>`);
              });
              _push2(`<!--]--></div>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(ssrRenderComponent(unref(_sfc_main$b), {
              type: "submit",
              disabled: unref(form).processing
            }, {
              default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                if (_push3) {
                  _push3(`${ssrInterpolate(unref(form).processing ? "Создание..." : "Создать")}`);
                } else {
                  return [
                    createTextVNode(toDisplayString(unref(form).processing ? "Создание..." : "Создать"), 1)
                  ];
                }
              }),
              _: 1
            }, _parent2, _scopeId));
            _push2(`</form></div>`);
          } else {
            return [
              createVNode("div", { class: "flex h-full flex-1 flex-col gap-4 rounded-xl p-4" }, [
                createVNode("h1", { class: "text-2xl font-bold mb-4" }, "Новая заявка"),
                createVNode("form", {
                  onSubmit: withModifiers(submit, ["prevent"]),
                  class: "space-y-6 max-w-xl"
                }, [
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode(unref(_sfc_main$2), { for: "title" }, {
                      default: withCtx(() => [
                        createTextVNode("Заголовок")
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$3), {
                      id: "title",
                      modelValue: unref(form).title,
                      "onUpdate:modelValue": ($event) => unref(form).title = $event,
                      placeholder: "Введите заголовок"
                    }, null, 8, ["modelValue", "onUpdate:modelValue"]),
                    unref(form).errors.title ? (openBlock(), createBlock("p", {
                      key: 0,
                      class: "text-sm text-red-500"
                    }, toDisplayString(unref(form).errors.title), 1)) : createCommentVNode("", true)
                  ]),
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode(unref(_sfc_main$2), { for: "description" }, {
                      default: withCtx(() => [
                        createTextVNode("Описание")
                      ]),
                      _: 1
                    }),
                    withDirectives(createVNode("textarea", {
                      id: "description",
                      "onUpdate:modelValue": ($event) => unref(form).description = $event,
                      rows: "4",
                      class: "w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm",
                      placeholder: "Краткое описание (необязательно)"
                    }, null, 8, ["onUpdate:modelValue"]), [
                      [vModelText, unref(form).description]
                    ])
                  ]),
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode(unref(_sfc_main$2), { for: "region" }, {
                      default: withCtx(() => [
                        createTextVNode("Регион")
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$3), {
                      id: "region",
                      modelValue: unref(form).region,
                      "onUpdate:modelValue": ($event) => unref(form).region = $event,
                      placeholder: "Укажите регион"
                    }, null, 8, ["modelValue", "onUpdate:modelValue"]),
                    unref(form).errors.region ? (openBlock(), createBlock("p", {
                      key: 0,
                      class: "text-sm text-red-500"
                    }, toDisplayString(unref(form).errors.region), 1)) : createCommentVNode("", true)
                  ]),
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode(unref(_sfc_main$2), { for: "address" }, {
                      default: withCtx(() => [
                        createTextVNode("Субъект")
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$4), {
                      modelValue: unref(form).subject,
                      "onUpdate:modelValue": ($event) => unref(form).subject = $event,
                      class: "w-full"
                    }, {
                      default: withCtx(() => [
                        createVNode(unref(_sfc_main$5), { class: "w-full" }, {
                          default: withCtx(() => [
                            createVNode(unref(_sfc_main$6), { placeholder: "-- Не назначен --" })
                          ]),
                          _: 1
                        }),
                        createVNode(unref(_sfc_main$7), null, {
                          default: withCtx(() => [
                            createVNode(unref(_sfc_main$8), null, {
                              default: withCtx(() => [
                                createVNode(unref(_sfc_main$9), null, {
                                  default: withCtx(() => [
                                    createTextVNode("Субъект")
                                  ]),
                                  _: 1
                                }),
                                createVNode(unref(_sfc_main$a), { value: "{null}" }, {
                                  default: withCtx(() => [
                                    createTextVNode("-- Не назначен --")
                                  ]),
                                  _: 1
                                }),
                                createVNode(unref(_sfc_main$a), {
                                  key: "physical",
                                  value: "Физическое лицо"
                                }, {
                                  default: withCtx(() => [
                                    createTextVNode(" Физическое лицо ")
                                  ]),
                                  _: 1
                                }),
                                createVNode(unref(_sfc_main$a), {
                                  key: "legal",
                                  value: "Юридическое лицо"
                                }, {
                                  default: withCtx(() => [
                                    createTextVNode(" Юридическое лицо ")
                                  ]),
                                  _: 1
                                })
                              ]),
                              _: 1
                            })
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    }, 8, ["modelValue", "onUpdate:modelValue"]),
                    unref(form).errors.subject ? (openBlock(), createBlock("p", {
                      key: 0,
                      class: "text-sm text-red-500"
                    }, toDisplayString(unref(form).errors.subject), 1)) : createCommentVNode("", true)
                  ]),
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode(unref(_sfc_main$2), { for: "region" }, {
                      default: withCtx(() => [
                        createTextVNode("Клиент")
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$3), {
                      id: "region",
                      modelValue: unref(form).client_name,
                      "onUpdate:modelValue": ($event) => unref(form).client_name = $event,
                      placeholder: "Укажите имя"
                    }, null, 8, ["modelValue", "onUpdate:modelValue"]),
                    unref(form).errors.client_name ? (openBlock(), createBlock("p", {
                      key: 0,
                      class: "text-sm text-red-500"
                    }, toDisplayString(unref(form).errors.client_name), 1)) : createCommentVNode("", true)
                  ]),
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode(unref(_sfc_main$2), { for: "region" }, {
                      default: withCtx(() => [
                        createTextVNode("Телефон")
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$3), {
                      id: "region",
                      modelValue: unref(form).client_phone,
                      "onUpdate:modelValue": ($event) => unref(form).client_phone = $event,
                      placeholder: "Укажите контактный телефон"
                    }, null, 8, ["modelValue", "onUpdate:modelValue"]),
                    unref(form).errors.client_phone ? (openBlock(), createBlock("p", {
                      key: 0,
                      class: "text-sm text-red-500"
                    }, toDisplayString(unref(form).errors.client_phone), 1)) : createCommentVNode("", true)
                  ]),
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode(unref(_sfc_main$2), { for: "address" }, {
                      default: withCtx(() => [
                        createTextVNode("Адрес")
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$3), {
                      id: "address",
                      modelValue: unref(form).address,
                      "onUpdate:modelValue": ($event) => unref(form).address = $event,
                      placeholder: "Адрес установки"
                    }, null, 8, ["modelValue", "onUpdate:modelValue"]),
                    unref(form).errors.address ? (openBlock(), createBlock("p", {
                      key: 0,
                      class: "text-sm text-red-500"
                    }, toDisplayString(unref(form).errors.address), 1)) : createCommentVNode("", true)
                  ]),
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode(unref(_sfc_main$2), { for: "installer_id" }, {
                      default: withCtx(() => [
                        createTextVNode("Назначить монтажника")
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$4), {
                      modelValue: unref(form).installer_id,
                      "onUpdate:modelValue": ($event) => unref(form).installer_id = $event,
                      class: "w-full"
                    }, {
                      default: withCtx(() => [
                        createVNode(unref(_sfc_main$5), { class: "w-full" }, {
                          default: withCtx(() => [
                            createVNode(unref(_sfc_main$6), { placeholder: "-- Не назначен --" })
                          ]),
                          _: 1
                        }),
                        createVNode(unref(_sfc_main$7), null, {
                          default: withCtx(() => [
                            createVNode(unref(_sfc_main$8), null, {
                              default: withCtx(() => [
                                createVNode(unref(_sfc_main$9), null, {
                                  default: withCtx(() => [
                                    createTextVNode("Монтажники")
                                  ]),
                                  _: 1
                                }),
                                createVNode(unref(_sfc_main$a), { value: "{null}" }, {
                                  default: withCtx(() => [
                                    createTextVNode("-- Не назначен --")
                                  ]),
                                  _: 1
                                }),
                                (openBlock(true), createBlock(Fragment, null, renderList(_ctx.installers, (installer) => {
                                  return openBlock(), createBlock(unref(_sfc_main$a), {
                                    key: installer.id,
                                    value: installer.id
                                  }, {
                                    default: withCtx(() => [
                                      createTextVNode(toDisplayString(installer.name), 1)
                                    ]),
                                    _: 2
                                  }, 1032, ["value"]);
                                }), 128))
                              ]),
                              _: 1
                            })
                          ]),
                          _: 1
                        })
                      ]),
                      _: 1
                    }, 8, ["modelValue", "onUpdate:modelValue"]),
                    unref(form).errors.installer_id ? (openBlock(), createBlock("p", {
                      key: 0,
                      class: "text-sm text-red-500"
                    }, toDisplayString(unref(form).errors.installer_id), 1)) : createCommentVNode("", true)
                  ]),
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode(unref(_sfc_main$2), { for: "scheduled_date" }, {
                      default: withCtx(() => [
                        createTextVNode("Дата и время")
                      ]),
                      _: 1
                    }),
                    createVNode(unref(_sfc_main$3), {
                      id: "scheduled_date",
                      modelValue: unref(form).scheduled_date,
                      "onUpdate:modelValue": ($event) => unref(form).scheduled_date = $event,
                      type: "datetime-local"
                    }, null, 8, ["modelValue", "onUpdate:modelValue"]),
                    unref(form).errors.scheduled_date ? (openBlock(), createBlock("p", {
                      key: 0,
                      class: "text-sm text-red-500"
                    }, toDisplayString(unref(form).errors.scheduled_date), 1)) : createCommentVNode("", true)
                  ]),
                  createVNode("div", { class: "space-y-2" }, [
                    createVNode("div", { class: "grid w-full max-w-sm items-center gap-1.5" }, [
                      createVNode(unref(_sfc_main$2), { for: "photos" }, {
                        default: withCtx(() => [
                          createTextVNode("Фото заявки (до 10Мб)")
                        ]),
                        _: 1
                      }),
                      createVNode(unref(_sfc_main$3), {
                        id: "photos",
                        type: "file",
                        multiple: "",
                        accept: "image/*",
                        onChange: handleFileChange
                      })
                    ]),
                    unref(form).errors.photos ? (openBlock(), createBlock("p", {
                      key: 0,
                      class: "text-sm text-red-500"
                    }, toDisplayString(unref(form).errors.photos), 1)) : createCommentVNode("", true)
                  ]),
                  previewUrls.value.length ? (openBlock(), createBlock("div", {
                    key: 0,
                    class: "flex gap-4 flex-wrap mt-2"
                  }, [
                    (openBlock(true), createBlock(Fragment, null, renderList(previewUrls.value, (url, index) => {
                      return openBlock(), createBlock("div", { key: index }, [
                        createVNode("img", {
                          src: url,
                          class: "w-32 h-32 object-cover rounded border"
                        }, null, 8, ["src"])
                      ]);
                    }), 128))
                  ])) : createCommentVNode("", true),
                  createVNode(unref(_sfc_main$b), {
                    type: "submit",
                    disabled: unref(form).processing
                  }, {
                    default: withCtx(() => [
                      createTextVNode(toDisplayString(unref(form).processing ? "Создание..." : "Создать"), 1)
                    ]),
                    _: 1
                  }, 8, ["disabled"])
                ], 32)
              ])
            ];
          }
        }),
        _: 1
      }, _parent));
      _push(`<!--]-->`);
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/pages/requests/Create.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export {
  _sfc_main as default
};
