+
+
+ Corporate account *
+
+ u.type === "corporate"
+ ) as CorporateUser[]
+ ).map((user) => ({
+ value: user.id,
+ meta: user,
+ label: `${
+ user.corporateInformation?.companyInformation?.name ||
+ user.name
+ } - ${user.email}`,
+ }))}
+ defaultValue={
+ user.type === "corporate"
+ ? {
+ value: user.id,
+ meta: user,
+ label: `${
+ user.corporateInformation?.companyInformation
+ ?.name || user.name
+ } - ${user.email}`,
+ }
+ : undefined
+ }
+ isDisabled={user.type === "corporate"}
+ onChange={(value) =>
+ setCorporate((value as any)?.meta ?? undefined)
+ }
+ menuPortalTarget={document?.body}
+ styles={{
+ menuPortal: (base) => ({ ...base, zIndex: 9999 }),
+ control: (styles) => ({
+ ...styles,
+ paddingLeft: "4px",
+ border: "none",
+ outline: "none",
+ ":focus": {
+ outline: "none",
+ },
+ }),
+ option: (styles, state) => ({
+ ...styles,
+ backgroundColor: state.isFocused
+ ? "#D5D9F0"
+ : state.isSelected
+ ? "#7872BF"
+ : "white",
+ color: state.isFocused ? "black" : styles.color,
+ }),
+ }}
+ />
+
+ {user.type !== "corporate" && (
+
+
+ Country manager *
+
+ u.type === "agent") as AgentUser[]
+ ).map((user) => ({
+ value: user.id,
+ meta: user,
+ label: `${user.name} - ${user.email}`,
+ }))}
+ value={
+ agent
+ ? {
+ value: agent?.id,
+ label: `${agent.name} - ${agent.email}`,
+ }
+ : undefined
+ }
+ onChange={(value) =>
+ setAgent(
+ value !== null ? (value as any).meta : undefined
+ )
+ }
+ menuPortalTarget={document?.body}
+ styles={{
+ menuPortal: (base) => ({ ...base, zIndex: 9999 }),
+ control: (styles) => ({
+ ...styles,
+ paddingLeft: "4px",
+ border: "none",
+ outline: "none",
+ ":focus": {
+ outline: "none",
+ },
+ }),
+ option: (styles, state) => ({
+ ...styles,
+ backgroundColor: state.isFocused
+ ? "#D5D9F0"
+ : state.isSelected
+ ? "#7872BF"
+ : "white",
+ color: state.isFocused ? "black" : styles.color,
+ }),
+ }}
+ />
+
+ )}
+
+
+ Paid
+
+ e.value === paid)}
+ onChange={(value) => {
+ if (value) return setPaid(value.value);
+ setPaid(null);
+ }}
+ menuPortalTarget={document?.body}
+ styles={{
+ menuPortal: (base) => ({ ...base, zIndex: 9999 }),
+ control: (styles) => ({
+ ...styles,
+ paddingLeft: "4px",
+ border: "none",
+ outline: "none",
+ ":focus": {
+ outline: "none",
+ },
+ }),
+ option: (styles, state) => ({
+ ...styles,
+ backgroundColor: state.isFocused
+ ? "#D5D9F0"
+ : state.isSelected
+ ? "#7872BF"
+ : "white",
+ color: state.isFocused ? "black" : styles.color,
+ }),
+ }}
+ />
+
+
+
+ Date
+
+
+ moment(date).isSameOrBefore(moment(new Date()))
+ }
+ onChange={([initialDate, finalDate]: [Date, Date]) => {
+ setStartDate(
+ initialDate ?? moment("01/01/2023").toDate()
+ );
+ if (finalDate) {
+ // basicly selecting a final day works as if I'm selecting the first
+ // minute of that day. this way it covers the whole day
+ setEndDate(moment(finalDate).endOf("day").toDate());
+ return;
+ }
+ setEndDate(null);
+ }}
+ />
+
+ {user.type !== "corporate" && (
+
+
+ Commission transfer
+
+ e.value === commissionTransfer
+ )}
+ onChange={(value) => {
+ if (value) return setCommissionTransfer(value.value);
+ setCommissionTransfer(null);
+ }}
+ menuPortalTarget={document?.body}
+ styles={{
+ menuPortal: (base) => ({ ...base, zIndex: 9999 }),
+ control: (styles) => ({
+ ...styles,
+ paddingLeft: "4px",
+ border: "none",
+ outline: "none",
+ ":focus": {
+ outline: "none",
+ },
+ }),
+ option: (styles, state) => ({
+ ...styles,
+ backgroundColor: state.isFocused
+ ? "#D5D9F0"
+ : state.isSelected
+ ? "#7872BF"
+ : "white",
+ color: state.isFocused ? "black" : styles.color,
+ }),
+ }}
+ />
+
+ )}
+
+
+ Corporate transfer
+
+ e.value === corporateTransfer
+ )}
+ onChange={(value) => {
+ if (value) return setCorporateTransfer(value.value);
+ setCorporateTransfer(null);
+ }}
+ menuPortalTarget={document?.body}
+ styles={{
+ menuPortal: (base) => ({ ...base, zIndex: 9999 }),
+ control: (styles) => ({
+ ...styles,
+ paddingLeft: "4px",
+ border: "none",
+ outline: "none",
+ ":focus": {
+ outline: "none",
+ },
+ }),
+ option: (styles, state) => ({
+ ...styles,
+ backgroundColor: state.isFocused
+ ? "#D5D9F0"
+ : state.isSelected
+ ? "#7872BF"
+ : "white",
+ color: state.isFocused ? "black" : styles.color,
+ }),
+ }}
+ />
+
+
+ {renderTable(table as Table