IO-244 Resolve IOU
This commit is contained in:
8
.vscode/settings.json
vendored
Normal file
8
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"xml.fileAssociations": [
|
||||||
|
{
|
||||||
|
"pattern": "**/Test.xml",
|
||||||
|
"systemId": "file:///Users/pfic/Downloads/IMEX.xsd"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -78,6 +78,9 @@ export function JobCreateIOU({ bodyshop, currentUser, job, selectedJobLines }) {
|
|||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={t("jobs.labels.createiouwarning")}
|
title={t("jobs.labels.createiouwarning")}
|
||||||
onConfirm={handleCreateIou}
|
onConfirm={handleCreateIou}
|
||||||
|
disabled={
|
||||||
|
!selectedJobLines || selectedJobLines.length === 0 || !job.converted
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
|||||||
@@ -108,7 +108,9 @@ export async function CreateIouForJob(
|
|||||||
_tempLines.forEach((line) => {
|
_tempLines.forEach((line) => {
|
||||||
delete line.id;
|
delete line.id;
|
||||||
delete line.__typename;
|
delete line.__typename;
|
||||||
line.oem_partno = `${line.oem_partno} - IOU $${line.act_price}/${line.mod_lb_hrs}hrs`;
|
line.oem_partno = `${line.oem_partno ? `${line.oem_partno} - ` : ``}IOU $${
|
||||||
|
line.act_price || 0
|
||||||
|
}/${line.mod_lb_hrs || 0}hrs`;
|
||||||
line.act_price = 0;
|
line.act_price = 0;
|
||||||
line.mod_lb_hrs = 0;
|
line.mod_lb_hrs = 0;
|
||||||
line.manual_line = true;
|
line.manual_line = true;
|
||||||
|
|||||||
@@ -7,8 +7,25 @@ import {
|
|||||||
} from "../../graphql/associations.queries";
|
} from "../../graphql/associations.queries";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import ProfileShopsComponent from "./profile-shops.component";
|
import ProfileShopsComponent from "./profile-shops.component";
|
||||||
|
import axios from "axios";
|
||||||
|
import { messaging } from "../../firebase/firebase.utils";
|
||||||
|
import { getToken } from "firebase/messaging";
|
||||||
|
|
||||||
export default function ProfileShopsContainer() {
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ProfileShopsContainer);
|
||||||
|
|
||||||
|
export function ProfileShopsContainer({ bodyshop }) {
|
||||||
const { loading, error, data } = useQuery(QUERY_ALL_ASSOCIATIONS, {
|
const { loading, error, data } = useQuery(QUERY_ALL_ASSOCIATIONS, {
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
@@ -18,6 +35,11 @@ export default function ProfileShopsContainer() {
|
|||||||
const updateActiveShop = async (activeShopId) => {
|
const updateActiveShop = async (activeShopId) => {
|
||||||
logImEXEvent("profile_change_active_shop");
|
logImEXEvent("profile_change_active_shop");
|
||||||
|
|
||||||
|
await axios.post("/notifications/unsubscribe", {
|
||||||
|
fcm_tokens: await getToken(messaging),
|
||||||
|
imexshopid: bodyshop.imexshopid,
|
||||||
|
type: "messaging",
|
||||||
|
});
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
data.associations.map(async (record) => {
|
data.associations.map(async (record) => {
|
||||||
await updateAssocation({
|
await updateAssocation({
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ export const requestForToken = () => {
|
|||||||
console.log("An error occurred while retrieving token. ", err);
|
console.log("An error occurred while retrieving token. ", err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const onMessageListener = () =>
|
export const onMessageListener = () =>
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
onMessage(messaging, (payload) => {
|
onMessage(messaging, (payload) => {
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ import {
|
|||||||
validatePasswordResetSuccess,
|
validatePasswordResetSuccess,
|
||||||
} from "./user.actions";
|
} from "./user.actions";
|
||||||
import UserActionTypes from "./user.types";
|
import UserActionTypes from "./user.types";
|
||||||
|
import axios from "axios";
|
||||||
|
import { messaging } from "../../firebase/firebase.utils";
|
||||||
|
import { getToken } from "firebase/messaging";
|
||||||
export function* onEmailSignInStart() {
|
export function* onEmailSignInStart() {
|
||||||
yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail);
|
yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail);
|
||||||
}
|
}
|
||||||
@@ -98,6 +100,15 @@ export function* signOutStart() {
|
|||||||
try {
|
try {
|
||||||
logImEXEvent("redux_sign_out");
|
logImEXEvent("redux_sign_out");
|
||||||
|
|
||||||
|
const state = yield select();
|
||||||
|
console.log(yield getToken(messaging));
|
||||||
|
//unsub from topic.
|
||||||
|
yield call(axios.post, "/notifications/unsubscribe", {
|
||||||
|
fcm_tokens: yield getToken(messaging),
|
||||||
|
imexshopid: state.user.bodyshop.imexshopid,
|
||||||
|
type: "messaging",
|
||||||
|
});
|
||||||
|
|
||||||
yield signOut(auth);
|
yield signOut(auth);
|
||||||
yield put(signOutSuccess());
|
yield put(signOutSuccess());
|
||||||
localStorage.removeItem("token");
|
localStorage.removeItem("token");
|
||||||
|
|||||||
@@ -139,6 +139,11 @@ app.post(
|
|||||||
fb.sendNotification
|
fb.sendNotification
|
||||||
);
|
);
|
||||||
app.post("/notifications/subscribe", fb.validateFirebaseIdToken, fb.subscribe);
|
app.post("/notifications/subscribe", fb.validateFirebaseIdToken, fb.subscribe);
|
||||||
|
app.post(
|
||||||
|
"/notifications/unsubscribe",
|
||||||
|
fb.validateFirebaseIdToken,
|
||||||
|
fb.unsubscribe
|
||||||
|
);
|
||||||
app.post("/adm/updateuser", fb.validateFirebaseIdToken, fb.updateUser);
|
app.post("/adm/updateuser", fb.validateFirebaseIdToken, fb.updateUser);
|
||||||
|
|
||||||
//Stripe Processing
|
//Stripe Processing
|
||||||
|
|||||||
@@ -118,6 +118,21 @@ exports.subscribe = async (req, res) => {
|
|||||||
res.json(result);
|
res.json(result);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.unsubscribe = async (req, res) => {
|
||||||
|
try {
|
||||||
|
const result = await admin
|
||||||
|
.messaging()
|
||||||
|
.unsubscribeFromTopic(
|
||||||
|
req.body.fcm_tokens,
|
||||||
|
`${req.body.imexshopid}-${req.body.type}`
|
||||||
|
);
|
||||||
|
|
||||||
|
res.json(result);
|
||||||
|
} catch (error) {
|
||||||
|
res.sendStatus(500);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
exports.validateFirebaseIdToken = async (req, res, next) => {
|
exports.validateFirebaseIdToken = async (req, res, next) => {
|
||||||
if (
|
if (
|
||||||
(!req.headers.authorization ||
|
(!req.headers.authorization ||
|
||||||
|
|||||||
@@ -525,7 +525,7 @@ exports.QUERY_EMPLOYEE_PIN = `query QUERY_EMPLOYEE_PIN($shopId: uuid!, $employee
|
|||||||
}`;
|
}`;
|
||||||
|
|
||||||
exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshopid: uuid!) {
|
exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshopid: uuid!) {
|
||||||
jobs(where: {_and: [{converted: {_eq: true}}, {updated_at: {_gt: $start}}, {shopid: {_eq: $bodyshopid}}]}) {
|
jobs(where: {_and: [{converted: {_eq: true}}, {updated_at: {_gt: $start}}, {shopid: {_eq: $bodyshopid}}]} ) {
|
||||||
id
|
id
|
||||||
ro_number
|
ro_number
|
||||||
status
|
status
|
||||||
|
|||||||
Reference in New Issue
Block a user