Skip to content

Commit

Permalink
sdfsd
Browse files Browse the repository at this point in the history
fsdfds
  • Loading branch information
rupomsoft committed Oct 5, 2022
1 parent 5f6d32c commit 13025ed
Show file tree
Hide file tree
Showing 24 changed files with 774 additions and 100 deletions.
12 changes: 0 additions & 12 deletions Inventory/inventory-mern-backend/.idea/inventory-mern-backend.iml

This file was deleted.

8 changes: 0 additions & 8 deletions Inventory/inventory-mern-backend/.idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions Inventory/inventory-mern-backend/.idea/vcs.xml

This file was deleted.

53 changes: 40 additions & 13 deletions Inventory/inventory-mern-frontend/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import store from "../redux/store/store";
import {HideLoader, ShowLoader} from "../redux/state-slice/settings-slice";
import axios from "axios";
import {ErrorToast} from "../helper/FormHelper";
import {ErrorToast, SuccessToast} from "../helper/FormHelper";
import {getToken} from "../helper/SessionHelper";
import {SetBrandList, SetBrandListTotal} from "../redux/state-slice/brand-slice";
import {SetBrandList, SetBrandListTotal,ResetBrandFormValue,OnChangeBrandInput} from "../redux/state-slice/brand-slice";
import {BaseURL} from "../helper/config";
const AxiosHeader={headers:{"token":getToken()}}

Expand Down Expand Up @@ -31,3 +31,87 @@ export async function BrandListRequest(pageNo, perPage, searchKeyword) {
store.dispatch(HideLoader())
}
}


export async function CreateBrandRequest(PostBody,ObjectID) {
try {
store.dispatch(ShowLoader())
let URL = BaseURL+"/CreateBrand"
if(ObjectID!==0){
URL = BaseURL+"/UpdateBrand/"+ObjectID;
}
const result = await axios.post(URL,PostBody,AxiosHeader)
store.dispatch(HideLoader())
if (result.status === 200 && result.data['status'] === "success") {
SuccessToast("Request Successful");
store.dispatch(ResetBrandFormValue())
return true;
}
else if(result.status === 200 && result.data['status'] === "fail") {
if(result.data['data']['keyPattern']['Name']===1){
ErrorToast("Brand Name Already Exist")
return false;
}
}
else {
ErrorToast("Request Fail ! Try Again")
return false;
}
}
catch (e) {
ErrorToast("Something Went Wrong")
store.dispatch(HideLoader())
return false
}
}

export async function FillBrandFormRequest(ObjectID) {
try {
store.dispatch(ShowLoader())
let URL = BaseURL+"/BrandDetailsByID/"+ObjectID;
const result = await axios.get(URL,AxiosHeader)
store.dispatch(HideLoader())
if (result.status === 200 && result.data['status'] === "success") {
let FormValue=result.data['data'][0];
store.dispatch(OnChangeBrandInput({Name:"Name",Value:FormValue['Name']}));
return true;
} else {
debugger;
ErrorToast("Request Fail ! Try Again")
return false;
}
}
catch (e) {
debugger;
ErrorToast("Something Went Wrong")
store.dispatch(HideLoader())
return false
}
}

export async function DeleteBrandRequest(ObjectID) {
try {
store.dispatch(ShowLoader())
let URL = BaseURL+"/DeleteBrand/"+ObjectID;
const result = await axios.get(URL,AxiosHeader)
store.dispatch(HideLoader())
if (result.status === 200 && result.data['status'] === "associate") {
ErrorToast(result.data['data'])
return false;
}
if (result.status === 200 && result.data['status'] === "success") {
SuccessToast("Request Successful");
return true
}
else {
ErrorToast("Request Fail ! Try Again")
return false;
}
}
catch (e) {
ErrorToast("Something Went Wrong")
store.dispatch(HideLoader())
return false
}
}

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import store from "../redux/store/store";
import {HideLoader, ShowLoader} from "../redux/state-slice/settings-slice";
import axios from "axios";
import {ErrorToast} from "../helper/FormHelper";
import {ErrorToast, SuccessToast} from "../helper/FormHelper";
import {getToken} from "../helper/SessionHelper";
import {SetCategoryList, SetCategoryListTotal} from "../redux/state-slice/category-slice";
import {SetCategoryList, SetCategoryListTotal,ResetCategoryFormValue,OnChangeCategoryInput} from "../redux/state-slice/category-slice";
import {BaseURL} from "../helper/config";
const AxiosHeader={headers:{"token":getToken()}}

Expand Down Expand Up @@ -31,3 +31,90 @@ export async function CategoryListRequest(pageNo, perPage, searchKeyword) {
store.dispatch(HideLoader())
}
}

export async function CreateCategoryRequest(PostBody,ObjectID) {
try {
store.dispatch(ShowLoader())
let URL = BaseURL+"/CreateCategories"
if(ObjectID!==0){
URL = BaseURL+"/UpdateCategories/"+ObjectID;
}
const result = await axios.post(URL,PostBody,AxiosHeader)
store.dispatch(HideLoader())
if (result.status === 200 && result.data['status'] === "success") {
SuccessToast("Request Successful");
store.dispatch(ResetCategoryFormValue())
return true;
}
else if(result.status === 200 && result.data['status'] === "fail") {
if(result.data['data']['keyPattern']['Name']===1){
ErrorToast("Category Already Exist")
return false;
}
}
else {
ErrorToast("Request Fail ! Try Again")
return false;
}
}
catch (e) {
ErrorToast("Something Went Wrong")
store.dispatch(HideLoader())
return false
}
}




export async function FillCategoryFormRequest(ObjectID) {
try {
store.dispatch(ShowLoader())
let URL = BaseURL+"/CategoriesDetailsByID/"+ObjectID;
const result = await axios.get(URL,AxiosHeader)
store.dispatch(HideLoader())
if (result.status === 200 && result.data['status'] === "success") {
let FormValue=result.data['data'][0];
store.dispatch(OnChangeCategoryInput({Name:"Name",Value:FormValue['Name']}));
return true;
} else {
ErrorToast("Request Fail ! Try Again")
return false;
}
}
catch (e) {
ErrorToast("Something Went Wrong")
store.dispatch(HideLoader())
return false
}
}



export async function DeleteCategoryRequest(ObjectID) {
try {
store.dispatch(ShowLoader())
let URL = BaseURL+"/DeleteCategories/"+ObjectID;
let result = await axios.get(URL,AxiosHeader)
store.dispatch(HideLoader())
if (result.status === 200 && result.data['status'] === "associate") {
ErrorToast(result.data['data'])
return false;
}
if (result.status === 200 && result.data['status'] === "success") {
SuccessToast("Request Successful");
return true
}
else {
ErrorToast("Request Fail ! Try Again")
return false;
}
}
catch (e) {
ErrorToast("Something Went Wrong")
store.dispatch(HideLoader())
return false
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ import {HideLoader, ShowLoader} from "../redux/state-slice/settings-slice";
import axios from "axios";
import {ErrorToast, SuccessToast} from "../helper/FormHelper";
import {getToken} from "../helper/SessionHelper";
import {
OnChangeCustomerInput,
ResetFormValue,
SetCustomerList,
SetCustomerListTotal
} from "../redux/state-slice/customer-slice";
import {OnChangeCustomerInput, ResetFormValue, SetCustomerList, SetCustomerListTotal} from "../redux/state-slice/customer-slice";
import {BaseURL} from "../helper/config";

const AxiosHeader={headers:{"token":getToken()}}

export async function CustomerListRequest(pageNo, perPage, searchKeyword) {
Expand Down Expand Up @@ -51,7 +47,6 @@ export async function CreateCustomerRequest(PostBody,ObjectID) {
SuccessToast("Request Successful");
store.dispatch(ResetFormValue())
return true;

}
else if(result.status === 200 && result.data['status'] === "fail") {
if(result.data['data']['keyPattern']['Phone']===1){
Expand Down Expand Up @@ -79,17 +74,11 @@ export async function FillCustomerFormRequest(ObjectID) {
const result = await axios.get(URL,AxiosHeader)
store.dispatch(HideLoader())
if (result.status === 200 && result.data['status'] === "success") {

let FormValue=result.data['data'][0];

store.dispatch(OnChangeCustomerInput({Name:"CustomerName",Value:FormValue['CustomerName']}));
store.dispatch(OnChangeCustomerInput({Name:"Phone",Value:FormValue['Phone']}));
store.dispatch(OnChangeCustomerInput({Name:"Email",Value:FormValue['Email']}));
store.dispatch(OnChangeCustomerInput({Name:"Address",Value:FormValue['Address']}));

debugger;


return true;
} else {
debugger;
Expand All @@ -106,7 +95,6 @@ export async function FillCustomerFormRequest(ObjectID) {
}



export async function DeleteCustomerRequest(ObjectID) {
try {
store.dispatch(ShowLoader())
Expand Down Expand Up @@ -134,10 +122,3 @@ export async function DeleteCustomerRequest(ObjectID) {
}









Loading

0 comments on commit 13025ed

Please sign in to comment.