|
|
@@ -66,27 +66,28 @@ class Calendar extends Component {
|
|
|
await this.fetchData();
|
|
|
|
|
|
const cek = this.state.dataLaporan.filter((e) => e._number === parseInt(this.props.query.number) && e.pt_id == this.props.query.ptId)[0];
|
|
|
- if (!cek.penjadwalan) {
|
|
|
- this.setState({ externalEvents: [{ id: this.props.query.number, color: "#" + Math.floor(Math.random() * 16777215).toString(16), name: "Jadwal Pemeriksaan - BI:54678" }] });
|
|
|
+ let color = "#" + Math.floor(Math.random() * 16777215).toString(16);
|
|
|
+ if (cek.penjadwalan) {
|
|
|
+ color = cek.penjadwalan.background_color;
|
|
|
}
|
|
|
+ this.setState({ externalEvents: [{ id: this.props.query.number, color: color, name: "Jadwal Pemeriksaan - BI:" + this.props.query.number }] });
|
|
|
}
|
|
|
|
|
|
fetchData = async () => {
|
|
|
const res = await fetch("http://localhost:1880/pelaporan");
|
|
|
const data = await res.json();
|
|
|
this.setState({ dataLaporan: data });
|
|
|
- const dataEvent = this.state.dataLaporan.map((e) => {
|
|
|
- if (!e.penjadwalan) {
|
|
|
- return;
|
|
|
- }
|
|
|
- return {
|
|
|
- title: e.penjadwalan.title,
|
|
|
- start: new Date(e.penjadwalan.from_date),
|
|
|
- end: new Date(e.penjadwalan.to_date),
|
|
|
- backgroundColor: e.penjadwalan.background_color, //red
|
|
|
- borderColor: e.penjadwalan.background_color,
|
|
|
- };
|
|
|
- });
|
|
|
+ const dataEvent = data
|
|
|
+ .filter((e) => e.penjadwalan)
|
|
|
+ .map((e) => {
|
|
|
+ return {
|
|
|
+ title: e.penjadwalan.title,
|
|
|
+ start: new Date(e.penjadwalan.from_date),
|
|
|
+ end: new Date(e.penjadwalan.to_date),
|
|
|
+ backgroundColor: e.penjadwalan.background_color, //red
|
|
|
+ borderColor: e.penjadwalan.background_color,
|
|
|
+ };
|
|
|
+ });
|
|
|
this.setState({
|
|
|
dataEvent: dataEvent,
|
|
|
});
|
|
|
@@ -121,9 +122,9 @@ class Calendar extends Component {
|
|
|
info.event.setProp("borderColor", styles.borderColor);
|
|
|
this.handleEventCalendar(info);
|
|
|
// is the "remove after drop" checkbox checked?
|
|
|
- if (this.state.evRemoveOnDrop) {
|
|
|
- this.removeExternalEvent(info.draggedEl.textContent);
|
|
|
- }
|
|
|
+ // if (this.state.evRemoveOnDrop) {
|
|
|
+ // this.removeExternalEvent(info.draggedEl.textContent);
|
|
|
+ // }
|
|
|
};
|
|
|
|
|
|
getEvColorClasses(evcolor) {
|
|
|
@@ -132,7 +133,7 @@ class Calendar extends Component {
|
|
|
|
|
|
addNewExternalEvent = () => {
|
|
|
const externalEvents = this.state.externalEvents.concat({
|
|
|
- color: this.state.evSelectedColor,
|
|
|
+ color: "#" + Math.floor(Math.random() * 16777215).toString(16),
|
|
|
name: this.state.evNewName,
|
|
|
});
|
|
|
this.setState({
|
|
|
@@ -223,7 +224,7 @@ class Calendar extends Component {
|
|
|
{/* START card */}
|
|
|
<Card className="card-default" title="">
|
|
|
<CardHeader>
|
|
|
- <CardTitle tag="h4">Draggable Events</CardTitle>
|
|
|
+ <CardTitle tag="h4">Daftar Kegiatan</CardTitle>
|
|
|
</CardHeader>
|
|
|
{/* Default external events list */}
|
|
|
<CardBody>
|
|
|
@@ -249,11 +250,11 @@ class Calendar extends Component {
|
|
|
</Card>
|
|
|
{/* END card */}
|
|
|
</div>
|
|
|
- <div className="col-lg-12 col-md-6 col-12">
|
|
|
- {/* START card */}
|
|
|
- {/* <Card className="card-default">
|
|
|
+ {/* <div className="col-lg-12 col-md-6 col-12"> */}
|
|
|
+ {/* START card */}
|
|
|
+ {/* <Card className="card-default">
|
|
|
<CardHeader>
|
|
|
- <CardTitle tag="h4">Create Event</CardTitle>
|
|
|
+ <CardTitle tag="h4">Tambah Kegiatan</CardTitle>
|
|
|
</CardHeader>
|
|
|
<CardBody>
|
|
|
<div className="input-group mb-2">
|
|
|
@@ -263,21 +264,21 @@ class Calendar extends Component {
|
|
|
Add
|
|
|
</button>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <p className="text-muted">
|
|
|
+ </div> */}
|
|
|
+ {/* <p className="text-muted">
|
|
|
<small>Choose a Color</small>
|
|
|
</p>
|
|
|
<ul className="list-inline" id="external-event-color-selector">
|
|
|
{this.evColors.map((evc) => (
|
|
|
<li className="list-inline-item p-0" key={evc}>
|
|
|
- <div className={"circle circle-xl " + this.getEvColorClasses(evc)} onClick={this.selectColor(evc)}></div>
|
|
|
+ <div className="circle circle-xl" onClick={this.selectColor(evc)}></div>
|
|
|
</li>
|
|
|
))}
|
|
|
- </ul>
|
|
|
- </CardBody>
|
|
|
+ </ul> */}
|
|
|
+ {/* </CardBody>
|
|
|
</Card> */}
|
|
|
- {/* END card */}
|
|
|
- </div>
|
|
|
+ {/* END card */}
|
|
|
+ {/* </div> */}
|
|
|
</div>
|
|
|
<div className="mb-3">
|
|
|
{selectedEvent && (
|