From f0548068badf0f561f2652bfb7bb282770607a63 Mon Sep 17 00:00:00 2001 From: Fuad Rifki Refactory Date: Mon, 20 Apr 2020 12:52:40 +0700 Subject: [PATCH 01/43] add button mainapp --- src/App/Container/Assets/Css/main.css | 12 ++++ src/App/Container/Components/MainApp/View.tsx | 56 ++++++++++++++++++- 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/src/App/Container/Assets/Css/main.css b/src/App/Container/Assets/Css/main.css index ef6823f..351e8f3 100644 --- a/src/App/Container/Assets/Css/main.css +++ b/src/App/Container/Assets/Css/main.css @@ -1050,10 +1050,22 @@ video { background-color: #162f42; } +.bg-bluepindad-300 { + background-color: #0078a9 +} + .bg-yellowpindad-100 { background-color: #D4AF37; } +.bg-orangepindad-100 { + background-color: #EC971F +} + +.bg-greenpindad-100 { + background-color: #449D44 +} + .hover\:bg-transparent:hover { background-color: transparent; } diff --git a/src/App/Container/Components/MainApp/View.tsx b/src/App/Container/Components/MainApp/View.tsx index c980623..97bf038 100644 --- a/src/App/Container/Components/MainApp/View.tsx +++ b/src/App/Container/Components/MainApp/View.tsx @@ -1,13 +1,63 @@ import React from "react"; -export const MainApp = ({ title, children }) => { +export const MainApp = ({ + title, + children, + textDone = "", + textNew = "", + classNameDone = "bg-white hover:bg-gray-300 border border-gray-400 text-gray-800", + classNameNew = "focus:outline-none bg-blue-600 hover:bg-blue-800 text-white", + onActionOne = () => {}, + onActionTwo = () => {}, +}) => { return (
- From 3261e461634e51f215d990be1a79b029c2e5c315 Mon Sep 17 00:00:00 2001 From: Fuad Rifki Refactory Date: Mon, 20 Apr 2020 13:07:30 +0700 Subject: [PATCH 02/43] add reusable 4 button main app --- src/App/Container/Components/MainApp/View.tsx | 87 +++++++++++-------- .../VendorProfile/Component/General/View.tsx | 7 +- 2 files changed, 57 insertions(+), 37 deletions(-) diff --git a/src/App/Container/Components/MainApp/View.tsx b/src/App/Container/Components/MainApp/View.tsx index 97bf038..8c96a67 100644 --- a/src/App/Container/Components/MainApp/View.tsx +++ b/src/App/Container/Components/MainApp/View.tsx @@ -3,12 +3,10 @@ import React from "react"; export const MainApp = ({ title, children, - textDone = "", - textNew = "", - classNameDone = "bg-white hover:bg-gray-300 border border-gray-400 text-gray-800", - classNameNew = "focus:outline-none bg-blue-600 hover:bg-blue-800 text-white", - onActionOne = () => {}, - onActionTwo = () => {}, + onActionRefresh = () => {}, + onActionDone = () => {}, + onActionNew = () => {}, + onActionPrimary = () => {}, }) => { return (
@@ -20,43 +18,60 @@ export const MainApp = ({ {title}
-
- +
+ )} + {onActionPrimary.toString() !== "() => {}" && ( + -
- - - + + + + Buat Entri Baru + + )} diff --git a/src/App/Container/Views/Private/VendorProfile/Component/General/View.tsx b/src/App/Container/Views/Private/VendorProfile/Component/General/View.tsx index 47a1713..f755564 100644 --- a/src/App/Container/Views/Private/VendorProfile/Component/General/View.tsx +++ b/src/App/Container/Views/Private/VendorProfile/Component/General/View.tsx @@ -4,7 +4,12 @@ import GeneralComponent from "./Component/General"; const General = () => { return ( - + alert("Ok")} + onActionDone={() => alert("Done")} + onActionNew={() => alert("New")} + > ); From 28f31ed2287e2397d73a232ef354fbd270b7a565 Mon Sep 17 00:00:00 2001 From: Fuad Rifki Refactory Date: Mon, 20 Apr 2020 14:13:03 +0700 Subject: [PATCH 03/43] add modal --- .../Component/General/Component/General.tsx | 52 +- .../Component/General/Component/Modal.tsx | 517 ++++++++++++++++++ .../Component/General/Controller.tsx | 213 ++++++++ .../VendorProfile/Component/General/View.tsx | 11 +- 4 files changed, 773 insertions(+), 20 deletions(-) create mode 100644 src/App/Container/Views/Private/VendorProfile/Component/General/Component/Modal.tsx create mode 100644 src/App/Container/Views/Private/VendorProfile/Component/General/Controller.tsx diff --git a/src/App/Container/Views/Private/VendorProfile/Component/General/Component/General.tsx b/src/App/Container/Views/Private/VendorProfile/Component/General/Component/General.tsx index 3b5f13a..9653fe6 100644 --- a/src/App/Container/Views/Private/VendorProfile/Component/General/Component/General.tsx +++ b/src/App/Container/Views/Private/VendorProfile/Component/General/Component/General.tsx @@ -1,21 +1,49 @@ -import React from "react"; +import React, { useContext } from "react"; import Table from "./Table"; +import { Modal } from "../../../../../../Components"; +import { GeneralContext } from "../Controller"; +import { MainApp } from "../../../../../../Components"; +import ModalComponent from "./Modal"; const GeneralComponent = () => { + const { open, setOpen } = useContext(GeneralContext); + return ( -
-
-
- - -
-
-
- {title} + +
+ {title} +
+
+
+ +
+ + + +
+ alert("Ok")} + onActionDone={() => alert("Done")} + onActionNew={() => setOpen(true)} + > +
+
+
+ + +
+
+
+ + { + setOpen(false); + }} + onActionOne={() => { + setOpen(false); + }} + textOne="Batal" + textTwo="Simpan" + > + + - + ); }; diff --git a/src/App/Container/Views/Private/VendorProfile/Component/General/Component/Modal.tsx b/src/App/Container/Views/Private/VendorProfile/Component/General/Component/Modal.tsx new file mode 100644 index 0000000..8b412cb --- /dev/null +++ b/src/App/Container/Views/Private/VendorProfile/Component/General/Component/Modal.tsx @@ -0,0 +1,517 @@ +import React, { useContext } from "react"; +import { ErrorMessage } from "react-hook-form"; +import Select from "react-select"; +import { GeneralContext } from "../Controller"; + +const ModalComponent = () => { + const { + customStyles, + register, + errors, + setBranchName, + setAddress, + country, + setCountry, + province, + setProvince, + city, + setCity, + setSubDistrict, + setPostalCode, + setPhoneNumber, + setPhoneNumberExt, + setFaxNumber, + setFaxNumberExt, + setCompanyEmail, + optionsCompanyType, + Indonesia, + Yogya, + Sleman, + } = useContext(GeneralContext); + + return ( +
+
+
+ Use as Branch Office +
+
+
+
+
+
+
+ +
+
+ setBranchName(val.target.value)} + className="w-full bg-white border border-gray-400 hover:border-gray-500 py-1 px-2" + placeholder="Nama Cabang/Lokasi Cabang" + /> + + {({ messages }) => { + return ( + messages && + Object.entries(messages).map(([type, message]) => ( +

+ {message} +

+ )) + ); + }} +
+
+
+
+
+ +
+
+