added organization api and successfuly created invoice
This commit is contained in:
parent
82c1dc4b8e
commit
998284f398
@ -202,7 +202,7 @@ export const SelectProjectField = ({
|
|||||||
isAllProject = false,
|
isAllProject = false,
|
||||||
disabled,
|
disabled,
|
||||||
className,
|
className,
|
||||||
errors
|
errors,
|
||||||
}) => {
|
}) => {
|
||||||
const [searchText, setSearchText] = useState("");
|
const [searchText, setSearchText] = useState("");
|
||||||
const debounce = useDebounce(searchText, 300);
|
const debounce = useDebounce(searchText, 300);
|
||||||
@ -304,12 +304,11 @@ export const SelectProjectField = ({
|
|||||||
{displayText}
|
{displayText}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{errors?.projectId && (
|
|
||||||
<div className="danger-text">{errors.projectId.message}</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* DROPDOWN */}
|
{errors?.projectId && (
|
||||||
|
<div className="danger-text">{errors.projectId.message}</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{open && (
|
{open && (
|
||||||
<ul
|
<ul
|
||||||
className="dropdown-menu w-100 shadow-sm show animate__fadeIn h-64 overflow-auto rounded"
|
className="dropdown-menu w-100 shadow-sm show animate__fadeIn h-64 overflow-auto rounded"
|
||||||
@ -332,6 +331,7 @@ export const SelectProjectField = ({
|
|||||||
placeholder="Search..."
|
placeholder="Search..."
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="overflow-auto px-1" style={{ maxHeight: "200px" }}>
|
||||||
|
|
||||||
{isLoading && (
|
{isLoading && (
|
||||||
<li className="dropdown-item text-muted text-center">Loading...</li>
|
<li className="dropdown-item text-muted text-center">Loading...</li>
|
||||||
@ -364,6 +364,7 @@ export const SelectProjectField = ({
|
|||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -372,7 +373,7 @@ export const SelectProjectField = ({
|
|||||||
|
|
||||||
export const SelectFieldSearch = ({
|
export const SelectFieldSearch = ({
|
||||||
label = "Select",
|
label = "Select",
|
||||||
placeholder = "Select ",
|
placeholder = "Select",
|
||||||
required = false,
|
required = false,
|
||||||
value = null,
|
value = null,
|
||||||
onChange,
|
onChange,
|
||||||
@ -383,7 +384,7 @@ export const SelectFieldSearch = ({
|
|||||||
isMultiple = false,
|
isMultiple = false,
|
||||||
hookParams,
|
hookParams,
|
||||||
useFetchHook,
|
useFetchHook,
|
||||||
errors=null,
|
errors = null,
|
||||||
}) => {
|
}) => {
|
||||||
const [searchText, setSearchText] = useState("");
|
const [searchText, setSearchText] = useState("");
|
||||||
const debounce = useDebounce(searchText, 300);
|
const debounce = useDebounce(searchText, 300);
|
||||||
@ -393,108 +394,75 @@ export const SelectFieldSearch = ({
|
|||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const dropdownRef = useRef(null);
|
const dropdownRef = useRef(null);
|
||||||
|
|
||||||
const getDisplayName = (entity) => {
|
const getDisplayName = (entity) =>
|
||||||
if (!entity) return "";
|
entity ? `${entity[labelKey] || ""}`.trim() : "";
|
||||||
return `${entity[labelKey] || ""}`.trim();
|
|
||||||
};
|
|
||||||
|
|
||||||
/** -----------------------------
|
/** ----------------------------- SELECTED OPTION ----------------------------- */
|
||||||
* SELECTED OPTION (SINGLE)
|
|
||||||
* ----------------------------- */
|
|
||||||
let selectedSingle = null;
|
let selectedSingle = null;
|
||||||
|
|
||||||
if (!isMultiple) {
|
if (!isMultiple) {
|
||||||
if (isFullObject && value) selectedSingle = value;
|
if (isFullObject && value) selectedSingle = value;
|
||||||
else if (!isFullObject && value)
|
else if (!isFullObject && value)
|
||||||
selectedSingle = options.find((o) => o[valueKey] === value);
|
selectedSingle = options.find((o) => o[valueKey] === value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** -----------------------------
|
|
||||||
* SELECTED OPTION (MULTIPLE)
|
|
||||||
* ----------------------------- */
|
|
||||||
let selectedList = [];
|
let selectedList = [];
|
||||||
if (isMultiple && Array.isArray(value)) {
|
if (isMultiple && Array.isArray(value)) {
|
||||||
if (isFullObject) selectedList = value;
|
selectedList = isFullObject
|
||||||
else {
|
? value
|
||||||
selectedList = options.filter((opt) => value.includes(opt[valueKey]));
|
: options.filter((opt) => value.includes(opt[valueKey]));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Main button label */
|
|
||||||
const displayText = !isMultiple
|
const displayText = !isMultiple
|
||||||
? getDisplayName(selectedSingle) || placeholder
|
? getDisplayName(selectedSingle) || placeholder
|
||||||
: selectedList.length > 0
|
: selectedList.length
|
||||||
? selectedList.map((e) => getDisplayName(e)).join(", ")
|
? selectedList.map((e) => getDisplayName(e)).join(", ")
|
||||||
: placeholder;
|
: placeholder;
|
||||||
|
|
||||||
/** -----------------------------
|
/** ----------------------------- OUTSIDE CLICK ----------------------------- */
|
||||||
* HANDLE OUTSIDE CLICK
|
|
||||||
* ----------------------------- */
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleClickOutside = (e) => {
|
const handleClickOutside = (e) => {
|
||||||
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target))
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener("mousedown", handleClickOutside);
|
document.addEventListener("mousedown", handleClickOutside);
|
||||||
return () => document.removeEventListener("mousedown", handleClickOutside);
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// MERGED OPTIONS TO ENSURE SELECTED VALUE APPEARS EVEN IF NOT IN SEARCH RESULT
|
/** ----------------------------- MERGED OPTIONS ----------------------------- */
|
||||||
const [mergedOptions, setMergedOptions] = useState([]);
|
const [mergedOptions, setMergedOptions] = useState(options);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let finalList = [...options];
|
let finalList = [...options];
|
||||||
|
|
||||||
if (!isMultiple && value && !isFullObject) {
|
if (!isMultiple && value && !isFullObject && typeof value === "object") {
|
||||||
// already selected option inside options?
|
const exists = options.some((o) => o[valueKey] === value[valueKey]);
|
||||||
const exists = options.some((o) => o[valueKey] === value);
|
if (!exists) finalList.unshift(value);
|
||||||
|
|
||||||
// if selected item not found, try to get from props (value) as fallback
|
|
||||||
if (!exists && typeof value === "object") {
|
|
||||||
finalList.unshift(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMultiple && Array.isArray(value)) {
|
if (isMultiple && Array.isArray(value)) {
|
||||||
value.forEach((val) => {
|
value.forEach((val) => {
|
||||||
const id = isFullObject ? val[valueKey] : val;
|
const id = isFullObject ? val[valueKey] : val;
|
||||||
const exists = options.some((o) => o[valueKey] === id);
|
const exists = options.some((o) => o[valueKey] === id);
|
||||||
|
if (!exists && typeof val === "object") finalList.unshift(val);
|
||||||
if (!exists && typeof val === "object") {
|
|
||||||
finalList.unshift(val);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setMergedOptions(finalList);
|
// Only update if different to avoid infinite loop
|
||||||
}, [options, value]);
|
const oldKeys = mergedOptions.map((o) => o[valueKey]).join(",");
|
||||||
|
const newKeys = finalList.map((o) => o[valueKey]).join(",");
|
||||||
|
if (oldKeys !== newKeys) setMergedOptions(finalList);
|
||||||
|
}, [options, value, isMultiple, isFullObject, valueKey, mergedOptions]);
|
||||||
|
|
||||||
/** -----------------------------
|
/** ----------------------------- HANDLE SELECT ----------------------------- */
|
||||||
* HANDLE SELECT
|
|
||||||
* ----------------------------- */
|
|
||||||
const handleSelect = (option) => {
|
const handleSelect = (option) => {
|
||||||
if (!isMultiple) {
|
if (!isMultiple) {
|
||||||
// SINGLE SELECT
|
onChange(isFullObject ? option : option[valueKey]);
|
||||||
if (isFullObject) onChange(option);
|
|
||||||
else onChange(option[valueKey]);
|
|
||||||
} else {
|
} else {
|
||||||
// MULTIPLE SELECT
|
|
||||||
let updated = [];
|
|
||||||
|
|
||||||
const exists = selectedList.some((e) => e[valueKey] === option[valueKey]);
|
const exists = selectedList.some((e) => e[valueKey] === option[valueKey]);
|
||||||
|
const updated = exists
|
||||||
if (exists) {
|
? selectedList.filter((e) => e[valueKey] !== option[valueKey])
|
||||||
// remove
|
: [...selectedList, option];
|
||||||
updated = selectedList.filter((e) => e[valueKey] !== option[valueKey]);
|
onChange(isFullObject ? updated : updated.map((x) => x[valueKey]));
|
||||||
} else {
|
|
||||||
// add
|
|
||||||
updated = [...selectedList, option];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFullObject) onChange(updated);
|
|
||||||
else onChange(updated.map((x) => x[valueKey]));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -506,10 +474,9 @@ export const SelectFieldSearch = ({
|
|||||||
</Label>
|
</Label>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* MAIN BUTTON */}
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`select2-icons form-select d-flex align-items-center justify-content-between ${
|
className={`select2-icons form-select d-flex align-items-center justify-content-between ${
|
||||||
open ? "show" : ""
|
open ? "show" : ""
|
||||||
}`}
|
}`}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
@ -519,21 +486,18 @@ export const SelectFieldSearch = ({
|
|||||||
{displayText}
|
{displayText}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
{errors && (
|
|
||||||
<div className="danger-text">{errors.message}</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* DROPDOWN */}
|
{errors && <div className="danger-text">{errors.message}</div>}
|
||||||
|
|
||||||
{open && (
|
{open && (
|
||||||
<ul
|
<ul
|
||||||
className="dropdown-menu w-100 shadow-sm show animate__fadeIn h-64 overflow-auto rounded overflow-x-hidden"
|
className="dropdown-menu w-100 shadow-sm show animate__fadeIn h-64 overflow-auto rounded rounded-top-0 overflow-x-hidden"
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: "100%",
|
top: "100%",
|
||||||
left: 0,
|
left: 0,
|
||||||
zIndex: 1050,
|
zIndex: 1050,
|
||||||
marginTop: "2px",
|
marginTop: "1px",
|
||||||
borderRadius: "0.375rem",
|
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -547,36 +511,40 @@ export const SelectFieldSearch = ({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="overflow-auto px-1" style={{ maxHeight: "200px" }}>
|
||||||
|
{isLoading && (
|
||||||
|
<li className="dropdown-item text-muted text-center">
|
||||||
|
Loading...
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
{!isLoading && mergedOptions.length === 0 && (
|
||||||
|
<li className="dropdown-item text-muted text-center">
|
||||||
|
No results found
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
|
||||||
{isLoading && (
|
{!isLoading &&
|
||||||
<li className="dropdown-item text-muted text-center">Loading...</li>
|
mergedOptions.map((option) => {
|
||||||
)}
|
const isActive = isMultiple
|
||||||
|
? selectedList.some((x) => x[valueKey] === option[valueKey])
|
||||||
|
: selectedSingle &&
|
||||||
|
selectedSingle[valueKey] === option[valueKey];
|
||||||
|
|
||||||
{!isLoading && options.length === 0 && (
|
return (
|
||||||
<li className="dropdown-item text-muted text-center">
|
<li key={option[valueKey]}>
|
||||||
No results found
|
<button
|
||||||
</li>
|
type="button"
|
||||||
)}
|
className={`dropdown-item rounded ${
|
||||||
|
isActive ? "active" : ""
|
||||||
{!isLoading &&
|
}`}
|
||||||
options.map((option) => {
|
onClick={() => handleSelect(option)}
|
||||||
const isActive = isMultiple
|
>
|
||||||
? selectedList.some((x) => x[valueKey] === option[valueKey])
|
{getDisplayName(option)}
|
||||||
: selectedSingle &&
|
</button>
|
||||||
selectedSingle[valueKey] === option[valueKey];
|
</li>
|
||||||
|
);
|
||||||
return (
|
})}
|
||||||
<li key={option[valueKey]}>
|
</div>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className={`dropdown-item ${isActive ? "active" : ""}`}
|
|
||||||
onClick={() => handleSelect(option)}
|
|
||||||
>
|
|
||||||
{getDisplayName(option)}
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -9,29 +9,30 @@ import {
|
|||||||
import PurchasePartyDetails from "./PurchasePartyDetails";
|
import PurchasePartyDetails from "./PurchasePartyDetails";
|
||||||
import PurchaseTransportDetails from "./PurchaseTransportDetails";
|
import PurchaseTransportDetails from "./PurchaseTransportDetails";
|
||||||
import PurchasePaymentDetails from "./PurchasePaymentDetails";
|
import PurchasePaymentDetails from "./PurchasePaymentDetails";
|
||||||
|
import { useCreatePurchaseInvoice } from "../../hooks/usePurchase";
|
||||||
|
|
||||||
const ManagePurchase = () => {
|
const ManagePurchase = ({ onClose }) => {
|
||||||
const [activeTab, setActiveTab] = useState(0);
|
const [activeTab, setActiveTab] = useState(0);
|
||||||
const [completedTabs, setCompletedTabs] = useState([]);
|
const [completedTabs, setCompletedTabs] = useState([]);
|
||||||
|
|
||||||
const stepsConfig = [
|
const stepsConfig = [
|
||||||
{
|
{
|
||||||
name: "Contact Info",
|
name: "Party Details",
|
||||||
icon: "bx bx-user bx-md",
|
icon: "bx bx-user bx-md",
|
||||||
subtitle: "Provide Contact Details",
|
subtitle: "Supplier & project information",
|
||||||
component: <PurchasePartyDetails />,
|
component: <PurchasePartyDetails />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Organization",
|
name: "Invoice & Transport",
|
||||||
icon: "bx bx-buildings bx-md",
|
icon: "bx bx-receipt bx-md",
|
||||||
subtitle: "Organization Details",
|
subtitle: "Invoice, eWay bill & transport info",
|
||||||
component: <PurchaseTransportDetails/>,
|
component: <PurchaseTransportDetails />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Subscription",
|
name: "Payment Details",
|
||||||
icon: "bx bx-star bx-md",
|
icon: "bx bx-credit-card bx-md",
|
||||||
subtitle: "Payment & Financials",
|
subtitle: "Amount, tax & due date",
|
||||||
component: <PurchasePaymentDetails/>,
|
component: <PurchasePaymentDetails />,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -55,8 +56,14 @@ const ManagePurchase = () => {
|
|||||||
setActiveTab((prev) => Math.max(prev - 1, 0));
|
setActiveTab((prev) => Math.max(prev - 1, 0));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { mutate: CreateInvoice, isPending } = useCreatePurchaseInvoice(() => {
|
||||||
|
onClose?.();
|
||||||
|
});
|
||||||
|
|
||||||
const onSubmit = (formData) => {
|
const onSubmit = (formData) => {
|
||||||
console.log("PURCHASE DATA:", formData);
|
console.log("PURCHASE DATA:", formData);
|
||||||
|
let payload = formData;
|
||||||
|
CreateInvoice(payload);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -88,9 +95,7 @@ const ManagePurchase = () => {
|
|||||||
|
|
||||||
<span className="bs-stepper-label">
|
<span className="bs-stepper-label">
|
||||||
<span className="bs-stepper-title">{step.name}</span>
|
<span className="bs-stepper-title">{step.name}</span>
|
||||||
<span className="bs-stepper-subtitle">
|
<span className="bs-stepper-subtitle">{step.subtitle}</span>
|
||||||
{step.subtitle}
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -112,26 +117,27 @@ const ManagePurchase = () => {
|
|||||||
<div className="d-flex justify-content-between mt-4">
|
<div className="d-flex justify-content-between mt-4">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-outline-secondary"
|
className="btn btn-sm btn-outline-secondary"
|
||||||
onClick={handlePrev}
|
onClick={handlePrev}
|
||||||
disabled={activeTab === 0}
|
disabled={activeTab === 0}
|
||||||
>
|
>
|
||||||
Previous
|
Previous
|
||||||
</button>
|
</button>
|
||||||
|
<di>
|
||||||
{activeTab < stepsConfig.length - 1 ? (
|
{activeTab < stepsConfig.length - 1 ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-sm btn-primary"
|
className="btn btn-sm btn-primary"
|
||||||
onClick={handleNext}
|
onClick={handleNext}
|
||||||
>
|
>
|
||||||
Next
|
Next <i className="bx bx-sm bx-right-arrow"></i>
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<button type="submit" className="btn btn-sm btn-primary">
|
<button type="submit" className="btn btn-sm btn-primary">
|
||||||
Submit
|
{isPending ? "Please Wait" : "SUbmit"}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
</di>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</AppFormProvider>
|
</AppFormProvider>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import {
|
|||||||
SelectFieldSearch,
|
SelectFieldSearch,
|
||||||
SelectProjectField,
|
SelectProjectField,
|
||||||
} from "../common/Forms/SelectFieldServerSide";
|
} from "../common/Forms/SelectFieldServerSide";
|
||||||
import { useOrganization, useOrganizationsList } from "../../hooks/useOrganization";
|
import { useGlobaleOrganizations, useOrganization, useOrganizationsList } from "../../hooks/useOrganization";
|
||||||
import { ITEMS_PER_PAGE } from "../../utils/constants";
|
import { ITEMS_PER_PAGE } from "../../utils/constants";
|
||||||
|
|
||||||
const PurchasePartyDetails = () => {
|
const PurchasePartyDetails = () => {
|
||||||
@ -82,7 +82,7 @@ const PurchasePartyDetails = () => {
|
|||||||
onChange={field.onChange}
|
onChange={field.onChange}
|
||||||
valueKey="id"
|
valueKey="id"
|
||||||
labelKey="name"
|
labelKey="name"
|
||||||
useFetchHook={useOrganizationsList}
|
useFetchHook={useGlobaleOrganizations}
|
||||||
hookParams={[ITEMS_PER_PAGE,1]}
|
hookParams={[ITEMS_PER_PAGE,1]}
|
||||||
errors={errors?.organizationId}
|
errors={errors?.organizationId}
|
||||||
/>
|
/>
|
||||||
@ -93,15 +93,25 @@ const PurchasePartyDetails = () => {
|
|||||||
|
|
||||||
{/* Supplier */}
|
{/* Supplier */}
|
||||||
<div className="col-12 col-md-6">
|
<div className="col-12 col-md-6">
|
||||||
<Label htmlFor="supplierId" required>
|
|
||||||
Supplier
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
<input
|
<AppFormController
|
||||||
id="supplierId"
|
name="supplierId"
|
||||||
type="text"
|
control={control}
|
||||||
className={`form-control form-control-md `}
|
render={({ field }) => (
|
||||||
{...register("supplierId")}
|
<SelectFieldSearch
|
||||||
|
label="Supplier"
|
||||||
|
placeholder="Select Organization"
|
||||||
|
required
|
||||||
|
value={field.value}
|
||||||
|
onChange={field.onChange}
|
||||||
|
valueKey="id"
|
||||||
|
labelKey="name"
|
||||||
|
useFetchHook={useGlobaleOrganizations}
|
||||||
|
hookParams={[ITEMS_PER_PAGE,1]}
|
||||||
|
errors={errors?.organizationId}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{errors?.supplierId && (
|
{errors?.supplierId && (
|
||||||
|
|||||||
@ -1,20 +1,24 @@
|
|||||||
import React from "react";
|
import React, { useEffect } from "react";
|
||||||
import Label from "../common/Label";
|
import Label from "../common/Label";
|
||||||
import { useAppFormContext } from "../../hooks/appHooks/useAppForm";
|
import { useAppFormContext } from "../../hooks/appHooks/useAppForm";
|
||||||
import DatePicker from "../common/DatePicker";
|
import DatePicker from "../common/DatePicker";
|
||||||
|
import { useInvoiceAttachmentTypes } from "../../hooks/masterHook/useMaster";
|
||||||
|
|
||||||
const PurchasePaymentDetails = () => {
|
const PurchasePaymentDetails = () => {
|
||||||
|
const { data, isLoading, error, isError } = useInvoiceAttachmentTypes();
|
||||||
|
console.log(data);
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
watch,
|
watch,
|
||||||
setValue,control,
|
setValue,
|
||||||
|
control,
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useAppFormContext();
|
} = useAppFormContext();
|
||||||
|
|
||||||
const baseAmount = watch("baseAmount");
|
const baseAmount = watch("baseAmount");
|
||||||
const taxAmount = watch("taxAmount");
|
const taxAmount = watch("taxAmount");
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
const base = parseFloat(baseAmount) || 0;
|
const base = parseFloat(baseAmount) || 0;
|
||||||
const tax = parseFloat(taxAmount) || 0;
|
const tax = parseFloat(taxAmount) || 0;
|
||||||
|
|
||||||
@ -25,7 +29,6 @@ const PurchasePaymentDetails = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="row g-2 text-start">
|
<div className="row g-2 text-start">
|
||||||
{/* Base Amount */}
|
|
||||||
<div className="col-12 col-md-4">
|
<div className="col-12 col-md-4">
|
||||||
<Label htmlFor="baseAmount" required>
|
<Label htmlFor="baseAmount" required>
|
||||||
Base Amount
|
Base Amount
|
||||||
@ -45,7 +48,6 @@ const PurchasePaymentDetails = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tax Amount */}
|
|
||||||
<div className="col-12 col-md-4">
|
<div className="col-12 col-md-4">
|
||||||
<Label htmlFor="taxAmount" required>
|
<Label htmlFor="taxAmount" required>
|
||||||
Tax Amount
|
Tax Amount
|
||||||
@ -65,7 +67,6 @@ const PurchasePaymentDetails = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Total Amount */}
|
|
||||||
<div className="col-12 col-md-4">
|
<div className="col-12 col-md-4">
|
||||||
<Label htmlFor="totalAmount" required>
|
<Label htmlFor="totalAmount" required>
|
||||||
Total Amount
|
Total Amount
|
||||||
@ -86,7 +87,6 @@ const PurchasePaymentDetails = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Transport Charges */}
|
|
||||||
<div className="col-12 col-md-6">
|
<div className="col-12 col-md-6">
|
||||||
<Label htmlFor="transportCharges">Transport Charges</Label>
|
<Label htmlFor="transportCharges">Transport Charges</Label>
|
||||||
|
|
||||||
@ -104,12 +104,14 @@ const PurchasePaymentDetails = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Payment Due Date */}
|
|
||||||
<div className="col-12 col-md-6">
|
<div className="col-12 col-md-6">
|
||||||
<Label htmlFor="paymentDueDate">Payment Due Date</Label>
|
<Label htmlFor="paymentDueDate">Payment Due Date</Label>
|
||||||
|
|
||||||
|
<DatePicker
|
||||||
<DatePicker name={"paymentDueDate"} control={control} className="w-full"/>
|
name={"paymentDueDate"}
|
||||||
|
control={control}
|
||||||
|
className="w-full"
|
||||||
|
/>
|
||||||
|
|
||||||
{errors?.paymentDueDate && (
|
{errors?.paymentDueDate && (
|
||||||
<div className="small danger-text mt-1">
|
<div className="small danger-text mt-1">
|
||||||
|
|||||||
@ -10,16 +10,25 @@ import {
|
|||||||
} from "@tanstack/react-query";
|
} from "@tanstack/react-query";
|
||||||
import showToast from "../../services/toastService";
|
import showToast from "../../services/toastService";
|
||||||
|
|
||||||
|
export const useInvoiceAttachmentTypes = () => {
|
||||||
export const useRecurringStatus = ()=>{
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey:["RecurringStatus"],
|
queryKey: ["invoiceAttachmentType"],
|
||||||
queryFn:async()=>{
|
queryFn: async () => {
|
||||||
|
const resp = await MasterRespository.getInvoiceAttachmentTypes();
|
||||||
|
return resp.data;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useRecurringStatus = () => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["RecurringStatus"],
|
||||||
|
queryFn: async () => {
|
||||||
const resp = await MasterRespository.getRecurringStatus();
|
const resp = await MasterRespository.getRecurringStatus();
|
||||||
return resp.data
|
return resp.data;
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
export const useCurrencies = () => {
|
export const useCurrencies = () => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ["currencies"],
|
queryKey: ["currencies"],
|
||||||
@ -31,10 +40,10 @@ export const useCurrencies = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const usePaymentAjustmentHead = (isActive) => {
|
export const usePaymentAjustmentHead = (isActive) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ["paymentType",isActive],
|
queryKey: ["paymentType", isActive],
|
||||||
queryFn: async () => await MasterRespository.getPaymentAdjustmentHead(isActive),
|
queryFn: async () =>
|
||||||
|
await MasterRespository.getPaymentAdjustmentHead(isActive),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -296,26 +305,26 @@ export const useOrganizationType = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useJobStatus=(statusId,projectId)=>{
|
export const useJobStatus = (statusId, projectId) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey:["Job_Staus",statusId,projectId],
|
queryKey: ["Job_Staus", statusId, projectId],
|
||||||
queryFn:async()=>{
|
queryFn: async () => {
|
||||||
const resp = await MasterRespository.getJobStatus(statusId,projectId);
|
const resp = await MasterRespository.getJobStatus(statusId, projectId);
|
||||||
return resp.data;
|
return resp.data;
|
||||||
},
|
},
|
||||||
enabled:!!statusId && !!projectId
|
enabled: !!statusId && !!projectId,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export const useTeamRole=()=>{
|
export const useTeamRole = () => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey:["Team_Role"],
|
queryKey: ["Team_Role"],
|
||||||
queryFn:async()=>{
|
queryFn: async () => {
|
||||||
const resp = await MasterRespository.getTeamRole();
|
const resp = await MasterRespository.getTeamRole();
|
||||||
return resp.data;
|
return resp.data;
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
//#region ==Get Masters==
|
//#region ==Get Masters==
|
||||||
const fetchMasterData = async (masterType) => {
|
const fetchMasterData = async (masterType) => {
|
||||||
switch (masterType) {
|
switch (masterType) {
|
||||||
@ -405,8 +414,6 @@ const useMaster = () => {
|
|||||||
export default useMaster;
|
export default useMaster;
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ================================Mutation====================================
|
// ================================Mutation====================================
|
||||||
|
|
||||||
//#region Job Role
|
//#region Job Role
|
||||||
@ -456,10 +463,6 @@ export const useCreateJobRole = (onSuccessCallback) => {
|
|||||||
};
|
};
|
||||||
//#endregion Job Role
|
//#endregion Job Role
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Application Role
|
//#region Application Role
|
||||||
export const useCreateApplicationRole = (onSuccessCallback) => {
|
export const useCreateApplicationRole = (onSuccessCallback) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -505,10 +508,6 @@ export const useUpdateApplicationRole = (onSuccessCallback) => {
|
|||||||
};
|
};
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Create work Category
|
//#region Create work Category
|
||||||
export const useCreateWorkCategory = (onSuccessCallback) => {
|
export const useCreateWorkCategory = (onSuccessCallback) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -554,11 +553,6 @@ export const useUpdateWorkCategory = (onSuccessCallback) => {
|
|||||||
};
|
};
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Contact Category
|
//#region Contact Category
|
||||||
|
|
||||||
export const useCreateContactCategory = (onSuccessCallback) => {
|
export const useCreateContactCategory = (onSuccessCallback) => {
|
||||||
@ -609,10 +603,6 @@ export const useUpdateContactCategory = (onSuccessCallback) => {
|
|||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Contact Tag
|
//#region Contact Tag
|
||||||
|
|
||||||
export const useCreateContactTag = (onSuccessCallback) => {
|
export const useCreateContactTag = (onSuccessCallback) => {
|
||||||
@ -659,10 +649,6 @@ export const useUpdateContactTag = (onSuccessCallback) => {
|
|||||||
};
|
};
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Expense Category
|
//#region Expense Category
|
||||||
export const useCreateExpenseCategory = (onSuccessCallback) => {
|
export const useCreateExpenseCategory = (onSuccessCallback) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -689,7 +675,10 @@ export const useUpdateExpenseCategory = (onSuccessCallback) => {
|
|||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async ({ id, payload }) => {
|
mutationFn: async ({ id, payload }) => {
|
||||||
const response = await MasterRespository.updateExpenseCategory(id, payload);
|
const response = await MasterRespository.updateExpenseCategory(
|
||||||
|
id,
|
||||||
|
payload
|
||||||
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
onSuccess: (data, variables) => {
|
onSuccess: (data, variables) => {
|
||||||
@ -708,11 +697,6 @@ export const useUpdateExpenseCategory = (onSuccessCallback) => {
|
|||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Payment Mode
|
//#region Payment Mode
|
||||||
|
|
||||||
export const useCreatePaymentMode = (onSuccessCallback) => {
|
export const useCreatePaymentMode = (onSuccessCallback) => {
|
||||||
@ -759,10 +743,6 @@ export const useUpdatePaymentMode = (onSuccessCallback) => {
|
|||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Services-------------------------------
|
// Services-------------------------------
|
||||||
|
|
||||||
// export const useCreateService = (onSuccessCallback) => {
|
// export const useCreateService = (onSuccessCallback) => {
|
||||||
@ -844,10 +824,6 @@ export const useUpdateService = (onSuccessCallback) => {
|
|||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Activity Grouph
|
//#region Activity Grouph
|
||||||
|
|
||||||
export const useCreateActivityGroup = (onSuccessCallback) => {
|
export const useCreateActivityGroup = (onSuccessCallback) => {
|
||||||
@ -912,10 +888,6 @@ export const useUpdateActivityGroup = (onSuccessCallback) => {
|
|||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Activities
|
//#region Activities
|
||||||
export const useCreateActivity = (onSuccessCallback) => {
|
export const useCreateActivity = (onSuccessCallback) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -970,11 +942,6 @@ export const useUpdateActivity = (onSuccessCallback) => {
|
|||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Expense Status
|
//#region Expense Status
|
||||||
export const useCreateExpenseStatus = (onSuccessCallback) => {
|
export const useCreateExpenseStatus = (onSuccessCallback) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -1018,10 +985,6 @@ export const useUpdateExpenseStatus = (onSuccessCallback) => {
|
|||||||
};
|
};
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Document-Category
|
//#region Document-Category
|
||||||
export const useCreateDocumentCatgory = (onSuccessCallback) => {
|
export const useCreateDocumentCatgory = (onSuccessCallback) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -1068,11 +1031,6 @@ export const useUpdateDocumentCategory = (onSuccessCallback) => {
|
|||||||
};
|
};
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Document-Type
|
//#region Document-Type
|
||||||
export const useCreateDocumentType = (onSuccessCallback) => {
|
export const useCreateDocumentType = (onSuccessCallback) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -1117,10 +1075,6 @@ export const useUpdateDocumentType = (onSuccessCallback) => {
|
|||||||
};
|
};
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region Payment Adjustment Head
|
//#region Payment Adjustment Head
|
||||||
export const useCreatePaymentAjustmentHead = (onSuccessCallback) => {
|
export const useCreatePaymentAjustmentHead = (onSuccessCallback) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -1147,7 +1101,10 @@ export const useUpdatePaymentAjustmentHead = (onSuccessCallback) => {
|
|||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async ({ id, payload }) => {
|
mutationFn: async ({ id, payload }) => {
|
||||||
const resp = await MasterRespository.updatePaymentAjustmentHead(id, payload);
|
const resp = await MasterRespository.updatePaymentAjustmentHead(
|
||||||
|
id,
|
||||||
|
payload
|
||||||
|
);
|
||||||
return resp.data;
|
return resp.data;
|
||||||
},
|
},
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
@ -1164,10 +1121,6 @@ export const useUpdatePaymentAjustmentHead = (onSuccessCallback) => {
|
|||||||
};
|
};
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#region ==Delete Master==
|
//#region ==Delete Master==
|
||||||
export const useDeleteMasterItem = () => {
|
export const useDeleteMasterItem = () => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -1203,8 +1156,6 @@ export const useDeleteMasterItem = () => {
|
|||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const useDeleteServiceGroup = () => {
|
export const useDeleteServiceGroup = () => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,9 @@ export const useOrganizationModal = () => {
|
|||||||
dispatch(
|
dispatch(
|
||||||
openOrgModal({
|
openOrgModal({
|
||||||
isOpen: true,
|
isOpen: true,
|
||||||
orgData: options.hasOwnProperty("orgData") ? options.orgData : orgData,
|
orgData: options.hasOwnProperty("orgData")
|
||||||
|
? options.orgData
|
||||||
|
: orgData,
|
||||||
startStep: options.startStep ?? startStep ?? 1,
|
startStep: options.startStep ?? startStep ?? 1,
|
||||||
prevStep: options.prevStep ?? prevStep ?? 1,
|
prevStep: options.prevStep ?? prevStep ?? 1,
|
||||||
flowType: options.flowType ?? flowType ?? "default",
|
flowType: options.flowType ?? flowType ?? "default",
|
||||||
@ -37,16 +39,30 @@ export const useOrganizationModal = () => {
|
|||||||
|
|
||||||
// ================================Query=============================================================
|
// ================================Query=============================================================
|
||||||
|
|
||||||
export const useOrganization=(id)=>{
|
export const useGlobaleOrganizations = (pageSize, pageNumber, searchString) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey:["organization",id],
|
queryKey: ["global_organization",pageSize, pageNumber, searchString],
|
||||||
queryFn:async()=> {
|
queryFn: async () => {
|
||||||
const resp = await await OrganizationRepository.getOrganizaion(id);
|
const resp = await OrganizationRepository.getGlobalOrganization(
|
||||||
return resp.data
|
pageSize,
|
||||||
},
|
pageNumber,
|
||||||
enabled:!!id
|
searchString
|
||||||
})
|
);
|
||||||
}
|
return resp.data;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useOrganization = (id) => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["organization", id],
|
||||||
|
queryFn: async () => {
|
||||||
|
const resp = await await OrganizationRepository.getOrganizaion(id);
|
||||||
|
return resp.data;
|
||||||
|
},
|
||||||
|
enabled: !!id,
|
||||||
|
});
|
||||||
|
};
|
||||||
export const useOrganizationBySPRID = (sprid) => {
|
export const useOrganizationBySPRID = (sprid) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ["organization by", sprid],
|
queryKey: ["organization by", sprid],
|
||||||
@ -101,7 +117,7 @@ export const useOrganizationEmployees = (
|
|||||||
organizationId,
|
organizationId,
|
||||||
searchString
|
searchString
|
||||||
),
|
),
|
||||||
enabled: !!projectId ,
|
enabled: !!projectId,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -138,10 +154,10 @@ export const useAssignOrgToProject = (onSuccessCallback) => {
|
|||||||
useClient.invalidateQueries({
|
useClient.invalidateQueries({
|
||||||
queryKey: ["projectAssignedOrganiztions"],
|
queryKey: ["projectAssignedOrganiztions"],
|
||||||
});
|
});
|
||||||
useClient.invalidateQueries({
|
useClient.invalidateQueries({
|
||||||
queryKey: ["projectAssignedOrganiztionsName"],
|
queryKey: ["projectAssignedOrganiztionsName"],
|
||||||
});
|
});
|
||||||
|
|
||||||
useClient.invalidateQueries({
|
useClient.invalidateQueries({
|
||||||
queryKey: ["projectAssignedServices", projectId],
|
queryKey: ["projectAssignedServices", projectId],
|
||||||
});
|
});
|
||||||
@ -181,12 +197,14 @@ export const useAssignOrgToTenant = (onSuccessCallback) => {
|
|||||||
export const useUpdateOrganization = (onSuccessCallback) => {
|
export const useUpdateOrganization = (onSuccessCallback) => {
|
||||||
const useClient = useQueryClient();
|
const useClient = useQueryClient();
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async ({orgId,payload}) =>
|
mutationFn: async ({ orgId, payload }) =>
|
||||||
await OrganizationRepository.updateOrganizaion(orgId,payload),
|
await OrganizationRepository.updateOrganizaion(orgId, payload),
|
||||||
onSuccess: (_, variables) => {
|
onSuccess: (_, variables) => {
|
||||||
useClient.invalidateQueries({ queryKey: ["organizationList"] });
|
useClient.invalidateQueries({ queryKey: ["organizationList"] });
|
||||||
useClient.invalidateQueries({ queryKey: ["projectAssignedOrganiztionsName"] });
|
useClient.invalidateQueries({
|
||||||
|
queryKey: ["projectAssignedOrganiztionsName"],
|
||||||
|
});
|
||||||
|
|
||||||
showToast("Organization Updated successfully", "success");
|
showToast("Organization Updated successfully", "success");
|
||||||
if (onSuccessCallback) onSuccessCallback();
|
if (onSuccessCallback) onSuccessCallback();
|
||||||
},
|
},
|
||||||
|
|||||||
25
src/hooks/usePurchase.jsx
Normal file
25
src/hooks/usePurchase.jsx
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
|
import { PurchaseRepository } from "../repositories/PurchaseRepository";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const useCreatePurchaseInvoice = (onSuccessCallback) => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: async (payload) =>
|
||||||
|
await PurchaseRepository.CreatePurchase(payload),
|
||||||
|
onSuccess: (data, variables) => {
|
||||||
|
showToast("Purchase Invoice Created successfully", "success");
|
||||||
|
if (onSuccessCallback) onSuccessCallback();
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
showToast(
|
||||||
|
error?.response?.data?.message ||
|
||||||
|
error.message ||
|
||||||
|
"Failed to create invoice",
|
||||||
|
"error"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
@ -157,4 +157,7 @@ export const MasterRespository = {
|
|||||||
),
|
),
|
||||||
|
|
||||||
getTeamRole: () => api.get(`/api/Master/team-roles/list`),
|
getTeamRole: () => api.get(`/api/Master/team-roles/list`),
|
||||||
|
|
||||||
|
|
||||||
|
getInvoiceAttachmentTypes:()=>api.get("/api/Master/invoice-attachment-type/list")
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,8 +2,9 @@ import { api } from "../utils/axiosClient";
|
|||||||
|
|
||||||
const OrganizationRepository = {
|
const OrganizationRepository = {
|
||||||
createOrganization: (data) => api.post("/api/Organization/create", data),
|
createOrganization: (data) => api.post("/api/Organization/create", data),
|
||||||
updateOrganizaion:(id,data)=>api.put(`/api/Organization/edit/${id}`,data),
|
updateOrganizaion: (id, data) =>
|
||||||
getOrganizaion:(id)=>api.get(`/api/Organization/details/${id}`),
|
api.put(`/api/Organization/edit/${id}`, data),
|
||||||
|
getOrganizaion: (id) => api.get(`/api/Organization/details/${id}`),
|
||||||
getOrganizationList: (pageSize, pageNumber, active, sprid, searchString) => {
|
getOrganizationList: (pageSize, pageNumber, active, sprid, searchString) => {
|
||||||
return api.get(
|
return api.get(
|
||||||
`/api/Organization/list?pageSize=${pageSize}&pageNumber=${pageNumber}&active=${active}&${
|
`/api/Organization/list?pageSize=${pageSize}&pageNumber=${pageNumber}&active=${active}&${
|
||||||
@ -39,6 +40,11 @@ const OrganizationRepository = {
|
|||||||
|
|
||||||
return api.get(url);
|
return api.get(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getGlobalOrganization: (pageSize, pageNumber, searchString) =>
|
||||||
|
api.get(
|
||||||
|
`/api/Organization/list/basic?pageSize=${pageSize}&pageNumber=${pageNumber}&searchString=${searchString}`
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default OrganizationRepository;
|
export default OrganizationRepository;
|
||||||
|
|||||||
5
src/repositories/PurchaseRepository.jsx
Normal file
5
src/repositories/PurchaseRepository.jsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { api } from "../utils/axiosClient";
|
||||||
|
|
||||||
|
export const PurchaseRepository = {
|
||||||
|
CreatePurchase: (data) => api.post("/api/PurchaseInvoice/create", data),
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user