add the ticket patch method
parent
0a9d085e10
commit
8db72dd9b2
|
@ -75,6 +75,9 @@ const TicketAggent = ({ setRedirect, setRedirectUrl, t }) => {
|
|||
const [ticketFields, setTicketFields] = useState({});
|
||||
const [ticketTransitionField, setTicketTransitionField] = useState('');
|
||||
|
||||
// ticket id
|
||||
const [ticketId, setTicketId] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
let isResponseOK = false;
|
||||
// Get Ticket Type
|
||||
|
@ -160,6 +163,7 @@ const TicketAggent = ({ setRedirect, setRedirectUrl, t }) => {
|
|||
|
||||
let viewTicket = (id, e) => {
|
||||
console.log('View Ticket Status', id);
|
||||
setTicketId(id);
|
||||
// Get Ticket Status
|
||||
let isResponseOK = false;
|
||||
fetch(APIBaseURL + '/ticket/status/' + id, {
|
||||
|
@ -365,7 +369,40 @@ const TicketAggent = ({ setRedirect, setRedirectUrl, t }) => {
|
|||
};
|
||||
|
||||
let submitApplication = target => {
|
||||
console.log('submitApplication', target);
|
||||
hiddenModal();
|
||||
// Patch the agent ticket
|
||||
let isResponseOK = false;
|
||||
fetch(APIBaseURL + '/ticket/agent/' + ticketId, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: '123',
|
||||
repair_reason: '123',
|
||||
tl_agree_text: '223',
|
||||
transition_id: ticketTransitionField.value[0].transition_id
|
||||
})
|
||||
})
|
||||
.then(response => {
|
||||
console.log(response);
|
||||
if (response.ok) {
|
||||
isResponseOK = true;
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(json => {
|
||||
if (isResponseOK) {
|
||||
console.log('submitApplication /ticket/agent ---', json);
|
||||
hiddenModal(true);
|
||||
} else {
|
||||
toast.error(json.description);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
let confirmButton = () => {
|
||||
message.info('Clicked on Yes.');
|
||||
|
@ -393,9 +430,11 @@ Hello world
|
|||
useEffect(() => {
|
||||
console.log('ticketFields', ticketFields);
|
||||
}, [ticketFields]);
|
||||
const onFinish = (values) => {
|
||||
console.log('Success:', values);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log('ticketId', ticketId);
|
||||
}, [ticketId]);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<div>
|
||||
|
@ -482,8 +521,7 @@ Hello world
|
|||
)}
|
||||
</Panel>
|
||||
<Panel header={t('Ticket Fields')} key="4">
|
||||
<Form
|
||||
onFinish={onFinish}>
|
||||
<Form>
|
||||
{ticketFields &&
|
||||
ticketFields.value &&
|
||||
ticketFields.value.field_list &&
|
||||
|
@ -494,7 +532,10 @@ Hello world
|
|||
|
||||
return (
|
||||
<Form.Item key={index} label={item.field_name} name={item.field_name}>
|
||||
<Input defaultValue={item.field_value} disabled={item.field_attribute==1?true:false}/>
|
||||
<Input
|
||||
defaultValue={item.field_value}
|
||||
disabled={item.field_attribute == 1 ? true : false}
|
||||
/>
|
||||
</Form.Item>
|
||||
);
|
||||
|
||||
|
@ -503,7 +544,10 @@ Hello world
|
|||
|
||||
return (
|
||||
<Form.Item key={index} label={item.field_name} name={item.field_name}>
|
||||
<TextArea defaultValue={item.field_value} disabled={item.field_attribute==1?true:false}/>
|
||||
<TextArea
|
||||
defaultValue={item.field_value}
|
||||
disabled={item.field_attribute == 1 ? true : false}
|
||||
/>
|
||||
</Form.Item>
|
||||
// <InputGroup key={index}>
|
||||
// <InputGroupText>{item.field_name}</InputGroupText>
|
||||
|
|
Loading…
Reference in New Issue