Commit 08af1bd4 authored by Jayasith H.B.C's avatar Jayasith H.B.C

Merge remote-tracking branch 'origin/IT19079264' into IT19079264

parents 0241ae04 b14ff7a2
......@@ -12,7 +12,6 @@ import services.question_preprocess_service
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
UPLOADS_FOLDER_PATH = os.path.join(APP_ROOT, 'uploads')
OUTPUTS_GENERATED_DOT_FILES_PATH = os.path.join('outputs', 'generated_dot_files')
OUTPUTS_GENERATED_USE_CASE_DIAGRAMS_PATH = os.path.join('outputs', 'generated_use_case_diagrams')
OUTPUTS_GENERATED_CLASS_DIAGRAMS_PATH = os.path.join('outputs', 'generated_class_diagrams')
......@@ -46,22 +45,20 @@ def index():
return 'UML Diagram Plagiarism Detection Tool API'
@app.route('/api/v1/process-uml-diagrams-inputs', methods=['POST'])
@app.route('/api/v1/diagrams/generate', methods=['POST'])
def process_uml_diagrams():
try:
if request.method == 'POST':
if request.files['scenarioFile']:
file = request.files['scenarioFile']
file.save(os.path.join(app.config['UML_GENERATOR_UPLOAD_FOLDER'], secure_filename(file.filename)))
# generated_class_diagram_path, generated_usecase_diagram_path = services.question_preprocess_service.main(
# file.filename)
# return jsonify(generated_class_diagram_path=generated_class_diagram_path,
# generated_usecase_diagram_path=generated_usecase_diagram_path), HTTP_200_OK
generated_usecase_diagram_path = services.question_preprocess_service.main(
file.filename)
return jsonify(generated_usecase_diagram_path=generated_usecase_diagram_path), HTTP_200_OK
return jsonify('Please attach a scenario file'), HTTP_400_BAD_REQUEST
data = request.get_json(silent=True)
if data is None:
return jsonify('Please attach a scenario file'), HTTP_400_BAD_REQUEST
generated_class_diagram_path, generated_usecase_diagram_path = services.question_preprocess_service.main(
data['scenario'])
return jsonify(generated_class_diagram_path=generated_class_diagram_path,
generated_usecase_diagram_path=generated_usecase_diagram_path), HTTP_200_OK
except Exception or BadRequestKeyError:
if BadRequestKeyError:
return jsonify('Please attach a scenario file'), HTTP_400_BAD_REQUEST
......
class Admin:
def login_to_the_system(self):
pass
def view_and_manage_cart_items(self):
pass
def check_the_payments_and_sold_items(self):
pass
def reply_to_Customer_feedbacks(self):
pass
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_qxjyzaydlr" {
rankdir=BT
charset="utf-8"
"qxjyzaydlr.Admin" [color="black", fontcolor="black", label="{Admin|\l|check_the_payments_and_sold_items()\llogin_to_the_system()\lreply_to_Customer_feedbacks()\lview_and_manage_cart_items()\l}", shape="record", style="solid"];
}
digraph "classes_xgxiplwygn" {
rankdir=BT
charset="utf-8"
"xgxiplwygn.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"];
"xgxiplwygn.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"];
"xgxiplwygn.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 Admin {label="Admin"; admin};
admin [image="D:\SLIIT\Year 4\Research Project\2022-158\backend/stick.png";peripheries=0;];
node [shape=ellipse, style=solid];
login_to_the_system [label="Login To The System"];
check_the_home_page [label="Check The Home Page"];
play_the_site_demo_video [label="Play The Site Demo Video"];
add_items_to_the_cart [label="Add Items To The Cart"];
pay_the_items [label="Pay The Items"];
give_a_feedback_for_the_system [label="Give A Feedback For The System"];
view_the_seller_details [label="View The Seller Details"];
contact_the_seller_to_request_more_items [label="Contact The Seller To Request More Items"];
login_to_the_system [label="Login To The System"];
view_and_manage_cart_items [label="View And Manage Cart Items"];
check_the_payments_and_sold_items [label="Check The Payments And Sold Items"];
reply_to_customer_feedbacks [label="Reply To Customer Feedbacks"];
edge [arrowhead="none"];
customer->login_to_the_system;
customer->check_the_home_page;
customer->play_the_site_demo_video;
customer->add_items_to_the_cart;
customer->pay_the_items;
customer->give_a_feedback_for_the_system;
customer->view_the_seller_details;
customer->contact_the_seller_to_request_more_items;
admin->login_to_the_system;
admin->view_and_manage_cart_items;
admin->check_the_payments_and_sold_items;
admin->reply_to_customer_feedbacks;
edge [arrowtail="vee", label="<<extend>>", style=dashed];
give_a_feedback_for_the_system->rate_the_service;
edge [arrowtail="vee", label="<<include>>", style=dashed];
pay_the_items->recieve_the_confirmation_email;
}
\ No newline at end of file
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
import random
import string
import subprocess
import shutil
import os
from app import OUTPUTS_GENERATED_DOT_FILES_PATH, OUTPUTS_GENERATED_CLASS_DIAGRAMS_PATH, \
OUTPUTS_GENERATED_CLASS_FILES_PATH, APP_ROOT
def generate_random_string():
letters = string.ascii_lowercase
random_string = ''.join(random.choice(letters) for i in range(10))
return random_string
def remove_duplicate_class_names(data):
return list(dict.fromkeys(data))
def generate_class_string_array(actors, data):
class_content = []
for actor in actors:
single_class = []
for d in data:
if d[0] == actor:
class_name_string = "class " + actor + ": \n\t\n"
class_methods_string = "\t def " + d[1] + "(self): \n\t\t pass \n\n"
single_class.extend((class_name_string, class_methods_string))
cleaned_class = remove_duplicate_class_names(single_class)
class_content.append(cleaned_class)
return class_content
def create_class_methods(data):
cleaned_data = []
for element in data:
cleaned_array = []
class_name = element[0].strip()
method_name = element[1].replace(" ", "_")
cleaned_array.extend((class_name, method_name))
cleaned_data.append(cleaned_array)
return cleaned_data
def generate_diagram(filename):
try:
subprocess.run(["pyreverse", "-S", "-o", "dot", "-p", filename, OUTPUTS_GENERATED_CLASS_FILES_PATH+"/"+filename+".py"])
shutil.move("classes_" + filename + ".dot", OUTPUTS_GENERATED_DOT_FILES_PATH)
subprocess.run(["dot", "-Tpng", OUTPUTS_GENERATED_DOT_FILES_PATH+"/classes_"+filename+".dot", "-o", OUTPUTS_GENERATED_CLASS_DIAGRAMS_PATH+"/"+filename+".png"])
except Exception:
print(Exception)
# generate python file for the class
def generate_class(actors, data):
res = create_class_methods(data)
class_string_arr = generate_class_string_array(actors, res)
python_class_file_name = generate_random_string()
class_file = open(OUTPUTS_GENERATED_CLASS_FILES_PATH + "/" + python_class_file_name + ".py", "x")
for single_class_string in class_string_arr:
for single_string in single_class_string:
class_file.write(single_string)
class_file.write("\n\n")
class_file.close()
generate_diagram(python_class_file_name)
return '/generated_class_diagrams/' + python_class_file_name + '.png'
import spacy
import os
from services.tokenization_service import *
# from services.class_diagram_generation_service import *
from services.class_diagram_generation_service import *
from services.use_case_diagram_generation_service import *
from app import UPLOADS_FOLDER_PATH
def remove_unwanted_values(data):
......@@ -26,15 +23,15 @@ def remove_punctuation(sentence):
# load the text file
def main(filepath):
with open(UPLOADS_FOLDER_PATH + "/" + filepath, "r", errors='ignore') as f:
requirement_text = f.read().replace("\n\n", " ").replace("\n", " ")
def main(scenario):
requirement_text = scenario.replace("\n\n", " ").replace("\n", " ")
nlp = spacy.load("en_core_web_lg")
doc = nlp(requirement_text)
# sentence splitting
sentences = list(doc.sents)
sentences.pop(0)
del sentences[-1]
nc = []
cleaned_extracted_actions = []
cleaned_sentences = []
......@@ -52,19 +49,17 @@ def main(filepath):
extracted_actions = get_actions(splitted_actions)
if extracted_actions is not None:
cleaned_extracted_actions.append(extracted_actions)
# remove duplicates of the actors
nc = list(dict.fromkeys(nc))
data = remove_unwanted_values(nc)
# generated_class_diagram_path = generate_class(data, cleaned_extracted_actions)
generated_class_diagram_path = generate_class(data, cleaned_extracted_actions)
extracted_relationships = get_include_extend_relationships(splitted_actions_array)
actors_and_use_cases_array = identify_use_cases(cleaned_extracted_actions)
generated_usecase_diagram_path = generate_use_case_diagram(data, extracted_relationships,
actors_and_use_cases_array)
# return generated_class_diagram_path, generated_usecase_diagram_path
return generated_usecase_diagram_path
return generated_class_diagram_path, generated_usecase_diagram_path
......@@ -43,6 +43,7 @@ def get_include_extend_relationships(splitted_actions_array):
continue
relationship_array.append(dictionary)
return relationship_array
def clean_use_case_strings(use_case):
if 'Extend' in use_case:
return use_case.replace('Extend','').lstrip(' ')
......
In ABC shop which provides essential goods requirements are as follows. Customer should be able to login to the system. Customer should be able to check the home page. Customer should be able to play the site demo video. Customer should be able to add items to the cart. Customer should be able to pay the items | include: recieve the confirmation email. Customer should be able to give a feedback for the system | extend: rate the service. Customer should be able to view the seller details. Customer should be able to contact the seller to request more items. Admin should be able to login to the system. Admin should be able to view and manage cart items. Admin should be able to check the payments and sold items. Admin should be able to reply to Customer feedbacks. Consider above requirements and draw an usecase diagram.
\ No newline at end of file
This diff is collapsed.
......@@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@emotion/react": "^11.4.1",
"@grammarly/editor-sdk-react": "^1.7.3",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
......
......@@ -37,7 +37,7 @@
.row-user input {
width: 100%;
box-sizing: border-box;
border: 1px solid var(--main-color-blue);
border: 2px solid var(--main-color-blue);
font-size: 1rem;
padding: 1rem;
border-radius: 5px;
......
frontend/src/assets/images/logo.png

20.4 KB | W: | H:

frontend/src/assets/images/logo.png

41.2 KB | W: | H:

frontend/src/assets/images/logo.png
frontend/src/assets/images/logo.png
frontend/src/assets/images/logo.png
frontend/src/assets/images/logo.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -54,11 +54,7 @@
}
.sidebar__item-inner.active {
background-image: linear-gradient(
to right,
var(--main-color-blue),
var(--second-color)
);
background-image: linear-gradient(to right, var(--main-color-blue), var(--second-color));
color: var(--txt-white);
}
......
......@@ -34,8 +34,8 @@ const sidebar_student = [
},
{
display_name: "Modules",
route: "/auth/student/subjects",
icon: "bx bx-transfer",
route: "/auth/student/modules",
icon: "bx bx-bar-chart-square",
},
{
display_name: "Sign Out",
......
import axios from "axios";
import { Link } from "react-router-dom";
import React, { useEffect, useState } from "react";
import Sidebar from "../components/sidebar/Sidebar";
import TopNav from "../components/topnav/TopNav";
import Table from "../components/table/Table";
import Badge from "../components/badge/Badge";
import Spinner from "../components/loading/Spinner";
import { RiDeleteBinLine } from "react-icons/ri";
import Popup from "./Popup";
const ViewAssignment = () => {
const siteId = localStorage.getItem("site");
const [Materials, setMaterials] = useState([]);
const students = [
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 40,
CorrectnessPercentage: 70,
},
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 10,
CorrectnessPercentage: 70,
},
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 30,
CorrectnessPercentage: 70,
},
];
const fields = [
"",
"Student Email",
"Submission",
"Plagiarism Percentage",
"Correctness Percentage",
"Submitted At",
"Action",
];
const permissionStatus = {
pending: "warning",
approved: "success",
rejected: "danger",
};
const [OrderDetail, setOrderDetail] = useState([]);
const [Loading, setLoading] = useState(false);
const [Trigger, setTrigger] = useState(false);
const [Name, setName] = useState("");
const [Id, setId] = useState("");
const [ItemName, setItemName] = useState("");
const [Description, setDescription] = useState("");
const [Order, setOrder] = useState({
item: {},
quantity: 0,
siteid: siteId,
requiredDate: "",
urgentOrder: false,
});
console.log(Order);
const FetchData = async () => {
const resMaterials = await axios.get(`materials`);
setMaterials(resMaterials.data.materials);
const resOrders = await axios.get("/orders");
setOrderDetail(resOrders.data.orders);
if (resOrders.statusText === "OK") {
setLoading(true);
}
};
useEffect(() => {
FetchData();
}, []);
const orderHandler = async () => {
try {
console.log(Order);
const res = await axios.post("/orders", Order);
if (res.statusText === "OK") {
window.location.reload();
}
} catch (Err) {
console.log(Err.response);
}
};
return (
<div>
<Sidebar />
<div id="main" className="layout__content">
<TopNav />
<div className="layout__content-main">
<div className="row">
<div className="col-10">
<h1 className="page-header">CTSE Assignment 01</h1>
</div>
<div className="col-1" style={{ marginTop: "1rem" }}>
<Link to={`/auth/teacher/assignments/1`}>
<button className="view-btn">Back to Assignment</button>
</Link>
</div>
</div>
<div className="row">
<div className="col-12">
<div className="card">
<h3>Generated usecase diagram</h3>
<br />
<div className="flex" style={{ justifyContent: "center" }}>
<img
src="https://d2slcw3kip6qmk.cloudfront.net/marketing/pages/chart/what-is-a-use-case-diagram-in-UML/UML_use_case_example-800x707.PNG"
alt="usecase"
/>
</div>
</div>
</div>
</div>
<div className="row">
<div className="col-12">
<div className="card">
<h3>Generated class diagram</h3>
<br />
<div className="flex" style={{ justifyContent: "center" }}>
<img
src="https://www.researchgate.net/profile/Sergi-Valverde/publication/225686440/figure/fig3/AS:667828239732738@1536234068086/A-simple-class-diagram-for-a-commercial-software-application-in-UML-notation-The.png"
alt="usecase"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
};
export default ViewAssignment;
import React, { useEffect, useState } from "react";
import axios from "axios";
import { GrammarlyEditorPlugin } from "@grammarly/editor-sdk-react";
import { RiDeleteBinLine } from "react-icons/ri";
import { Link } from "react-router-dom";
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";
......@@ -16,7 +19,17 @@ const ManageAssignments = () => {
const [material, setMaterial] = useState({ scenario: "" });
const [materials, setMaterials] = useState([]);
const fields = ["Scenario", "Material Name", "Actions"];
const fields = ["", "Module Code", "Name", "Status", "Created At", "Actions"];
const permissionStatus = {
pending: "warning",
approved: "success",
rejected: "danger",
};
const assignments = [
{ code: "A001", name: "CTSE Assignment", status: "pending", createdAt: "2022-01-01" },
{ code: "A002", name: "CTSE Assignment", status: "pending", createdAt: "2022-01-01" },
{ code: "A003", name: "CTSE Assignment", status: "pending", createdAt: "2022-01-01" },
];
const renderOrderHead = (item, index) => <th key={index}>{item}</th>;
......@@ -26,7 +39,17 @@ const ManageAssignments = () => {
<td>{item.code}</td>
<td>{item.name}</td>
<td>
<>
<Badge type={permissionStatus[item.status]} content={item.status} />
</td>
<td>{item.createdAt}</td>
<td>
<div style={{ display: "flex", alignItems: "center" }}>
<Link to={`/auth/teacher/assignments/1`}>
<button className="view-btn">View</button>
</Link>
<button className="action-btn check" style={{ marginLeft: "2rem" }}>
<i className="bx bx-edit-alt"></i>
</button>
<button
className="action-btn x"
onClick={() => {
......@@ -37,7 +60,7 @@ const ManageAssignments = () => {
>
<RiDeleteBinLine />
</button>
</>
</div>
</td>
</tr>
);
......@@ -114,18 +137,20 @@ const ManageAssignments = () => {
)}
<div className="row">
<div className="col-12">
<textarea
type="text"
placeholder="Paste question scenario here..."
value={material.code}
onChange={e =>
setMaterial({
...material,
code: e.target.value,
})
}
required
/>
<GrammarlyEditorPlugin clientId="5c891c34-55b1-4504-b1a2-5215d35757ba">
<textarea
type="text"
placeholder="PASTE QUESTION SCENARIO HERE..."
value={material.code}
onChange={e =>
setMaterial({
...material,
code: e.target.value,
})
}
required
/>
</GrammarlyEditorPlugin>
</div>
</div>
<div className="row">
......@@ -133,13 +158,30 @@ const ManageAssignments = () => {
<div className="row-user">
<select name="position" id="position" required>
<option value="position" defaultValue>
Please select class
PLEASE SELECT MODULE
</option>
<option value="class">Class A</option>
<option value="class">Class B</option>
<option value="class">Module A</option>
<option value="class">Module B</option>
</select>
</div>
</div>
<div className="col-4">
<div className="row-user">
<input
type="text"
placeholder="Accepted Plagiarism Percentage"
value={material.name}
onChange={e =>
setMaterial({
...material,
name: e.target.value,
})
}
required
/>
</div>
</div>
</div>
<div className="row-user">
<button type="submit" onClick={saveMaterial}>
......@@ -151,14 +193,14 @@ const ManageAssignments = () => {
</div>
<div className="card col-12">
<h2>Created Assignments</h2>
{isLoading ? (
{false ? (
<Spinner />
) : (
<Table
limit="5"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={materials}
bodyData={assignments}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
)}
......
......@@ -16,11 +16,20 @@ const ManageStudents = () => {
const { loggedIn } = useContext(AuthContext);
const [suppliers, setSuppliers] = useState([]);
const [isLoading, setIsLoading] = useState(true);
const fields = ["", "Username", "Email", "Class", "Registered At", "Actions"];
const fields = ["", "Username", "Email", "Class", "Enrolled At", "Actions"];
const students = [
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
{ username: "IT19074343", email: "email@gmail.com", registeredAt: "2022-04-05", class: "A001" },
];
const deleteHandler = async id => {
......@@ -78,7 +87,22 @@ const ManageStudents = () => {
<div id="main" className="layout__content">
<TopNav />
<div className="layout__content-main">
<h1 className="page-header">Manage Students</h1>
<div className="row">
<div className="col-8">
<h1 className="page-header">Manage Students</h1>
</div>
<div className="col-4">
<div className="row-user">
<select name="position" id="position" required>
<option value="position" defaultValue>
FILTER STUDENTS BY MODULE
</option>
<option value="class">Module A</option>
<option value="class">Module B</option>
</select>
</div>
</div>
</div>
<div className="row"></div>
<div className="row">
<div className="col-12">
......@@ -87,7 +111,7 @@ const ManageStudents = () => {
<Spinner />
) : (
<Table
limit="5"
limit="8"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={students}
......
......@@ -31,17 +31,19 @@ const SupplierDashboard = () => {
"Subject Code",
];
const subjects = [
{ ModuleCode: "IT20300", ModuleName: "CTSE", assign: "Assignment 01" },
{ ModuleCode: "IT30300", ModuleName: "DMS", assign: "Assignment 02" },
{ ModuleCode: "IT40300", ModuleName: "SPM", assign: "Assignment 03" }
]
const renderOrderHead = (item, index) => <th key={index}>{item}</th>;
const renderOrderBody = (item, index) => (
<tr key={index}>
<td>{index + 1}</td>
<td>{item.itemName}</td>
<td>{item.quantity}</td>
<td>{item.total}</td>
<td>{item.address}</td>
<td>{new Date(item.updatedAt).toDateString()}</td>
<td>{ }</td>
<td>{item.assign}</td>
<td>{item.ModuleName}</td>
<td>{item.ModuleCode}</td>
<td>
<div className="row-user" style={{ paddingTop: "0" }}>
{item.DeliveryStatus === "pending" ? (
......@@ -138,9 +140,7 @@ const SupplierDashboard = () => {
<div className="card">
<div className="flex">
<h2 className="request-title">Assignments to complete</h2>
<Link to={`/auth/student/assignments`}>
<button className="view-btn">View All</button>
</Link>
</div>
{/* {isLoading ? (
<Spinner />
......@@ -149,7 +149,7 @@ const SupplierDashboard = () => {
limit="5"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={orderDetails}
bodyData={subjects}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
{/* ) : (
......
......@@ -17,24 +17,29 @@ const ManageOrdersSupplier = () => {
const [orderDetails, setOrderDetails] = useState([]);
const fields = [
"",
"Module Code",
"Module Code",
"Module Name",
"Year",
"",
"Actions",
];
const subjects = [
{ ModuleCode: "IT20300", ModuleName: "CTSE", Year: "4th Year" },
{ ModuleCode: "IT30300", ModuleName: "DMS", Year: "4th Year" },
{ ModuleCode: "IT40300", ModuleName: "SPM:", Year: "4th Year" }
]
const renderOrderHead = (item, index) => <th key={index}>{item}</th>;
const renderOrderBody = (item, index) => (
<tr key={index}>
<td>{index + 1}</td>
<td>{"IT2030"}</td>
<td>{"Software Process"}</td>
<td>{item.total}</td>
<td>{item.address}</td>
<td>{new Date(item.updatedAt).toDateString()}</td>
<td style={{ textTransform: "capitalize" }}>{item.DeliveryStatus}</td>
<td>{ }</td>
<td>{item.ModuleCode}</td>
<td>{item.ModuleName}</td>
<td>{item.Year}</td>
<td>{ }</td>
<td><Link to={`/auth/student/assignment`}>
<button className="view-btn">View</button>
</Link></td>
<td>
<div className="row-user" style={{ paddingTop: "0" }}>
{item.DeliveryStatus === "pending" ? (
......@@ -162,19 +167,19 @@ const ManageOrdersSupplier = () => {
<div id="main" className="layout__content">
<TopNav />
<div className="layout__content-main">
<h1 className="page-header">All Assignments</h1>
<h1 className="page-header">All Modules</h1>
<div className="card">
<h2>Assignments to Complete </h2>
<h2>Subjects You Enrolled </h2>
{/* {isLoading ? (
<Spinner />
) : orderDetails.length > 0 ? ( */}
<Table
limit="5"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={orderDetails}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
<Table
limit="5"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={subjects}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
{/* ) : (
<>
{setError("No Assignments found")}
......
......@@ -23,7 +23,7 @@ const TeacherDashboard = () => {
const { loggedIn } = useContext(AuthContext);
const [suppliers, setSuppliers] = useState([]);
const [isLoading, setIsLoading] = useState(true);
const fields = ["", "Name", "Class Code", "Status", "Actions"];
const fields = ["", "Name", "Module Code", "Status", "Actions"];
const permissionStatus = {
pending: "warning",
......@@ -153,7 +153,7 @@ const TeacherDashboard = () => {
<div className="card">
<div className="flex">
<h2 className="request-title">Recent Assignments</h2>
<Link to={`/auth/manager/suppliers`}>
<Link to={`/auth/teacher/assignments`}>
<button className="view-btn">View All</button>
</Link>
</div>
......
import axios from "axios";
import { Link } from "react-router-dom";
import React, { useEffect, useState } from "react";
import Sidebar from "../components/sidebar/Sidebar";
import TopNav from "../components/topnav/TopNav";
import Table from "../components/table/Table";
import Badge from "../components/badge/Badge";
import Spinner from "../components/loading/Spinner";
import { RiDeleteBinLine } from "react-icons/ri";
import Popup from "./Popup";
const ViewAssignment = () => {
const siteId = localStorage.getItem("site");
const [Materials, setMaterials] = useState([]);
const students = [
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 40,
CorrectnessPercentage: 70,
},
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 10,
CorrectnessPercentage: 70,
},
{
email: "email@gmail.com",
submittedAt: "2022-04-05",
submission: "IT1912192.png",
plagiarismPercentage: 30,
CorrectnessPercentage: 70,
},
];
const fields = [
"",
"Student Email",
"Submission",
"Plagiarism Percentage",
"Correctness Percentage",
"Submitted At",
"Action",
];
const permissionStatus = {
pending: "warning",
approved: "success",
rejected: "danger",
};
const [OrderDetail, setOrderDetail] = useState([]);
const [Loading, setLoading] = useState(false);
const [Trigger, setTrigger] = useState(false);
const [Name, setName] = useState("");
const [Id, setId] = useState("");
const [ItemName, setItemName] = useState("");
const [Description, setDescription] = useState("");
const [Order, setOrder] = useState({
item: {},
quantity: 0,
siteid: siteId,
requiredDate: "",
urgentOrder: false,
});
console.log(Order);
const FetchData = async () => {
const resMaterials = await axios.get(`materials`);
setMaterials(resMaterials.data.materials);
const resOrders = await axios.get("/orders");
setOrderDetail(resOrders.data.orders);
if (resOrders.statusText === "OK") {
setLoading(true);
}
};
useEffect(() => {
FetchData();
}, []);
const deleteHandler = async id => {
console.log(id);
try {
const res = await axios.delete(`/orders/delete/${id}`);
if (res.statusText === "OK") {
window.location.reload();
}
} catch (Err) {
console.log(Err.response);
}
};
const orderHandler = async () => {
try {
console.log(Order);
const res = await axios.post("/orders", Order);
if (res.statusText === "OK") {
window.location.reload();
}
} catch (Err) {
console.log(Err.response);
}
};
const renderOrderHead = (item, index) => <th key={index}>{item}</th>;
const renderOrderBody = (item, index) => (
<tr key={index}>
<td>{index + 1}</td>
<td>{item.email}</td>
<td>{item.submission}</td>
<td>
{item.plagiarismPercentage >= 20 ? (
<Badge type={permissionStatus.rejected} content={item.plagiarismPercentage + "%"} />
) : (
<Badge type={permissionStatus.approved} content={item.plagiarismPercentage + "%"} />
)}
</td>
<td>{item.CorrectnessPercentage + "%"}</td>
<td>{item.submittedAt}</td>
<td>
<div style={{ display: "flex", alignItems: "center" }}>
<button className="action-btn check">
<i
className="bx bx-check"
onClick={() => {
if (window.confirm("Are you sure to accept this submission?")) {
// successHandler(item._id);
}
}}
></i>
</button>
<button
className="action-btn x"
style={{ marginRight: "2rem" }}
onClick={() => {
if (window.confirm("Are you sure to remove this submission?")) {
deleteHandler(item._id);
}
}}
>
<RiDeleteBinLine />
</button>
<Link to={``}>
<button className="view-btn">View</button>
</Link>
</div>
</td>
</tr>
);
return (
<div>
<Sidebar />
<div id="main" className="layout__content">
<TopNav />
<div className="layout__content-main">
<h1 className="page-header">CTSE Assignment 01</h1>
<div className="row">
<div className="col-12">
<div className="card">
<div className="row">
<div className="col-10">
<h3>
Analyze the case study given below and draw a usecase and class diagram.
</h3>
</div>
<div className="col-1">
<Link to={`/auth/teacher/assignments/1/diagrams`}>
<button className="view-btn">View Generated Diagrams</button>
</Link>
</div>
</div>
<br />
<p>
GlamourFashions (GF) is a clothing store situated in Colombo and its planning
to build an online shopping system to promote their sales further. The management
of clothing store hired you as a System Analyst and asked to come up with the
design models for GlamourFashions Online Store (GFOS). GlamourFashions (GF) Online
Clothing Store is expected to organize clothing items under several categories
like office wear, casual wear, evening wear and so on. A visitor can browse on
items without being registering to the system. If he/she likes to order item, the
system facilitates to add selected items into the shopping cart and directly move
to checkout option. If the user interested to be a regular user, the system will
provide registration facility as well. Without even registering, the user can
directly go for the checkout. For a registered user, the system is expected to
send a promotion code for users mobile every month which can be used only once.
when the user logs into the system to do online shopping, user can enter this code
which will give a 5% discount for the order he/she makes. If the user does not use
the code within the month, automatically the system must discard promotion code.
If its been already used, the system must display a message saying its already
been used.
</p>
</div>
</div>
</div>
<div className="row ">
<div className="col-12">
<div className="card">
<h2>Student Submissions</h2>
{false ? (
<Spinner />
) : (
<Table
limit="8"
headData={fields}
renderHead={(item, index) => renderOrderHead(item, index)}
bodyData={students}
renderBody={(item, index) => renderOrderBody(item, index)}
/>
)}
</div>
</div>
</div>
</div>
</div>
</div>
);
};
export default ViewAssignment;
......@@ -18,8 +18,10 @@ import OfficerDashboard from "../pages/OfficerDashboard";
import OfficerOrders from "../pages/OfficerOrders";
import Register from "../pages/Register";
import SiteManagerDashboard from "../pages/SiteManagerDashboard";
import SiteManagerForm from "../pages/SiteManagerForm";
import StudentSubjectAssingment from "../pages/StudentSubjectAssingment";
import ViewAssignment from "../pages/ViewAssignment";
import StudentDashboard from "../pages/StudentDashboard";
import GeneratedDiagrams from "../pages/GeneratedDiagrams";
import { AuthContext } from "../contexts/AuthContext";
......@@ -38,12 +40,14 @@ const Routes = () => {
<Route exact path="/auth/teacher/students" component={ManageStudents} />
<Route exact path="/auth/teacher/modules" component={ManageClasses} />
<Route exact path="/auth/teacher/assignments" component={ManageAssignments} />
<Route exact path="/auth/teacher/assignments/:id" component={ViewAssignment} />
<Route exact path="/auth/teacher/assignments/:id/diagrams" component={GeneratedDiagrams} />
<Route exact path="/auth/student/dashboard" component={StudentDashboard} />
<Route exact path="/auth/student/modules" component={SubjectsStudent} />
<Route exact path="/auth/student/services" component={ManageServices} />
<Route exact path="/auth/sitemanager/requisitions" component={SiteManagerForm} />
<Route exact path="/auth/student/assignment" component={StudentSubjectAssingment} />
</Switch>
);
};
......
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