Added association tracking
This commit is contained in:
@@ -18,6 +18,110 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>translation</name>
|
<name>translation</name>
|
||||||
<children>
|
<children>
|
||||||
|
<folder_node>
|
||||||
|
<name>associations</name>
|
||||||
|
<children>
|
||||||
|
<folder_node>
|
||||||
|
<name>actions</name>
|
||||||
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>activate</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
|
</children>
|
||||||
|
</folder_node>
|
||||||
|
<folder_node>
|
||||||
|
<name>fields</name>
|
||||||
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>active</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>shopname</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
|
</children>
|
||||||
|
</folder_node>
|
||||||
|
<folder_node>
|
||||||
|
<name>labels</name>
|
||||||
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>actions</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
|
</children>
|
||||||
|
</folder_node>
|
||||||
|
</children>
|
||||||
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
<name>documents</name>
|
<name>documents</name>
|
||||||
<children>
|
<children>
|
||||||
@@ -4436,6 +4540,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>updateprofile</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import ProfileMyComponent from "../profile-my/profile-my.component";
|
import ProfileMyComponent from "../profile-my/profile-my.component";
|
||||||
|
import ProfileShopsContainer from "../profile-shops/profile-shops.container";
|
||||||
|
|
||||||
export default function ProfileContent({ sidebarSelection }) {
|
export default function ProfileContent({ sidebarSelection }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -10,7 +11,7 @@ export default function ProfileContent({ sidebarSelection }) {
|
|||||||
case "profile":
|
case "profile":
|
||||||
return <ProfileMyComponent />;
|
return <ProfileMyComponent />;
|
||||||
case "shops":
|
case "shops":
|
||||||
return <div>Shop stuff</div>;
|
return <ProfileShopsContainer />;
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<AlertComponent message={t("profile.errors.state")} type="error" />
|
<AlertComponent message={t("profile.errors.state")} type="error" />
|
||||||
|
|||||||
@@ -44,7 +44,14 @@ export default connect(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<AlertComponent message={"hi"} />
|
{isFieldsTouched() ? (
|
||||||
|
//TODO: Appropriate Error
|
||||||
|
<AlertComponent
|
||||||
|
message={t("jobs.errors.validation")}
|
||||||
|
onClick={() => resetFields()}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<Form onSubmit={handleSubmit} autoComplete={"no"}>
|
<Form onSubmit={handleSubmit} autoComplete={"no"}>
|
||||||
<Form.Item label={t("user.fields.displayname")}>
|
<Form.Item label={t("user.fields.displayname")}>
|
||||||
{getFieldDecorator("displayname", {
|
{getFieldDecorator("displayname", {
|
||||||
@@ -58,7 +65,7 @@ export default connect(
|
|||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
>
|
>
|
||||||
Save
|
{t("user.actions.updateprofile")}
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { Table, Button } from "antd";
|
||||||
|
export default function ProfileShopsComponent({
|
||||||
|
loading,
|
||||||
|
data,
|
||||||
|
updateActiveShop
|
||||||
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("associations.fields.shopname"),
|
||||||
|
dataIndex: "shopname",
|
||||||
|
key: "shopname",
|
||||||
|
width: "25%",
|
||||||
|
render: (text, record) => <span>{record.bodyshop.shopname}</span>
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("associations.fields.active"),
|
||||||
|
dataIndex: "active",
|
||||||
|
key: "active",
|
||||||
|
width: "25%",
|
||||||
|
render: (text, record) => <span>{record.active ? "Yes" : "No"}</span>
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("associations.labels.actions"),
|
||||||
|
dataIndex: "actions",
|
||||||
|
key: "actions",
|
||||||
|
width: "25%",
|
||||||
|
render: (text, record) => (
|
||||||
|
<span>
|
||||||
|
{record.active ? null : (
|
||||||
|
<Button onClick={() => updateActiveShop(record.id)}>
|
||||||
|
Activate
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table
|
||||||
|
loading={loading}
|
||||||
|
size="small"
|
||||||
|
columns={columns.map(item => ({ ...item }))}
|
||||||
|
rowKey="id"
|
||||||
|
dataSource={data}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { useQuery } from "react-apollo";
|
||||||
|
import { QUERY_ALL_ASSOCIATIONS } from "../../graphql/associations.queries";
|
||||||
|
import AlertComponent from "../alert/alert.component";
|
||||||
|
import ProfileShopsComponent from "./profile-shops.component";
|
||||||
|
|
||||||
|
export default function ProfileShopsContainer() {
|
||||||
|
|
||||||
|
const { loading, error, data, refetch } = useQuery(QUERY_ALL_ASSOCIATIONS);
|
||||||
|
|
||||||
|
const updateActiveShop = activeShopId => {
|
||||||
|
console.log("activeShopId", activeShopId);
|
||||||
|
refetch();
|
||||||
|
};
|
||||||
|
|
||||||
|
if (error) return <AlertComponent type="error" message={error.message} />;
|
||||||
|
return (
|
||||||
|
<ProfileShopsComponent
|
||||||
|
loading={loading}
|
||||||
|
data={data ? data.associations : null}
|
||||||
|
updateActiveShop={updateActiveShop}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
27
client/src/graphql/associations.queries.js
Normal file
27
client/src/graphql/associations.queries.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { gql } from "apollo-boost";
|
||||||
|
|
||||||
|
export const QUERY_ALL_ASSOCIATIONS = gql`
|
||||||
|
query QUERY_ALL_ASSOCIATIONS {
|
||||||
|
associations {
|
||||||
|
id
|
||||||
|
active
|
||||||
|
bodyshop {
|
||||||
|
shopname
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const UPDATE_ASSOCIATION = gql`
|
||||||
|
mutation UPDATE_ASSOCIATION($assocId: uuid, $assocActive: Boolean) {
|
||||||
|
update_associations(
|
||||||
|
where: { id: { _eq: $assocId } }
|
||||||
|
_set: { active: $assocActive }
|
||||||
|
) {
|
||||||
|
returning {
|
||||||
|
id
|
||||||
|
active
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
@@ -28,7 +28,7 @@ const ChatWindowContainer = lazy(() =>
|
|||||||
import("../../components/chat-window/chat-window.container")
|
import("../../components/chat-window/chat-window.container")
|
||||||
);
|
);
|
||||||
|
|
||||||
const { Header, Content, Footer, Sider } = Layout;
|
const { Header, Content, Footer } = Layout;
|
||||||
//This page will handle all routing for the entire application.
|
//This page will handle all routing for the entire application.
|
||||||
export default function Manage({ match }) {
|
export default function Manage({ match }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -100,12 +100,9 @@ export function* updateUserDetails(userDetails) {
|
|||||||
|
|
||||||
export function* userSagas() {
|
export function* userSagas() {
|
||||||
yield all([
|
yield all([
|
||||||
// call(onGoogleSignInStart),
|
|
||||||
call(onEmailSignInStart),
|
call(onEmailSignInStart),
|
||||||
call(onCheckUserSession),
|
call(onCheckUserSession),
|
||||||
call(onSignOutStart),
|
call(onSignOutStart),
|
||||||
call(onUpdateUserDetails)
|
call(onUpdateUserDetails)
|
||||||
// call(onEmailSignUpStart),
|
|
||||||
// call(onEmailSignUpSuccess)
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
{
|
{
|
||||||
"translation": {
|
"translation": {
|
||||||
|
"associations": {
|
||||||
|
"actions": {
|
||||||
|
"activate": "Activate"
|
||||||
|
},
|
||||||
|
"fields": {
|
||||||
|
"active": "Active?",
|
||||||
|
"shopname": "Shop Name"
|
||||||
|
},
|
||||||
|
"labels": {
|
||||||
|
"actions": "Actions"
|
||||||
|
}
|
||||||
|
},
|
||||||
"documents": {
|
"documents": {
|
||||||
"errors": {
|
"errors": {
|
||||||
"deletes3": "Error deleting document from storage. ",
|
"deletes3": "Error deleting document from storage. ",
|
||||||
@@ -271,7 +283,8 @@
|
|||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"signout": "Sign Out"
|
"signout": "Sign Out",
|
||||||
|
"updateprofile": "Update Profile"
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"displayname": "Display Name"
|
"displayname": "Display Name"
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
{
|
{
|
||||||
"translation": {
|
"translation": {
|
||||||
|
"associations": {
|
||||||
|
"actions": {
|
||||||
|
"activate": "Activar"
|
||||||
|
},
|
||||||
|
"fields": {
|
||||||
|
"active": "¿Activo?",
|
||||||
|
"shopname": "Nombre de tienda"
|
||||||
|
},
|
||||||
|
"labels": {
|
||||||
|
"actions": "Comportamiento"
|
||||||
|
}
|
||||||
|
},
|
||||||
"documents": {
|
"documents": {
|
||||||
"errors": {
|
"errors": {
|
||||||
"deletes3": "Error al eliminar el documento del almacenamiento.",
|
"deletes3": "Error al eliminar el documento del almacenamiento.",
|
||||||
@@ -271,7 +283,8 @@
|
|||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"signout": "desconectar"
|
"signout": "desconectar",
|
||||||
|
"updateprofile": "Actualización del perfil"
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"displayname": "Nombre para mostrar"
|
"displayname": "Nombre para mostrar"
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
{
|
{
|
||||||
"translation": {
|
"translation": {
|
||||||
|
"associations": {
|
||||||
|
"actions": {
|
||||||
|
"activate": "Activer"
|
||||||
|
},
|
||||||
|
"fields": {
|
||||||
|
"active": "Actif?",
|
||||||
|
"shopname": "nom de la boutique"
|
||||||
|
},
|
||||||
|
"labels": {
|
||||||
|
"actions": "actes"
|
||||||
|
}
|
||||||
|
},
|
||||||
"documents": {
|
"documents": {
|
||||||
"errors": {
|
"errors": {
|
||||||
"deletes3": "Erreur lors de la suppression du document du stockage.",
|
"deletes3": "Erreur lors de la suppression du document du stockage.",
|
||||||
@@ -271,7 +283,8 @@
|
|||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"signout": "Déconnexion"
|
"signout": "Déconnexion",
|
||||||
|
"updateprofile": "Mettre à jour le profil"
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"displayname": "Afficher un nom"
|
"displayname": "Afficher un nom"
|
||||||
|
|||||||
Reference in New Issue
Block a user