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