156 lines
5.8 KiB
JavaScript
156 lines
5.8 KiB
JavaScript
import { defineComponent, mergeProps, unref, withCtx, createTextVNode, toDisplayString, ref, reactive, createVNode, useSSRContext } from 'vue';
|
|
import { ssrRenderAttrs, ssrRenderComponent, ssrInterpolate, ssrRenderAttr } from 'vue/server-renderer';
|
|
import { U as UserProfilePic } from './UserProfilePic-DXA233hi.mjs';
|
|
import { _ as _sfc_main$2 } from './BasicButton-B-4QDu9v.mjs';
|
|
import { u as useRouter, a as useConfigStore, z as useElementSize, aQ as baseConfirmWithId, aR as deleteUser } from './server.mjs';
|
|
import { ContentLoader } from 'vue-content-loader';
|
|
|
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
__name: "CustomerCard",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
user: {}
|
|
},
|
|
emits: ["refresh"],
|
|
setup(__props, { emit: __emit }) {
|
|
const router = useRouter();
|
|
const props = __props;
|
|
const config = useConfigStore();
|
|
const emits = __emit;
|
|
async function handlerConfirmDeleteUser() {
|
|
var _a;
|
|
await baseConfirmWithId(config.useString("areYouSureToDeleteThisUser"), (_a = props.user.id) != null ? _a : "", deleteUser, () => emits("refresh"));
|
|
}
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(`<div${ssrRenderAttrs(mergeProps({ class: "flex justify-between items-center" }, _attrs))}><div class="flex gap-4 items-center">`);
|
|
_push(ssrRenderComponent(UserProfilePic, {
|
|
width: "60",
|
|
src: _ctx.user.avatar,
|
|
"just-show-profile": ""
|
|
}, null, _parent));
|
|
_push(`<div><div class="text-sm font-400">${ssrInterpolate(_ctx.user.name)}</div><div class="text-sm text-gray font-300">${ssrInterpolate(_ctx.user.infoText)}</div></div></div>`);
|
|
if (unref(config).isSeller) {
|
|
_push(`<div class="w-1/4 my1">`);
|
|
_push(ssrRenderComponent(_sfc_main$2, {
|
|
class: "!h-7 w-full",
|
|
onClick: ($event) => unref(router).push({ name: "user-edit-id", params: { id: _ctx.user.id } })
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`${ssrInterpolate(unref(config).useString("edit"))}`);
|
|
} else {
|
|
return [
|
|
createTextVNode(toDisplayString(unref(config).useString("edit")), 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(ssrRenderComponent(_sfc_main$2, {
|
|
class: "!h-7 w-full border-red text-red mt1",
|
|
onClick: handlerConfirmDeleteUser
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`${ssrInterpolate(unref(config).useString("delete"))}`);
|
|
} else {
|
|
return [
|
|
createTextVNode(toDisplayString(unref(config).useString("delete")), 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div>`);
|
|
} else {
|
|
_push(ssrRenderComponent(_sfc_main$2, { class: "!h-7 w-1/4" }, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`${ssrInterpolate(unref(config).useString("details"))}`);
|
|
} else {
|
|
return [
|
|
createTextVNode(toDisplayString(unref(config).useString("details")), 1)
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
}
|
|
_push(`</div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
_sfc_main$1.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Cards/CustomerCard.vue");
|
|
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
};
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "CustomerCardSkeleton",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
const isLoaded = ref(false);
|
|
const skeletonRatio = ref(null);
|
|
const skeletonSize = reactive(
|
|
useElementSize(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" })
|
|
);
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
if (isLoaded.value) {
|
|
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
ref_key: "skeletonRatio",
|
|
ref: skeletonRatio,
|
|
class: "h-fit"
|
|
}, _attrs))}>`);
|
|
_push(ssrRenderComponent(unref(ContentLoader), {
|
|
width: skeletonSize.width,
|
|
height: "70"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<circle cx="30" cy="30" r="30"${_scopeId}></circle><rect x="80" y="20" rx="3" ry="3" width="170" height="20"${_scopeId}></rect><rect${ssrRenderAttr("x", skeletonSize.width - 80)} y="15" rx="3" ry="3" width="80" height="30"${_scopeId}></rect>`);
|
|
} else {
|
|
return [
|
|
createVNode("circle", {
|
|
cx: "30",
|
|
cy: "30",
|
|
r: "30"
|
|
}),
|
|
createVNode("rect", {
|
|
x: "80",
|
|
y: "20",
|
|
rx: "3",
|
|
ry: "3",
|
|
width: "170",
|
|
height: "20"
|
|
}),
|
|
createVNode("rect", {
|
|
x: skeletonSize.width - 80,
|
|
y: "15",
|
|
rx: "3",
|
|
ry: "3",
|
|
width: "80",
|
|
height: "30"
|
|
}, null, 8, ["x"])
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Cards/CustomerCardSkeleton.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main$1 as _, _sfc_main as a };
|
|
//# sourceMappingURL=CustomerCardSkeleton-CUuPSTKB.mjs.map
|