Skip to content

Commit

Permalink
Merge branch 'main' into noob-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer-Sch authored Jan 5, 2024
2 parents c8e241a + 74e0747 commit cfa97ba
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
44 changes: 44 additions & 0 deletions packages/nextjs/components/dash-wind/features/employees/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function Employees() {
*/

// // uncomment below @todo

const {
data: salariedEmployeeAddresses, // address[]
// isError,
Expand Down Expand Up @@ -156,6 +157,7 @@ function Employees() {
setErrorMsg("removeEmployee error");
},
});

// const {
// data: hourlyEmployeeAddresses, // address[]
// isError,
Expand All @@ -167,6 +169,27 @@ function Employees() {
// chainId: Number(chainId),
// });

// // this will return a bool from contract as to if the address is an employee true = employee exists
// const {
// data: isEmployee,
// // isError,
// // isLoading,
// } = useContractRead({
// address: process.env.NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS,
// abi: payrollABI,

// functionName: "isEmployee",
// //@todo where do we need to get this address from?
// // figured we should check if an address is an employee
// // before owner/company is allwoed to add or delete
// args: [userAddress],
// chainId: Number(chainId),
// });

// functionName: "getHourlyEmployees",
// chainId: Number(chainId),
// });

// // this will return a bool from contract as to if the address is an employee true = employee exists
// const {
// data: isEmployee,
Expand All @@ -183,6 +206,21 @@ function Employees() {
// chainId: Number(chainId),
// });

// // hook to add employee to the contract @todo
// // need their address, a bool _isSalary, uint256 _payRate(hourly rate if isSalary is false, otherwise annual salary)
// const { data, isLoading, isSuccess, write } = useContractWrite({
// address: process.env.NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS,
// abi: payrollABI,
// functionName: "addEmployee",
// args: [],
// onSuccess(data: any) {
// console.log("employee added! Data: ", data); //will data be the contract addresses?
// },
// onError(error: any) {
// console.error("employee add error!", error); //error message
// },
// });

// // hook to set or change an employees salary if we need it, not necessary for stuff rn
// // from Payroll: function setEmployeeSalary(address _employeeAddress, bool _isSalary, uint256 _payRate) external onlyOwner {}
// const { data, isLoading, isSuccess, write } = useContractWrite({
Expand Down Expand Up @@ -226,6 +264,12 @@ function Employees() {
// Kaz & Trevor @todo
// this function will be responsible for deleting an employee
// WAGMI HOOK
// const { data, isLoading, isSuccess, write } = useContractWrite({
// address: process.env.NEXT_PUBLIC_PAYROLL_CONTRACT_ADDRESS,
// abi: payrollABI,
// functionName: "removeEmployee",
// args: [employeeAddress]
// });
/*-------------------------------------*/
setEmpAddiToRemove(address);
setIsRemovingEmpAndFetching(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { RECENT_PAYMENTS } from "../../utils/dummyData";
import FunnelIcon from "@heroicons/react/24/outline/FunnelIcon";
import XMarkIcon from "@heroicons/react/24/outline/XMarkIcon";

// uncomment @todo
//import { useContractWrite } from "wagmi";
//import Payroll from "../../../../../hardhat/artifacts/contracts/Payroll.sol/Payroll.json";

//@todo add buttons to pay single employee, pay all salary employees, pay all hourly employees, and pay all employees?

// const chainId = process.env.NEXT_PUBLIC_TARGET_LOCAL_CHAIN
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/components/dash-wind/features/user/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ function Login() {
updateFormValue={updateFormValue}
/>
</div>
<p>isOwner: {isOwner}</p>
<p>isEmployee: {isEmployee}</p>

<button
onClick={login}
Expand Down

0 comments on commit cfa97ba

Please sign in to comment.