Skip to content

Commit

Permalink
feat(layout): Add ticket creation details to header
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc committed Oct 8, 2024
1 parent 2753a89 commit 51ce469
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ function App() {
loader = {detailsLoader}
/>

<Route path="/:module/:common_model/:model/:pk/:action"
element={<ModelForm
setContentHeading={setContentHeading}
/>}
errorElement={<ErrorPage /> }
loader = {detailsLoader}
/>

<Route path="/:module/:model"
element={<List
setContentHeading={setContentHeading}
Expand Down
5 changes: 5 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,15 @@ div.ticket .contents {
width: 100%;
}

.ticket h3.description span.sub-script,
.ticket .comment h4.comment #text span.sub-script {
font-size: smaller;
}

.ticket h3.description span.sub-script {
color: #777;
}

.ticket .comment h4.comment #icons {
border: none;
display: inline-flexbox;
Expand Down
5 changes: 4 additions & 1 deletion src/layout/ModelForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ const ModelForm = ({

url = '/' + params.module + '/' + params.common_model + '/' + params.common_pk + '/' + params.model

}else if ( params.common_model && params.pk ) {

url = url = '/' + params.module + '/' + params.common_model + '/' + params.model + '/' + params.pk
}

if( params.common_pk && params.pk && params.action === 'edit') {

url = '/' + params.module + '/' + params.common_model + '/' + params.common_pk + '/' + params.model + '/' + params.pk
Expand Down
38 changes: 31 additions & 7 deletions src/layout/Ticket.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { useEffect, useState } from "react";
import { useLoaderData, useParams } from "react-router-dom";
import { Link, useLoaderData, useParams } from "react-router-dom";
import FieldData from "../functions/FieldData";

import TicketStatusIcon from "../components/icons/ticket/TicketStatusIcon";
import Badge from "../components/Badge";
import { ResponseException } from "../classes/Exceptions";
import TicketComments from "../components/page/ticket/Comments";
import { apiFetch } from "../hooks/apiFetch";
import TicketCommentForm from "../components/page/ticket/Comment";



const Ticket = ({
setContentHeading = null
}) => {
Expand Down Expand Up @@ -89,12 +85,40 @@ const Ticket = ({
return (
metadata !== null && <div className="ticket">


<div className="contents">

<section className="description">
<h3 className={"description ticket-type-" + ticket_type}>ticket data </h3>
<h3 className={"description ticket-type-" + ticket_type}>
<span class="sub-script">opened by&nbsp;</span>
<FieldData
metadata={metadata}
field_name='opened_by'
data={page_data}
/>&nbsp;
<span class="sub-script">on&nbsp;</span>
<FieldData
metadata={metadata}
field_name='created'
data={page_data}
/>&nbsp;
<span class="sub-script">Updated&nbsp;</span>
<FieldData
metadata={metadata}
field_name='modified'
data={page_data}
/>
</h3>
<div className="markdown">
{/* <Button
button_text = 'Edit'
button_align = 'right'
type='button'
buttonClickCallback = {() => {
console.log('button clicked')
}}
/> */}
<Link to="edit"><button className="common-field form">Edit</button></Link>
<FieldData
metadata={metadata}
field_name='description'
Expand Down

0 comments on commit 51ce469

Please sign in to comment.