Fix QC
# fix - authentication - profile - pencarian user - forum ## No issue
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
Paper,
|
||||
Select,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Textarea,
|
||||
Title,
|
||||
@@ -32,6 +33,8 @@ import { NotifPeringatan } from "@/app_modules/donasi/component/notifikasi/notif
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
||||
import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown";
|
||||
|
||||
export default function CreatePortofolio({
|
||||
bidangBisnis,
|
||||
@@ -60,6 +63,7 @@ export default function CreatePortofolio({
|
||||
|
||||
const [file, setFile] = useState<File | any>(null);
|
||||
const [img, setImg] = useState<any | null>(null);
|
||||
const [isFile, setIsFile] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -72,7 +76,7 @@ export default function CreatePortofolio({
|
||||
withAsterisk
|
||||
label="Nama Bisnis"
|
||||
placeholder="Nama bisnis"
|
||||
error={value.namaBisnis.length > 100 ? "Maksimal 100 karakter" : ""}
|
||||
maxLength={100}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
@@ -99,9 +103,7 @@ export default function CreatePortofolio({
|
||||
withAsterisk
|
||||
label="Alamat Kantor"
|
||||
placeholder="Alamat kantor"
|
||||
error={
|
||||
value.alamatKantor.length > 100 ? "Maksimal 100 karakter" : ""
|
||||
}
|
||||
maxLength={100}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
@@ -121,21 +123,27 @@ export default function CreatePortofolio({
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Textarea
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={5}
|
||||
withAsterisk
|
||||
label="Deskripsi"
|
||||
placeholder="Deskripsi singkat mengenai usaha"
|
||||
error={value.deskripsi.length > 150 ? "Maksimal 150 karakter" : ""}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
deskripsi: val.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Stack spacing={5}>
|
||||
<Textarea
|
||||
maxLength={150}
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={5}
|
||||
withAsterisk
|
||||
label="Deskripsi"
|
||||
placeholder="Deskripsi singkat mengenai usaha"
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
deskripsi: val.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<ComponentGlobal_InputCountDown
|
||||
maxInput={150}
|
||||
lengthInput={value.deskripsi.length}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
<Stack>
|
||||
@@ -145,6 +153,8 @@ export default function CreatePortofolio({
|
||||
<Image alt="Foto" src={img ? img : "/aset/no-img.png"} />
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
{isFile ? <ComponentGlobal_ErrorInput text="Upload gambar" /> : ""}
|
||||
|
||||
<Center>
|
||||
<FileButton
|
||||
onChange={async (files: any | null) => {
|
||||
@@ -160,6 +170,7 @@ export default function CreatePortofolio({
|
||||
} else {
|
||||
setImg(buffer);
|
||||
setFile(files);
|
||||
setIsFile(false);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -187,6 +198,7 @@ export default function CreatePortofolio({
|
||||
<ComponentKatalog_NotedBox informasi="Isi hanya pada sosial media yang anda miliki" />
|
||||
<TextInput
|
||||
label="Facebook"
|
||||
maxLength={100}
|
||||
placeholder="Facebook"
|
||||
onChange={(val) => {
|
||||
setMedsos({
|
||||
@@ -197,6 +209,7 @@ export default function CreatePortofolio({
|
||||
/>
|
||||
<TextInput
|
||||
label="Instagram"
|
||||
maxLength={100}
|
||||
placeholder="Instagram"
|
||||
onChange={(val) => {
|
||||
setMedsos({
|
||||
@@ -207,6 +220,7 @@ export default function CreatePortofolio({
|
||||
/>
|
||||
<TextInput
|
||||
label="Tiktok"
|
||||
maxLength={100}
|
||||
placeholder="Tiktok"
|
||||
onChange={(val) => {
|
||||
setMedsos({
|
||||
@@ -217,6 +231,7 @@ export default function CreatePortofolio({
|
||||
/>
|
||||
<TextInput
|
||||
label="Twitter"
|
||||
maxLength={100}
|
||||
placeholder="Twitter"
|
||||
onChange={(val) => {
|
||||
setMedsos({
|
||||
@@ -227,6 +242,7 @@ export default function CreatePortofolio({
|
||||
/>
|
||||
<TextInput
|
||||
label="Youtube"
|
||||
maxLength={100}
|
||||
placeholder="Youtube"
|
||||
onChange={(val) => {
|
||||
setMedsos({
|
||||
@@ -245,7 +261,15 @@ export default function CreatePortofolio({
|
||||
loading={loading ? true : false}
|
||||
loaderPosition="center"
|
||||
onClick={() => {
|
||||
onSubmit(router, profileId, value as any, file, medsos, setLoading);
|
||||
onSubmit(
|
||||
router,
|
||||
profileId,
|
||||
value as any,
|
||||
file,
|
||||
medsos,
|
||||
setLoading,
|
||||
setIsFile
|
||||
);
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
@@ -263,7 +287,8 @@ async function onSubmit(
|
||||
dataPorto: MODEL_PORTOFOLIO_OLD,
|
||||
file: FormData,
|
||||
dataMedsos: any,
|
||||
setLoading: any
|
||||
setLoading: any,
|
||||
setIsFile: any
|
||||
) {
|
||||
const porto = {
|
||||
namaBisnis: dataPorto.namaBisnis,
|
||||
@@ -272,14 +297,13 @@ async function onSubmit(
|
||||
tlpn: dataPorto.tlpn,
|
||||
deskripsi: dataPorto.deskripsi,
|
||||
};
|
||||
|
||||
if (_.values(porto).includes(""))
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
||||
if (!file)
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi logo bisnis");
|
||||
|
||||
if (porto.namaBisnis.length > 100) return null;
|
||||
if (porto.alamatKantor.length > 100) return null;
|
||||
if (porto.deskripsi.length > 150) return null;
|
||||
if (file === null) {
|
||||
setIsFile(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
const gambar = new FormData();
|
||||
gambar.append("file", file as any);
|
||||
|
||||
@@ -13,6 +13,8 @@ import { Portofolio_funEditDataBisnis } from "../../fun/edit/fun_edit_data_bisni
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
||||
import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown";
|
||||
|
||||
export default function Portofolio_EditDataBisnis({
|
||||
dataPorto,
|
||||
@@ -35,7 +37,14 @@ export default function Portofolio_EditDataBisnis({
|
||||
value={value.namaBisnis}
|
||||
label="Nama Bisnis"
|
||||
placeholder="Nama bisnis"
|
||||
error={value.namaBisnis.length > 100 ? "Maksimal 100 karakter" : ""}
|
||||
maxLength={100}
|
||||
error={
|
||||
value.namaBisnis === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan nama bisnis" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
@@ -66,8 +75,13 @@ export default function Portofolio_EditDataBisnis({
|
||||
value={value.alamatKantor}
|
||||
label="Alamat Kantor"
|
||||
placeholder="Alamat kantor"
|
||||
maxLength={100}
|
||||
error={
|
||||
value.alamatKantor.length > 100 ? "Maksimal 100 karakter" : ""
|
||||
value.alamatKantor === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan alamat kantor" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
@@ -80,8 +94,16 @@ export default function Portofolio_EditDataBisnis({
|
||||
withAsterisk
|
||||
value={value.tlpn}
|
||||
label="Nomor Telepon Kantor"
|
||||
placeholder="62 xxx xxx xxx"
|
||||
placeholder="Nomor telepon kantor"
|
||||
type="number"
|
||||
maxLength={15}
|
||||
error={
|
||||
value.tlpn === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan nomor telepon kantor" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
@@ -89,22 +111,35 @@ export default function Portofolio_EditDataBisnis({
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Textarea
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={5}
|
||||
withAsterisk
|
||||
value={value.deskripsi}
|
||||
label="Deskripsi"
|
||||
placeholder="Deskripsi singkat mengenai usaha"
|
||||
error={value.deskripsi.length > 150 ? "Maksimal 150 karakter" : ""}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
deskripsi: val.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Stack spacing={5}>
|
||||
<Textarea
|
||||
autosize
|
||||
minRows={2}
|
||||
maxRows={5}
|
||||
withAsterisk
|
||||
value={value.deskripsi}
|
||||
label="Deskripsi"
|
||||
placeholder="Deskripsi singkat mengenai usaha"
|
||||
maxLength={150}
|
||||
error={
|
||||
value.deskripsi === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan deskripsi" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
deskripsi: val.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<ComponentGlobal_InputCountDown
|
||||
maxInput={150}
|
||||
lengthInput={value.deskripsi.length}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
@@ -126,12 +161,13 @@ async function onUpdate(
|
||||
data: MODEL_PORTOFOLIO,
|
||||
setLoading: any
|
||||
) {
|
||||
if (_.values(data).includes(""))
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
||||
if (_.values(data).includes("")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (data.namaBisnis.length > 100) return null;
|
||||
if (data.alamatKantor.length > 100) return null;
|
||||
if (data.deskripsi.length > 150) return null;
|
||||
// if (data.namaBisnis.length > 100) return null;
|
||||
// if (data.alamatKantor.length > 100) return null;
|
||||
// if (data.deskripsi.length > 150) return null;
|
||||
|
||||
await Portofolio_funEditDataBisnis(data).then((res) => {
|
||||
if (res.status === 200) {
|
||||
|
||||
@@ -185,7 +185,7 @@ export default function ViewPortofolio({
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Paper>
|
||||
{userLoginId === dataPorto.Profile.User.id ? (
|
||||
{userLoginId === dataPorto?.Profile?.User?.id ? (
|
||||
<Button
|
||||
radius={"xl"}
|
||||
bg={"red"}
|
||||
@@ -233,7 +233,7 @@ async function onDelete(
|
||||
if (res.status === 200) {
|
||||
setLoadingDel(true);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.push(RouterProfile.katalog + `${dataPorto.profileId}`);
|
||||
router.back();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
|
||||
@@ -128,17 +128,7 @@ export default function CreateProfile({ userId }: { userId: any }) {
|
||||
<Stack>
|
||||
<ComponentKatalog_NotedBox informasi="Upload foto latar belakang profile anda." />
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper
|
||||
radius={"md"}
|
||||
withBorder
|
||||
shadow="lg"
|
||||
bg={"gray.2"}
|
||||
// sx={{
|
||||
// borderStyle: "solid",
|
||||
// borderColor: "black",
|
||||
// borderWidth: "1px",
|
||||
// }}
|
||||
>
|
||||
<Paper radius={"md"} withBorder shadow="lg" bg={"gray.2"}>
|
||||
{imgBG ? (
|
||||
<Image alt="Foto" src={imgBG ? imgBG : "/aset/no-img.png"} />
|
||||
) : (
|
||||
@@ -197,6 +187,7 @@ export default function CreateProfile({ userId }: { userId: any }) {
|
||||
<TextInput
|
||||
withAsterisk
|
||||
label="Nama"
|
||||
maxLength={50}
|
||||
placeholder="Nama lengkap"
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
@@ -209,6 +200,7 @@ export default function CreateProfile({ userId }: { userId: any }) {
|
||||
withAsterisk
|
||||
icon={<IconAt size={15} />}
|
||||
label="Email"
|
||||
maxLength={100}
|
||||
placeholder="Contoh: User@gmail.com"
|
||||
error={
|
||||
value.email.length > 0 && !value.email.match(validRegex)
|
||||
@@ -225,8 +217,8 @@ export default function CreateProfile({ userId }: { userId: any }) {
|
||||
<TextInput
|
||||
withAsterisk
|
||||
label="Alamat"
|
||||
maxLength={100}
|
||||
placeholder="Alamat lengkap"
|
||||
error={value.alamat.length > 100 ? "Max 100 karakter" : ""}
|
||||
onChange={(val) => {
|
||||
setValue({
|
||||
...value,
|
||||
@@ -288,7 +280,6 @@ function ButtonAction({
|
||||
if (_.values(body).includes(""))
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
||||
if (!body.email.match(validRegex)) return null;
|
||||
if (body.alamat.length > 100) return null;
|
||||
|
||||
const gambarPP = new FormData();
|
||||
gambarPP.append("filePP", filePP as any);
|
||||
|
||||
@@ -19,6 +19,7 @@ import { Profile_funEditById } from "../fun/update/fun_edit_profile_by_id";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { validRegex } from "../../component/regular_expressions";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
|
||||
|
||||
export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
|
||||
const router = useRouter();
|
||||
@@ -31,10 +32,8 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
|
||||
const body = dataProfile;
|
||||
|
||||
// console.log(body)
|
||||
if (_.values(body).includes(""))
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi data");
|
||||
if (_.values(body).includes("")) return null;
|
||||
if (!body.email.match(validRegex)) return null;
|
||||
if (body.alamat.length > 100) return null;
|
||||
|
||||
await Profile_funEditById(body).then((res) => {
|
||||
if (res.status === 200) {
|
||||
@@ -77,7 +76,6 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
|
||||
value={dataProfile?.User?.username}
|
||||
onChange={(val) => {
|
||||
// const dataUsername = _.clone(dataProfile)
|
||||
|
||||
setDataProfile({
|
||||
...(dataProfile as any),
|
||||
User: {
|
||||
@@ -90,7 +88,15 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
|
||||
<TextInput
|
||||
withAsterisk
|
||||
label="Nama"
|
||||
placeholder="Nama"
|
||||
placeholder="nama"
|
||||
maxLength={50}
|
||||
error={
|
||||
dataProfile?.name === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan nama" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
value={dataProfile?.name}
|
||||
onChange={(val) => {
|
||||
setDataProfile({
|
||||
@@ -105,10 +111,14 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
|
||||
label="Email"
|
||||
placeholder="email"
|
||||
error={
|
||||
dataProfile?.email?.length > 0 &&
|
||||
!dataProfile?.email.match(validRegex)
|
||||
? "Invalid email"
|
||||
: ""
|
||||
dataProfile?.email === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan email " />
|
||||
) : dataProfile?.email?.length > 0 &&
|
||||
!dataProfile?.email.match(validRegex) ? (
|
||||
<ComponentGlobal_ErrorInput text="Invalid email" />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
value={dataProfile?.email}
|
||||
onChange={(val) => {
|
||||
@@ -124,7 +134,14 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
|
||||
label="Alamat"
|
||||
placeholder="alamat"
|
||||
value={dataProfile.alamat}
|
||||
error={dataProfile.alamat.length > 100 ? "Max 100 karakter" : ""}
|
||||
maxLength={100}
|
||||
error={
|
||||
dataProfile?.alamat === "" ? (
|
||||
<ComponentGlobal_ErrorInput text="Masukan alamat " />
|
||||
) : (
|
||||
""
|
||||
)
|
||||
}
|
||||
onChange={(val) => {
|
||||
setDataProfile({
|
||||
...dataProfile,
|
||||
|
||||
Reference in New Issue
Block a user