diff --git a/SUBD-back/src/main/java/com/subd/subd/Controllers/DriverController.java b/SUBD-back/src/main/java/com/subd/subd/Controllers/DriverController.java index 945fa8c..63a6d19 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Controllers/DriverController.java +++ b/SUBD-back/src/main/java/com/subd/subd/Controllers/DriverController.java @@ -22,11 +22,11 @@ public class DriverController { } @PostMapping("/driver") public Driver createDriver(@RequestBody Driver driver) { - return DriverService.addDriver(driver.getName(), driver.getAge(), driver.getPhone(), driver.getEmail()); + return DriverService.addDriver(driver.getName(), driver.getBirthday(), driver.getPhone(), driver.getEmail()); } @PutMapping("/driver/{id}") public Driver updateDriver(@PathVariable Long id, @RequestBody Driver driver) { - return DriverService.updateDriver(id, driver.getName(), driver.getAge(), driver.getPhone(), driver.getEmail()); + return DriverService.updateDriver(id, driver.getName(), driver.getBirthday(), driver.getPhone(), driver.getEmail()); } @DeleteMapping("/driver/{id}") public Driver deleteDriver(@PathVariable Long id) { diff --git a/SUBD-back/src/main/java/com/subd/subd/Controllers/OrderController.java b/SUBD-back/src/main/java/com/subd/subd/Controllers/OrderController.java index 5586956..ae044eb 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Controllers/OrderController.java +++ b/SUBD-back/src/main/java/com/subd/subd/Controllers/OrderController.java @@ -23,11 +23,11 @@ public class OrderController { } @PostMapping("/order") public Order createOrder(@RequestBody OrderDto orderDto) { - return OrderService.addOrder(orderDto.getValue(), orderDto.getClientId(), orderDto.getSourcePickUpPointId(), orderDto.getDestPickUpPointId(), orderDto.getCarId()); + return OrderService.addOrder(orderDto.getValue(), orderDto.getStatus(), orderDto.getClientId(), orderDto.getSourcePickUpPointId(), orderDto.getDestPickUpPointId(), orderDto.getCarId()); } @PutMapping("/order/{id}") public Order updateOrder(@PathVariable Long id, @RequestBody OrderDto orderDto) { - return OrderService.updateOrder(id, orderDto.getValue(), orderDto.getClientId(), orderDto.getSourcePickUpPointId(), orderDto.getDestPickUpPointId(), orderDto.getCarId()); + return OrderService.updateOrder(id, orderDto.getValue(), orderDto.getStatus(), orderDto.getClientId(), orderDto.getSourcePickUpPointId(), orderDto.getDestPickUpPointId(), orderDto.getCarId()); } @DeleteMapping("/order/{id}") public Order deleteOrder(@PathVariable Long id) { diff --git a/SUBD-back/src/main/java/com/subd/subd/Dtos/OrderDto.java b/SUBD-back/src/main/java/com/subd/subd/Dtos/OrderDto.java index f84bae5..ebccfd3 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Dtos/OrderDto.java +++ b/SUBD-back/src/main/java/com/subd/subd/Dtos/OrderDto.java @@ -2,13 +2,15 @@ package com.subd.subd.Dtos; public class OrderDto { private Double value; + private String status; private Long clientId; private Long sourcePickUpPointId; private Long destPickUpPointId; private Long carId; public OrderDto() {} - public OrderDto(Double value, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { + public OrderDto(Double value, String status, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { this.value = value; + this.status = status; this.clientId = clientId; this.sourcePickUpPointId = sourcePickUpPointId; this.destPickUpPointId = destPickUpPointId; @@ -17,6 +19,9 @@ public class OrderDto { public Double getValue() { return this.value; } + public String getStatus() { + return this.status; + } public Long getClientId() { return this.clientId; } diff --git a/SUBD-back/src/main/java/com/subd/subd/Models/Driver.java b/SUBD-back/src/main/java/com/subd/subd/Models/Driver.java index 6d56399..6090a15 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Models/Driver.java +++ b/SUBD-back/src/main/java/com/subd/subd/Models/Driver.java @@ -5,6 +5,7 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import jakarta.persistence.Table; +import java.util.Date; import java.util.Objects; @Entity @@ -14,13 +15,13 @@ public class Driver { @GeneratedValue private Long id; private String name; - private Integer age; + private Date birthday; private String phone; private String email; Driver() {} - public Driver(String name, Integer age, String phone, String email) { + public Driver(String name, Date birthday, String phone, String email) { this.name = name; - this.age = age; + this.birthday = birthday; this.phone = phone; this.email = email; } @@ -28,8 +29,8 @@ public class Driver { public void setId(Long id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } - public Integer getAge() { return this.age; } - public void setAge(Integer age) { this.age = age; } + public Date getBirthday() { return this.birthday; } + public void setBirthday(Date birthday) { this.birthday = birthday; } public String getPhone() { return this.phone; } public void setPhone(String phone) { this.phone = phone; } public String getEmail() { return this.email; } @@ -43,19 +44,19 @@ public class Driver { Driver driver = (Driver) o; return Objects.equals(this.id, driver.id) && Objects.equals(this.name, driver.name) && - Objects.equals(this.age, driver.age) && + Objects.equals(this.birthday, driver.birthday) && Objects.equals(this.phone, driver.phone) && Objects.equals(this.email, driver.email); } @Override public int hashCode() { - return Objects.hash(this.id, this.name, this.age, this.phone, this.email); + return Objects.hash(this.id, this.name, this.birthday, this.phone, this.email); } @Override public String toString() { return "Client{" + "id=" + this.id + ", name='" + this.name + '\'' + - ", age='" + this.age + '\'' + + ", birthday='" + this.birthday + '\'' + ", phone='" + this.phone + '\'' + ", email='" + this.email + '\'' + '}'; diff --git a/SUBD-back/src/main/java/com/subd/subd/Models/Order.java b/SUBD-back/src/main/java/com/subd/subd/Models/Order.java index 9aa34eb..65abd22 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Models/Order.java +++ b/SUBD-back/src/main/java/com/subd/subd/Models/Order.java @@ -11,6 +11,7 @@ public class Order { @GeneratedValue private Long id; private Double value; + private String status; @ManyToOne( cascade = {CascadeType.MERGE}, fetch = FetchType.EAGER) @JoinColumn(name = "Client_id", nullable = true) private Client client; @@ -24,8 +25,9 @@ public class Order { @JoinColumn(name = "Car_id", referencedColumnName = "id") private Car car; Order() {} - public Order(Double value, Client client, PickUpPoint sourcePickUpPoint, PickUpPoint destPickUpPoint, Car car) { + public Order(Double value, String status, Client client, PickUpPoint sourcePickUpPoint, PickUpPoint destPickUpPoint, Car car) { this.value = value; + this.status = status; this.client = client; this.sourcePickUpPoint = sourcePickUpPoint; this.destPickUpPoint = destPickUpPoint; @@ -43,6 +45,12 @@ public class Order { public void setValue(Double value) { this.value = value; } + public String getStatus() { + return this.status; + } + public void setStatus(String status) { + this.status = status; + } public Client getClient() { return client; } @@ -81,6 +89,7 @@ public class Order { Order order = (Order) o; return Objects.equals(this.id, order.id) && Objects.equals(this.value, order.value) && + Objects.equals(this.status, order.status) && Objects.equals(this.client, order.client) && Objects.equals(this.sourcePickUpPoint, order.sourcePickUpPoint) && Objects.equals(this.destPickUpPoint, order.destPickUpPoint) && @@ -88,12 +97,13 @@ public class Order { } @Override public int hashCode() { - return Objects.hash(this.id, this.value, this.client, this.sourcePickUpPoint, destPickUpPoint, car); + return Objects.hash(this.id, this.value, this.status, this.client, this.sourcePickUpPoint, destPickUpPoint, car); } @Override public String toString() { return "Client{" + "id=" + this.id + ", value='" + this.value + '\'' + + ", status='" + this.status + '\'' + ", client='" + this.client + '\'' + ", sourcePickUpPoint='" + this.sourcePickUpPoint + '\'' + ", destPickUpPoint='" + this.destPickUpPoint + '\'' + diff --git a/SUBD-back/src/main/java/com/subd/subd/Services/DriverService.java b/SUBD-back/src/main/java/com/subd/subd/Services/DriverService.java index eb6933f..0cfbf8d 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Services/DriverService.java +++ b/SUBD-back/src/main/java/com/subd/subd/Services/DriverService.java @@ -6,6 +6,7 @@ import com.subd.subd.Repositories.DriverRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Date; import java.util.List; import java.util.Optional; @@ -16,8 +17,8 @@ public class DriverService { this.driverRepository = driverRepository; } @Transactional - public Driver addDriver(String name, Integer age, String phone, String email) { - final Driver driver = new Driver(name, age, phone, email); + public Driver addDriver(String name, Date birthday, String phone, String email) { + final Driver driver = new Driver(name, birthday, phone, email); return driverRepository.save(driver); } @Transactional(readOnly = true) @@ -30,13 +31,13 @@ public class DriverService { return driverRepository.findAll(); } @Transactional - public Driver updateDriver(Long id, String name, Integer age, String phone, String email) { + public Driver updateDriver(Long id, String name, Date birthday, String phone, String email) { final Driver currentDriver = findDriver(id); if (name != null) { currentDriver.setName(name); } - if (age != null) { - currentDriver.setAge(age); + if (birthday != null) { + currentDriver.setBirthday(birthday); } if (phone != null) { currentDriver.setPhone(phone); diff --git a/SUBD-back/src/main/java/com/subd/subd/Services/OrderService.java b/SUBD-back/src/main/java/com/subd/subd/Services/OrderService.java index cef05bd..633c670 100644 --- a/SUBD-back/src/main/java/com/subd/subd/Services/OrderService.java +++ b/SUBD-back/src/main/java/com/subd/subd/Services/OrderService.java @@ -31,7 +31,7 @@ public class OrderService { this.carRepository = carRepository; } @Transactional - public Order addOrder(Double value, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { + public Order addOrder(Double value, String status, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { final Client client = clientRepository.findById(clientId) .orElseThrow(() -> new ClientNotFoundException(clientId)); final PickUpPoint sourcePickUpPoint = pickUpPointRepository.findById(sourcePickUpPointId) @@ -40,7 +40,7 @@ public class OrderService { .orElseThrow(() -> new PickUpPointNotFoundException(destPickUpPointId)); final Car car = carRepository.findById(carId) .orElseThrow(() -> new CarNotFoundException(carId)); - final Order order = new Order(value, client, sourcePickUpPoint, destPickUpPoint, car); + final Order order = new Order(value, status, client, sourcePickUpPoint, destPickUpPoint, car); return orderRepository.save(order); } @Transactional(readOnly = true) @@ -53,11 +53,14 @@ public class OrderService { return orderRepository.findAll(); } @Transactional - public Order updateOrder(Long id, Double value, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { + public Order updateOrder(Long id, Double value, String status, Long clientId, Long sourcePickUpPointId, Long destPickUpPointId, Long carId) { final Order currentOrder = findOrder(id); if (value != null) { currentOrder.setValue(value); } + if (status != null) { + currentOrder.setStatus(status); + } if (clientId != null) { final Client client = clientRepository.findById(clientId) .orElseThrow(() -> new ClientNotFoundException(clientId)); diff --git a/SUBD-front/main.js b/SUBD-front/main.js new file mode 100644 index 0000000..7baf981 --- /dev/null +++ b/SUBD-front/main.js @@ -0,0 +1,30 @@ +import { createApp } from 'vue' +import { createRouter, createWebHistory } from 'vue-router' +import './style.css' +import App from './App.vue' +import Catalogs from './components/Catalogs.vue' +import CatalogStudents from './components/CatalogStudents.vue' +import CatalogGroups from './components/CatalogGroups.vue' +import CatalogDisciplines from './components/CatalogDisciplines.vue' +import Reports from './components/Reports.vue' +import ReportGroupStudents from './components/ReportGroupStudents.vue' +import ReportGroupDisciplines from './components/ReportGroupDisciplines.vue' + +const routes = [ + { path: '/', redirect: '/catalogs/students' }, + { path: '/catalogs', component: Catalogs, meta: { label: 'Справочники' } }, + { path: '/catalogs/students', component: CatalogStudents }, + { path: '/catalogs/groups', component: CatalogGroups }, + { path: '/catalogs/disciplines', component: CatalogDisciplines }, + { path: '/reports', component: Reports, meta: { label: 'Отчеты' } }, + { path: '/reports/group-students', component: ReportGroupStudents }, + { path: '/reports/group-disciplines', component: ReportGroupDisciplines } +] + +const router = createRouter({ + history: createWebHistory(), + linkActiveClass: 'active', + routes +}) + +createApp(App).use(router).mount('#app') \ No newline at end of file diff --git a/SUBD-front/src/App.vue b/SUBD-front/src/App.vue index 7cb90de..406f563 100644 --- a/SUBD-front/src/App.vue +++ b/SUBD-front/src/App.vue @@ -1,5 +1,6 @@ + + \ No newline at end of file diff --git a/SUBD-front/src/components/CatalogGroups.vue b/SUBD-front/src/components/CatalogGroups.vue new file mode 100644 index 0000000..b7ac5ac --- /dev/null +++ b/SUBD-front/src/components/CatalogGroups.vue @@ -0,0 +1,44 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/CatalogStudents.vue b/SUBD-front/src/components/CatalogStudents.vue new file mode 100644 index 0000000..2a8aad0 --- /dev/null +++ b/SUBD-front/src/components/CatalogStudents.vue @@ -0,0 +1,82 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/Catalogs.vue b/SUBD-front/src/components/Catalogs.vue new file mode 100644 index 0000000..8480eb4 --- /dev/null +++ b/SUBD-front/src/components/Catalogs.vue @@ -0,0 +1,23 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/DataTable.vue b/SUBD-front/src/components/DataTable.vue new file mode 100644 index 0000000..f24eb88 --- /dev/null +++ b/SUBD-front/src/components/DataTable.vue @@ -0,0 +1,67 @@ + + + + + \ No newline at end of file diff --git a/SUBD-front/src/components/Header.vue b/SUBD-front/src/components/Header.vue index 0067085..162c8d6 100644 --- a/SUBD-front/src/components/Header.vue +++ b/SUBD-front/src/components/Header.vue @@ -1,45 +1,35 @@ + + \ No newline at end of file + + + \ No newline at end of file diff --git a/SUBD-front/src/components/Modal.vue b/SUBD-front/src/components/Modal.vue new file mode 100644 index 0000000..f12c004 --- /dev/null +++ b/SUBD-front/src/components/Modal.vue @@ -0,0 +1,63 @@ + + + + + \ No newline at end of file diff --git a/SUBD-front/src/components/ReportGroupDisciplines.vue b/SUBD-front/src/components/ReportGroupDisciplines.vue new file mode 100644 index 0000000..2d87fe6 --- /dev/null +++ b/SUBD-front/src/components/ReportGroupDisciplines.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/ReportGroupStudents.vue b/SUBD-front/src/components/ReportGroupStudents.vue new file mode 100644 index 0000000..82ebd6c --- /dev/null +++ b/SUBD-front/src/components/ReportGroupStudents.vue @@ -0,0 +1,64 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/Reports.vue b/SUBD-front/src/components/Reports.vue new file mode 100644 index 0000000..56cfe60 --- /dev/null +++ b/SUBD-front/src/components/Reports.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/SUBD-front/src/components/ToolBar.vue b/SUBD-front/src/components/ToolBar.vue new file mode 100644 index 0000000..0a21290 --- /dev/null +++ b/SUBD-front/src/components/ToolBar.vue @@ -0,0 +1,46 @@ + + + + + \ No newline at end of file diff --git a/SUBD-front/src/images/hamburger.png b/SUBD-front/src/images/hamburger.png deleted file mode 100644 index c847f22..0000000 Binary files a/SUBD-front/src/images/hamburger.png and /dev/null differ diff --git a/SUBD-front/src/main.js b/SUBD-front/src/main.js deleted file mode 100644 index 2974ee0..0000000 --- a/SUBD-front/src/main.js +++ /dev/null @@ -1,25 +0,0 @@ -import { createApp } from 'vue' -import App from './App.vue'; -import Orders from './components/Orders.vue' -// import Clients from './components/Clients.vue' -// import Cars from './components/Cars.vue' -// import Drivers from './components/Drivers.vue' - -// import './assets/main.css' - -const routes = [ - { path: '/', redirect: '/orders' }, - { path: '/orders', component: Orders }, - // { path: '/clients', component: Clients}, - // { path: '/cars', component: Cars}, - // { path: '/drivers', component: Drivers} -] - -const router = createRouter({ - history: createWebHistory(), - linkActiveClass: 'active', - routes -}) - - -const app = createApp(App).use(router).mount('#app') diff --git a/SUBD-front/src/mixins/CatalogMixins.js b/SUBD-front/src/mixins/CatalogMixins.js new file mode 100644 index 0000000..a9ea635 --- /dev/null +++ b/SUBD-front/src/mixins/CatalogMixins.js @@ -0,0 +1,99 @@ +import ToolBar from '../components/ToolBar.vue'; +import DataTable from '../components/DataTable.vue'; +import Modal from '../components/Modal.vue'; +import DataService from '../services/DataService'; + +const CatalogMixin = { + components: { + ToolBar, DataTable, Modal + }, + data() { + return { + getAllUrl: undefined, + dataUrl: undefined, + transformer: undefined, + headers: [], + items: [], + selectedItems: [], + modal: { + header: undefined, + confirm: undefined, + }, + modalShow: false, + data: undefined, + isEdit: false + } + }, + created() { + this.getItems(); + this.data = this.transformer(); + }, + methods: { + getItems() { + DataService.readAll(this.getAllUrl, this.transformer) + .then(data => { + this.items = data; + }); + }, + showAddModal() { + this.isEdit = false; + this.data = this.transformer(); + this.modal.header = 'Добавление элемента'; + this.modal.confirm = 'Добавить'; + this.modalShow = true; + }, + showEditModal() { + if (this.selectedItems.length === 0) { + return; + } + this.showEditModalDblClick(this.selectedItems[0]); + }, + showEditModalDblClick(editId) { + DataService.read(this.dataUrl + editId, this.transformer) + .then(data => { + this.data = data; + this.isEdit = true; + this.modal.header = 'Редактирование элемента'; + this.modal.confirm = 'Сохранить'; + this.modalShow = true; + }); + }, + saveItem() { + if (!this.isEdit) { + DataService.create(this.dataUrl, this.data) + .then(() => { + this.getItems(); + }); + } else { + DataService.update(this.dataUrl + this.data.id, this.data) + .then(() => { + this.getItems(); + }); + } + }, + removeSelectedItems() { + if (this.selectedItems.length === 0) { + return; + } + if (confirm('Удалить выбранные элементы?')) { + const promises = []; + const self = this; + this.selectedItems.forEach(item => { + promises.push(DataService.delete(this.dataUrl + item)); + }); + Promise.all(promises).then((results) => { + results.forEach(function (id) { + const index = self.selectedItems.indexOf(id); + if (index === - 1) { + return; + } + self.selectedItems.splice(index, 1); + }); + this.getItems(); + }); + } + } + } +} + +export default CatalogMixin; \ No newline at end of file diff --git a/SUBD-front/src/models/Car.js b/SUBD-front/src/models/Car.js new file mode 100644 index 0000000..dc56858 --- /dev/null +++ b/SUBD-front/src/models/Car.js @@ -0,0 +1,47 @@ +export default class Car { + constructor(data) { + this._id = data?.id; + this._gosNumber = data?.gosNumber; + this._vin = data?.vin; + this._driver = data?.driver; + this._driverId = data?.driverId; + } + + get id() { + return this._id; + } + + get gosNumber() { + return this._gosNumber; + } + + set gosNumber(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New gosNumber value ' + value + ' is not a string or empty'; + } + this._gosNumber = value; + } + + get vin() { + return this._vin; + } + + set vin(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New vin value ' + value + ' is not a string or empty'; + } + this._vin = value; + } + + get driverId() { + return this._groupId; + } + + set driverId(value) { + this._groupId = value; + } + + get driverName() { + return this.driver?.name; + } +} \ No newline at end of file diff --git a/SUBD-front/src/models/Client.js b/SUBD-front/src/models/Client.js new file mode 100644 index 0000000..86f54b9 --- /dev/null +++ b/SUBD-front/src/models/Client.js @@ -0,0 +1,45 @@ +export default class Student { + constructor(data) { + this._id = data?.id; + this._name = data?.name; + this._phone = data?.phone; + this._email = data?.email; + } + + get id() { + return this._id; + } + + get name() { + return this._name; + } + + set name(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New name value ' + value + ' is not a string or empty'; + } + this._name = value; + } + + get phone() { + return this._phone; + } + + set phone(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New phone value ' + value + ' is not a string or empty'; + } + this._phone = value; + } + + get email() { + return this._email; + } + + set email(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New email value ' + value + ' is not a string or empty'; + } + this._email = value; + } +} \ No newline at end of file diff --git a/SUBD-front/src/models/Driver.js b/SUBD-front/src/models/Driver.js new file mode 100644 index 0000000..43727d1 --- /dev/null +++ b/SUBD-front/src/models/Driver.js @@ -0,0 +1,54 @@ +export default class Driver { + constructor(data) { + this._id = data?.id; + this._name = data?.name; + this._birthday = data?.birthday; + this._phone = data?.phone; + this._email = data?.email; + } + + get id() { + return this._id; + } + + get name() { + return this._name; + } + + set name(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New name value ' + value + ' is not a string or empty'; + } + this._name = value; + } + + get birthday() { + return this._age; + } + + set birthday(value) { + this._birthday = value; + } + + get phone() { + return this._phone; + } + + set phone(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New phone value ' + value + ' is not a string or empty'; + } + this._phone = value; + } + + get email() { + return this._email; + } + + set email(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New email value ' + value + ' is not a string or empty'; + } + this._email = value; + } +} \ No newline at end of file diff --git a/SUBD-front/src/models/Order.js b/SUBD-front/src/models/Order.js new file mode 100644 index 0000000..ca906a9 --- /dev/null +++ b/SUBD-front/src/models/Order.js @@ -0,0 +1,86 @@ +export default class Order { + constructor(data) { + this._id = data?.id; + this._value = data?.value; + this._status = data?.status; + this._client = data?.client; + this._clientId = data?.clientId; + this._sourcePickUpPoint = data?.sourcePickUpPoint; + this._sourcePickUpPointId = data?.sourcePickUpPointId; + this._destPickUpPoint = data?.destPickUpPoint; + this._destPickUpPointId = data?.destPickUpPointId; + this._car = data?.car; + this._carId = data?.carId; + } + + get id() { + return this._id; + } + + get value() { + return this._value; + } + + set value(data) { + this._value = data; + } + + get status() { + return this._status; + } + + set status(data) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New status value ' + value + ' is not a string or empty'; + } + this._status = data; + } + + get clientId() { + return this._firstName; + } + + set clientId(value) { + this._clientId = value; + } + + get clientName() { + return this._client?.name; + } + + get sourcePickUpPointId() { + return this._sourcePickUpPointId; + } + + set sourcePickUpPointId(value) { + this._sourcePickUpPointId = value; + } + + get sourcePickUpPointAddress() { + return this._sourcePickUpPoint?.address; + } + + get destPickUpPointId() { + return this._destPickUpPointId; + } + + set destPickUpPointId(value) { + this._destPickUpPointId = value; + } + + get destPickUpPointAddress() { + return this._destPickUpPoint?.address; + } + + get carId() { + return this._carId; + } + + set carId(value) { + this._carId = value; + } + + get carNumber() { + return this.car?.gosNumber; + } +} \ No newline at end of file diff --git a/SUBD-front/src/models/PickUpPoint.js b/SUBD-front/src/models/PickUpPoint.js new file mode 100644 index 0000000..652ddeb --- /dev/null +++ b/SUBD-front/src/models/PickUpPoint.js @@ -0,0 +1,21 @@ +export default class PickUpPoint { + constructor(data) { + this._id = data?.id; + this._address = data?.address; + } + + get id() { + return this._id; + } + + get address() { + return this._address; + } + + set address(value) { + if (typeof value !== 'string' || value === null || value.length == 0) { + throw 'New address value ' + value + ' is not a string or empty'; + } + this._address = value; + } +} \ No newline at end of file diff --git a/SUBD-front/src/services/DataService.js b/SUBD-front/src/services/DataService.js index a06314a..54810c9 100644 --- a/SUBD-front/src/services/DataService.js +++ b/SUBD-front/src/services/DataService.js @@ -7,22 +7,22 @@ function toJSON(data) { if (data[field] === undefined) { continue; } - jsonObj[field.substring(0)] = data[field]; + jsonObj[field.substring(1)] = data[field]; } return jsonObj; } export default class DataService { - static dataUrlPrefix = 'http://127.0.0.1:8080/'; + static dataUrlPrefix = 'http://localhost:8080/'; static async readAll(url, transformer) { const response = await axios.get(this.dataUrlPrefix + url); return response.data.map(item => transformer(item)); } - static async read(url) { + static async read(url, transformer) { const response = await axios.get(this.dataUrlPrefix + url); - return response.data; + return transformer(response.data); } static async create(url, data) { diff --git a/SUBD-front/style.css b/SUBD-front/style.css new file mode 100644 index 0000000..e69de29