Compare commits

..

No commits in common. "a5329f1a2ae550206edc4cc8f75d9611b754456f" and "4506f740eb89fe9ddba452563ae7b8457f36fe07" have entirely different histories.

3 changed files with 35 additions and 74 deletions

View File

@ -29,7 +29,6 @@ import Filelist from "../Expenses/Filelist";
import InputSuggestions from "../common/InputSuggestion";
import { useProfile } from "../../hooks/useProfile";
import { blockUI } from "../../utils/blockUI";
import { SelectProjectField } from "../common/Forms/SelectFieldServerSide";
function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
const {
@ -235,10 +234,10 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
{/* Project and Category */}
<div className="row my-2 text-start">
<div className="col-md-6">
{/* <Label className="form-label" required>
<Label className="form-label" required>
Select Project
</Label> */}
{/* <select
</Label>
<select
className="form-select form-select-sm"
{...register("projectId")}
disabled={
@ -255,23 +254,7 @@ function ManagePaymentRequest({ closeModal, requestToEdit = null }) {
</option>
))
)}
</select> */}
<SelectProjectField
label="Project"
required
placeholder="Select Project"
value={watch("projectId")}
onChange={(val) =>
setValue("projectId", val, {
shouldDirty: true,
shouldValidate: true,
})
}
disabled={
data?.recurringPayment?.isVariable && !isDraft && !isProcessed
}
/>
</select>
{errors.projectId && (
<small className="danger-text">{errors.projectId.message}</small>
)}

View File

@ -27,7 +27,6 @@ import InputSuggestions from "../common/InputSuggestion";
import { useEmployeesName } from "../../hooks/useEmployees";
import PmsEmployeeInputTag from "../common/PmsEmployeeInputTag";
import HoverPopup from "../common/HoverPopup";
import { SelectProjectField } from "../common/Forms/SelectFieldServerSide";
const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
const {
@ -132,7 +131,7 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
}
}, [currencyData, requestToEdit, setValue]);
const StrikeDate = watch("strikeDate");
const StrikeDate = watch("strikeDate")
const onSubmit = (fromdata) => {
let payload = {
@ -164,7 +163,10 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
{/* Project and Category */}
<div className="row my-2 text-start">
<div className="col-md-6">
{/* <select
<Label className="form-label" required>
Select Project
</Label>
<select
className="form-select form-select-sm"
{...register("projectId")}
>
@ -178,19 +180,7 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
</option>
))
)}
</select> */}
<SelectProjectField
label="Select Project"
required
placeholder="Select Project"
value={watch("projectId")}
onChange={(val) =>
setValue("projectId", val, {
shouldDirty: true,
shouldValidate: true,
})
}
/>
</select>
{errors.projectId && (
<small className="danger-text">{errors.projectId.message}</small>
)}
@ -245,7 +235,7 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
</div>
<div className="col-md-6 mt-2">
<div className="d-flex justify-content-start align-items-center text-nowrap gap-2">
<div className="d-flex justify-content-start align-items-center gap-2">
<Label htmlFor="isVariable" className="form-label mb-0" required>
Payment Type
</Label>
@ -253,16 +243,13 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
title="Payment Type"
id="payment_type"
content={
<div className=" w-50">
<p>
Choose whether the payment amount varies or remains fixed
each cycle.
<br />
<strong>Is Variable:</strong> Amount changes per cycle.
<br />
<strong>Fixed:</strong> Amount stays constant.
</p>
</div>
<p>
Choose whether the payment amount varies or remains fixed each cycle.
<br />
<strong>Is Variable:</strong> Amount changes per cycle.
<br />
<strong>Fixed:</strong> Amount stays constant.
</p>
}
>
<i className="bx bx-info-circle bx-sm text-muted cursor-pointer"></i>
@ -283,10 +270,7 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
checked={field.value === true}
onChange={() => field.onChange(true)}
/>
<Label
htmlFor="isVariableTrue"
className="form-check-label"
>
<Label htmlFor="isVariableTrue" className="form-check-label">
Is Variable
</Label>
</div>
@ -299,10 +283,7 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
checked={field.value === false}
onChange={() => field.onChange(false)}
/>
<Label
htmlFor="isVariableFalse"
className="form-check-label"
>
<Label htmlFor="isVariableFalse" className="form-check-label">
Fixed
</Label>
</div>
@ -314,6 +295,7 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
<small className="danger-text">{errors.isVariable.message}</small>
)}
</div>
</div>
{/* Date and Amount */}
@ -409,12 +391,11 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
id="frequency"
content={
<p>
Defines how often payments or billing occur, such as
monthly, quarterly, or annually.
Defines how often payments or billing occur, such as monthly, quarterly, or annually.
</p>
}
>
<i className="bx bx-info-circle bx-xs text-muted cursor-pointer"></i>
<i className="bx bx-info-circle bx-sm text-muted cursor-pointer"></i>
</HoverPopup>
</div>
@ -463,13 +444,10 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
{/* Payment Buffer Days and End Date */}
<div className="row my-2 text-start">
<div className="col-md-6">
<div className="d-flex justify-content-start align-items-center text-nowrap gap-2">
<Label
htmlFor="paymentBufferDays"
className="form-label mb-0 "
required
>
<div className="d-flex justify-content-start align-items-center gap-2">
<Label htmlFor="paymentBufferDays" className="form-label mb-0" required>
Payment Buffer Days
</Label>
<HoverPopup
@ -477,12 +455,11 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
id="payment_buffer_days"
content={
<p>
Number of extra days allowed after the due date before
payment is considered late.
Number of extra days allowed after the due date before payment is considered late.
</p>
}
>
<i className="bx bx-info-circle bx-xs text-muted cursor-pointer"></i>
<i className="bx bx-info-circle bx-sm text-muted cursor-pointer"></i>
</HoverPopup>
</div>
@ -503,8 +480,9 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
)}
</div>
<div className="col-md-6">
<div className="d-flex justify-content-start align-items-center text-nowrap gap-2">
<div className="d-flex justify-content-start align-items-center gap-2">
<Label htmlFor="endDate" className="form-label mb-0" required>
End Date
</Label>
@ -517,7 +495,7 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
</p>
}
>
<i className="bx bx-info-circle bx-xs text-muted cursor-pointer"></i>
<i className="bx bx-info-circle bx-sm text-muted cursor-pointer"></i>
</HoverPopup>
</div>
@ -532,8 +510,10 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
<small className="danger-text">{errors.endDate.message}</small>
)}
</div>
</div>
<div className="row my-2 text-start">
<div className="col-md-6">
<Label htmlFor="notifyTo" className="form-label" required>
@ -592,8 +572,8 @@ const ManageRecurringExpense = ({ closeModal, requestToEdit = null }) => {
{createPending || isPending
? "Please wait...."
: requestToEdit
? "Update"
: "Save as Draft"}
? "Update"
: "Save as Draft"}
</button>
</div>
</form>

View File

@ -200,7 +200,6 @@ export const SelectProjectField = ({
isFullObject = false,
isMultiple = false,
isAllProject = false,
disabled
}) => {
const [searchText, setSearchText] = useState("");
const debounce = useDebounce(searchText, 300);
@ -296,7 +295,6 @@ export const SelectProjectField = ({
open ? "show" : ""
}`}
onClick={() => setOpen((prev) => !prev)}
disabled={disabled}
>
<span className={`text-truncate ${!displayText ? "text-muted" : ""}`}>
{displayText}