Merge branch 'master' of https://git.shiblysolution.id/TPAY/dashboard
This commit is contained in:
@ -40,17 +40,17 @@ const AddDialog = () => {
|
||||
message: ''
|
||||
});
|
||||
const initialState = {
|
||||
products_name: '',
|
||||
products_code: '',
|
||||
products_type: '',
|
||||
products_description: '',
|
||||
products_price_point: 0,
|
||||
products_price_cash: 0,
|
||||
products_cashback_point: 0,
|
||||
products_cashback_cash: 0,
|
||||
products_status: '',
|
||||
products_provider: '',
|
||||
products_process_on_third_party: '',
|
||||
name: '',
|
||||
code: '',
|
||||
type: '',
|
||||
description: '',
|
||||
price_point: 0,
|
||||
price_cash: 0,
|
||||
cashback_point: 0,
|
||||
cashback_cash: 0,
|
||||
status: '',
|
||||
provider: '',
|
||||
process_on_third_party: '',
|
||||
created_by: '',
|
||||
created_at: ''
|
||||
};
|
||||
@ -104,15 +104,15 @@ const AddDialog = () => {
|
||||
e.preventDefault();
|
||||
|
||||
if (
|
||||
formField.products_name.trim() === '' ||
|
||||
formField.products_type.trim() === '' ||
|
||||
formField.products_code.trim() === '' ||
|
||||
formField.products_description.trim() === '' ||
|
||||
formField.products_price_point === 0 ||
|
||||
formField.products_price_cash === 0 ||
|
||||
formField.products_cashback_point === 0 ||
|
||||
formField.products_cashback_cash === 0 ||
|
||||
formField.products_status.trim() === '' ||
|
||||
formField.name.trim() === '' ||
|
||||
formField.type.trim() === '' ||
|
||||
formField.code.trim() === '' ||
|
||||
formField.description.trim() === '' ||
|
||||
formField.price_point === 0 ||
|
||||
formField.price_cash === 0 ||
|
||||
formField.cashback_point === 0 ||
|
||||
formField.cashback_cash === 0 ||
|
||||
formField.status.trim() === '' ||
|
||||
formField.created_by.trim() === '' ||
|
||||
formField.created_at.trim() === ''
|
||||
) {
|
||||
@ -172,9 +172,9 @@ const AddDialog = () => {
|
||||
<Input
|
||||
className="input"
|
||||
type="text"
|
||||
value={formField.products_name}
|
||||
value={formField.name}
|
||||
onChange={(e) =>
|
||||
setFormField({ ...formField, products_name: e.target.value })
|
||||
setFormField({ ...formField, name: e.target.value })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
@ -188,9 +188,9 @@ const AddDialog = () => {
|
||||
<Input
|
||||
className="input"
|
||||
type="text"
|
||||
value={formField.products_type}
|
||||
value={formField.type}
|
||||
onChange={(e) =>
|
||||
setFormField({ ...formField, products_type: e.target.value })
|
||||
setFormField({ ...formField, type: e.target.value })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
@ -204,9 +204,9 @@ const AddDialog = () => {
|
||||
<Input
|
||||
className="input"
|
||||
type="text"
|
||||
value={formField.products_code}
|
||||
value={formField.code}
|
||||
onChange={(e) =>
|
||||
setFormField({ ...formField, products_code: e.target.value })
|
||||
setFormField({ ...formField, code: e.target.value })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
@ -220,9 +220,9 @@ const AddDialog = () => {
|
||||
<Input
|
||||
className="input"
|
||||
type="text"
|
||||
value={formField.products_description}
|
||||
value={formField.description}
|
||||
onChange={(e) =>
|
||||
setFormField({ ...formField, products_description: e.target.value })
|
||||
setFormField({ ...formField, description: e.target.value })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
@ -238,12 +238,12 @@ const AddDialog = () => {
|
||||
type="number"
|
||||
min={0}
|
||||
step={0.01}
|
||||
value={formField.products_price_point}
|
||||
value={formField.price_point}
|
||||
onChange={(e) => {
|
||||
const value = parseFloat(e.target.value);
|
||||
setFormField({
|
||||
...formField,
|
||||
products_price_point: isNaN(value) ? 0 : value
|
||||
price_point: isNaN(value) ? 0 : value
|
||||
});
|
||||
}}
|
||||
/>
|
||||
@ -260,12 +260,12 @@ const AddDialog = () => {
|
||||
type="number"
|
||||
min={0}
|
||||
step={0.01}
|
||||
value={formField.products_price_cash}
|
||||
value={formField.price_cash}
|
||||
onChange={(e) => {
|
||||
const value = parseFloat(e.target.value);
|
||||
setFormField({
|
||||
...formField,
|
||||
products_price_cash: isNaN(value) ? 0 : value
|
||||
price_cash: isNaN(value) ? 0 : value
|
||||
});
|
||||
}}
|
||||
/>
|
||||
@ -282,12 +282,12 @@ const AddDialog = () => {
|
||||
type="number"
|
||||
min={0}
|
||||
step={0.01}
|
||||
value={formField.products_cashback_point}
|
||||
value={formField.cashback_point}
|
||||
onChange={(e) => {
|
||||
const value = parseFloat(e.target.value);
|
||||
setFormField({
|
||||
...formField,
|
||||
products_cashback_point: isNaN(value) ? 0 : value
|
||||
cashback_point: isNaN(value) ? 0 : value
|
||||
});
|
||||
}}
|
||||
/>
|
||||
@ -304,12 +304,12 @@ const AddDialog = () => {
|
||||
type="number"
|
||||
min={0}
|
||||
step={0.01}
|
||||
value={formField.products_cashback_cash}
|
||||
value={formField.cashback_cash}
|
||||
onChange={(e) => {
|
||||
const value = parseFloat(e.target.value);
|
||||
setFormField({
|
||||
...formField,
|
||||
products_cashback_cash: isNaN(value) ? 0 : value
|
||||
cashback_cash: isNaN(value) ? 0 : value
|
||||
});
|
||||
}}
|
||||
/>
|
||||
@ -322,9 +322,9 @@ const AddDialog = () => {
|
||||
Status<span className="text-red-500">*</span>
|
||||
</label>
|
||||
<Select
|
||||
value={formField.products_status}
|
||||
value={formField.status}
|
||||
onValueChange={(value) =>
|
||||
setFormField({ ...formField, products_status: value })
|
||||
setFormField({ ...formField, status: value })
|
||||
}
|
||||
>
|
||||
<SelectTrigger>
|
||||
@ -344,9 +344,9 @@ const AddDialog = () => {
|
||||
Provider ID
|
||||
</label>
|
||||
<Select
|
||||
value={formField.products_provider}
|
||||
value={formField.provider}
|
||||
onValueChange={(value) =>
|
||||
setFormField({ ...formField, products_provider: value.toString() })
|
||||
setFormField({ ...formField, provider: value.toString() })
|
||||
}
|
||||
>
|
||||
<SelectTrigger>
|
||||
@ -372,9 +372,9 @@ const AddDialog = () => {
|
||||
Process on Third Party<span className="text-red-500">*</span>
|
||||
</label>
|
||||
<Select
|
||||
value={formField.products_process_on_third_party}
|
||||
value={formField.process_on_third_party}
|
||||
onValueChange={(value) =>
|
||||
setFormField({ ...formField, products_process_on_third_party: value })
|
||||
setFormField({ ...formField, process_on_third_party: value })
|
||||
}
|
||||
>
|
||||
<SelectTrigger>
|
||||
|
||||
@ -152,7 +152,7 @@ const ManageProductsContextProvider = ({ children }: { children: React.ReactNode
|
||||
const response = await GetData(`${API_URL}/product/list`, {
|
||||
limit,
|
||||
page: page + 1,
|
||||
with_deleted: true,
|
||||
with_deleted: false,
|
||||
order_field: sorting[0].id,
|
||||
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC',
|
||||
filter: JSON.stringify(filter)
|
||||
|
||||
@ -64,8 +64,8 @@ const AddDialog = () => {
|
||||
description: '',
|
||||
type: '',
|
||||
status: '',
|
||||
transactionTypeId: '',
|
||||
agentId: '',
|
||||
transaction_type: '',
|
||||
agent: '',
|
||||
created_by: '',
|
||||
created_at: ''
|
||||
};
|
||||
@ -104,15 +104,15 @@ const AddDialog = () => {
|
||||
formField.description.trim() === '' ||
|
||||
formField.type.trim() === '' ||
|
||||
formField.status.trim() === '' ||
|
||||
formField.transactionTypeId.trim() === '' ||
|
||||
formField.agentId.trim() === ''
|
||||
formField.transaction_type === '' ||
|
||||
formField.agent.trim() === ''
|
||||
) {
|
||||
setAlert({ show: true, message: 'Please fill in all required fields.' });
|
||||
return;
|
||||
}
|
||||
|
||||
doCreateProvider(e);
|
||||
// console.log(formField);
|
||||
console.log(formField);
|
||||
setAlert({ show: false, message: '' });
|
||||
};
|
||||
|
||||
@ -263,9 +263,9 @@ const AddDialog = () => {
|
||||
Transaction Type Id<span className="text-red-500">*</span>
|
||||
</label>
|
||||
<Select
|
||||
value={formField.transactionTypeId}
|
||||
value={formField.transaction_type}
|
||||
onValueChange={(value) =>
|
||||
setFormField({ ...formField, transactionTypeId: value })
|
||||
setFormField({ ...formField, transaction_type: value })
|
||||
}
|
||||
>
|
||||
<SelectTrigger>
|
||||
@ -290,7 +290,7 @@ const AddDialog = () => {
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<button type="button" className="input col-span-5 text-left">
|
||||
{customers.find((customer) => customer.msisdn === formField.agentId)
|
||||
{customers.find((customer) => customer.msisdn === formField.agent)
|
||||
?.fullname || 'Select Agent'}
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
@ -307,7 +307,7 @@ const AddDialog = () => {
|
||||
onSelect={() => {
|
||||
setFormField({
|
||||
...formField,
|
||||
agentId: customer.msisdn
|
||||
agent: customer.msisdn
|
||||
});
|
||||
setOpen(false);
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user