Add temporary uploads.
This commit is contained in:
@@ -1462,6 +1462,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>tempdocs</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>
|
||||||
|
|||||||
@@ -9,13 +9,17 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
//import ErrorDisplay from "../error-display/error-display.component";
|
//import ErrorDisplay from "../error-display/error-display.component";
|
||||||
|
import { openImagePicker } from "@/redux/photos/photos.actions";
|
||||||
import JobListItem from "./job-list-item";
|
import JobListItem from "./job-list-item";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
openImagePicker: (id) => dispatch(openImagePicker(id)),
|
||||||
|
});
|
||||||
|
|
||||||
export function JobListComponent({ bodyshop }) {
|
export function JobListComponent({ bodyshop, openImagePicker }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { loading, error, data, refetch } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
const { loading, error, data, refetch } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
||||||
@@ -30,6 +34,10 @@ export function JobListComponent({ bodyshop }) {
|
|||||||
return refetch();
|
return refetch();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleTempUpload = () => {
|
||||||
|
openImagePicker(); //Kept null for temp docs.
|
||||||
|
};
|
||||||
|
|
||||||
if (loading) return <ActivityIndicator style={{ flex: 1 }} />;
|
if (loading) return <ActivityIndicator style={{ flex: 1 }} />;
|
||||||
if (error) return <Text>{error.message}</Text>;
|
if (error) return <Text>{error.message}</Text>;
|
||||||
if (data && data.jobs && data.jobs.length === 0)
|
if (data && data.jobs && data.jobs.length === 0)
|
||||||
@@ -51,12 +59,24 @@ export function JobListComponent({ bodyshop }) {
|
|||||||
style={{ flex: 1, marginHorizontal: 12, paddingBottom: 48 }}
|
style={{ flex: 1, marginHorizontal: 12, paddingBottom: 48 }}
|
||||||
edges={["top"]}
|
edges={["top"]}
|
||||||
>
|
>
|
||||||
<Text
|
<View
|
||||||
variant="headlineMedium"
|
style={{
|
||||||
style={{ marginBottom: 12, fontWeight: "600" }}
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
alignContent: "space-between",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Jobs
|
<Text
|
||||||
</Text>
|
variant="headlineMedium"
|
||||||
|
style={{ marginBottom: 12, fontWeight: "600", flex: 1 }}
|
||||||
|
>
|
||||||
|
{t("joblist.titles.jobtab")}
|
||||||
|
</Text>
|
||||||
|
<Button icon="cloud-upload-outline" mode="outlined" onPress={handleTempUpload}>
|
||||||
|
{t("joblist.labels.tempdocs")}
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
<FlatList
|
<FlatList
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl refreshing={loading} onRefresh={onRefresh} />
|
<RefreshControl refreshing={loading} onRefresh={onRefresh} />
|
||||||
@@ -70,4 +90,4 @@ export function JobListComponent({ bodyshop }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(JobListComponent);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobListComponent);
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ function* uploadToLocalMediaServer(photos, bodyshop, jobid) {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("jobid", jobid);
|
formData.append("jobid", jobid || "temporary");
|
||||||
|
|
||||||
for (const file of photos) {
|
for (const file of photos) {
|
||||||
formData.append("file", {
|
formData.append("file", {
|
||||||
|
|||||||
@@ -94,7 +94,8 @@
|
|||||||
"activejobs": "Jobs",
|
"activejobs": "Jobs",
|
||||||
"detail": "Job Detail",
|
"detail": "Job Detail",
|
||||||
"nojobs": "There are no active jobs.",
|
"nojobs": "There are no active jobs.",
|
||||||
"search": "Search..."
|
"search": "Search...",
|
||||||
|
"tempdocs": "Temp. Docs"
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
"jobtab": "Jobs"
|
"jobtab": "Jobs"
|
||||||
|
|||||||
@@ -94,7 +94,8 @@
|
|||||||
"activejobs": "",
|
"activejobs": "",
|
||||||
"detail": "",
|
"detail": "",
|
||||||
"nojobs": "",
|
"nojobs": "",
|
||||||
"search": ""
|
"search": "",
|
||||||
|
"tempdocs": ""
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
"jobtab": ""
|
"jobtab": ""
|
||||||
|
|||||||
@@ -94,7 +94,8 @@
|
|||||||
"activejobs": "",
|
"activejobs": "",
|
||||||
"detail": "",
|
"detail": "",
|
||||||
"nojobs": "",
|
"nojobs": "",
|
||||||
"search": ""
|
"search": "",
|
||||||
|
"tempdocs": ""
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
"jobtab": ""
|
"jobtab": ""
|
||||||
|
|||||||
Reference in New Issue
Block a user