Commit 97e21d7f authored by Thushara Thiwanka's avatar Thushara Thiwanka

CREATE: assignment create integrated

parent 2b8ad4c1
No preview for this file type
class WarehouseOperator:
def create_orders_by_uploading_a_csv_file(self):
pass
def make_adjustments_to_the_order(self):
pass
def allocate_a_vehicle_for_a_job(self):
pass
def change_the_system_suggested_optimized_route_if_required(self):
pass
def confirm_a_job(self):
pass
def change_the_vehicle_allocated_for_a_job(self):
pass
def export_information_of_a_job_to_pdf_and_xls_format(self):
pass
def indicate_that_the_loading_is_completed(self):
pass
def generate_an_invoice_for_each_vehicle(self):
pass
def generate_vehicle_capacity_utilization_report(self):
pass
def generate_outlet_wise_transport_cost_report_for_a_given_date_range(self):
pass
def generate_vehicle_turnaround_time_report_for_a_warehouse(self):
pass
def generate_cost_per_1_kg_report(self):
pass
def generate_an_idle_time_limit_violation_report(self):
pass
class WarehouseIncharge:
def confirm_the_delivered_items_to_a_outlet(self):
pass
def approve_a_job(self):
pass
def request_a_modification_to_the_planned_mileage_of_a_job(self):
pass
class Admin:
def approve_the_planned_mileage_modification_request_submitted_by_the_WarehouseIncharge(self):
pass
def modify_the_minimum_fix_mileage_configuration_for_a_job(self):
pass
def modify_the_unloading_charge(self):
pass
def update_the_radius_limit_from_a_warehouse_for___drop_off___charges(self):
pass
def set_up_the___drop_off___rate_table_based_on_number_of_outlets_visited(self):
pass
def modify_the___drop_off___rate_table(self):
pass
def edit_the_eligibility_criteria_for_driver_incentive(self):
pass
def edit_the_per_km_rate_for_an_existing_vehicle_capacity_type(self):
pass
digraph "classes_okovnrmokc" {
rankdir=BT
charset="utf-8"
"okovnrmokc.Admin" [color="black", fontcolor="black", label="{Admin|\l|approve_the_planned_mileage_modification_request_submitted_by_the_WarehouseIncharge()\ledit_the_eligibility_criteria_for_driver_incentive()\ledit_the_per_km_rate_for_an_existing_vehicle_capacity_type()\lmodify_the___drop_off___rate_table()\lmodify_the_minimum_fix_mileage_configuration_for_a_job()\lmodify_the_unloading_charge()\lset_up_the___drop_off___rate_table_based_on_number_of_outlets_visited()\lupdate_the_radius_limit_from_a_warehouse_for___drop_off___charges()\l}", shape="record", style="solid"];
"okovnrmokc.WarehouseIncharge" [color="black", fontcolor="black", label="{WarehouseIncharge|\l|approve_a_job()\lconfirm_the_delivered_items_to_a_outlet()\lrequest_a_modification_to_the_planned_mileage_of_a_job()\l}", shape="record", style="solid"];
"okovnrmokc.WarehouseOperator" [color="black", fontcolor="black", label="{WarehouseOperator|\l|allocate_a_vehicle_for_a_job()\lchange_the_system_suggested_optimized_route_if_required()\lchange_the_vehicle_allocated_for_a_job()\lconfirm_a_job()\lcreate_orders_by_uploading_a_csv_file()\lexport_information_of_a_job_to_pdf_and_xls_format()\lgenerate_an_idle_time_limit_violation_report()\lgenerate_an_invoice_for_each_vehicle()\lgenerate_cost_per_1_kg_report()\lgenerate_outlet_wise_transport_cost_report_for_a_given_date_range()\lgenerate_vehicle_capacity_utilization_report()\lgenerate_vehicle_turnaround_time_report_for_a_warehouse()\lindicate_that_the_loading_is_completed()\lmake_adjustments_to_the_order()\l}", shape="record", style="solid"];
}
digraph G {
rankdir=LR;
labelloc="b";
peripheries=0;
node [shape=plaintext]
subgraph WarehouseOperator {label="WarehouseOperator"; warehouseoperator};
warehouseoperator [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
subgraph WarehouseIncharge {label="WarehouseIncharge"; warehouseincharge};
warehouseincharge [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
subgraph Admin {label="Admin"; admin};
admin [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
node [shape=ellipse, style=solid];
sign_up_to_the_system [label="Sign Up To The System"];
sign_in_to_the_system [label="Sign In To The System"];
create_orders_by_uploading_a_csv_file [label="Create Orders By Uploading A Csv File"];
make_adjustments_to_the_order [label="Make Adjustments To The Order"];
allocate_a_vehicle_for_a_job [label="Allocate A Vehicle For A Job"];
change_the_system_suggested_optimized_route_if_required [label="Change The System Suggested Optimized Route If Required"];
confirm_a_job [label="Confirm A Job"];
change_the_vehicle_allocated_for_a_job [label="Change The Vehicle Allocated For A Job"];
export_information_of_a_job_to_pdf_and_xls_format [label="Export Information Of A Job To Pdf And Xls Format"];
indicate_that_the_loading_is_completed [label="Indicate That The Loading Is Completed"];
confirm_the_delivered_items_to_a_outlet [label="Confirm The Delivered Items To A Outlet"];
approve_a_job [label="Approve A Job"];
request_a_modification_to_the_planned_mileage_of_a_job [label="Request A Modification To The Planned Mileage Of A Job"];
approve_the_planned_mileage_modification_request_submitted_by_the_warehouseincharge [label="Approve The Planned Mileage Modification Request Submitted By The Warehouseincharge"];
generate_an_invoice_for_each_vehicle [label="Generate An Invoice For Each Vehicle"];
modify_the_minimum_fix_mileage_configuration_for_a_job [label="Modify The Minimum Fix Mileage Configuration For A Job"];
modify_the_unloading_charge [label="Modify The Unloading Charge"];
update_the_radius_limit_from_a_warehouse_for___drop_off___charges [label="Update The Radius Limit From A Warehouse For Drop Off Charges"];
set_up_the___drop_off___rate_table_based_on_number_of_outlets_visited [label="Set Up The Drop Off Rate Table Based On Number Of Outlets Visited"];
modify_the___drop_off___rate_table [label="Modify The Drop Off Rate Table"];
edit_the_eligibility_criteria_for_driver_incentive [label="Edit The Eligibility Criteria For Driver Incentive"];
edit_the_per_km_rate_for_an_existing_vehicle_capacity_type [label="Edit The Per Km Rate For An Existing Vehicle Capacity Type"];
generate_vehicle_capacity_utilization_report [label="Generate Vehicle Capacity Utilization Report"];
generate_outlet_wise_transport_cost_report_for_a_given_date_range [label="Generate Outlet Wise Transport Cost Report For A Given Date Range"];
generate_vehicle_turnaround_time_report_for_a_warehouse [label="Generate Vehicle Turnaround Time Report For A Warehouse"];
generate_cost_per_1_kg_report [label="Generate Cost Per 1 Kg Report"];
generate_an_idle_time_limit_violation_report [label="Generate An Idle Time Limit Violation Report"];
edge [arrowhead="none"];
user->sign_up_to_the_system;
user->sign_in_to_the_system;
warehouseoperator->create_orders_by_uploading_a_csv_file;
warehouseoperator->make_adjustments_to_the_order;
warehouseoperator->allocate_a_vehicle_for_a_job;
warehouseoperator->change_the_system_suggested_optimized_route_if_required;
warehouseoperator->confirm_a_job;
warehouseoperator->change_the_vehicle_allocated_for_a_job;
warehouseoperator->export_information_of_a_job_to_pdf_and_xls_format;
warehouseoperator->indicate_that_the_loading_is_completed;
warehouseincharge->confirm_the_delivered_items_to_a_outlet;
warehouseincharge->approve_a_job;
warehouseincharge->request_a_modification_to_the_planned_mileage_of_a_job;
admin->approve_the_planned_mileage_modification_request_submitted_by_the_warehouseincharge;
warehouseoperator->generate_an_invoice_for_each_vehicle;
admin->modify_the_minimum_fix_mileage_configuration_for_a_job;
admin->modify_the_unloading_charge;
admin->update_the_radius_limit_from_a_warehouse_for___drop_off___charges;
admin->set_up_the___drop_off___rate_table_based_on_number_of_outlets_visited;
admin->modify_the___drop_off___rate_table;
admin->edit_the_eligibility_criteria_for_driver_incentive;
admin->edit_the_per_km_rate_for_an_existing_vehicle_capacity_type;
warehouseoperator->generate_vehicle_capacity_utilization_report;
warehouseoperator->generate_outlet_wise_transport_cost_report_for_a_given_date_range;
warehouseoperator->generate_vehicle_turnaround_time_report_for_a_warehouse;
warehouseoperator->generate_cost_per_1_kg_report;
warehouseoperator->generate_an_idle_time_limit_violation_report;
edge [arrowtail="vee", label="<<extend>>", style=dashed];
create_orders_by_uploading_a_csv_file->make_adjustments_to_the_order;
confirm_a_job->change_the_vehicle_allocated_for_a_job_change_the_system_suggested_optimized_route_if_required;
edge [arrowtail="vee", label="<<include>>", style=dashed];
confirm_a_job->allocate_a_vehicle_for_a_job;
approve_a_job->confirm_the_delivered_items_to_a_outlet;
request_a_modification_to_the_planned_mileage_of_a_job->approve_the_planned_mileage_modification_request_submitted_by_the_warehouseincharge;
}
\ No newline at end of file
......@@ -8,7 +8,6 @@ import Sidebar from "../components/sidebar/Sidebar";
import Spinner from "../components/loading/Spinner";
import Table from "../components/table/Table";
import TopNav from "../components/topnav/TopNav";
import Badge from "../components/badge/Badge";
import "../assets/css/Usercreate.css";
......@@ -18,10 +17,13 @@ const ManageAssignments = () => {
const [isLoading, setIsLoading] = useState(true);
const [assignment, setAssignment] = useState({
content: "",
plagiarism_percentage: 0,
plagiarism_percentage: "",
module_id: "",
start_at: "",
end_at: "",
});
const [assignments, setAssignments] = useState([]);
const [modules, setModules] = useState([]);
const fields = ["", "ID", "Module Code", "Name", "Start At", "End At", "Actions"];
......@@ -62,6 +64,8 @@ const ManageAssignments = () => {
e.preventDefault();
setBtnState(true);
console.log(assignment);
for (let key of Object.keys(assignment)) {
if (!assignment[key]) {
setBtnState(false);
......@@ -70,10 +74,14 @@ const ManageAssignments = () => {
}
try {
const res = await axios.post("assignments", assignment);
const res = await axios.post("assignments/create", assignment);
console.log(res);
setAssignment({
scenario: "",
content: "",
plagiarism_percentage: "",
module_id: "",
start_at: "",
end_at: "",
});
getAllAssignments();
setError("");
......@@ -82,6 +90,7 @@ const ManageAssignments = () => {
setIsLoading(true);
} catch (err) {
setBtnState(false);
setError("Something went wrong");
console.log(err.response);
}
};
......@@ -101,6 +110,18 @@ const ManageAssignments = () => {
}
};
const getAllModules = async () => {
setIsLoading(true);
try {
const res = await axios.get("modules");
console.log(res);
setModules(res.data.modules);
setIsLoading(false);
} catch (err) {
console.log(err.response);
}
};
const getAllAssignments = async () => {
try {
const res = await axios.get(`assignments`);
......@@ -112,6 +133,7 @@ const ManageAssignments = () => {
};
useEffect(() => getAllAssignments(), []);
useEffect(() => getAllModules(), []);
return (
<div>
......@@ -124,7 +146,7 @@ const ManageAssignments = () => {
<div className="col-12">
<form className="card" style={{ position: "relative" }}>
{error && (
<div className="error-bg" style={{ left: "3%" }}>
<div className="error-bg" style={{ left: "2%", top: "2%" }}>
<p>{error}</p>
</div>
)}
......@@ -134,11 +156,11 @@ const ManageAssignments = () => {
<textarea
type="text"
placeholder="PASTE QUESTION SCENARIO HERE..."
value={assignment.code}
value={assignment.content}
onChange={e =>
setAssignment({
...assignment,
code: e.target.value,
content: e.target.value,
})
}
required
......@@ -149,12 +171,27 @@ const ManageAssignments = () => {
<div className="row">
<div className="col-4">
<div className="row-user">
<select name="position" id="position" required>
<option value="position" defaultValue>
<select
name="position"
id="position"
required
onChange={e => {
console.log(e.target.value);
setAssignment({
...assignment,
module_id: e.target.value,
});
}}
>
<option value="position" disabled selected>
PLEASE SELECT MODULE
</option>
<option value="class">Module A</option>
<option value="class">Module B</option>
{modules.map(item => (
<option
value={item.id}
key={item.id}
>{`${item.code} - ${item.name}`}</option>
))}
</select>
</div>
</div>
......@@ -164,17 +201,54 @@ const ManageAssignments = () => {
<input
type="text"
placeholder="Accepted Plagiarism Percentage"
value={assignment.name}
value={assignment.plagiarism_percentage}
onChange={e =>
setAssignment({
...assignment,
name: e.target.value,
plagiarism_percentage: e.target.value,
})
}
required
/>
</div>
</div>
<div className="col-4">
<div className="row-user">
<input
type="datetime-local"
step={1}
placeholder="Starts At"
onFocus={"(this.type='datetime-local')"}
value={assignment.start_at}
onChange={e => {
let date = e.target.value.replace("T", " ");
setAssignment({
...assignment,
start_at: date,
});
}}
required
/>
</div>
</div>
<div className="col-4">
<div className="row-user">
<input
type="datetime-local"
step={1}
placeholder="Ends At"
value={assignment.end_at}
onChange={e => {
let date = e.target.value.replace("T", " ");
setAssignment({
...assignment,
end_at: date,
});
}}
required
/>
</div>
</div>
</div>
<div className="row-user">
<button type="submit" onClick={saveAssignment}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment