diff --git a/frontend/src/components/CreatorGrid.jsx b/frontend/src/components/CreatorGrid.jsx index 584e0f6e..45e1961f 100644 --- a/frontend/src/components/CreatorGrid.jsx +++ b/frontend/src/components/CreatorGrid.jsx @@ -169,7 +169,7 @@ const CreatorGrid = props => { - +
diff --git a/frontend/src/components/EditWorkflow.jsx b/frontend/src/components/EditWorkflow.jsx index 46e2d610..8763d4a1 100644 --- a/frontend/src/components/EditWorkflow.jsx +++ b/frontend/src/components/EditWorkflow.jsx @@ -496,7 +496,9 @@ const EditWorkflow = (props) => { setWorkflow({}) } else { setWorkflow(innerWorkflow) + console.log("editing workflow: ", innerWorkflow) } + setModalOpen(false) }} color="primary" diff --git a/frontend/src/components/OrgHeader.jsx b/frontend/src/components/OrgHeader.jsx index 46b8266c..d1d1bfcb 100644 --- a/frontend/src/components/OrgHeader.jsx +++ b/frontend/src/components/OrgHeader.jsx @@ -143,9 +143,7 @@ const OrgHeader = (props) => { variant="contained" color="primary" disabled={ - userdata === undefined || - userdata === null || - userdata.admin !== "true" + userdata === undefined || userdata === null || userdata.admin !== "true" } onClick={() => handleEditOrg( diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx index 6468eeae..bcb8220c 100644 --- a/frontend/src/views/Admin.jsx +++ b/frontend/src/views/Admin.jsx @@ -78,6 +78,7 @@ import HandlePaymentNew from "../views/HandlePaymentNew.jsx"; import OrgHeader from "../components/OrgHeader.jsx"; import OrgHeaderexpanded from "../components/OrgHeaderexpanded.jsx"; import Billing from "../components/Billing.jsx"; +import Branding from "../components/Branding.jsx"; import Files from "../components/Files.jsx"; import { display, style } from "@mui/system"; @@ -143,8 +144,7 @@ const Admin = (props) => { const [loading, setLoading] = React.useState(false); const [selectedOrganization, setSelectedOrganization] = React.useState({}); - const [selectedDealModalOpen, setSelectedDealModalOpen] = - React.useState(false); + //console.log("Selected: ", selectedOrganization) const [organizationFeatures, setOrganizationFeatures] = React.useState({}); const [loginInfo, setLoginInfo] = React.useState(""); @@ -177,16 +177,7 @@ const Admin = (props) => { const [secret2FA, setSecret2FA] = React.useState(""); const [show2faSetup, setShow2faSetup] = useState(false); - const [dealName, setDealName] = React.useState(""); - const [dealAddress, setDealAddress] = React.useState(""); - const [dealType, setDealType] = React.useState("MSSP"); - const [dealCountry, setDealCountry] = React.useState("United States"); - const [dealCurrency, setDealCurrency] = React.useState("USD"); - const [dealStatus, setDealStatus] = React.useState("initiated"); - const [dealValue, setDealValue] = React.useState(""); - const [dealDiscount, setDealDiscount] = React.useState(""); - const [dealerror, setDealerror] = React.useState(""); - const [dealList, setDealList] = React.useState([]); + const [adminTab, setAdminTab] = React.useState(1); const [showApiKey, setShowApiKey] = useState(false); @@ -700,46 +691,7 @@ const Admin = (props) => { }); }; - const handleGetDeals = (orgId) => { - console.log("Get deals!"); - - if (orgId.length === 0) { - alert.error( - "Organization ID not defined (get deals). Please contact us on https://shuffler.io if this persists logout." - ); - return; - } - - const url = `${globalUrl}/api/v1/orgs/${orgId}/deals`; - fetch(url, { - method: "GET", - credentials: "include", - headers: { - "Content-Type": "application/json", - }, - }) - .then((response) => { - if (response.status !== 200) { - console.log("Bad status code in get deals: ", response.status); - } - - return response.json(); - }) - .then((responseJson) => { - console.log("Got deals: ", responseJson); - if (responseJson.success === false) { - alert.error("Failed loading deals. Contact support if this persists"); - } else { - setDealList(responseJson); - } - }) - .catch((error) => { - console.log("Error getting org deals: ", error); - alert.error( - "Failed getting deals for your org. Contact support if this persists." - ); - }); - }; + const handleGetOrg = (orgId) => { if (orgId.length === 0) { @@ -776,13 +728,7 @@ const Admin = (props) => { responseJson.sync_features = {}; } - if ( - isCloud && - responseJson.partner_info !== undefined && - responseJson.partner_info.reseller === true - ) { - handleGetDeals(orgId); - } + setSelectedOrganization(responseJson) var lists = { @@ -1322,7 +1268,7 @@ const Admin = (props) => { 0: "organization", 1: "cloud_sync", 2: "billing", - 3: "stats", + 3: "branding", }; const setConfig = (event, inputValue) => { @@ -1653,248 +1599,9 @@ const Admin = (props) => { ) : null; - const products = [ - { code: "", label: "MSSP", phone: "" }, - { code: "", label: "Enterprise", phone: "" }, - { code: "", label: "Consultancy", phone: "" }, - { code: "", label: "Support", phone: "" }, - ]; + - const addDealModal = ( - { - setSelectedDealModalOpen(false); - }} - PaperProps={{ - style: { - backgroundColor: theme.palette.surfaceColor, - color: "white", - minWidth: "800px", - minHeight: "320px", - }, - }} - > - - Register new deal - - -
- { - setDealName(e.target.value); - }} - /> - { - setDealAddress(e.target.value); - }} - /> -
-
- { - setDealValue(e.target.value); - }} - /> - option.label} - onChange={(event, newValue) => { - setDealCountry(newValue.label); - }} - renderOption={(props, option) => ( - img": { mr: 2, flexShrink: 0 } }} - {...props} - > - - {option.label} ({option.code}) +{option.phone} - - )} - renderInput={(params) => ( - - )} - /> - { - setDealType(newValue); - }} - getOptionLabel={(option) => option.label} - renderOption={(props, option) => ( - img": { mr: 2, flexShrink: 0 } }} - {...props} - > - {option.label} - - )} - renderInput={(params) => ( - - )} - /> -
- {dealerror.length > 0 ? ( - - error registering: {dealerror} - - ) : null} -
- - -
-
-
- ); + const editUserModal = ( { ); - const submitDeal = (dealName, dealAddress, dealCountry, dealValue) => { - if (dealerror.length > 0) { - setDealerror(""); - } - - const orgId = selectedOrganization.id; - const data = { - reseller_org: orgId, - name: dealName, - address: dealAddress, - country: dealCountry, - value: dealValue, - }; - - const url = `${globalUrl}/api/v1/orgs/${orgId}/deals`; - fetch(url, { - mode: "cors", - method: "POST", - body: JSON.stringify(data), - credentials: "include", - crossDomain: true, - withCredentials: true, - headers: { - "Content-Type": "application/json; charset=utf-8", - }, - }) - .then(function (response) { - if (response.status !== 200) { - console.log("Error in response"); - } - - return response.json(); - }) - .then(function (responseJson) { - if (responseJson.success === true) { - setSelectedDealModalOpen(false); - alert.success( - "Added new deal! We will be in touch shortly with an update." - ); - - setDealName(""); - setDealAddress(""); - setDealValue(""); - setDealCountry("United States"); - setDealType("MSSP"); - } else { - setDealerror(responseJson.reason); - } - }) - .catch(function (error) { - //console.log("Error: ", error); - setDealerror(error.toString()); - alert.error("Failed adding deal reg: ", error); - }); - }; const organizationView = @@ -2538,7 +2190,7 @@ const Admin = (props) => { /> Branding @@ -2811,11 +2463,16 @@ const Admin = (props) => { handleGetOrg={handleGetOrg} /> : adminTab === 3 ? -
- - Stats - -
+ : null } { backgroundColor: theme.palette.inputColor, }} /> - {isCloud && - selectedOrganization.partner_info !== undefined && - selectedOrganization.partner_info.reseller === true ? ( -
- - Reseller dashboard - - - - - - - - - - - - - - - - - - {dealList.length === 0 ? ( - - No deals registered yet. Click "Add deal" to register one - - ) : ( - dealList.map((deal, index) => { - var bgColor = "#27292d"; - if (index % 2 === 0) { - bgColor = "#1f2023"; - } - - return ( - - - - - - - - - - - - - ); - }) - )} - - - -
- ) : null} +
)} @@ -4500,7 +3974,6 @@ const Admin = (props) => { {modalView} {cloudSyncModal} {editUserModal} - {addDealModal} {editAuthenticationModal} {data} { {isCloud ? - By connecting your Github or Metamask account, you agree to our
Terms of Service, and acknowledge that your non-sensitive data will be turned into a creator account. This enables you to earn a passive income from Shuffle. This IS reversible. Support: support@shuffler.io + By connecting your Github account, you agree to our Terms of Service, and acknowledge that your non-sensitive data will be turned into a creator account. This enables you to earn a passive income from Shuffle. This IS reversible. Support: support@shuffler.io