This commit is contained in:
unknown
2025-05-29 00:13:11 +07:00
6 changed files with 266 additions and 169 deletions

View File

@ -1,5 +1,5 @@
steps: steps:
- name: telegram_start_notify - name: telegram start notify
image: appleboy/drone-telegram image: appleboy/drone-telegram
settings: settings:
token: 7616010754:AAGXMf8x-roKozdT0j-bOZ1y9dmbulbKPbM token: 7616010754:AAGXMf8x-roKozdT0j-bOZ1y9dmbulbKPbM
@ -11,14 +11,14 @@ steps:
*Repo Link:* ${CI_REPO_URL} *Repo Link:* ${CI_REPO_URL}
*Branch:* ${CI_COMMIT_BRANCH} *Branch:* ${CI_COMMIT_BRANCH}
*Build Status:* starting *Build Status:* *starting*
*Build Link:* ${CI_PIPELINE_URL} *Build Link:* ${CI_PIPELINE_URL}
*Commit ID:* `${CI_COMMIT_SHA:0:8}` *Commit ID:* `${CI_COMMIT_SHA:0:8}`
*Commit By:* ${CI_PREV_COMMIT_AUTHOR} *Commit By:* {{commit.author}}
*Commit Link:* ${CI_PREV_COMMIT_URL} *Commit Link:* {{commit.link}}
*Commit Msg:* {{commit.message}} *Commit Msg:* {{commit.message}}
🙏 hopefully success Mas Bro. 🙏 hopefully success {{commit.author}}
when: when:
branch: branch:
- master - master
@ -59,7 +59,7 @@ steps:
branch: branch:
- master - master
- name: telegram_end_notify - name: telegram failed notify
image: appleboy/drone-telegram image: appleboy/drone-telegram
settings: settings:
token: 7616010754:AAGXMf8x-roKozdT0j-bOZ1y9dmbulbKPbM token: 7616010754:AAGXMf8x-roKozdT0j-bOZ1y9dmbulbKPbM
@ -71,18 +71,43 @@ steps:
*Repo Link:* ${CI_REPO_URL} *Repo Link:* ${CI_REPO_URL}
*Branch:* ${CI_COMMIT_BRANCH} *Branch:* ${CI_COMMIT_BRANCH}
*Build Status:* *${CI_PREV_PIPELINE_STATUS}* *Build Status:* *Failed*
*Build Link:* ${CI_PIPELINE_URL} *Build Link:* ${CI_PIPELINE_URL}
*Commit ID:* `${CI_COMMIT_SHA:0:8}` *Commit ID:* `${CI_COMMIT_SHA:0:8}`
*Commit By:* ${CI_PREV_COMMIT_AUTHOR} *Commit By:* {{commit.author}}
*Commit Link:* ${CI_PREV_COMMIT_URL} *Commit Link:* {{commit.link}}
*Commit Msg:* {{commit.message}} *Commit Msg:* {{commit.message}}
{{#success build.status}}
😎 build succeeded. Good job.
{{else}}
🙈 build failed. Fix me please, before client is aware. 🙈 build failed. Fix me please, before client is aware.
{{/success}}
when: when:
status:
- failure
- cancel
branch:
- master
- name: telegram success notify
image: appleboy/drone-telegram
settings:
token: 7616010754:AAGXMf8x-roKozdT0j-bOZ1y9dmbulbKPbM
to: -4765409490
message: |
🚀 *Woodpecker CI Build Finish* 🚀
*Repo:* ${CI_REPO_OWNER}/${CI_REPO_NAME}
*Repo Link:* ${CI_REPO_URL}
*Branch:* ${CI_COMMIT_BRANCH}
*Build Status:* *Success*
*Build Link:* ${CI_PIPELINE_URL}
*Commit ID:* `${CI_COMMIT_SHA:0:8}`
*Commit By:* {{commit.author}}
*Commit Link:* {{commit.link}}
*Commit Msg:* {{commit.message}}
😎 build succeeded. Good job {{commit.author}}
when:
status:
- success
branch: branch:
- master - master

View File

@ -612,10 +612,10 @@ const DetailApprovalTransaction = () => {
<p className="text-sm text-gray-500">Full Name</p> <p className="text-sm text-gray-500">Full Name</p>
<p className="font-medium">{transactionDetails?.origin_name ?? ""}</p> <p className="font-medium">{transactionDetails?.origin_name ?? ""}</p>
</div> </div>
<div> {/* <div>
<p className="text-sm text-gray-500">Phone Number</p> <p className="text-sm text-gray-500">Phone Number</p>
<p className="font-medium">{transactionDetails?.origin_customer?.msisdn ?? transactionDetails?.origin_msisdn}</p> <p className="font-medium">{transactionDetails?.origin_customer?.msisdn ?? transactionDetails?.origin_msisdn}</p>
</div> </div> */}
<div> <div>
<p className="text-sm text-gray-500">Email</p> <p className="text-sm text-gray-500">Email</p>
<p className="font-medium">{transactionDetails?.origin_customer?.email ?? "-"}</p> <p className="font-medium">{transactionDetails?.origin_customer?.email ?? "-"}</p>

View File

@ -678,11 +678,11 @@ const DetailTransaction = () => {
<p className="text-sm text-gray-500">Full Name</p> <p className="text-sm text-gray-500">Full Name</p>
<p className="font-medium">{transactionDetails?.origin_name}</p> <p className="font-medium">{transactionDetails?.origin_name}</p>
</div> </div>
<div> {/* <div>
<p className="text-sm text-gray-500">Phone Number</p> <p className="text-sm text-gray-500">Phone Number</p>
<p className="font-medium">{transactionDetails?.origin_msisdn}</p> <p className="font-medium">{transactionDetails?.origin_msisdn}</p>
<p className="font-medium">{transactionDetails?.origin_customer?.origin_name ?? ""}</p> <p className="font-medium">{transactionDetails?.origin_customer?.origin_name ?? ""}</p>
</div> </div> */}
<div> <div>
<p className="text-sm text-gray-500">Phone Number</p> <p className="text-sm text-gray-500">Phone Number</p>
<p className="font-medium">{transactionDetails?.origin_customer?.msisdn ?? transactionDetails?.origin_msisdn}</p> <p className="font-medium">{transactionDetails?.origin_customer?.msisdn ?? transactionDetails?.origin_msisdn}</p>

View File

@ -114,7 +114,8 @@ const AddFeeDialog = () => {
deduct_from_account: '', deduct_from_account: '',
credit_to: '', credit_to: '',
credit_destination: '00000000-0000-0000-0000-000000000000', credit_destination: '00000000-0000-0000-0000-000000000000',
credit_destination_account: '' credit_destination_account: '',
deduct_when: 'A'
}; };
const [formField, setFormField] = useState(initialState); const [formField, setFormField] = useState(initialState);
@ -389,13 +390,19 @@ const AddFeeDialog = () => {
); );
}; };
useEffect(() => {
if (formField.status_include === 'N') {
setFormField((prev) => ({ ...prev, deduct_when: 'A' }));
}
}, [formField.status_include]);
return ( return (
<Dialog <Dialog
open={showAddFeeDialog} open={showAddFeeDialog}
onOpenChange={(open) => { onOpenChange={(open) => {
if (!open) { if (!open) {
handleAddFeeDialog(open); handleAddFeeDialog(open);
handleCloseDialog(); handleCloseDialog();
} }
}} }}
> >
@ -835,6 +842,25 @@ const AddFeeDialog = () => {
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
{formField.status_include === 'Y' && (
<div className="w-full">
<label className="form-label">
Deduct When <span className="text-red-500">*</span>
</label>
<Select
value={formField.deduct_when}
onValueChange={(value) => setFormField({ ...formField, deduct_when: value })}
>
<SelectTrigger>
<SelectValue placeholder="Select Deduct When" />
</SelectTrigger>
<SelectContent>
<SelectItem value="A">After</SelectItem>
<SelectItem value="B">Before</SelectItem>
</SelectContent>
</Select>
</div>
)}
<div className="flex justify-end pt-2.5 gap-5"> <div className="flex justify-end pt-2.5 gap-5">
<Button <Button

View File

@ -105,7 +105,8 @@ const EditFeeDialog = () => {
deduct_from_account: '', deduct_from_account: '',
credit_to: '', credit_to: '',
credit_destination: '00000000-0000-0000-0000-000000000000', credit_destination: '00000000-0000-0000-0000-000000000000',
credit_destination_account: '' credit_destination_account: '',
deduct_when: 'A'
}; };
const [formField, setFormField] = useState(initialState); const [formField, setFormField] = useState(initialState);
@ -161,6 +162,15 @@ const EditFeeDialog = () => {
} }
} }
if (formField.status_include === 'Y' && !formField.deduct_origin) {
setAlert({
show: true,
message: 'Deduct Origin is required when Input is selected'
});
setIsSubmitting(false);
return;
}
if (formField.credit_to === 'I' && !formField.credit_destination) { if (formField.credit_to === 'I' && !formField.credit_destination) {
setAlert({ setAlert({
show: true, show: true,
@ -190,6 +200,9 @@ const EditFeeDialog = () => {
if (formField.deduct_from !== 'I') { if (formField.deduct_from !== 'I') {
payload.deduct_origin = '00000000-0000-0000-0000-000000000000'; payload.deduct_origin = '00000000-0000-0000-0000-000000000000';
} }
if (formField.status_include !== 'Y') {
payload.deduct_origin = '00000000-0000-0000-0000-000000000000';
}
// console.log(payload); // console.log(payload);
try { try {
@ -334,7 +347,8 @@ const EditFeeDialog = () => {
response.data.credit_destination?.id || '00000000-0000-0000-0000-000000000000', response.data.credit_destination?.id || '00000000-0000-0000-0000-000000000000',
credit_destination_account: response.data.credit_destination_account?.id || '', credit_destination_account: response.data.credit_destination_account?.id || '',
updated_by: parsedUser?.username, updated_by: parsedUser?.username,
updated_at: new Date().toISOString().slice(0, 19).replace('T', ' ') updated_at: new Date().toISOString().slice(0, 19).replace('T', ' '),
deduct_when: response.data.deduct_when || 'A'
}); });
if (response.data.transaction_type?.name) { if (response.data.transaction_type?.name) {
@ -488,7 +502,6 @@ const EditFeeDialog = () => {
/> />
</div> </div>
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
Transfer Fee Name <span className="text-red-500">*</span> Transfer Fee Name <span className="text-red-500">*</span>
@ -503,7 +516,6 @@ const EditFeeDialog = () => {
} }
/> />
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
Description <span className="text-red-500">*</span> Description <span className="text-red-500">*</span>
@ -518,7 +530,6 @@ const EditFeeDialog = () => {
} }
/> />
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label">Minimum Amount</label> <label className="form-label">Minimum Amount</label>
<NumericFormat <NumericFormat
@ -536,7 +547,6 @@ const EditFeeDialog = () => {
placeholder="Enter Minimum Amount" placeholder="Enter Minimum Amount"
/> />
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label">Maximum Amount</label> <label className="form-label">Maximum Amount</label>
<NumericFormat <NumericFormat
@ -554,7 +564,6 @@ const EditFeeDialog = () => {
placeholder="Enter Maximum Amount" placeholder="Enter Maximum Amount"
/> />
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
Period Start <span className="text-red-500">*</span> Period Start <span className="text-red-500">*</span>
@ -569,7 +578,6 @@ const EditFeeDialog = () => {
} }
/> />
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
Period End <span className="text-red-500">*</span> Period End <span className="text-red-500">*</span>
@ -584,7 +592,6 @@ const EditFeeDialog = () => {
} }
/> />
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label">Deduct Amount</label> <label className="form-label">Deduct Amount</label>
<NumericFormat <NumericFormat
@ -602,7 +609,6 @@ const EditFeeDialog = () => {
placeholder="Enter Deduct Amount" placeholder="Enter Deduct Amount"
/> />
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label">Deduct Percentage</label> <label className="form-label">Deduct Percentage</label>
<NumericFormat <NumericFormat
@ -620,7 +626,6 @@ const EditFeeDialog = () => {
placeholder="Enter Deduct Percentage" placeholder="Enter Deduct Percentage"
/> />
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
Deduct From <span className="text-red-500">*</span> Deduct From <span className="text-red-500">*</span>
@ -645,70 +650,74 @@ const EditFeeDialog = () => {
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
{formField.deduct_from === 'I' && (
<div className="w-full">
<label className="form-label">
Deduct Origin <span className="text-red-500">*</span>
</label>
<div className="relative">
<div
className="flex w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer"
onClick={() => setOpenDeductOrigin(!openDeductOrigin)}
>
<span className="truncate">
{customers.find((customer) => customer.id === formField.deduct_origin)
?.username || 'Search customer...'}
</span>
</div>
{formField.deduct_from === 'I' && ( {openDeductOrigin && (
<div className="w-full"> <div className="absolute left-0 right-0 top-full z-50 mt-1 max-h-52 overflow-auto rounded-md border border-gray-200 bg-white shadow-lg">
<label className="form-label"> <div className="sticky top-0 bg-white p-2 border-b">
Deduct Origin <span className="text-red-500">*</span> <Input
</label> className="h-8 text-sm"
<div className="relative"> type="text"
<div placeholder="Search customer..."
className="flex w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer" value={customerSearchTerm}
onClick={() => setOpenDeductOrigin(!openDeductOrigin)} onChange={(e) => setCustomerSearchTerm(e.target.value)}
> autoComplete="off"
<span className="truncate"> onClick={(e) => e.stopPropagation()}
{customers.find((customer) => customer.id === formField.deduct_origin)?.username || 'Search customer...'} autoFocus
</span> />
</div> </div>
<div>
{openDeductOrigin && ( {customers
<div className="absolute left-0 right-0 top-full z-50 mt-1 max-h-52 overflow-auto rounded-md border border-gray-200 bg-white shadow-lg"> .filter(
<div className="sticky top-0 bg-white p-2 border-b"> (customer) =>
<Input customer.username
className="h-8 text-sm" .toLowerCase()
type="text" .includes(customerSearchTerm.toLowerCase()) ||
placeholder="Search customer..." customer.msisdn.includes(customerSearchTerm)
value={customerSearchTerm} )
onChange={(e) => setCustomerSearchTerm(e.target.value)} .map((customer) => (
autoComplete="off" <div
onClick={(e) => e.stopPropagation()} key={customer.id}
autoFocus className="cursor-pointer px-3 py-1.5 text-sm hover:bg-gray-100"
/> onClick={() => {
</div> setFormField({ ...formField, deduct_origin: customer.id });
<div> setOpenDeductOrigin(false);
{customers }}
.filter( >
(customer) => {customer.username}
customer.username.toLowerCase().includes(customerSearchTerm.toLowerCase()) || </div>
customer.msisdn.includes(customerSearchTerm) ))}
) {customers.filter(
.map((customer) => ( (customer) =>
<div customer.username
key={customer.id} .toLowerCase()
className="cursor-pointer px-3 py-1.5 text-sm hover:bg-gray-100" .includes(customerSearchTerm.toLowerCase()) ||
onClick={() => { customer.msisdn.includes(customerSearchTerm)
setFormField({ ...formField, deduct_origin: customer.id }); ).length === 0 && (
setOpenDeductOrigin(false); <div className="px-3 py-2 text-sm text-gray-500">
}} No customer found
> </div>
{customer.username} )}
</div> </div>
))} </div>
{customers.filter( )}
(customer) => </div>
customer.username.toLowerCase().includes(customerSearchTerm.toLowerCase()) || </div>
customer.msisdn.includes(customerSearchTerm) )}
).length === 0 && (
<div className="px-3 py-2 text-sm text-gray-500">No customer found</div>
)}
</div>
</div>
)}
</div>
</div>
)}
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
Deduct From Account <span className="text-red-500">*</span> Deduct From Account <span className="text-red-500">*</span>
@ -746,78 +755,78 @@ const EditFeeDialog = () => {
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
{formField.credit_to === 'I' && (
<div className="w-full">
<label className="form-label">
Credit Destination <span className="text-red-500">*</span>
</label>
<div className="relative">
<div
className="flex w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer"
onClick={() => setOpenCreditDestination(!openCreditDestination)}
>
<span className="truncate">
{customers.find(
(customer) => customer.id === formField.credit_destination
)?.username || 'Search customer...'}
</span>
</div>
{formField.credit_to === 'I' && ( {openCreditDestination && (
<div className="w-full"> <div className="absolute left-0 right-0 top-full z-50 mt-1 max-h-52 overflow-auto rounded-md border border-gray-200 bg-white shadow-lg">
<label className="form-label"> <div className="sticky top-0 bg-white p-2 border-b">
Credit Destination <span className="text-red-500">*</span> <Input
</label> className="h-8 text-sm"
<div className="relative"> type="text"
<div placeholder="Search customer..."
className="flex w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer" value={customerSearchTerm}
onClick={() => setOpenCreditDestination(!openCreditDestination)} onChange={(e) => setCustomerSearchTerm(e.target.value)}
> autoComplete="off"
<span className="truncate"> onClick={(e) => e.stopPropagation()}
{customers.find((customer) => customer.id === formField.credit_destination) autoFocus
?.username || 'Search customer...'} />
</span> </div>
</div> <div>
{customers
{openCreditDestination && ( .filter(
<div className="absolute left-0 right-0 top-full z-50 mt-1 max-h-52 overflow-auto rounded-md border border-gray-200 bg-white shadow-lg"> (customer) =>
<div className="sticky top-0 bg-white p-2 border-b"> customer.username
<Input .toLowerCase()
className="h-8 text-sm" .includes(customerSearchTerm.toLowerCase()) ||
type="text" customer.msisdn.includes(customerSearchTerm)
placeholder="Search customer..." )
value={customerSearchTerm} .map((customer) => (
onChange={(e) => setCustomerSearchTerm(e.target.value)} <div
autoComplete="off" key={customer.id}
onClick={(e) => e.stopPropagation()} className="cursor-pointer px-3 py-1.5 text-sm hover:bg-gray-100"
autoFocus onClick={() => {
/> setFormField({
</div> ...formField,
<div> credit_destination: customer.id
{customers });
.filter( setOpenCreditDestination(false);
(customer) => }}
customer.username >
.toLowerCase() {customer.username}
.includes(customerSearchTerm.toLowerCase()) || </div>
customer.msisdn.includes(customerSearchTerm) ))}
) {customers.filter(
.map((customer) => ( (customer) =>
<div customer.username
key={customer.id} .toLowerCase()
className="cursor-pointer px-3 py-1.5 text-sm hover:bg-gray-100" .includes(customerSearchTerm.toLowerCase()) ||
onClick={() => { customer.msisdn.includes(customerSearchTerm)
setFormField({ ).length === 0 && (
...formField, <div className="px-3 py-2 text-sm text-gray-500">
credit_destination: customer.id No customer found
}); </div>
setOpenCreditDestination(false); )}
}} </div>
> </div>
{customer.username} )}
</div> </div>
))} </div>
{customers.filter( )}
(customer) =>
customer.username
.toLowerCase()
.includes(customerSearchTerm.toLowerCase()) ||
customer.msisdn.includes(customerSearchTerm)
).length === 0 && (
<div className="px-3 py-2 text-sm text-gray-500">No customer found</div>
)}
</div>
</div>
)}
</div>
</div>
)}
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
Credit Destination Account <span className="text-red-500">*</span> Credit Destination Account <span className="text-red-500">*</span>
@ -830,7 +839,6 @@ const EditFeeDialog = () => {
isLoadingWallets isLoadingWallets
)} )}
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
Status <span className="text-red-500">*</span> Status <span className="text-red-500">*</span>
@ -848,7 +856,6 @@ const EditFeeDialog = () => {
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
Status Include <span className="text-red-500">*</span> Status Include <span className="text-red-500">*</span>
@ -856,7 +863,11 @@ const EditFeeDialog = () => {
<Select <Select
value={formField.status_include} value={formField.status_include}
onValueChange={(value) => onValueChange={(value) =>
setFormField({ ...formField, status_include: value }) setFormField({
...formField,
status_include: value,
deduct_when: value === 'N' ? 'A' : formField.deduct_when
})
} }
> >
<SelectTrigger> <SelectTrigger>
@ -868,7 +879,27 @@ const EditFeeDialog = () => {
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
{formField.status_include === 'Y' && (
<div className="w-full">
<label className="form-label">
Deduct When <span className="text-red-500">*</span>
</label>
<Select
value={formField.deduct_when}
onValueChange={(value) =>
setFormField({ ...formField, deduct_when: value })
}
>
<SelectTrigger>
<SelectValue placeholder="Select Deduct When" />
</SelectTrigger>
<SelectContent>
<SelectItem value="A">After</SelectItem>
<SelectItem value="B">Before</SelectItem>
</SelectContent>
</Select>
</div>
)}
<div className="flex justify-end pt-2.5 gap-5"> <div className="flex justify-end pt-2.5 gap-5">
<Button variant={'outline'} type="button" onClick={resetForm}> <Button variant={'outline'} type="button" onClick={resetForm}>
Reset Reset

View File

@ -315,6 +315,21 @@ const ManageTransferFeeContextProvider = ({
cellClassName: 'text-center' cellClassName: 'text-center'
} }
}, },
{
accessorFn: (row: { deduct_when: string }) => {
const mapping: Record<string, string> = {
A: 'After',
B: 'Before'
};
return mapping[row.deduct_when] || 'Unknown';
},
id: 'deduct_when',
header: ({ column }) => <DataGridColumnHeader title="Status Deduct" column={column} />,
enableSorting: false,
enableHiding: false,
meta: { headerClassName: 'w-[250px]' }
},
{ {
id: 'actions', id: 'actions',
header: ({ column }) => <DataGridColumnHeader title="Actions" column={column} />, header: ({ column }) => <DataGridColumnHeader title="Actions" column={column} />,