generated from Jbithell/bCMS
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add project list + fix Font awesome * add more content to projects * Fix date Data * Lint to ease merge * Squashed commit of the following: commit f199370 Author: James Bithell <Jbithell@users.noreply.github.com> Date: Sat Dec 18 18:17:06 2021 +0000 Lint Everything (#268) * Lint App * Don't lint on Netifly * Apply requested tsconfig changes commit 8bde02a Author: John Cherry <jac677@york.ac.uk> Date: Sat Dec 18 17:45:29 2021 +0000 Add message when no assets found (#261) * Add message when no assets found * Allow assets to be accessed directly * Fix merge conflict * Remove Import Co-authored-by: James Bithell <Jbithell@users.noreply.github.com> Co-authored-by: Robert Watts <11817698+Robert-Watts@users.noreply.github.com> Co-authored-by: Robert Watts <mail@rlwatts.co.uk> * close #264 Also fixes Linting issues * Add Project Assets view Currently just a list, needs statuses to be added * Add crew list TODO: add popovers when project is updated to Ionic 6 * Update type.d.ts * resolve comments Co-authored-by: James Bithell <Jbithell@users.noreply.github.com>
- Loading branch information
Showing
30 changed files
with
717 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { IonCol, IonGrid, IonItem, IonLabel, IonRow } from "@ionic/react"; | ||
import { MassFormatter, MoneyFormatter } from "../../utilities/Formatters"; | ||
|
||
const AssetItem = (props: any) => { | ||
let additionalInfo; | ||
if (props.item.price) { | ||
additionalInfo = ( | ||
<> | ||
<IonCol size="2"> | ||
<IonLabel>{MassFormatter(props.item.assetTypes_mass)}</IonLabel> | ||
</IonCol> | ||
<IonCol size="2"> | ||
<IonLabel> | ||
{MoneyFormatter(props.item.price.currency, props.item.price.amount)} | ||
</IonLabel> | ||
</IonCol> | ||
<IonCol size="2"> | ||
<IonLabel> | ||
{MoneyFormatter( | ||
props.item.discountPrice.currency, | ||
props.item.discountPrice.amount, | ||
)} | ||
</IonLabel> | ||
</IonCol> | ||
</> | ||
); | ||
} | ||
return ( | ||
<IonItem | ||
routerLink={"/assets/" + props.AssetTypeId + "/" + props.item.assets_id} | ||
> | ||
<IonGrid> | ||
<IonRow> | ||
<IonCol size="3"> | ||
<IonLabel> | ||
<h2>{props.item.assets_tag}</h2> | ||
</IonLabel> | ||
</IonCol> | ||
{additionalInfo} | ||
<IonCol size="3"> | ||
<FontAwesomeIcon | ||
icon="arrow-right" | ||
className="ion-margin-end ion-float-end" | ||
/> | ||
{props.item.flagsblocks["COUNT"]["BLOCK"] > 0 && ( | ||
<FontAwesomeIcon | ||
icon="ban" | ||
color="#dc3545" | ||
className="ion-margin-end ion-float-end" | ||
/> | ||
)} | ||
{props.item.flagsblocks["COUNT"]["FLAG"] > 0 && ( | ||
<FontAwesomeIcon | ||
icon="flag" | ||
color="#ffc107" | ||
className="ion-margin-end ion-float-end" | ||
/> | ||
)} | ||
</IonCol> | ||
</IonRow> | ||
</IonGrid> | ||
</IonItem> | ||
); | ||
}; | ||
|
||
export default AssetItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { createContext, useState } from "react"; | ||
import Api from "../../utilities/Api"; | ||
|
||
// The actual context | ||
export const ProjectContext = createContext<any>(null); | ||
|
||
//Create a provider wrapper to make the interaction with the context easier | ||
const ProjectProvider: React.FC<React.ReactNode> = ({ children }) => { | ||
//Create default state | ||
const [projects, setProjects] = useState<IProject[]>([]); | ||
|
||
/** | ||
* Refresh Context | ||
* Replace all projects in context | ||
*/ | ||
async function refreshProjects() { | ||
setProjects(await Api("projects/list.php")); | ||
} | ||
|
||
// Don't forget to add new functions to the value of the provider! | ||
return ( | ||
<ProjectContext.Provider value={{ projects, refreshProjects }}> | ||
{children} | ||
</ProjectContext.Provider> | ||
); | ||
}; | ||
|
||
export default ProjectProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createContext, useState } from "react"; | ||
import Api from "../../utilities/Api"; | ||
|
||
// The actual context | ||
export const ProjectDataContext = createContext<any>(null); | ||
|
||
//Create a provider wrapper to make the interaction with the context easier | ||
const ProjectDataProvider: React.FC<React.ReactNode> = ({ children }) => { | ||
//Create default state | ||
const [projectData, setProjectData] = useState<IProjectData>({ | ||
project: {}, | ||
files: [], | ||
assetsAssignmentsStatus: [], | ||
FINANCIALS: {}, | ||
}); | ||
|
||
/** | ||
* Refresh Context | ||
* Replace all projects in context | ||
*/ | ||
async function refreshProjectData(id: number) { | ||
setProjectData(await Api("projects/data.php", { id: id })); | ||
} | ||
|
||
// Don't forget to add new functions to the value of the provider! | ||
return ( | ||
<ProjectDataContext.Provider value={{ projectData, refreshProjectData }}> | ||
{children} | ||
</ProjectDataContext.Provider> | ||
); | ||
}; | ||
|
||
export default ProjectDataProvider; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.